Custom Input Rule always removing the last char #3879
Unanswered
Andre2553
asked this question in
Questions & Help
Replies: 1 comment
-
Hi, did you found a way to fix this? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi guys, I am working on a new mark, and I am having a lot of problems achieving what I want.
I want to have an input rule that is triggered where I have an open curly bracket and closed curly bracket e.g. {test}, but I want to keep the curly brackets when the mark is created. So, it will stay {test}
But the default rule deletes the first char and the last one, leaving just the test.
I was able to keep the first one, but I don't know how to keep the last {test
this is is the code
`const inputRegex = /{[^{}]*}/;
const CustomSpan = Mark.create({
name: 'customSpan',
selectable: false,
group: 'inline',
inclusive: false,
inline: true,
atom: true,
addOptions() {
return {
HTMLAttributes: {},
}
},
parseHTML() {
return [{ tag: 'span' }]
},
renderHTML({ HTMLAttributes }) {
return ['span', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
},
})`
Beta Was this translation helpful? Give feedback.
All reactions