@zero-library/common 2.0.7 → 2.0.8

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.esm.js CHANGED
@@ -43,6 +43,7 @@ import TiptapLink from '@tiptap/extension-link';
43
43
  import { Plugin, TextSelection, PluginKey } from '@tiptap/pm/state';
44
44
  import { DecorationSet, Decoration } from '@tiptap/pm/view';
45
45
  import { useMergeRefs, FloatingPortal, FloatingFocusManager, useListItem, FloatingDelayGroup, useFloating, offset, flip, shift, autoUpdate, useHover, useFocus, useDismiss, useRole, useInteractions, FloatingList, useClick, useListNavigation, useTypeahead, limitShift } from '@floating-ui/react';
46
+ import TurndownService from 'turndown';
46
47
  import { Node, mergeAttributes, Extension as Extension$1 } from '@tiptap/core';
47
48
 
48
49
  // src/components/File/styles.module.less
@@ -4913,6 +4914,7 @@ var SearchAndReplace = Extension$1.create({
4913
4914
  }
4914
4915
  });
4915
4916
  var searchAndReplace_default = SearchAndReplace;
4917
+ var turndown = new TurndownService();
4916
4918
  var MainToolbarContent = ({
4917
4919
  onHighlighterClick,
4918
4920
  onLinkClick,
@@ -5033,13 +5035,17 @@ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue,
5033
5035
  // })
5034
5036
  ],
5035
5037
  content: "",
5036
- onUpdate: ({ editor: editor2 }) => {
5037
- const markdownOutput = editor2.storage.markdown.getMarkdown();
5038
+ onUpdate: () => {
5039
+ const markdownOutput = getMarkdown();
5038
5040
  if (markdownOutput === lastContentRef.current) return;
5039
5041
  lastContentRef.current = markdownOutput;
5040
5042
  onChange?.(markdownOutput);
5041
5043
  }
5042
5044
  });
5045
+ const getMarkdown = () => {
5046
+ if (!editor) return "";
5047
+ return turndown.turndown(editor.getHTML());
5048
+ };
5043
5049
  const bodyRect = useCursorVisibility({
5044
5050
  editor,
5045
5051
  overlayHeight: toolbarRef.current?.getBoundingClientRect().height ?? 0
@@ -5148,7 +5154,7 @@ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue,
5148
5154
  }
5149
5155
  ) });
5150
5156
  const downloadFile2 = () => {
5151
- onDownloadFile?.(editor.storage.markdown.getMarkdown(), "docx");
5157
+ onDownloadFile?.(getMarkdown(), "docx");
5152
5158
  };
5153
5159
  return /* @__PURE__ */ jsx("div", { className: classNames2("height-full", "editor-parent"), children: /* @__PURE__ */ jsxs(EditorContext.Provider, { value: { editor }, children: [
5154
5160
  showToolbar && /* @__PURE__ */ jsxs(Fragment, { children: [