import { onlyChangesUnrelatedAttrs } from "./../../ricos-common-plugins/transaction-predicates/only-changes-unrelated-attrs.js";
import { Mark_Type } from "./../../ricos-types/index.js";
import { createRicosMarkExtension } from "./../../plugin-commons/index.js";
import { findHashTag } from "./find-hash-tag.js";
const tiptapExtensions = [
  createRicosMarkExtension({
    type: "mark",
    groups: [],
    name: Mark_Type.HASHTAG,
    createExtensionConfig({ Plugin }) {
      return {
        name: this.name,
        addProseMirrorPlugins() {
          return [
            new Plugin({
              state: {
                init(_, { doc }) {
                  return findHashTag(doc);
                },
                apply(transaction, oldState) {
                  if (!transaction.docChanged) {
                    return oldState;
                  }
                  if (onlyChangesUnrelatedAttrs(transaction)) {
                    return oldState;
                  }
                  return findHashTag(transaction.doc);
                }
              },
              props: {
                decorations(state) {
                  return this.getState(state);
                }
              }
            })
          ];
        }
      };
    }
  })
];
export {
  tiptapExtensions
};
//# sourceMappingURL=tiptap.js.map
