Project

General

Profile

Actions

Bug #78048

closed

Firefox: JS Error when inserting image in empty RTE

Added by Hendrik Putzek over 7 years ago. Updated over 6 years ago.

Status:
Closed
Priority:
Should have
Assignee:
-
Category:
RTE (rtehtmlarea + ckeditor)
Target version:
-
Start date:
2016-09-23
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
7
PHP Version:
5.5
Tags:
rte, image
Complexity:
Is Regression:
No
Sprint Focus:

Description

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

  1. Create a new Textmedia Element in Firefox
  2. Do NOT modify the input field in any way
  3. Set the cursor into the RTE textarea field (do NOT enter any text)
  4. Click on the 'insert image'-Button and select an image
  5. Image is inserted. Check the code view -> Image is not there
  6. console says: TypeError: parentElement is null
  7. 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

[...]
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;
  }
[...]

Actions

Also available in: Atom PDF