You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug: editor.onChange is not triggered in case of removing the whole text inside block, if the contenteditable element is not the root node of a block
#2523
* fix isMutationBelongsToElement function: make it return true if the whole text node is deleted inside of some descendant of the passed element
* isMutationBelongsToElement function shouldn't return true if some of the ancestors of the passed element were added or deleted, only if the element itself
* add test case verifying that 'onChange' is fired when the whole text inside some nested descendant of the block is removed
* replace introduced dependency with ToolMock
* add comment explaining isMutationBelongsToElement behaviour in case of adding/removing the passed element itself
* fix formatting
* added some more explanation
* added record to the changelog
---------
Co-authored-by: Peter Savchenko <specc.dev@gmail.com>
editor.js/src/components/utils/mutations.ts
Line 15 in ee188bf
this check won't help if the change happened within some descendant of the 'element'.
For example, if we remove the text inside one of the 'li' items of '@editorjs/nested-list' block, onChange won't be triggered.
The text was updated successfully, but these errors were encountered: