From: Aleksander Ɓukasz Date: Wed, 7 May 2014 07:25:02 +0000 (+0200) Subject: editor: canvas links fix X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/1a42d792d1124f110fd7eaad8ac4da0289cdd5df?ds=inline editor: canvas links fix --- diff --git a/src/editor/plugins/core/core.js b/src/editor/plugins/core/core.js index 150464e..ade5d93 100644 --- a/src/editor/plugins/core/core.js +++ b/src/editor/plugins/core/core.js @@ -274,13 +274,12 @@ var createLinkFromSelection = function(callback, params) { 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; - span.setAttr('href', event.formData.href); event.success(); return doc.createFragment(doc.CaretFragment, {node: span.contents()[0], offset:0}); }, { diff --git a/src/editor/plugins/core/links/linkElement.js b/src/editor/plugins/core/links/linkElement.js index fdb60e1..8a9edd7 100644 --- a/src/editor/plugins/core/links/linkElement.js +++ b/src/editor/plugins/core/links/linkElement.js @@ -17,7 +17,7 @@ _.extend(linkElement, { genericElement.init.call(this); _.bindAll(this, 'changeLink', 'deleteLink'); - var linkText = this.wlxmlNode.getAttr('href'), + var linkText = this.wlxmlNode.getAttr('href') || '', linkUrl = this.getUrl(linkText); this.box = $(_.template(boxTemplate)({text: linkText, url: linkUrl}));