import { initializeTiptapAdapter } from "./../tiptap-editor/index.js";
const topics = [
  "ricos.editor.instance.loaded",
  "ricos.editor.instance.error",
  "ricos.editor.functionality.firstEdit",
  "ricos.editor.content.saved"
];
const UPLOAD_TOPICS = [
  "ricos.upload.functionality.uploadStarted",
  "ricos.upload.functionality.uploadFinished"
];
class RicosEditor {
  constructor(editorProps, services, isDebugMode = false, getToolbarStateSelectorContextValue, getSelectionSelectorContextValue, getModalStateSelectorContextValue, getPmContentSelectorContextValue, getInlineAiStateSelectorContextValue) {
    this.id = "ricos-editor";
    this.topicsToPublish = topics;
    this.topicsToSubscribe = UPLOAD_TOPICS;
    this.getPublicCommands = () => this.tiptapAdapter.getEditorCommands();
    this.tiptapAdapter = initializeTiptapAdapter(
      editorProps,
      services,
      isDebugMode,
      getToolbarStateSelectorContextValue,
      getSelectionSelectorContextValue,
      getModalStateSelectorContextValue,
      getPmContentSelectorContextValue,
      getInlineAiStateSelectorContextValue
    );
  }
  publishLoaded() {
    return this.publishers.byTopic("ricos.editor.instance.loaded").publish({ msg: "🖖 editor mounted" });
  }
  publishFirstEdit() {
    return this.publishers.byTopic("ricos.editor.functionality.firstEdit").publishOnce({ msg: "📝 first content edit" });
  }
  publishError(error, errorInfo) {
    return this.publishers.byTopic("ricos.editor.instance.error").publish({ error, errorInfo });
  }
  publishContentSaved() {
    return this.publishers.byTopic("ricos.editor.content.saved").publish({ msg: "💾 content saved" });
  }
  get adapter() {
    return this.tiptapAdapter;
  }
}
export {
  RicosEditor
};
//# sourceMappingURL=ricos-editor.js.map
