@firecms/editor 3.0.0-canary.187 → 3.0.0-canary.189

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/editor.d.ts CHANGED
@@ -16,9 +16,10 @@ export type FireCMSEditorProps = {
16
16
  };
17
17
  aiController?: EditorAIController;
18
18
  customComponents?: CustomEditorComponent[];
19
+ disabled?: boolean;
19
20
  };
20
21
  export type CustomEditorComponent = {
21
22
  name: string;
22
23
  component: React.FC;
23
24
  };
24
- export declare const FireCMSEditor: ({ content, onJsonContentChange, onHtmlContentChange, onMarkdownContentChange, version, textSize, highlight, handleImageUpload, aiController, }: FireCMSEditorProps) => import("react/jsx-runtime").JSX.Element;
25
+ export declare const FireCMSEditor: ({ content, onJsonContentChange, onHtmlContentChange, onMarkdownContentChange, version, textSize, highlight, handleImageUpload, aiController, disabled }: FireCMSEditorProps) => import("react/jsx-runtime").JSX.Element;
package/dist/index.es.js CHANGED
@@ -1825,7 +1825,8 @@ const FireCMSEditor = ({
1825
1825
  textSize = "base",
1826
1826
  highlight,
1827
1827
  handleImageUpload,
1828
- aiController
1828
+ aiController,
1829
+ disabled
1829
1830
  }) => {
1830
1831
  const ref = React.useRef(null);
1831
1832
  const editorRef = React.useRef(null);
@@ -1841,6 +1842,9 @@ const FireCMSEditor = ({
1841
1842
  editorRef.current?.commands.setContent(content ?? "");
1842
1843
  }
1843
1844
  }, [version]);
1845
+ useEffect(() => {
1846
+ editorRef?.current?.setEditable(!disabled);
1847
+ }, [disabled]);
1844
1848
  useEffect(() => {
1845
1849
  if (version === void 0) return;
1846
1850
  if (editorRef.current && version > 0) {
@@ -1914,6 +1918,7 @@ const FireCMSEditor = ({
1914
1918
  })
1915
1919
  ], []);
1916
1920
  return /* @__PURE__ */ jsx("div", { ref, className: "relative min-h-[300px] w-full", children: /* @__PURE__ */ jsx(EditorProvider, { content: content ?? "", extensions, editorProps: {
1921
+ editable: () => !disabled,
1917
1922
  attributes: {
1918
1923
  class: cls(proseClass, "prose-headings:font-title font-default focus:outline-none max-w-full p-12")
1919
1924
  }
@@ -1921,6 +1926,7 @@ const FireCMSEditor = ({
1921
1926
  editor: editor_0
1922
1927
  }) => {
1923
1928
  editorRef.current = editor_0;
1929
+ editor_0.setEditable(!disabled);
1924
1930
  }, onUpdate: ({
1925
1931
  editor: editor_1
1926
1932
  }) => {