@zero-library/common 2.0.7 → 2.0.9

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/index.cjs.js CHANGED
@@ -5071,13 +5071,17 @@ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue,
5071
5071
  // })
5072
5072
  ],
5073
5073
  content: "",
5074
- onUpdate: ({ editor: editor2 }) => {
5075
- const markdownOutput = editor2.storage.markdown.getMarkdown();
5074
+ onUpdate: () => {
5075
+ const markdownOutput = getMarkdown();
5076
5076
  if (markdownOutput === lastContentRef.current) return;
5077
5077
  lastContentRef.current = markdownOutput;
5078
5078
  onChange?.(markdownOutput);
5079
5079
  }
5080
5080
  });
5081
+ const getMarkdown = () => {
5082
+ if (!editor) return "";
5083
+ return editor.storage.markdown.getMarkdown();
5084
+ };
5081
5085
  const bodyRect = useCursorVisibility({
5082
5086
  editor,
5083
5087
  overlayHeight: toolbarRef.current?.getBoundingClientRect().height ?? 0
@@ -5186,7 +5190,7 @@ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue,
5186
5190
  }
5187
5191
  ) });
5188
5192
  const downloadFile2 = () => {
5189
- onDownloadFile?.(editor.storage.markdown.getMarkdown(), "docx");
5193
+ onDownloadFile?.(getMarkdown(), "docx");
5190
5194
  };
5191
5195
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default("height-full", "editor-parent"), children: /* @__PURE__ */ jsxRuntime.jsxs(react.EditorContext.Provider, { value: { editor }, children: [
5192
5196
  showToolbar && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [