Project

General

Profile

Bug #78048

Updated by Hendrik Putzek over 7 years ago

When inserting an image in an empty RTE editor field, a JS error is triggered in firefox. 
 The image does not show up in code view and is gone after saving. 

 *Steps to reproduce* 

 # Create a new Textmedia Element Open up RTE in Firefox 
 # Do NOT modify the input field in any way 
 #    Set the cursor into the RTE textarea input field (do NOT enter any text) 
 #    Click on the 'insert image'-Button and select an image 
 #    Image is inserted. Check the code view -> Image is not there 
 #    console says: TypeError: parentElement is null 
 #    Save the document -> Image is gone 

 *If the textarea contains anything, even a space or an empty line, the error does not occur* 

 It's important not to modify the input field in any way besides inserting the image. Even if you enter a space and remove it again, the error will not occur. 

 Error occurs in 
 typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/BlockElements.js:1041 
 <pre> 
 [...] 
 var parentElement = statusBarSelection ? statusBarSelection : this.editor.getSelection().getParentElement(); 
 if (!/^body$/i.test(parentElement.nodeName)) { 
   while (parentElement && parentElement != null && !Dom.isBlockElement(parentElement) || /^li$/i.test(parentElement.nodeName)) { 
     parentElement = parentElement.parentNode; 
   } 
 [...] 
 </pre> 

Back