blockComponent is recreated when special char is typed in the main editor
ShakurOo opened this issue · comments
-- Bug Report --
Expected Behavior
The blockComponent
shouldn't be re-created all times
Current Behavior
Since the version 0.7.0
the blockComponent
is always re-created when you write a special character like ê
, ë
(combinaison of two keyboard keys to being added).
Steps to Reproduce
Go to : https://codesandbox.io/s/megadraft-with-plugins-and-example-content-forked-ck83pb?file=/src/index.js
- Open the console, you see one
ImageButton mount ...
andImageBlock mount ...
- Type something in the editor you, nothing happened in the console
- Now type character
ê
multiple times and see the console, theImageBlock
component is re-created for each character... - Downgrade the version of
megadraft
under the0.7.0
, and type the special character, you can see the expected behavior
Browser, device, and OS
Screenshots
Update: It seem's that the problem still comes with the version under 0.7.0
. for this scenario :
- Create a new empty block by pressing ENTER key (to create new paragraph)
- Begins by typing the special char
ê
You'll see again the ImageBlock
re-mounting.
ImageBlock gets added as a plugin here:
megadraft/src/components/MegadraftEditor.js
Line 121 in 1caecd3
I also looked at the keybindings and couldn't find any default bindings that could cause this issue for you. I also couldn't replicate it myself
ALso, noticed opportunity for minor improvement on these components so opened a PR for them: #406