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

Resetting editor is not possible @ 0.72.2 #4780

Closed
tamilvendhank-helptap opened this issue Jan 9, 2022 · 5 comments
Closed

Resetting editor is not possible @ 0.72.2 #4780

tamilvendhank-helptap opened this issue Jan 9, 2022 · 5 comments
Labels

Comments

@tamilvendhank-helptap
Copy link

Description
Resetting editor is not possible.

Recording
https://user-images.githubusercontent.com/91463806/148670809-2ec54d15-b161-4e6b-aa19-cc374a0917c8.mov

Sandbox
https://codesandbox.io/s/strange-bardeen-nht71

Steps
To reproduce the behavior:

  1. Click on "Clear Text" button
  2. You will see the editor content gets changed.
  3. Click on the updated text & start editing.
  4. See error

Expectation
Resetting the editor state is the expectation. On other words, the ability to programatically set the state of the editor.

@tamilvendhank-helptap
Copy link
Author

tamilvendhank-helptap commented Jan 9, 2022

I had to adopt the idea mentioned here: #4564 (comment)

For my use case, I did this:

Transforms.select(editor, [0, editor.children.length - 1]);
Transforms.delete(editor);

But, still, for such a basic, trivial use case, I had to look into so many data, for so long time.

It is needed that a straightforward way of doing these basic things are documented.

@dylans
Copy link
Collaborator

dylans commented Jan 9, 2022

This is probably covered by the PR at https://github.com/ianstormtaylor/slate/pull/4768/files to update the docs. If not let me know.

@tamilvendhank-helptap
Copy link
Author

@dylans, thanks for that.
It indeed covers that use case.

@beewolf233
Copy link

hello, excuse me, I am faced with the same problem, Do you solve it??

@tamilvendhank-helptap
Copy link
Author

@beewolf233, yes. You can see it in here & also in this thread

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

No branches or pull requests

3 participants