-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Exit code on right arrow #1200
Exit code on right arrow #1200
Conversation
Hey, thanks for that PR. I think your gif doesn't demonstrate your fix very well because after applying a mark input rule, the mark is always removed. It’s just a rendering issue that you think you are still in the mark. But if you type something it's without the mark. See: Bildschirmaufnahme.2021-04-23.um.22.09.57.mp4You maybe want to improve the behavior when a code mark is at the end of a line? Bildschirmaufnahme.2021-04-23.um.22.23.03.mp4There is also a Bildschirmaufnahme.2021-04-23.um.22.23.03.mp4Or is there any other case you wanted to improve? |
Hello~I need that. It's hard for me to append another kind of element after previous code block.So, I need arrow to skip out code block to continue input |
I’m thinking of moving this into its own commands. It’s also important to say that this solved only the right side of code. I’m also not sure about adding a whitespace. Maybe just remove So maybe a Sorry about that but there are so many cases 🙃 |
@philippkuehn I'll try, thanks a lot~ |
The option to add an extra space would be great. I currently have an implementation of I believe the requested implementation does not actually insert a "space" character, because in the live editor it seems For example, Is there a workaround to add the space character? |
I think there were some changes in what
this works instead. EDIT: Updated the PR as well. |
cc79e45
to
039dee2
Compare
don’t understand that 🤔 |
I changed some code there but it should still work with simple strings: https://www.tiptap.dev/api/commands/insert-content But maybe there is a bug when using trailing or leading spaces. |
With this fix |
I should have mentioned I'm using a custom The fix works great, exactly as expected. Thanks. |
@martinthenth Within addKeyboardShortcuts() {
return {
// work with plain transactions
Enter: () => {
const { tr } = this.editor.state
tr.insertText('whatever')
this.editor.view.dispatch(tr)
return true
},
// or use commands as abstraction layer
Enter: () => {
return this.editor.commands.insertContent('whatever')
},
// or use the generic `command()` command
Enter: () => {
return this.editor.commands.command(({ tr }) => {
tr.insertText('whatever')
return true
})
},
}
} |
Might be useful to see another library Let me know if there is anything in there that might be helpful. |
|
May not be the best way to handle this, but it works for now and should help with exiting code marks in general with other marks - I added a new attribute to the This would solve this issue for code marks that are at the end of a node (for example paragraph, where it's hard to exit the mark). What I could now imagine as an improvement would be to "save" the last exit transaction and see if the selection moves out of the current node to remove the empty whitespace at the end of the node. |
Hey 👋
This PR adds functionality to
extension-code
and allows the user to exit by pressingRightArrow
: