-
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
Insert outside inline when selection is at the end #3260
Insert outside inline when selection is at the end #3260
Conversation
ff72352
to
8982ba9
Compare
Hey @dmarkow thank you for taking the time to investigate this! I think we actually want to define this in the |
fe9084e
to
289558a
Compare
Just made another pass on this. I moved the logic to As you mentioned, overriding I did catch another bug while working on this. If you highlight across the edge of an inline and type, the first letter you type becomes highlighted/selected, then the second letter you type replaces it. So if you quickly type Let me know how this looks. If it's good to merge, I can clean up the commit history on it first. |
Looks great! Thanks for the detailed explanation too, that made it very easy to review. No need to cleanup the commits either because I just use GitHub's "squash and merge" strategy so it all goes into a single commit. Thank you @dmarkow! |
* Insert outside inline when selection is at the end * Move inline edge check to insert_text * Fix selection point after deleting text
Is this adding or improving a feature or fixing a bug?
Fixing a bug
What's the new behavior?
When inserting text at the end of an inline (e.g. a link) using a selection as the insertion point, the text will be added outside the inline. Passing an explicit point/path to
Editor.insertText
will retain the old behavior of inserting inside the inline.Input:
Output from typing "four" or using
Editor.insertText(editor, "four")
(with no explicitat
point/path)Output from calling
Editor.insertText(editor, "four", { at: { path: [0, 1, 0], offset: 3 } })
:How does this change work?
I updated the
insertText
function to check if the cursor is at the end of an inline, and if so, it moves the selection outside of the inline before adding the text.I have no idea if this is the right approach, so any feedback is greatly appreciated.
Have you checked that...?
yarn test
.yarn lint
. (Fix errors withyarn fix
.)yarn start
.)Does this fix any issues or need any specific reviewers?
See #3151 - this addresses the inline portion of that issue.