From 1a42d792d1124f110fd7eaad8ac4da0289cdd5df Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Wed, 7 May 2014 09:25:02 +0200 Subject: [PATCH] editor: canvas links fix --- src/editor/plugins/core/core.js | 3 +-- src/editor/plugins/core/links/linkElement.js | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) 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})); -- 2.20.1