import { isInlineTextOnly } from "./../../../ricos-common-plugins/transaction-predicates/is-inline-text-only.js";
import { Plugin, PluginKey } from "./../../../tiptap/pm/state.js";
import { cellEdgeDecorations } from "../decorations/index.js";
const cellEdgePlugin = () => {
  const key = new PluginKey("cell-edge");
  return new Plugin({
    key,
    state: {
      init: (_config, state) => cellEdgeDecorations(state.doc),
      apply: (tr, prev) => {
        if (!tr.docChanged) {
          return prev;
        }
        if (isInlineTextOnly(tr)) {
          return prev.map(tr.mapping, tr.doc);
        }
        return cellEdgeDecorations(tr.doc);
      }
    },
    props: {
      decorations(state) {
        return key.getState(state);
      }
    }
  });
};
export {
  cellEdgePlugin
};
//# sourceMappingURL=cell-edge-plugin.js.map
