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 #1

Updated by Riccardo De Contardi over 7 years ago

The issue seems still present on 7.6.12 but not on 8.5.0-dev

Actions #2

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from New to Needs Feedback

I am not able to reproduce it on 7.6.16, can you confirm? Thank you!

Actions #3

Updated by Hendrik Putzek about 7 years ago

  • Description updated (diff)
  • Assignee set to Riccardo De Contardi

I can still reproduce the bug with TYPO3 7.6.1.5, I just tried it.
I updated the steps to reproduce: Better create a new content element to be sure the textarea is completely empty, otherwise you can not reproduce the error.

Actions #4

Updated by Riccardo De Contardi about 7 years ago

  • Assignee deleted (Riccardo De Contardi)

I am able to reproduce it with Firefox 52.0.2 (32 bit) on Windows7 and TYPO3 7.6.16 (I will test later again with Mac)

The image (plain or magic) is not saved, but no javascript error is reported...

Actions #5

Updated by Riccardo De Contardi about 7 years ago

  • Status changed from Needs Feedback to New
Actions #6

Updated by Hendrik Putzek about 7 years ago

The image (plain or magic) is not saved, but no javascript error is reported...

Yeah, I tested with 7.6.16 on mac, too. You're right, there is no JS Error anymore but the image is not saved.

Actions #7

Updated by Riccardo De Contardi about 7 years ago

I still confirm I can't reproduce on Mac (Firefox 52.0.2 (64 bit)) - the images get saved... I am puzzled

I am using PHP 7.0.13

Actions #8

Updated by Mathias Schreiber over 6 years ago

  • Status changed from New to Closed

HTMLArea is no longer supported by TYPO3.
You can open up new issues here https://github.com/FriendsOfTYPO3/rtehtmlarea.

Cheers
Mathias

Actions

Also available in: Atom PDF