Inserting link in TinyMCE on centered image produces js error
Permalink
Has anyone found a workaround for this problem? If I have the following code in a content block:
...and I try to make it a link (by clicking on the chain icon), when I click update, the form just stays open, and I get the following error in the console:
Uncaught TypeError: Cannot read property 'childNodes' of null
This was supposed to have been fixed in versions of TinyMCE earlier than the one shipped with Concrete 5.5.2.1 (TinyMCE 3.4.6). This only happens in Chrome from what I can tell. Also, note if I take out the style="" attribute, the link inserts fine...
<p><img style="margin-right: auto; margin-left: auto; display: block;" src="/index.php/download_file/view_inline/385/" alt="myimage.jpg" width="536" height="239" /></p>
...and I try to make it a link (by clicking on the chain icon), when I click update, the form just stays open, and I get the following error in the console:
Uncaught TypeError: Cannot read property 'childNodes' of null
This was supposed to have been fixed in versions of TinyMCE earlier than the one shipped with Concrete 5.5.2.1 (TinyMCE 3.4.6). This only happens in Chrome from what I can tell. Also, note if I take out the style="" attribute, the link inserts fine...
Same issue here, cannot insert links for items aligned to the right.
Yea, I think we just removed the style from the image and it worked.
If you want fix this:
open file concrete\js\tiny_mce\plugins\advlink\js\advlink.js
search line 381
and replace function insertAction() with this code:
open file concrete\js\tiny_mce\plugins\advlink\js\advlink.js
search line 381
and replace function insertAction() with this code:
function insertAction() { var inst = tinyMCEPopup.editor; var elm, elementArray, i; elm = inst.selection.getNode(); if(elm.nodeName == 'IMG') { var imgEl = elm; var elmStyleCSSText = elm.style.cssText; elm.style.cssText = ''; } checkPrefix(document.forms[0].href); elm = inst.dom.getParent(elm, "A"); // Remove element if there is no href if (!document.forms[0].href.value) { tinyMCEPopup.execCommand("mceBeginUndoLevel"); i = inst.selection.getBookmark();
Viewing 15 lines of 45 lines. View entire code block.
it's correct work on 5.6.1.2 version Concrete5 and 3 major version TinyMCE
remember — replace full function
remember — replace full function
If "float: right" or "float: left" is applied to the image class, it does not work :-( To work fine you should also remove class from the image...
function insertAction() { var inst = tinyMCEPopup.editor; var elm, elementArray, i; elm = inst.selection.getNode(); if (elm.nodeName == 'IMG') { var imgEl = elm; var elmStyleCSSText = imgEl.style.cssText; imgEl.style.cssText = ''; var ImgclassName = imgEl.className; imgEl.className = ''; } checkPrefix(document.forms[0].href); elm = inst.dom.getParent(elm, "A"); // Remove element if there is no href if (!document.forms[0].href.value) {
Viewing 15 lines of 48 lines. View entire code block.