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

Pasting list with empty bullet point from Google Docs causes Uncaught TypeError: Cannot read property 'is' of undefined #7958

Closed
tomi-bigpi opened this issue Aug 27, 2020 · 0 comments · Fixed by #7959
Labels
package:paste-from-office type:bug This issue reports a buggy (incorrect) behavior.

Comments

@tomi-bigpi
Copy link
Contributor

📝 Provide detailed reproduction steps (if any)

  1. Create a Google Doc with a bullet or numbered list with an empty bullet point, such as:
  • Item 1
  1. Copy the list onto the clipboard.
  2. Paste into CKEditor (https://ckeditor.com/docs/ckeditor5/latest/features/pasting/paste-from-google-docs.html).

✔️ Expected result

Content is pasted into document.

❌ Actual result

No content is pasted and the following error shows up in the Console:

Uncaught TypeError: Cannot read property 'is' of undefined
    at list.js:96
    at u.execute (googledocsnormalizer.js:49)
    at u.t.plugins.get.on.priority (pastefromoffice.js:68)
    at u.fire (emittermixin.js:209)
    at a.listenTo.priority (clipboard.js:80)
    at a.fire (emittermixin.js:209)
    at a.n (clipboardobserver.js:51)
    at a.fire (emittermixin.js:209)
    at a.fire (domeventobserver.js:96)
    at a.onDomEvent (clipboardobserver.js:74)

📃 Other details

  • Browser: Chrome 84.0.4147.135
  • OS: macOS
  • CKEditor version: 5
  • Installed CKEditor plugins: PasteFromOffice

The issues is on line:

if ( firstChild.is( 'element', 'p' ) ) {

It is missing a null check for firstChild, e.g.

			if ( firstChild && firstChild.is( 'element', 'p' ) ) {
@tomi-bigpi tomi-bigpi added the type:bug This issue reports a buggy (incorrect) behavior. label Aug 27, 2020
tomi-bigpi added a commit to tomi-bigpi/ckeditor5 that referenced this issue Aug 27, 2020
jodator added a commit that referenced this issue Aug 28, 2020
Fix (paste-from-office): Fix list paste from Google Docs with an empty item. Closes #7958.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:paste-from-office type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants