Expose nativeSelectionHidden for custom selection extension

Hi Marijn,

What do you think about exposing the nativeSelectionHidden facet? This would make it possible for a custom selection-drawing extension to tell the editor that it’s hidden the native selection and that it can therefore skip enforceCursorAssoc(), as the built-in drawSelection extension does.

1 Like

I created a hacky work-around to replace the default selectionLayer.

export const patchDrawSelection = (extension: Extension): Extension => {
  invariant(Array.isArray(extension) && extension.length === 5, 'Invalid extension.');
  return extension.map((extension, i) => {
    if (i === 2) {
      return selectionLayer;
    }
    return extension;
  });
};