registerMark function
Registers addMarkCommand and removeMarkCommand on editor.
Implementation
Unsubscribe registerMark(LexicalEditor editor) {
final unsubscribes = <Unsubscribe>[
editor.registerCommand<String>(addMarkCommand, (id) {
$markSelection(id);
return true;
}, CommandPriority.editor),
editor.registerCommand<String>(removeMarkCommand, (id) {
$removeMark(id);
return true;
}, CommandPriority.editor),
];
return () {
for (final unsubscribe in unsubscribes) {
unsubscribe();
}
};
}