lists = require('plugins/core/lists'),
plugin = {name: 'core', actions: [], canvas: {}, documentExtension: {textNode: {}}},
Dialog = require('views/dialog/dialog'),
lists = require('plugins/core/lists'),
plugin = {name: 'core', actions: [], canvas: {}, documentExtension: {textNode: {}}},
Dialog = require('views/dialog/dialog'),
+ newNodes.second.contents()
+ .filter(function(child) {
+ return child.object.describesParent;
+ })
+ .forEach(function(child) {
+ //child.detach();
+ parentDescribingNodes.push(child);
+ child.detach();
+ });
[newNodes.first, newNodes.second].some(function(newNode) {
if(!(newNode.contents().length)) {
emptyText = newNode.append({text: ''});
return true; // break
}
});
[newNodes.first, newNodes.second].some(function(newNode) {
if(!(newNode.contents().length)) {
emptyText = newNode.append({text: ''});
return true; // break
}
});
return _.extend(newNodes, {emptyText: emptyText});
},
getChangeRoot: function() {
return _.extend(newNodes, {emptyText: emptyText});
},
getChangeRoot: function() {
icon: 'share-alt',
iconStyle: dir === 'undo' ? '-webkit-transform: scale(-1,1); transform: scale(-1, 1)' : '',
execute: function(callback, params) {
icon: 'share-alt',
iconStyle: dir === 'undo' ? '-webkit-transform: scale(-1,1); transform: scale(-1, 1)' : '',
execute: function(callback, params) {
executeButtonText: gettext('Apply'),
cancelButtonText: gettext('Cancel'),
fields: [
executeButtonText: gettext('Apply'),
cancelButtonText: gettext('Cancel'),
fields: [
- {label: gettext('Link'), name: 'href', type: 'input'}
+ {label: gettext('Link'), name: 'href', type: 'input',
+ prePasteHandler: function(text) {
+ return params.fragment.document.getLinkForUrl(text);
+ }.bind(this)
+ }
dialog.on('execute', function(event) {
doc.transaction(function() {
var span = action.params.fragment.startNode.parent().wrapText({
dialog.on('execute', function(event) {
doc.transaction(function() {
var span = action.params.fragment.startNode.parent().wrapText({
- _with: {tagName: 'span', attrs: {'class': 'link'}},
+ _with: {tagName: 'span', attrs: {'class': 'link', href: event.formData.href }},
offsetStart: params.fragment.startOffset,
offsetEnd: params.fragment.endOffset,
textNodeIdx: [params.fragment.startNode.getIndex(), params.fragment.endNode.getIndex()]
}),
doc = params.fragment.document;
offsetStart: params.fragment.startOffset,
offsetEnd: params.fragment.endOffset,
textNodeIdx: [params.fragment.startNode.getIndex(), params.fragment.endNode.getIndex()]
}),
doc = params.fragment.document;
commentAction,
createWrapTextAction({name: 'emphasis', klass: 'emp', wrapDescription: gettext('Mark as emphasized'), unwrapDescription: gettext('Remove emphasis')}),
createWrapTextAction({name: 'cite', klass: 'cite', wrapDescription: gettext('Mark as citation'), unwrapDescription: gettext('Remove citation')}),
commentAction,
createWrapTextAction({name: 'emphasis', klass: 'emp', wrapDescription: gettext('Mark as emphasized'), unwrapDescription: gettext('Remove emphasis')}),
createWrapTextAction({name: 'cite', klass: 'cite', wrapDescription: gettext('Mark as citation'), unwrapDescription: gettext('Remove citation')}),
].concat(plugin.actions, templates.actions, footnote.actions, switchTo.actions, lists.actions);
].concat(plugin.actions, templates.actions, footnote.actions, switchTo.actions, lists.actions);
plugin.config = function(config) {
// templates.actions[0].config(config.templates);
templates.actions[0].params.template.options = config.templates;
plugin.config = function(config) {
// templates.actions[0].config(config.templates);
templates.actions[0].params.template.options = config.templates;