X-Git-Url: https://git.mdrn.pl/fnpeditor.git/blobdiff_plain/314bc2164ef9e9b94bd57eba48211e5df6002bf1..8f44492:/src/editor/plugins/core/core.js?ds=sidebyside diff --git a/src/editor/plugins/core/core.js b/src/editor/plugins/core/core.js index 31ac09d..7feb1a4 100644 --- a/src/editor/plugins/core/core.js +++ b/src/editor/plugins/core/core.js @@ -12,7 +12,10 @@ var _ = require('libs/underscore'), Dialog = require('views/dialog/dialog'), canvasElements = require('plugins/core/canvasElements'), metadataEditor = require('plugins/core/metadataEditor/metadataEditor'), - edumed = require('plugins/core/edumed/edumed'); + edumed = require('plugins/core/edumed/edumed'), + attachments = require('views/attachments/attachments'); + + var exerciseFix = function(newNodes) { @@ -314,6 +317,13 @@ plugin.documentExtension.documentNode.transformations = { } }); return toret; + }, + insertNewNode: function () { + var node = this; + var newElement = this.document.createDocumentNode({tagName: 'div', attrs: {class: 'p'}}); + node.after(newElement); + newElement.append({text: ''}); + return newElement; } }; @@ -520,6 +530,7 @@ var createWrapTextAction = function(createParams) { }; + var createLinkFromSelection = function(callback, params) { var doc = params.fragment.document, dialog = Dialog.create({ @@ -530,7 +541,8 @@ var createLinkFromSelection = function(callback, params) { {label: gettext('Link'), name: 'href', type: 'input', prePasteHandler: function(text) { return params.fragment.document.getLinkForUrl(text); - }.bind(this) + }.bind(this), + description: 'attachment library' } ] }), @@ -556,6 +568,9 @@ var createLinkFromSelection = function(callback, params) { }); }); dialog.show(); + $(".attachment-library", dialog.$el).on('click', function() { + attachments.select(function(v) {$("input", dialog.$el).val(v);}); + }); }; var editLink = function(callback, params) { @@ -625,6 +640,7 @@ var linkAction = { } }; + var metadataParams = {}; plugin.actions = [