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

Editor Pasting Crashes after Certain Sequence of Actions #3858

Closed
scottfr opened this issue Feb 12, 2020 · 5 comments · Fixed by #4895
Closed

Editor Pasting Crashes after Certain Sequence of Actions #3858

scottfr opened this issue Feb 12, 2020 · 5 comments · Fixed by #4895
Assignees
Labels
core The issue is caused by the editor core code. status:confirmed An issue confirmed by the development team. type:bug A bug.
Milestone

Comments

@scottfr
Copy link

scottfr commented Feb 12, 2020

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Create a CKeditor 4 editor with { enterMode: CKEDITOR.ENTER_BR, shiftEnterMode: CKEDITOR.ENTER_BR } (standard p mode does not have this issue)
  2. Paste this HTML into the editor: <p>a</p><p>b</p> (if you copy this from an editor, make sure you copy it with p-tags and not a br as the br will work fine)
  3. Hit enter twice
  4. Type a (or any other letter), then a backspace to delete the letter you just typed (this is important to do otherwise the issue does not manifest itself)
  5. Paste the same text from step 2 into the editor again (note you shouldn't be moving your cursor around during these steps, just follow them from top to bottom)

So again: paste, enter twice, any letter, delete letter, paste again.

Here's a code pen with CKEditor 4 and text ready to copy:

https://codepen.io/scottfr/pen/WNvQgwp

Expected result

The editor's content is:

a
b

a
b

Actual result

The editor's content is:

a
b

The javascript console has the error:

ckeditor.js:155 Uncaught TypeError: Cannot read property 'getParents' of null at d (ckeditor.js:155)

Other details

  • Browser: Chrome
  • OS: OS X
  • CKEditor version:4.13.0
  • Installed CKEditor plugins: None
@scottfr scottfr added the type:bug A bug. label Feb 12, 2020
@Comandeer Comandeer added status:confirmed An issue confirmed by the development team. core The issue is caused by the editor core code. labels Feb 17, 2020
@Comandeer
Copy link
Member

I can reproduce the issue. It seems to be connected with editor.inserHtml function.

The whole error stack:

Uncaught TypeError: Cannot read property 'getParents' of null
    at d (ckeditor.js:149)
    at CKEDITOR.dom.range.extractContents (ckeditor.js:154)
    at CKEDITOR.dom.range.splitElement (ckeditor.js:180)
    at ckeditor.js:410
    at $.insertHtml (ckeditor.js:374)
    at $.<anonymous> (ckeditor.js:384)
    at a.n (ckeditor.js:10)
    at a.<anonymous> (ckeditor.js:12)
    at a.CKEDITOR.editor.CKEDITOR.editor.fire (ckeditor.js:13)
    at a.insertHtml (ckeditor.js:286)

@carestad
Copy link

carestad commented Mar 11, 2020

I've seen a lot of TypeError: Cannot read property 'getParents' of null in our Sentry logs recently as well. It does not appear to be triggered in the same manner as here though, but I would not be surprised if it is related to the "paste from Word" functionality or the like, which probably uses insertHtml?

@scottfr
Copy link
Author

scottfr commented Jul 14, 2020

We have another user who is affected by this bug. It would be great if it could be looked into.

@Sugao1995
Copy link

Have there been any updates to this issue? I'm seeing a lot of these errors in our Sentry logs but I've only managed to reproduce this issue following steps posted here. I can't seem to reproduce the issue on an older CKEditor 4 version, such as 4.2. The one we're currently using is on 4.16.

@CKEditorBot
Copy link
Collaborator

Closed in #4895

@CKEditorBot CKEditorBot added this to the 4.17.1 milestone Oct 5, 2021
@jacekbogdanski jacekbogdanski modified the milestones: 4.17.1, 4.17.0 Oct 12, 2021
Comandeer added a commit that referenced this issue Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core The issue is caused by the editor core code. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants