codex-team / editor.js

A block-style editor with clean JSON output
https://editorjs.io
Apache License 2.0
27.61k stars 2.02k forks source link

[Bug] Error thrown when modifying text, yes I know it's vague :( #1174

Open vincentdesmares opened 4 years ago

vincentdesmares commented 4 years ago

We got a report from Sentry that one of our user got a bug when modifying a text.

TypeError
Cannot read property 'inputs' of undefined
{snip} election){var e=this.Editor.BlockManager.getBlock(t.target).inputs;e.length>1&&!this.readyToBlockSelection?this.readyToBlockSelection=!0:1!= {snip}

I cannot reproduce it as I don't know how it got triggered.

Yet I know the last user action:

ui.click | div.ce-block__content > div.ce-paragraph.cdx-block

Browser : Chrome Version: 81.0.4044 Computer : Macbook pro with Mac OS X Version:10.14.6

Editor.js version and plugins you use with their versions:

"@editorjs/checklist": "^1.1.0",
"@editorjs/editorjs": "^2.17.0",
"@editorjs/embed": "^2.3.1",
"@editorjs/header": "^2.4.1",
"@editorjs/image": "^2.3.4",
"@editorjs/link": "^2.1.3",
"@editorjs/list": "^1.4.0",
"@editorjs/marker": "^1.2.2"
ranemihir commented 4 years ago

Can you provide more details regarding the error?

hata6502 commented 3 years ago

It seems this error is occured in blockSelection.ts. When multiple Editor.js instances are launched, this error can be occured by Ctrl + A (Select All Command),

ranemihir commented 3 years ago

Provide proper steps for reproducing the error. @vincentdesmares

sKopheK commented 8 months ago

don't know what tooling you use when writing the code for the library, but as getBlock() might return undefined, you should not chain its call with property access/method call. i get the same error described by the author of this thread in handleCommandA() where you rely on getBlock() returning value based on event.target which is really unpredictable in general