Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Copy Paste Ckeditor Invalid HTML code in DB properties #2918

Closed
markuspfeifenberger opened this issue Jun 15, 2021 · 1 comment
Closed
Labels
7.3 8.3 Bug Label to mark the change as bugfix CKEditor

Comments

@markuspfeifenberger
Copy link

Description

If a property is configured as inlineEditable (true), without autoparagraph (false) and removeFormat (true), the HTML code sent to Neos and saved in the database is not valid, when the Code is pasted, eg using copy-paste of a formated browser content.

Steps to Reproduce

  1. NodeType configuration
properties:
    headline:
      type: string
      ui:
        inlineEditable: true
        inline:
          editorOptions:
            autoparagraph: false
            formatting:
              removeFormat: true
            placeholder: i18n
  1. Edit the headline in Neos and copy-paste HTML from a browser, e.g.:
<p><b>This text is bold</b></p>
<p><i>This text is italic</i></p>
<p>This is<sub> subscript</sub> and <sup>superscript</sup></p>

(The code can be copied from https://www.w3schools.com/html/html_formatting.asp - first white box, all three lines)

Expected behavior

The code should be stored as correct HTML

This text is bold This text is italic This is subscript and superscript

Actual behavior

Request URL: /neos/ui-services/change sends the code, where the payload is changed and stored in the DB

This text is bold</span><span>This text is italic</span><span>This is subscript and superscript

Affected Versions

Neos: > 5

UI: 7.0.3

Screen Shot 2021-06-15 at 14 58 45

@grebaldi grebaldi added Bug Label to mark the change as bugfix CKEditor labels Jul 17, 2021
@Sebobo
Copy link
Member

Sebobo commented Sep 6, 2022

Can confirm this bug in my customers project. I'll try to get some budget to fix it.

@mhsdesign mhsdesign changed the title Invalide HTML code in DB properties Bug: Copy Paste Ckeditor Invalid HTML code in DB properties Oct 12, 2022
mhsdesign added a commit that referenced this issue Jun 28, 2023
Since there is still no native support for a inline ckeditor mode. ckeditor/ckeditor5#762 we will continue our hacky road ;)

This fixes several issues:
- Inserting text with newlines will now correctly insert soft breaks (br)
- We use our own pseodo `<neos-inline-wrapper>` tag to avoid the issue of having to parse html with regex and doing it wrong #2918

i also added a test for some inline editing behavior. (Like that there are no outer span or p tags)
But writing a tests for #2918 is currently impossible, as our tests currently dont use `https` which means we cant access the `navigator.clipboard` and test that ckeditor works correctly when content is pasted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7.3 8.3 Bug Label to mark the change as bugfix CKEditor
Projects
None yet
Development

No branches or pull requests

4 participants