codex-team / codex-team/editor.js

Tunes with wrappers aren't calling didMutated, when changing tune value

Open
#2,691 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
31.9k
Forks
2.2k
Avg merge
1d 1h
Merged PRs (30d)
1

Description

Creating a custom tune, if a wrapper element is used, it will not call didMutated, and because of it, onChange is also not called.
Issue comes from v2.27.0-rc.5 : https://github.com/codex-team/editor.js/commit/b7b00fd0606330ae41876bd481b2c57fe4e99640#diff-3a2e107229dbebf0e0b7e00160e7faec0cf71e6baf51872078e031789692c8b5R934

On data mutation, it will check if block element contains the mutated wrapper tune element, and will always fail, as it is a wrapper, and not a child of the block.

https://github.com/kaaaaaaaaaaai/editorjs-alignment-blocktune/issues/12
https://github.com/kaaaaaaaaaaai/editorjs-alignment-blocktune/pull/13

Steps to reproduce:
1. Create a tune with a wrapper element / install editorjs-alignment-blocktune mentioned above
2. Try setting a tune for the block
3. onChange is not called

Expected behavior:
if this is intended, should all tunes use `dispatchChange()` on tune change starting from v2.27.0-rc.5?
if not, then, I think the onChange should be called regardless if mutated element is part of a block. (E.g. What happens if there is some button outside of EditorJS container, that would, change a tune for all blocks (backgrounds, alignments, etc.)?)

Screenshots:
![image](https://github.com/codex-team/editor.js/assets/45639295/d3fb06fb-2e0f-4d6d-b529-7b6aff541fa9)
The `ce-tune-alignment--center` is the tune wrapper element, and `ce-paragraph` is the block element, didMutated will not be called whenever wrapper is mutated, as it is not part of block element.

Device, Browser, OS: any

Editor.js version: v2.27.0-rc.5 and above

Plugins you use with their versions:
https://github.com/kaaaaaaaaaaai/editorjs-alignment-blocktune 1.0.3

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.