@zero-library/common 2.3.5 → 2.3.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 +31 -44
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +41 -8
- 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 +32 -45
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.js
CHANGED
|
@@ -2097,7 +2097,7 @@ var PdfImagePreview_default = ({ fileUrl, pageNo, scale = 1, isHasThumbnails = t
|
|
|
2097
2097
|
return index;
|
|
2098
2098
|
}
|
|
2099
2099
|
}
|
|
2100
|
-
return 0;
|
|
2100
|
+
return getCurrentIndex() ?? 0;
|
|
2101
2101
|
};
|
|
2102
2102
|
React.useEffect(() => {
|
|
2103
2103
|
const index = getIndex(pageNo);
|
|
@@ -3330,7 +3330,7 @@ var isSelectionValid = (editor, selection, excludedNodeTypes = ["imageUpload", "
|
|
|
3330
3330
|
const { state } = editor;
|
|
3331
3331
|
const { doc } = state;
|
|
3332
3332
|
const { empty, from, to } = selection;
|
|
3333
|
-
const isEmptyTextBlock = !doc.textBetween(from, to).length && react$1.isTextSelection(selection);
|
|
3333
|
+
const isEmptyTextBlock = !doc.textBetween(from, to).length && !react$1.isTextSelection(selection);
|
|
3334
3334
|
const isCodeBlock = selection.$from.parent.type.spec.code || react$1.isNodeSelection(selection) && selection.node.type.spec.code;
|
|
3335
3335
|
const isExcludedNode = react$1.isNodeSelection(selection) && excludedNodeTypes.includes(selection.node.type.name);
|
|
3336
3336
|
const isTableCell = selection instanceof tables.CellSelection;
|
|
@@ -7501,7 +7501,7 @@ var createHtmlMark = (markName, ATTRS, classNames7) => {
|
|
|
7501
7501
|
return core.Mark.create({
|
|
7502
7502
|
name: markName,
|
|
7503
7503
|
priority: 1e3,
|
|
7504
|
-
//
|
|
7504
|
+
// 高优先级确保摘录不会被其他marks覆盖
|
|
7505
7505
|
excludes: "",
|
|
7506
7506
|
// 允许相同类型 mark 叠加
|
|
7507
7507
|
inclusive: false,
|
|
@@ -7957,7 +7957,7 @@ var collectionSidebar_default = ({
|
|
|
7957
7957
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { children: [
|
|
7958
7958
|
/* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}),
|
|
7959
7959
|
/* @__PURE__ */ jsxRuntime.jsxs("span", { children: [
|
|
7960
|
-
"\
|
|
7960
|
+
"\u6458\u5F55",
|
|
7961
7961
|
collections.length > 0 && `\uFF08${collections.length}\uFF09`
|
|
7962
7962
|
] })
|
|
7963
7963
|
] }),
|
|
@@ -8003,9 +8003,9 @@ var collectionSidebar_default = ({
|
|
|
8003
8003
|
title: "\u63D0\u793A",
|
|
8004
8004
|
okText: "\u786E\u5B9A",
|
|
8005
8005
|
cancelText: "\u53D6\u6D88",
|
|
8006
|
-
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\
|
|
8006
|
+
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6458\u5F55\u5417?",
|
|
8007
8007
|
onConfirm: () => onDeleteCollection(collection[COLLECTION_ATTRS[0]]),
|
|
8008
|
-
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, {}) })
|
|
8009
8009
|
}
|
|
8010
8010
|
) })
|
|
8011
8011
|
] })
|
|
@@ -8014,7 +8014,7 @@ var collectionSidebar_default = ({
|
|
|
8014
8014
|
);
|
|
8015
8015
|
}
|
|
8016
8016
|
}
|
|
8017
|
-
) : /* @__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" })
|
|
8018
8018
|
}
|
|
8019
8019
|
);
|
|
8020
8020
|
const container = collectionConfig?.getContainer?.();
|
|
@@ -8151,7 +8151,7 @@ function useSelect(editor, disabled = false, hideWhenUnavailable = false) {
|
|
|
8151
8151
|
};
|
|
8152
8152
|
}
|
|
8153
8153
|
var SelectButton = React__namespace.default.forwardRef(
|
|
8154
|
-
({ editor: providedEditor,
|
|
8154
|
+
({ editor: providedEditor, disabled = false, hideWhenUnavailable = false, onClick, children, icon, tooltip, ...buttonProps }, ref) => {
|
|
8155
8155
|
const { editor } = useTiptapEditor(providedEditor);
|
|
8156
8156
|
const { isDisabled, shouldShow, getText, getMarkdown } = useSelect(editor, disabled, hideWhenUnavailable);
|
|
8157
8157
|
const handleClick = React__namespace.default.useCallback(
|
|
@@ -8164,23 +8164,7 @@ var SelectButton = React__namespace.default.forwardRef(
|
|
|
8164
8164
|
[onClick, editor, isDisabled, getText, getMarkdown]
|
|
8165
8165
|
);
|
|
8166
8166
|
if (!shouldShow || !editor || !editor.isEditable) return null;
|
|
8167
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
8168
|
-
Button4,
|
|
8169
|
-
{
|
|
8170
|
-
type: "button",
|
|
8171
|
-
className: className.trim(),
|
|
8172
|
-
disabled: isDisabled,
|
|
8173
|
-
"data-style": "ghost",
|
|
8174
|
-
"data-disabled": isDisabled,
|
|
8175
|
-
onClick: handleClick,
|
|
8176
|
-
...buttonProps,
|
|
8177
|
-
ref,
|
|
8178
|
-
children: children || /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
8179
|
-
icon,
|
|
8180
|
-
text && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "tiptap-button-text", children: text })
|
|
8181
|
-
] })
|
|
8182
|
-
}
|
|
8183
|
-
);
|
|
8167
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Tooltip, { placement: "bottom", title: tooltip, arrow: false, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "orange", variant: "text", size: "small", icon, onClick: handleClick, disabled: isDisabled, ...buttonProps, ref, children }) });
|
|
8184
8168
|
}
|
|
8185
8169
|
);
|
|
8186
8170
|
SelectButton.displayName = "SelectButton";
|
|
@@ -8387,14 +8371,14 @@ var SearchAndReplace = core.Extension.create({
|
|
|
8387
8371
|
}
|
|
8388
8372
|
});
|
|
8389
8373
|
var searchAndReplace_default = SearchAndReplace;
|
|
8390
|
-
var QuoteIcon = React__namespace.memo(({
|
|
8391
|
-
return /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "
|
|
8374
|
+
var QuoteIcon = React__namespace.memo(({ ...props }) => {
|
|
8375
|
+
return /* @__PURE__ */ jsxRuntime.jsx("span", { className: "anticon", children: /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "1em", height: "1em", viewBox: "0 0 1024 1024", fill: "currentColor", xmlns: "http://www.w3.org/2000/svg", ...props, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8392
8376
|
"path",
|
|
8393
8377
|
{
|
|
8394
8378
|
d: "M130.16 789.92V500.25q-1.85-62.51 18-117.41T204 286.23a308 308 0 0 1 86.13-69.1A304.32 304.32 0 0 1 386.26 184 11 11 0 0 1 399 194.86v104.52a11 11 0 0 1-7.21 10.29q-66.13 24.5-91.25 70.31-24.41 44.36-26.32 107a11 11 0 0 0 11 11.3h102.84a11 11 0 0 1 11 11V779a11 11 0 0 1-11 11h-257.9z m403.3 0V500.25q-2-62.51 17.95-117.41t55.85-96.61q35.94-41.6 86.13-69.1A304.7 304.7 0 0 1 789.56 184a11 11 0 0 1 12.76 10.82v104.56a11 11 0 0 1-7.21 10.29Q729 334.18 703.86 380q-24.41 44.36-26.32 107a11 11 0 0 0 11 11.3h102.82a11 11 0 0 1 11 11V779a11 11 0 0 1-11 11H533.45z m0 0",
|
|
8395
8379
|
fill: "currentColor"
|
|
8396
8380
|
}
|
|
8397
|
-
) });
|
|
8381
|
+
) }) });
|
|
8398
8382
|
});
|
|
8399
8383
|
QuoteIcon.displayName = "QuoteIcon";
|
|
8400
8384
|
var MainToolbarContent = ({
|
|
@@ -8415,9 +8399,9 @@ var MainToolbarContent = ({
|
|
|
8415
8399
|
] }),
|
|
8416
8400
|
/* @__PURE__ */ jsxRuntime.jsx(ToolbarSeparator, {})
|
|
8417
8401
|
] }),
|
|
8418
|
-
onQuote && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(QuoteIcon, {
|
|
8402
|
+
onQuote && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(QuoteIcon, {}), tooltip: "\u5F15\u7528\u9009\u4E2D\u6587\u672C", onClick: onQuote }) }),
|
|
8419
8403
|
onCreateAnnotation && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.MessageOutlined, {}), tooltip: "\u6279\u6CE8", onClick: onCreateAnnotation }) }),
|
|
8420
|
-
onCreateCollection && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}), tooltip: "\
|
|
8404
|
+
onCreateCollection && /* @__PURE__ */ jsxRuntime.jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxRuntime.jsx(SelectButton, { icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}), tooltip: "\u6458\u5F55\u7B14\u8BB0", onClick: onCreateCollection }) }),
|
|
8421
8405
|
/* @__PURE__ */ jsxRuntime.jsxs(ToolbarGroup, { children: [
|
|
8422
8406
|
/* @__PURE__ */ jsxRuntime.jsx(HeadingDropdownMenu, { levels: [1, 2, 3, 4], portal: isMobile }),
|
|
8423
8407
|
/* @__PURE__ */ jsxRuntime.jsx(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"], portal: isMobile }),
|
|
@@ -8585,7 +8569,7 @@ var MarkdownEditor_default = ({
|
|
|
8585
8569
|
}
|
|
8586
8570
|
})
|
|
8587
8571
|
] : [],
|
|
8588
|
-
//
|
|
8572
|
+
// 摘录功能扩展
|
|
8589
8573
|
...collectionConfig?.enabled ? [
|
|
8590
8574
|
CollectionMark,
|
|
8591
8575
|
CollectionPlugin.configure({
|
|
@@ -8607,6 +8591,7 @@ var MarkdownEditor_default = ({
|
|
|
8607
8591
|
});
|
|
8608
8592
|
const getMarkdown = () => {
|
|
8609
8593
|
if (!editor) return "";
|
|
8594
|
+
if (editor.isEmpty) return "";
|
|
8610
8595
|
return editor.getMarkdown();
|
|
8611
8596
|
};
|
|
8612
8597
|
React.useEffect(() => {
|
|
@@ -8669,28 +8654,30 @@ var MarkdownEditor_default = ({
|
|
|
8669
8654
|
NsToolBar({ isBubble: false }),
|
|
8670
8655
|
/* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, align: "center", className: classNames2__default.default(styles_module_default4.extraToolbar), children: [
|
|
8671
8656
|
annotationConfig?.enabled && annotationConfig?.showList !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8672
|
-
antd.
|
|
8657
|
+
antd.Button,
|
|
8673
8658
|
{
|
|
8659
|
+
size: "small",
|
|
8674
8660
|
title: "\u6279\u6CE8\u5217\u8868",
|
|
8675
|
-
|
|
8676
|
-
color: "
|
|
8677
|
-
|
|
8678
|
-
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8679
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(Icon.MessageOutlined, {})
|
|
8661
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.MessageOutlined, {}),
|
|
8662
|
+
color: "primary",
|
|
8663
|
+
variant: "text",
|
|
8664
|
+
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8680
8665
|
}
|
|
8681
8666
|
),
|
|
8682
8667
|
collectionConfig?.enabled && collectionConfig?.showList !== false && /* @__PURE__ */ jsxRuntime.jsx(
|
|
8683
|
-
antd.
|
|
8668
|
+
antd.Button,
|
|
8684
8669
|
{
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8670
|
+
style: { gap: "2px" },
|
|
8671
|
+
size: "small",
|
|
8672
|
+
title: "\u6458\u5F55\u5217\u8868",
|
|
8673
|
+
icon: /* @__PURE__ */ jsxRuntime.jsx(Icon.BookOutlined, {}),
|
|
8674
|
+
color: "primary",
|
|
8675
|
+
variant: "text",
|
|
8689
8676
|
onClick: () => setShowCollection(!showCollection),
|
|
8690
|
-
children:
|
|
8677
|
+
children: "\u6458\u5F55"
|
|
8691
8678
|
}
|
|
8692
8679
|
),
|
|
8693
|
-
onDownloadFile && /* @__PURE__ */ jsxRuntime.jsx(antd.
|
|
8680
|
+
onDownloadFile && /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
|
|
8694
8681
|
extraNav
|
|
8695
8682
|
] })
|
|
8696
8683
|
] }),
|