import { isCellSelection } from "./../../_shared/is-cell-selection.js";
import { Plugin, PluginKey } from "./../../tiptap/pm/state.js";
import { Decoration, DecorationSet } from "./../../tiptap/pm/view.js";
import { createRicosFunctionalExtension } from "./../../tiptap-extensions/index.js";
import { SELECTION_CLASS } from "./constants.js";
const selection = createRicosFunctionalExtension({
  type: "extension",
  groups: [],
  name: "selection",
  createExtensionConfig() {
    return {
      name: this.name,
      addProseMirrorPlugins() {
        return [
          new Plugin({
            key: new PluginKey("selection"),
            props: {
              decorations(state) {
                if (state.selection.empty) {
                  return null;
                }
                if (isCellSelection(state.selection)) {
                  return null;
                }
                return DecorationSet.create(state.doc, [
                  Decoration.inline(state.selection.from, state.selection.to, {
                    class: SELECTION_CLASS
                  })
                ]);
              }
            }
          })
        ];
      }
    };
  }
});
export {
  selection
};
//# sourceMappingURL=extension.js.map
