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

blockComponent is recreated when special char is typed in the main editor #384

Open
ShakurOo opened this issue Sep 15, 2022 · 2 comments
Open

Comments

@ShakurOo
Copy link

-- 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

  1. Open the console, you see one ImageButton mount ... and ImageBlock mount ...
  2. Type something in the editor you, nothing happened in the console
  3. Now type character ê multiple times and see the console, the ImageBlock component is re-created for each character...
  4. Downgrade the version of megadraft under the 0.7.0, and type the special character, you can see the expected behavior

Browser, device, and OS

Screenshots

Capture d’écran 2022-09-15 à 19 11 28

@ShakurOo
Copy link
Author

ShakurOo commented Sep 23, 2022

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.

@jerempy
Copy link

jerempy commented Oct 13, 2022

ImageBlock gets added as a plugin here:

for (let plugin of this.props.plugins || DEFAULT_PLUGINS) {
by default if you don't specify it as a plugin. What happens for you if you don't specify any plugins?

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants