Hi, I’m new to the CM6 and having trouble working with the “Extension”.
I want to pair up “<” with “>” whenever the user types “<”. So far I can detect the input but have no idea how to proceed to apply further transaction.
Should I get a EditorView object somewhere and dispatch the changes. And if it is the way, how do I get the EditorView object?
this.registerEditorExtension([EditorState.transactionFilter.of(tr => {
if (tr.isUserEvent("input"))
{
tr.changes.iterChanges((fromA, toA, fromB, toB, inserted) => {
if (inserted.sliceString(0, inserted.length) === "<") {
// create a new transaction
// how do I dispatch the transaction to add ">" ?
}
});
}
return tr;
})])