I’m trying to modify the textblockTypeInputRule to keep the matching characters on an input rule trigger. Specifically, wrap ``` in a codeblock without deleting the backticks in the same transaction.
My first thought is to remove the
return state.tr .delete(start, end) .setBlockType(start, start, nodeType, attrs)
return state.tr .setBlockType(start, end, nodeType, attrs)
However, this just results in a codeblock with 2 backticks instead of 3.
An approach that’s sort of hacky is to delete the backticks and re-insert them after after the
return state.tr .delete(start, end) .setBlockType(start, start, nodeType, attrs) .insertText('```', start, start)
Is there a less hacky way to keep the 3rd backtick that triggers the inputrule?