@zero-library/common 2.3.5 → 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 +24 -21
- 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 +25 -22
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -293,7 +293,7 @@ type CollectionType = {
|
|
|
293
293
|
[key in (typeof COLLECTION_ATTRS)[number]]: string;
|
|
294
294
|
};
|
|
295
295
|
/**
|
|
296
|
-
*
|
|
296
|
+
* 摘录功能配置
|
|
297
297
|
*/
|
|
298
298
|
interface CollectionsProps {
|
|
299
299
|
/** 是否启用批注功能,默认为false */
|
|
@@ -303,23 +303,23 @@ interface CollectionsProps {
|
|
|
303
303
|
id: string;
|
|
304
304
|
name: string;
|
|
305
305
|
};
|
|
306
|
-
/**
|
|
306
|
+
/** 是否显示摘录列表,默认为true */
|
|
307
307
|
showList?: boolean;
|
|
308
308
|
/** 受控属性:批注列表是否可见 */
|
|
309
309
|
visible?: boolean;
|
|
310
310
|
/** 受控属性:批注列表可见性改变回调 */
|
|
311
311
|
onVisibleChange?: (visible: boolean) => void;
|
|
312
312
|
/**
|
|
313
|
-
*
|
|
314
|
-
* @param data
|
|
315
|
-
* @returns
|
|
313
|
+
* 创建摘录的回调
|
|
314
|
+
* @param data 摘录数据
|
|
315
|
+
* @returns 返回摘录ID(如果有),返回Promise
|
|
316
316
|
*/
|
|
317
317
|
onBeforeCreate?: (data: {
|
|
318
318
|
content: string;
|
|
319
319
|
pageNo?: number;
|
|
320
320
|
}) => Promise<string>;
|
|
321
321
|
/**
|
|
322
|
-
*
|
|
322
|
+
* 自定义渲染摘录列表项
|
|
323
323
|
* @param props 列表项数据及操作
|
|
324
324
|
* @returns React节点
|
|
325
325
|
*/
|
|
@@ -331,7 +331,7 @@ interface CollectionsProps {
|
|
|
331
331
|
}) => React.ReactNode;
|
|
332
332
|
}
|
|
333
333
|
/**
|
|
334
|
-
*
|
|
334
|
+
* 摘录功能配置接口
|
|
335
335
|
*/
|
|
336
336
|
interface CollectionConfig extends CollectionsProps {
|
|
337
337
|
getContainer?: () => HTMLElement | null;
|
|
@@ -359,7 +359,7 @@ interface MarkdownEditorProps {
|
|
|
359
359
|
onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
|
|
360
360
|
/** 批注功能配置对象 */
|
|
361
361
|
annotationConfig?: AnnotationConfig;
|
|
362
|
-
/**
|
|
362
|
+
/** 摘录功能专属配置,不与批注混淆 */
|
|
363
363
|
collectionConfig?: CollectionConfig;
|
|
364
364
|
pageNoConfig?: {
|
|
365
365
|
/** 是否启用分页功能,默认为false */
|
package/dist/index.d.ts
CHANGED
|
@@ -293,7 +293,7 @@ type CollectionType = {
|
|
|
293
293
|
[key in (typeof COLLECTION_ATTRS)[number]]: string;
|
|
294
294
|
};
|
|
295
295
|
/**
|
|
296
|
-
*
|
|
296
|
+
* 摘录功能配置
|
|
297
297
|
*/
|
|
298
298
|
interface CollectionsProps {
|
|
299
299
|
/** 是否启用批注功能,默认为false */
|
|
@@ -303,23 +303,23 @@ interface CollectionsProps {
|
|
|
303
303
|
id: string;
|
|
304
304
|
name: string;
|
|
305
305
|
};
|
|
306
|
-
/**
|
|
306
|
+
/** 是否显示摘录列表,默认为true */
|
|
307
307
|
showList?: boolean;
|
|
308
308
|
/** 受控属性:批注列表是否可见 */
|
|
309
309
|
visible?: boolean;
|
|
310
310
|
/** 受控属性:批注列表可见性改变回调 */
|
|
311
311
|
onVisibleChange?: (visible: boolean) => void;
|
|
312
312
|
/**
|
|
313
|
-
*
|
|
314
|
-
* @param data
|
|
315
|
-
* @returns
|
|
313
|
+
* 创建摘录的回调
|
|
314
|
+
* @param data 摘录数据
|
|
315
|
+
* @returns 返回摘录ID(如果有),返回Promise
|
|
316
316
|
*/
|
|
317
317
|
onBeforeCreate?: (data: {
|
|
318
318
|
content: string;
|
|
319
319
|
pageNo?: number;
|
|
320
320
|
}) => Promise<string>;
|
|
321
321
|
/**
|
|
322
|
-
*
|
|
322
|
+
* 自定义渲染摘录列表项
|
|
323
323
|
* @param props 列表项数据及操作
|
|
324
324
|
* @returns React节点
|
|
325
325
|
*/
|
|
@@ -331,7 +331,7 @@ interface CollectionsProps {
|
|
|
331
331
|
}) => React.ReactNode;
|
|
332
332
|
}
|
|
333
333
|
/**
|
|
334
|
-
*
|
|
334
|
+
* 摘录功能配置接口
|
|
335
335
|
*/
|
|
336
336
|
interface CollectionConfig extends CollectionsProps {
|
|
337
337
|
getContainer?: () => HTMLElement | null;
|
|
@@ -359,7 +359,7 @@ interface MarkdownEditorProps {
|
|
|
359
359
|
onDownloadFile?: (fileContent: string, targetFormat?: string) => Promise<void>;
|
|
360
360
|
/** 批注功能配置对象 */
|
|
361
361
|
annotationConfig?: AnnotationConfig;
|
|
362
|
-
/**
|
|
362
|
+
/** 摘录功能专属配置,不与批注混淆 */
|
|
363
363
|
collectionConfig?: CollectionConfig;
|
|
364
364
|
pageNoConfig?: {
|
|
365
365
|
/** 是否启用分页功能,默认为false */
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import Icon, { MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, MessageOutlined, BookOutlined, AudioMutedOutlined, AudioOutlined, EditOutlined, DeleteOutlined, CloseOutlined } from '@ant-design/icons';
|
|
3
|
-
import { Spin, Input, Typography, message, Flex, Button, Alert, Skeleton, Result, Splitter, Empty, Image, Drawer,
|
|
3
|
+
import { Spin, Input, Typography, message, Flex, Button, Alert, Skeleton, Result, Splitter, Empty, Image, Drawer, Avatar, notification, Modal, Form, Card as Card$1, List, Space, Popconfirm } from 'antd';
|
|
4
4
|
import classNames2 from 'classnames';
|
|
5
5
|
import { renderAsync } from 'docx-preview';
|
|
6
6
|
import * as React from 'react';
|
|
@@ -3287,7 +3287,7 @@ var isSelectionValid = (editor, selection, excludedNodeTypes = ["imageUpload", "
|
|
|
3287
3287
|
const { state } = editor;
|
|
3288
3288
|
const { doc } = state;
|
|
3289
3289
|
const { empty, from, to } = selection;
|
|
3290
|
-
const isEmptyTextBlock = !doc.textBetween(from, to).length && isTextSelection(selection);
|
|
3290
|
+
const isEmptyTextBlock = !doc.textBetween(from, to).length && !isTextSelection(selection);
|
|
3291
3291
|
const isCodeBlock = selection.$from.parent.type.spec.code || isNodeSelection(selection) && selection.node.type.spec.code;
|
|
3292
3292
|
const isExcludedNode = isNodeSelection(selection) && excludedNodeTypes.includes(selection.node.type.name);
|
|
3293
3293
|
const isTableCell = selection instanceof CellSelection;
|
|
@@ -7458,7 +7458,7 @@ var createHtmlMark = (markName, ATTRS, classNames7) => {
|
|
|
7458
7458
|
return Mark.create({
|
|
7459
7459
|
name: markName,
|
|
7460
7460
|
priority: 1e3,
|
|
7461
|
-
//
|
|
7461
|
+
// 高优先级确保摘录不会被其他marks覆盖
|
|
7462
7462
|
excludes: "",
|
|
7463
7463
|
// 允许相同类型 mark 叠加
|
|
7464
7464
|
inclusive: false,
|
|
@@ -7914,7 +7914,7 @@ var collectionSidebar_default = ({
|
|
|
7914
7914
|
/* @__PURE__ */ jsxs(Space, { children: [
|
|
7915
7915
|
/* @__PURE__ */ jsx(BookOutlined, {}),
|
|
7916
7916
|
/* @__PURE__ */ jsxs("span", { children: [
|
|
7917
|
-
"\
|
|
7917
|
+
"\u6458\u5F55",
|
|
7918
7918
|
collections.length > 0 && `\uFF08${collections.length}\uFF09`
|
|
7919
7919
|
] })
|
|
7920
7920
|
] }),
|
|
@@ -7960,9 +7960,9 @@ var collectionSidebar_default = ({
|
|
|
7960
7960
|
title: "\u63D0\u793A",
|
|
7961
7961
|
okText: "\u786E\u5B9A",
|
|
7962
7962
|
cancelText: "\u53D6\u6D88",
|
|
7963
|
-
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\
|
|
7963
|
+
description: "\u786E\u8BA4\u5220\u9664\u5F53\u524D\u6458\u5F55\u5417?",
|
|
7964
7964
|
onConfirm: () => onDeleteCollection(collection[COLLECTION_ATTRS[0]]),
|
|
7965
|
-
children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", title: "\u5220\u9664\
|
|
7965
|
+
children: /* @__PURE__ */ jsx(Button, { type: "text", size: "small", title: "\u5220\u9664\u6458\u5F55", icon: /* @__PURE__ */ jsx(DeleteOutlined, {}) })
|
|
7966
7966
|
}
|
|
7967
7967
|
) })
|
|
7968
7968
|
] })
|
|
@@ -7971,7 +7971,7 @@ var collectionSidebar_default = ({
|
|
|
7971
7971
|
);
|
|
7972
7972
|
}
|
|
7973
7973
|
}
|
|
7974
|
-
) : /* @__PURE__ */ jsx(Empty, { className: "m-t-24", description: "\u6682\u65E0\
|
|
7974
|
+
) : /* @__PURE__ */ jsx(Empty, { className: "m-t-24", description: "\u6682\u65E0\u6458\u5F55" })
|
|
7975
7975
|
}
|
|
7976
7976
|
);
|
|
7977
7977
|
const container = collectionConfig?.getContainer?.();
|
|
@@ -8374,7 +8374,7 @@ var MainToolbarContent = ({
|
|
|
8374
8374
|
] }),
|
|
8375
8375
|
onQuote && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(QuoteIcon, { className: "tiptap-button-icon" }), tooltip: "\u5F15\u7528\u9009\u4E2D\u6587\u672C", onClick: onQuote }) }),
|
|
8376
8376
|
onCreateAnnotation && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(MessageOutlined, {}), tooltip: "\u6279\u6CE8", onClick: onCreateAnnotation }) }),
|
|
8377
|
-
onCreateCollection && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(BookOutlined, {}), tooltip: "\
|
|
8377
|
+
onCreateCollection && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsx(SelectButton, { icon: /* @__PURE__ */ jsx(BookOutlined, {}), tooltip: "\u6458\u5F55\u7B14\u8BB0", onClick: onCreateCollection }) }),
|
|
8378
8378
|
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
8379
8379
|
/* @__PURE__ */ jsx(HeadingDropdownMenu, { levels: [1, 2, 3, 4], portal: isMobile }),
|
|
8380
8380
|
/* @__PURE__ */ jsx(ListDropdownMenu, { types: ["bulletList", "orderedList", "taskList"], portal: isMobile }),
|
|
@@ -8542,7 +8542,7 @@ var MarkdownEditor_default = ({
|
|
|
8542
8542
|
}
|
|
8543
8543
|
})
|
|
8544
8544
|
] : [],
|
|
8545
|
-
//
|
|
8545
|
+
// 摘录功能扩展
|
|
8546
8546
|
...collectionConfig?.enabled ? [
|
|
8547
8547
|
CollectionMark,
|
|
8548
8548
|
CollectionPlugin.configure({
|
|
@@ -8564,6 +8564,7 @@ var MarkdownEditor_default = ({
|
|
|
8564
8564
|
});
|
|
8565
8565
|
const getMarkdown = () => {
|
|
8566
8566
|
if (!editor) return "";
|
|
8567
|
+
if (editor.isEmpty) return "";
|
|
8567
8568
|
return editor.getMarkdown();
|
|
8568
8569
|
};
|
|
8569
8570
|
useEffect(() => {
|
|
@@ -8626,28 +8627,30 @@ var MarkdownEditor_default = ({
|
|
|
8626
8627
|
NsToolBar({ isBubble: false }),
|
|
8627
8628
|
/* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default4.extraToolbar), children: [
|
|
8628
8629
|
annotationConfig?.enabled && annotationConfig?.showList !== false && /* @__PURE__ */ jsx(
|
|
8629
|
-
|
|
8630
|
+
Button,
|
|
8630
8631
|
{
|
|
8632
|
+
size: "small",
|
|
8631
8633
|
title: "\u6279\u6CE8\u5217\u8868",
|
|
8632
|
-
|
|
8633
|
-
color: "
|
|
8634
|
-
|
|
8635
|
-
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8636
|
-
children: /* @__PURE__ */ jsx(MessageOutlined, {})
|
|
8634
|
+
icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
8635
|
+
color: "primary",
|
|
8636
|
+
variant: "text",
|
|
8637
|
+
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8637
8638
|
}
|
|
8638
8639
|
),
|
|
8639
8640
|
collectionConfig?.enabled && collectionConfig?.showList !== false && /* @__PURE__ */ jsx(
|
|
8640
|
-
|
|
8641
|
+
Button,
|
|
8641
8642
|
{
|
|
8642
|
-
|
|
8643
|
-
|
|
8644
|
-
|
|
8645
|
-
|
|
8643
|
+
style: { gap: "2px" },
|
|
8644
|
+
size: "small",
|
|
8645
|
+
title: "\u6458\u5F55\u5217\u8868",
|
|
8646
|
+
icon: /* @__PURE__ */ jsx(BookOutlined, {}),
|
|
8647
|
+
color: "primary",
|
|
8648
|
+
variant: "text",
|
|
8646
8649
|
onClick: () => setShowCollection(!showCollection),
|
|
8647
|
-
children:
|
|
8650
|
+
children: "\u6458\u5F55"
|
|
8648
8651
|
}
|
|
8649
8652
|
),
|
|
8650
|
-
onDownloadFile && /* @__PURE__ */ jsx(
|
|
8653
|
+
onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
|
|
8651
8654
|
extraNav
|
|
8652
8655
|
] })
|
|
8653
8656
|
] }),
|