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
Toggling a mark stops when selection started at block's end #2830
Comments
More experiences from Rich Text example: go at the end of any line or make one. Press Ctrl-B and write. Text is bold. Now, try to toggle bolding off by pressing Ctrl-B again. When you write something, it is "automatically" toggled bold again. If you select some text at the end of line and press Ctrl-B to toggle bolding off, cursor is taken to the beginning of line. |
@mkoskim I think this is a different issue but it is also a bug on toggling a mark. {
anchor: {
object: "point",
offset: 6,
path: [0, 1]
},
focus: {
object: "point",
offset: 6,
path: [0, 1]
}
isFocused: true,
marks: null, // I think this is right since we removed the mark on toggling again
object: "selection"
} The problem I see is not in the selection but rather in the nature of Slate that it merges text nodes. My theory is that the bug lies in the failure of creating another text node. In an example text like this: "a b c" => { object: 'text', text: 'a', marks: [] },
{ object: 'text', text: 'b', marks: ['bold'] },
{ object: 'text', text: 'c', marks: [] }, but what happens is @ianstormtaylor sorry for tagging you but if you can point me to the right direction on fixing this, I am willing to submit a PR 😄 |
Looks like there is work being done here @FerrielMelarpis #2818 |
@ellinokon Thanks for referencing the PR. Looks like it will already solve this issue as well but I'll test it for this scenario as this might be a corner case that is not yet caught on the test cases. |
I believe that this may be fixed by #3093, which has changed a lot of the logic in Slate and |
Do you want to request a feature or report a bug?
Report a bug
What's the current behavior?
When selecting a text from end to any point at its left except the start of the block,
and toggling a mark, it stops the toggling state and moves the cursor to the leftmost of the adjacent text node.
It can be seen in Slate examples as well: https://www.slatejs.org/#/rich-text
Here is a screen record:
What's the expected behavior?
The expected behavior is to not lose focus and toggling state shouldn't stop.
The text was updated successfully, but these errors were encountered: