I like the simplicity of the inputrules but I was hoping that they would behave like autoformat in say word or other such apps whereby the formatting/change occurs after the input completes and the autoformat can be undone separately.
It seems like when the rule is processed via the textinput it is manipulating the model before the text was applied. So if I just use the undo/redo commands as is then undo’ing that action returns it to the state just prior to that last character being typed (e.g.
**bold* instead of
**bold** with the final
* that triggered the inputrule processing).
I also tried using the undoInputRule command such that it would be processed before the undo command (e.g. via ctrl-z) and that sort of works. The first undo would restore the text to what it would have been if the text were inserted (
**bold** in my example) but that itself interferes with the history. Because if I undo again the state created by the input rule action is redone (e.g. bold) - I assume because the undoInputRule acts like a new action added to the undo stack. If I then undo again it goes to say
**bold (because presumably that is the entry in the history from before the textinput rule was processed).
I think the ideal scenario would be that the input rule wasn’t processed until the transaction that involves that textinput were complete but I don’t see an easy way to do that. I mean I could try to infer it in the dispatchTransaction method but even if I can come up with a reasonable method of detecting I should do this then I’m essentially going to replicate much of the run of the rule - not the end of the world but not ideal either. Thoughts?