-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Documentation: removeMark() checks data
along with type
#826
Comments
The use case here is: the editor is in the readOnly state, but the user can highlight a section and click "add comment". Then I want to add a mark to show the selection. This is a very important feature for my project, but right now there is no way to easily create/get Slate's Selection object. (By the way, thank you to everyone who is contributing to this project. This is the best editor!) |
See also #873, which evolved into a discussion about this. (Unfortunately without any clear decision) |
You can also follow this discussion to see the different cases The decision so far is to have Slate may eventually get a |
I understand there's no direct API to remove marks with a certain type. But is there any workaround for this? I'm using the mark to toggle text colors. I put the color into the data of the mark. And everytime the color is changed, I would like to remove the mark and replace it with a new one with updated data. Is this the right way of implementing such functions in slate? Please help to advise. Thanks in advance and looking forward to suggestions. |
Hey folks—just wanted to chime in here. Just got bit by this and it took a lot of source exploration to track down. The Slate In case it's helpful, here's what I was naiively trying to do. I think this API behavior is fine but it should definitely be documented that the string shorthand only works when the mark has no data.
|
Open to fixing this if anyone wants to make a PR. |
As of #3093 (which was just merged), I believe this issue is no longer applicable, because a lot has changed. I'm going through and closing out any potential issues that are not out of date with the overhaul. Thanks for understanding. |
It was not at all clear to me that when you call removeMark(type), it also checks mark's data parameter and will not remove a mark even if it matches the type if the
data
doesn't match as well.The text was updated successfully, but these errors were encountered: