@zero-library/common 2.3.4 → 2.3.6
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 +33 -27
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +35 -4
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +8 -8
- package/dist/index.d.ts +8 -8
- package/dist/index.esm.js +34 -28
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -1383,14 +1383,17 @@ var styles_module_default2 = {
|
|
|
1383
1383
|
var baseComponentMap = {
|
|
1384
1384
|
// renderMarkdown: () => import('@/components/RenderMarkdown')
|
|
1385
1385
|
};
|
|
1386
|
+
var lazyCache = /* @__PURE__ */ new Map();
|
|
1386
1387
|
var LazyComponent_default = ({ type, customComponents, unknownContent, ...rest }) => {
|
|
1387
|
-
const
|
|
1388
|
-
return { ...baseComponentMap, ...customComponents };
|
|
1389
|
-
}, [customComponents]);
|
|
1388
|
+
const loader = customComponents?.[type] || baseComponentMap[type];
|
|
1390
1389
|
const LazyComponent = React.useMemo(() => {
|
|
1391
|
-
|
|
1392
|
-
|
|
1393
|
-
|
|
1390
|
+
if (!loader) return null;
|
|
1391
|
+
const cached = lazyCache.get(type);
|
|
1392
|
+
if (cached) return cached;
|
|
1393
|
+
const component = React.lazy(loader);
|
|
1394
|
+
lazyCache.set(type, component);
|
|
1395
|
+
return component;
|
|
1396
|
+
}, [loader]);
|
|
1394
1397
|
if (!LazyComponent) return unknownContent || /* @__PURE__ */ jsxRuntime.jsx(antd.Alert, { message: `\u672A\u77E5\u7C7B\u578B\uFF1A${type}`, type: "warning" });
|
|
1395
1398
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1396
1399
|
React.Suspense,
|
|
@@ -3327,7 +3330,7 @@ var isSelectionValid = (editor, selection, excludedNodeTypes = ["imageUpload", "
|
|
|
3327
3330
|
const { state } = editor;
|
|
3328
3331
|
const { doc } = state;
|
|
3329
3332
|
const { empty, from, to } = selection;
|
|
3330
|
-
const isEmptyTextBlock = !doc.textBetween(from, to).length && react$1.isTextSelection(selection);
|
|
3333
|
+
const isEmptyTextBlock = !doc.textBetween(from, to).length && !react$1.isTextSelection(selection);
|
|
3331
3334
|
const isCodeBlock = selection.$from.parent.type.spec.code || react$1.isNodeSelection(selection) && selection.node.type.spec.code;
|
|
3332
3335
|
const isExcludedNode = react$1.isNodeSelection(selection) && excludedNodeTypes.includes(selection.node.type.name);
|
|
3333
3336
|
const isTableCell = selection instanceof tables.CellSelection;
|
|
@@ -7498,7 +7501,7 @@ var createHtmlMark = (markName, ATTRS, classNames7) => {
|
|
|
7498
7501
|
return core.Mark.create({
|
|
7499
7502
|
name: markName,
|
|
7500
7503
|
priority: 1e3,
|
|
7501
|
-
//
|
|
7504
|
+
// 高优先级确保摘录不会被其他marks覆盖
|
|
7502
7505
|
excludes: "",
|
|
7503
7506
|
// 允许相同类型 mark 叠加
|
|
7504
7507
|
inclusive: false,
|
|
@@ -7954,7 +7957,7 @@ var collectionSidebar_default = ({
|
|
|
7954
7957
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
7955
7958
|
/* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}),
|
|
7956
7959
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
7957
|
-
"\
|
|
7960
|
+
"\u6458\u5F55",
|
|
7958
7961
|
collections.length > 0 && `\uFF08${collections.length}\uFF09`
|
|
7959
7962
|
] })
|
|
7960
7963
|
] }),
|
|
@@ -8000,9 +8003,9 @@ var collectionSidebar_default = ({
|
|
|
8000
8003
|
title: "\u63D0\u793A",
|
|
8001
8004
|
okText: "\u786E\u5B9A",
|
|
8002
8005
|
cancelText: "\u53D6\u6D88",
|
|
8003
|
-
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\
|
|
8006
|
+
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6458\u5F55\u5417?",
|
|
8004
8007
|
onConfirm: () => onDeleteCollection(collection[COLLECTION_ATTRS[0]]),
|
|
8005
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", title: "\u5220\u9664\
|
|
8008
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "small", title: "\u5220\u9664\u6458\u5F55", icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.DeleteOutlined, {}) })
|
|
8006
8009
|
}
|
|
8007
8010
|
) })
|
|
8008
8011
|
] })
|
|
@@ -8011,7 +8014,7 @@ var collectionSidebar_default = ({
|
|
|
8011
8014
|
);
|
|
8012
8015
|
}
|
|
8013
8016
|
}
|
|
8014
|
-
) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { className: "m-t-24", description: "\u6682\u65E0\
|
|
8017
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { className: "m-t-24", description: "\u6682\u65E0\u6458\u5F55" })
|
|
8015
8018
|
}
|
|
8016
8019
|
);
|
|
8017
8020
|
const container = collectionConfig?.getContainer?.();
|
|
@@ -8414,7 +8417,7 @@ var MainToolbarContent = ({
|
|
|
8414
8417
|
] }),
|
|
8415
8418
|
onQuote && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(QuoteIcon, { className: "tiptap-button-icon" }), tooltip: "\u5F15\u7528\u9009\u4E2D\u6587\u672C", onClick: onQuote }) }),
|
|
8416
8419
|
onCreateAnnotation && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.MessageOutlined, {}), tooltip: "\u6279\u6CE8", onClick: onCreateAnnotation }) }),
|
|
8417
|
-
onCreateCollection && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}), tooltip: "\
|
|
8420
|
+
onCreateCollection && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}), tooltip: "\u6458\u5F55\u7B14\u8BB0", onClick: onCreateCollection }) }),
|
|
8418
8421
|
/* @__PURE__ */ jsxRuntime.jsxs(ToolbarGroup, { children: [
|
|
8419
8422
|
/* @__PURE__ */ jsxRuntime.jsx(HeadingDropdownMenu, { levels: [1, 2, 3, 4], portal: isMobile }),
|
|
8420
8423
|
/* @__PURE__ */ jsxRuntime.jsx(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"], portal: isMobile }),
|
|
@@ -8582,7 +8585,7 @@ var MarkdownEditor_default = ({
|
|
|
8582
8585
|
}
|
|
8583
8586
|
})
|
|
8584
8587
|
] : [],
|
|
8585
|
-
//
|
|
8588
|
+
// 摘录功能扩展
|
|
8586
8589
|
...collectionConfig?.enabled ? [
|
|
8587
8590
|
CollectionMark,
|
|
8588
8591
|
CollectionPlugin.configure({
|
|
@@ -8604,6 +8607,7 @@ var MarkdownEditor_default = ({
|
|
|
8604
8607
|
});
|
|
8605
8608
|
const getMarkdown = () => {
|
|
8606
8609
|
if (!editor) return "";
|
|
8610
|
+
if (editor.isEmpty) return "";
|
|
8607
8611
|
return editor.getMarkdown();
|
|
8608
8612
|
};
|
|
8609
8613
|
React.useEffect(() => {
|
|
@@ -8666,28 +8670,30 @@ var MarkdownEditor_default = ({
|
|
|
8666
8670
|
NsToolBar({ isBubble: false }),
|
|
8667
8671
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", className: classNames2__default.default(styles_module_default4.extraToolbar), children: [
|
|
8668
8672
|
annotationConfig?.enabled && annotationConfig?.showList !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8669
|
-
antd.
|
|
8673
|
+
antd.Button,
|
|
8670
8674
|
{
|
|
8675
|
+
size: "small",
|
|
8671
8676
|
title: "\u6279\u6CE8\u5217\u8868",
|
|
8672
|
-
|
|
8673
|
-
color: "
|
|
8674
|
-
|
|
8675
|
-
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8676
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icon.MessageOutlined, {})
|
|
8677
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.MessageOutlined, {}),
|
|
8678
|
+
color: "primary",
|
|
8679
|
+
variant: "text",
|
|
8680
|
+
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8677
8681
|
}
|
|
8678
8682
|
),
|
|
8679
8683
|
collectionConfig?.enabled && collectionConfig?.showList !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8680
|
-
antd.
|
|
8684
|
+
antd.Button,
|
|
8681
8685
|
{
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
+
style: { gap: "2px" },
|
|
8687
|
+
size: "small",
|
|
8688
|
+
title: "\u6458\u5F55\u5217\u8868",
|
|
8689
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}),
|
|
8690
|
+
color: "primary",
|
|
8691
|
+
variant: "text",
|
|
8686
8692
|
onClick: () => setShowCollection(!showCollection),
|
|
8687
|
-
children:
|
|
8693
|
+
children: "\u6458\u5F55"
|
|
8688
8694
|
}
|
|
8689
8695
|
),
|
|
8690
|
-
onDownloadFile && /* @__PURE__ */ jsxRuntime.jsx(antd.
|
|
8696
|
+
onDownloadFile && /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
|
|
8691
8697
|
extraNav
|
|
8692
8698
|
] })
|
|
8693
8699
|
] }),
|