registerMark function

Unsubscribe registerMark(
  1. LexicalEditor editor
)

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();
    }
  };
}