@zero-library/common 2.0.5 → 2.0.7

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
@@ -263,7 +263,7 @@ function alertInlinePlugin(md2) {
263
263
  if (!m) return false;
264
264
  if (silent) return false;
265
265
  const raw = m[1].trim();
266
- const html = `<lazy-component ${raw} />`;
266
+ const html = `<lazy-component ${raw}></lazy-component>`;
267
267
  const token = state.push("html_inline", "", 0);
268
268
  token.content = html;
269
269
  state.pos += m[0].length;
@@ -701,6 +701,7 @@ var downloadFile = (url, name) => {
701
701
  document.body.appendChild(a);
702
702
  a.click();
703
703
  document.body.removeChild(a);
704
+ window.URL.revokeObjectURL(url);
704
705
  };
705
706
  var addUrlLastSlash = (url = "") => {
706
707
  const u = new URL(url, "https://logosdata.cn");
@@ -1018,6 +1019,9 @@ axios__default.default.interceptors.request.use(
1018
1019
  );
1019
1020
  axios__default.default.interceptors.response.use(
1020
1021
  function(response) {
1022
+ if (isBlob(response.data)) {
1023
+ return response;
1024
+ }
1021
1025
  if (response.data?.code !== OK && response.data?.code !== OK2) {
1022
1026
  const isPermission = response.data?.code === PERMISSION_DENIED;
1023
1027
  if (response.config?.showError !== false) {
@@ -5006,7 +5010,7 @@ var MobileToolbarContent = ({ type, onBack }) => /* @__PURE__ */ jsxRuntime.jsxs
5006
5010
  /* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {}),
5007
5011
  type === "highlighter" ? /* @__PURE__ */ jsxRuntime.jsx(HighlightContent, {}) : /* @__PURE__ */ jsxRuntime.jsx(LinkContent, {})
5008
5012
  ] });
5009
- var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue, disabled, extraNav, showToolbar = true, onQuote }) => {
5013
+ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue, disabled, extraNav, showToolbar = true, onQuote, onDownloadFile }) => {
5010
5014
  const isMobile = useMobile();
5011
5015
  const windowSize = useWindowSize();
5012
5016
  const lastContentRef = React16.useRef("");
@@ -5181,11 +5185,17 @@ var MarkdownEditor_default = ({ value = "", onChange, onScrollPage, searchValue,
5181
5185
  ) : /* @__PURE__ */ jsxRuntime.jsx(MobileToolbarContent, { type: mobileView === "highlighter" ? "highlighter" : "link", onBack: () => setMobileView("main") })
5182
5186
  }
5183
5187
  ) });
5188
+ const downloadFile2 = () => {
5189
+ onDownloadFile?.(editor.storage.markdown.getMarkdown(), "docx");
5190
+ };
5184
5191
  return /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames2__default.default("height-full", "editor-parent"), children: /* @__PURE__ */ jsxRuntime.jsxs(react.EditorContext.Provider, { value: { editor }, children: [
5185
5192
  showToolbar && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5186
5193
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "end", align: "center", children: [
5187
5194
  NsToolBar({ isBubble: false }),
5188
- extraNav && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "m-l-16 m-r-16", children: extraNav })
5195
+ extraNav && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { align: "center", className: "m-l-16 m-r-16", children: [
5196
+ onDownloadFile && /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
5197
+ extraNav
5198
+ ] })
5189
5199
  ] }),
5190
5200
  !isMobile && /* @__PURE__ */ jsxRuntime.jsx(react.BubbleMenu, { editor, children: NsToolBar({ isBubble: true }) })
5191
5201
  ] }),