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

[Bug]: loadSnapshot disables keyboard #3696

Open
1 task done
WilfredoHQ opened this issue May 3, 2024 · 3 comments
Open
1 task done

[Bug]: loadSnapshot disables keyboard #3696

WilfredoHQ opened this issue May 3, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@WilfredoHQ
Copy link

What happened?

The keyboard stopped responding when deleting, copying, cutting, etc.
Using the buttons on the user interface, actions are carried out normally.

How can we reproduce the bug?

  • Create a shape
  • Save with getSnapshot somewhere
  • Delete the shapes or make any changes (optional)
  • Load the saved snapshot with loadSnapshot
const snapshot = editor.store.getSnapshot()
editor.store.loadSnapshot(snapshot)

See an example

What browsers are you seeing the problem on?

Firefox, Chrome

Contact Details

wilfredo_sj@hotmail.com

Code of Conduct

  • I agree to follow this project's Code of Conduct
@WilfredoHQ WilfredoHQ added the bug Something isn't working label May 3, 2024
Copy link

linear bot commented May 3, 2024

@MitjaBezensek
Copy link
Contributor

MitjaBezensek commented May 6, 2024

Hey! Thanks for reporting this, we'll investigate it a bit further.

The issue seems to be that the editor looses focus. As a temporary workaround you can use the following line (after loading the snapshot).

editor.updateInstanceState({ isFocused: true })

You can also try playing with the editor.store.getSnapshot options. Using editor.store.getSnapshot('all') would also store the instance state and would then allow you to load it back in the same state as it was when storing the snapshot.

What are you trying to achieve? Just load a document when the page first loads?

@WilfredoHQ
Copy link
Author

Thank you very much, as you mentioned what I was trying to achieve is to load a document when the page loads for the first time.
The suggested temporary solution works great, the option to use "all" when obtaining the snapshot works just as well, but it saves data that I don't really need to save. Anyway, it's great for other cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants