From d5a04edf02a1a4ba0620401a8292b391b3f6126c Mon Sep 17 00:00:00 2001 From: Mateusz Uzdowski Date: Mon, 11 Jan 2010 20:07:51 +0000 Subject: [PATCH] BUGFIX: anchor, target, and title are not set on a link that's inserted without selection. Also when using createElement in that way firefox encodes the spaces within href parameter breaking the shortcodes. Switched to using the 'mctmp' placeholder now. git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/branches/2.4@96623 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- javascript/tiny_mce_improvements.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/javascript/tiny_mce_improvements.js b/javascript/tiny_mce_improvements.js index 45adb2996..c7dee82b2 100755 --- a/javascript/tiny_mce_improvements.js +++ b/javascript/tiny_mce_improvements.js @@ -242,20 +242,24 @@ LinkForm.prototype = { else ed.dom.setAttrib(e, k, v); }); }; + + function replace() { + tinymce.each(ed.dom.select('a'), function(e) { + if (e.href == 'javascript:mctmp(0);') set(e); + }); + } if(attributes.innerHTML && !ed.selection.getContent()) { if(tinymce.isIE) var rng = ed.selection.getRng(); e = ed.getDoc().createElement('a'); - e.innerHTML = attributes.innerHTML; - e.href = attributes.href; + e.href = 'javascript:mctmp(0);'; s.setNode(e); if(tinymce.isIE) tinyMCE.activeEditor.selection.setRng(rng); + replace(); } if (!e) { ed.execCommand('CreateLink', false, 'javascript:mctmp(0);'); - tinymce.each(ed.dom.select('a'), function(e) { - if (e.href == 'javascript:mctmp(0);') set(e); - }); + replace(); } else { if (attributes.href) set(e);