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

Feature request: More granular readOnly control - Selection vs Content #1909

Closed
Nantris opened this issue Jun 16, 2018 · 4 comments
Closed

Comments

@Nantris
Copy link
Contributor

Nantris commented Jun 16, 2018

It would be great if setting readOnly still allowed changes to selection, or if there was another option to allow modifying only the selection but not the text.

This is achievable most easily (though not safely if you're saving changes) in the interim by setting all of the elements in the editor to use the following CSS, and setting readOnly to false;

 .yourEditor * {
      -webkit-user-modify: read-only;
      -moz-user-modify: read-only;
      user-modify: read-only;
  }
@ianstormtaylor
Copy link
Owner

Fun fact, just discovered that there is sort of a semi-precedent for this with the contenteditable attribute being spec'd to take multiple different values: https://w3c.github.io/editing/contentEditable.html#editing-states

@Nantris
Copy link
Contributor Author

Nantris commented Aug 11, 2018

Huh I never knew there were settings besides true.

I forget why exactly this was an issue. One would assume selection would still be available even if it was readOnly, right? Is readOnly set via contentEditable="false" or some other method? Is there something Slate is doing that disables selection?

For all my time working with contentEditables, I've never really dove that deep into the finer points.

@isubasti
Copy link
Contributor

looks like for now the accepted values for contentEditable for now are only true/false. the w3c.github.io/editing/contentEditable.html#editing-states is still a draft

@ianstormtaylor
Copy link
Owner

I believe that this may be fixed by #3093, which has changed a lot of the logic in Slate and slate-react especially. I'm going to close this out, but as always, feel free to open a new issue if it persists for you. Thanks for understanding.

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

No branches or pull requests

3 participants