lists = require('plugins/core/lists'),
plugin = {name: 'core', actions: [], canvas: {}, documentExtension: {textNode: {}}},
Dialog = require('views/dialog/dialog'),
- canvasElements = require('plugins/core/canvasElements');
+ canvasElements = require('plugins/core/canvasElements'),
+ metadataEditor = require('plugins/core/metadataEditor/metadataEditor');
breakContent: {
impl: function(args) {
var node = this,
+ parentDescribingNodes = [],
newNodes, emptyText;
newNodes = node.split({offset: args.offset});
- [newNodes.first, newNodes.second].some(function(newNode) {
- if(!(newNode.contents().length)) {
- emptyText = newNode.append({text: ''});
- return true; // break
- }
- });
newNodes.second.contents()
.filter(function(child) {
return child.object.describesParent;
})
.forEach(function(child) {
//child.detach();
- newNodes.first.append(child);
+ parentDescribingNodes.push(child);
+ child.detach();
});
+ [newNodes.first, newNodes.second].some(function(newNode) {
+ if(!(newNode.contents().length)) {
+ emptyText = newNode.append({text: ''});
+ return true; // break
+ }
+ });
+ parentDescribingNodes.forEach(function(node) {
+ newNodes.first.append(node);
+ });
return _.extend(newNodes, {emptyText: emptyText});
},
getChangeRoot: function() {
}
};
+var metadataParams = {};
plugin.actions = [
undoRedoAction('undo'),
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')}),
- linkAction
+ linkAction,
+ metadataEditor.action(metadataParams)
].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;
+ metadataParams.config = (config.metadata || []).sort(function(configRow1, configRow2) {
+ if(configRow1.key < configRow2.key) {
+ return -1;
+ }
+ if(configRow1.key > configRow2.key) {
+ return 1;
+ }
+ return 0;
+ });
};
plugin.canvasElements = canvasElements;