@zero-library/common 2.4.3 → 2.5.0
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 +511 -285
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.css +6 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.mts +95 -14
- package/dist/index.d.ts +95 -14
- package/dist/index.esm.js +517 -296
- package/dist/index.esm.js.map +1 -1
- package/package.json +3 -2
package/dist/index.esm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined
|
|
3
|
-
import { Spin, Input, Typography, Tooltip as Tooltip$1, Button,
|
|
2
|
+
import { MessageOutlined, BookOutlined, EditOutlined, DeleteOutlined, CloseOutlined, MinusCircleOutlined, PlusCircleOutlined, RedoOutlined, FileUnknownOutlined, FileZipOutlined, FileMarkdownOutlined, FileGifOutlined, FileImageOutlined, FileJpgOutlined, NotificationOutlined, VideoCameraOutlined, FilePptOutlined, FileExcelOutlined, FileWordOutlined, FilePdfOutlined, FileTextOutlined, ColumnWidthOutlined } from '@ant-design/icons';
|
|
3
|
+
import { Spin, Input, Typography, Tooltip as Tooltip$1, Button, Flex, Form, Card, List, Space, Popconfirm, Empty, Modal, message, Alert, Skeleton, Result, Splitter, Image as Image$1, Drawer, Avatar, notification } from 'antd';
|
|
4
4
|
import classNames2 from 'classnames';
|
|
5
5
|
import { renderAsync } from 'docx-preview';
|
|
6
6
|
import * as React from 'react';
|
|
7
|
-
import React__default, { forwardRef, useState, useMemo, useEffect, useRef, useCallback, createContext, isValidElement, version, cloneElement, memo, useContext, Fragment as Fragment$1, lazy, Suspense } from 'react';
|
|
7
|
+
import React__default, { forwardRef, useState, useMemo, useEffect, useRef, useCallback, createContext, isValidElement, version, cloneElement, memo, useImperativeHandle, useContext, Fragment as Fragment$1, lazy, Suspense } from 'react';
|
|
8
8
|
import AES from 'crypto-js/aes';
|
|
9
9
|
import encUtf8 from 'crypto-js/enc-utf8';
|
|
10
10
|
import { convert } from 'html-to-text';
|
|
@@ -32,20 +32,22 @@ import zh_CN from '@react-pdf-viewer/locales/lib/zh_CN.json';
|
|
|
32
32
|
import '@react-pdf-viewer/page-navigation/lib/styles/index.css';
|
|
33
33
|
import '@react-pdf-viewer/thumbnail/lib/styles/index.css';
|
|
34
34
|
import '@react-pdf-viewer/zoom/lib/styles/index.css';
|
|
35
|
-
import
|
|
35
|
+
import microApp from '@micro-zoe/micro-app';
|
|
36
|
+
import jsxCustomEvent from '@micro-zoe/micro-app/polyfill/jsx-custom-event';
|
|
37
|
+
import { mergeAttributes, useEditor, EditorContext, EditorContent, isNodeSelection, posToDOMRect, useCurrentEditor, useEditorState, isTextSelection } from '@tiptap/react';
|
|
36
38
|
import { Highlight } from '@tiptap/extension-highlight';
|
|
37
|
-
import { Image
|
|
39
|
+
import { Image } from '@tiptap/extension-image';
|
|
38
40
|
import { TaskList, TaskItem } from '@tiptap/extension-list';
|
|
39
41
|
import { Subscript } from '@tiptap/extension-subscript';
|
|
40
42
|
import { Superscript } from '@tiptap/extension-superscript';
|
|
41
43
|
import { TextAlign } from '@tiptap/extension-text-align';
|
|
42
44
|
import { Typography as Typography$1 } from '@tiptap/extension-typography';
|
|
43
|
-
import { Selection
|
|
45
|
+
import { Selection } from '@tiptap/extensions';
|
|
44
46
|
import { StarterKit } from '@tiptap/starter-kit';
|
|
45
47
|
import { TableHeader, TableRow, TableCell, Table } from '@tiptap/extension-table';
|
|
46
48
|
import TiptapHorizontalRule from '@tiptap/extension-horizontal-rule';
|
|
47
49
|
import { Node as Node$1, mergeAttributes as mergeAttributes$1, Extension, Mark } from '@tiptap/core';
|
|
48
|
-
import { PluginKey, Plugin, TextSelection, Selection, NodeSelection, AllSelection } from '@tiptap/pm/state';
|
|
50
|
+
import { PluginKey, Plugin, TextSelection, Selection as Selection$1, NodeSelection, AllSelection } from '@tiptap/pm/state';
|
|
49
51
|
import { shift, flip, offset, useMergeRefs, FloatingPortal, useFloating, autoUpdate, useTransitionStyles, useDismiss, useInteractions, FloatingDelayGroup, useHover, useFocus, useRole } from '@floating-ui/react';
|
|
50
52
|
import { CellSelection } from '@tiptap/pm/tables';
|
|
51
53
|
import { createPortal } from 'react-dom';
|
|
@@ -1528,9 +1530,9 @@ ${fence}`;
|
|
|
1528
1530
|
function emit(type, data, to = "top") {
|
|
1529
1531
|
const payload = { type, data, to };
|
|
1530
1532
|
try {
|
|
1531
|
-
window.
|
|
1533
|
+
window.postMessage(payload, "*");
|
|
1532
1534
|
} catch (err) {
|
|
1533
|
-
console.warn("emit
|
|
1535
|
+
console.warn("emit failed", err);
|
|
1534
1536
|
}
|
|
1535
1537
|
}
|
|
1536
1538
|
function emitToChild(iframeWindow, type, data, origin = "*") {
|
|
@@ -1545,33 +1547,91 @@ function emitToChild(iframeWindow, type, data, origin = "*") {
|
|
|
1545
1547
|
console.warn("emit to child failed", err);
|
|
1546
1548
|
}
|
|
1547
1549
|
}
|
|
1548
|
-
var
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1550
|
+
var hookInstances = /* @__PURE__ */ new Set();
|
|
1551
|
+
var handleGlobalMessage = (evt) => {
|
|
1552
|
+
const { data, source, origin } = evt;
|
|
1553
|
+
if (!data || !isObject(data) || !data.type) return;
|
|
1554
|
+
const { type, data: params, to = "top" } = data;
|
|
1555
|
+
const safeOrigin = origin || "*";
|
|
1556
|
+
const fns = [];
|
|
1557
|
+
let isAllowed = hookInstances.size === 0;
|
|
1558
|
+
hookInstances.forEach((ctx) => {
|
|
1559
|
+
const isMatch = ctx.allowedOrigins[0] === "*" || ctx.allowedOrigins.includes(safeOrigin);
|
|
1560
|
+
if (isMatch) {
|
|
1561
|
+
isAllowed = true;
|
|
1562
|
+
if (ctx.handlers[type]) {
|
|
1563
|
+
fns.push(...ctx.handlers[type]);
|
|
1560
1564
|
}
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1565
|
+
}
|
|
1566
|
+
});
|
|
1567
|
+
if (!isAllowed) return;
|
|
1568
|
+
const isTop = window.parent === window;
|
|
1569
|
+
const hasHandler = fns.length > 0;
|
|
1570
|
+
let shouldExecute = false;
|
|
1571
|
+
let shouldForward = false;
|
|
1572
|
+
switch (to) {
|
|
1573
|
+
case "nearest":
|
|
1574
|
+
shouldExecute = hasHandler;
|
|
1575
|
+
shouldForward = !hasHandler && !isTop;
|
|
1576
|
+
break;
|
|
1577
|
+
case "broadcast":
|
|
1578
|
+
shouldExecute = true;
|
|
1579
|
+
shouldForward = !isTop;
|
|
1580
|
+
break;
|
|
1581
|
+
case "top":
|
|
1582
|
+
shouldExecute = isTop;
|
|
1583
|
+
shouldForward = !isTop;
|
|
1584
|
+
break;
|
|
1585
|
+
case "parent":
|
|
1586
|
+
shouldExecute = true;
|
|
1587
|
+
shouldForward = source === window && !isTop;
|
|
1588
|
+
break;
|
|
1589
|
+
case "sibling":
|
|
1590
|
+
case "child":
|
|
1591
|
+
default:
|
|
1592
|
+
shouldExecute = true;
|
|
1593
|
+
shouldForward = false;
|
|
1594
|
+
break;
|
|
1570
1595
|
}
|
|
1571
|
-
|
|
1572
|
-
|
|
1596
|
+
if (shouldExecute && hasHandler) {
|
|
1597
|
+
fns.forEach((fn) => fn(params, source, origin));
|
|
1598
|
+
}
|
|
1599
|
+
if (shouldForward && !isTop && window.parent !== window) {
|
|
1600
|
+
try {
|
|
1601
|
+
window.parent.postMessage(data, "*");
|
|
1602
|
+
} catch (err) {
|
|
1603
|
+
console.warn("IframeRelayBridge forward failed:", err);
|
|
1604
|
+
}
|
|
1573
1605
|
}
|
|
1574
|
-
|
|
1606
|
+
};
|
|
1607
|
+
if (window) {
|
|
1608
|
+
window.addEventListener("message", handleGlobalMessage);
|
|
1609
|
+
}
|
|
1610
|
+
var useIframeRelayBridge_default = (allowedOrigins = ["*"]) => {
|
|
1611
|
+
const ctxRef = useRef({
|
|
1612
|
+
handlers: {},
|
|
1613
|
+
allowedOrigins
|
|
1614
|
+
});
|
|
1615
|
+
ctxRef.current.allowedOrigins = allowedOrigins;
|
|
1616
|
+
useEffect(() => {
|
|
1617
|
+
const ctx = ctxRef.current;
|
|
1618
|
+
hookInstances.add(ctx);
|
|
1619
|
+
return () => {
|
|
1620
|
+
hookInstances.delete(ctx);
|
|
1621
|
+
};
|
|
1622
|
+
}, []);
|
|
1623
|
+
const on = useCallback((type, handler) => {
|
|
1624
|
+
const handlers = ctxRef.current.handlers;
|
|
1625
|
+
handlers[type] = handlers[type] || [];
|
|
1626
|
+
handlers[type].push(handler);
|
|
1627
|
+
}, []);
|
|
1628
|
+
const off = useCallback((type, handler) => {
|
|
1629
|
+
const handlers = ctxRef.current.handlers;
|
|
1630
|
+
if (handlers[type]) {
|
|
1631
|
+
handlers[type] = handlers[type].filter((fn) => fn !== handler);
|
|
1632
|
+
}
|
|
1633
|
+
}, []);
|
|
1634
|
+
return useMemo(() => ({ on, off }), [on, off]);
|
|
1575
1635
|
};
|
|
1576
1636
|
var useRefState_default = (init) => {
|
|
1577
1637
|
const [state, setState] = useState(init);
|
|
@@ -2343,7 +2403,7 @@ var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue,
|
|
|
2343
2403
|
case "JPG":
|
|
2344
2404
|
case "JPEG":
|
|
2345
2405
|
case "GIF":
|
|
2346
|
-
return /* @__PURE__ */ jsx(Image, { rootClassName: styles_module_default.nsPreviewImage, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
|
|
2406
|
+
return /* @__PURE__ */ jsx(Image$1, { rootClassName: styles_module_default.nsPreviewImage, src: fileUrl, alt: "\u9884\u89C8\u56FE\u7247" });
|
|
2347
2407
|
case "PDF":
|
|
2348
2408
|
return /* @__PURE__ */ jsx(PdfPreview_default, { fileUrl, ...pdfParams, password, onSetPassword });
|
|
2349
2409
|
case "PDF_IMG":
|
|
@@ -2382,6 +2442,110 @@ var FilePreviewDrawer_default = ({ open, title = "\u6587\u4EF6\u9884\u89C8", onC
|
|
|
2382
2442
|
);
|
|
2383
2443
|
};
|
|
2384
2444
|
|
|
2445
|
+
// src/components/MicroApp/styles.less
|
|
2446
|
+
var styles_default = {};
|
|
2447
|
+
var MicroApp_default = ({ name, url, className, onMounted, onError, data, ...rest }) => {
|
|
2448
|
+
const [loading, setLoading] = useState(false);
|
|
2449
|
+
useEffect(() => {
|
|
2450
|
+
setLoading(true);
|
|
2451
|
+
}, [url]);
|
|
2452
|
+
const handleLoad = () => {
|
|
2453
|
+
setLoading(false);
|
|
2454
|
+
onMounted?.();
|
|
2455
|
+
};
|
|
2456
|
+
const handleError = (e) => {
|
|
2457
|
+
setLoading(false);
|
|
2458
|
+
onError?.(e);
|
|
2459
|
+
};
|
|
2460
|
+
const microAppData = useMemo(() => {
|
|
2461
|
+
const parentMainSource = window?.microApp?.getData?.()?.mainSource || [];
|
|
2462
|
+
return { mainSource: [...parentMainSource, name], ...data };
|
|
2463
|
+
}, [data, name]);
|
|
2464
|
+
const TagName = microApp.tagName || "micro-app";
|
|
2465
|
+
return /* @__PURE__ */ jsxCustomEvent(Spin, { spinning: loading, wrapperClassName: "full-spin", tip: "\u52A0\u8F7D\u4E2D..." }, /* @__PURE__ */ jsxCustomEvent(
|
|
2466
|
+
TagName,
|
|
2467
|
+
{
|
|
2468
|
+
name,
|
|
2469
|
+
url,
|
|
2470
|
+
data: microAppData,
|
|
2471
|
+
class: classNames2(styles_default.microApp, className),
|
|
2472
|
+
onMounted: handleLoad,
|
|
2473
|
+
onError: handleError,
|
|
2474
|
+
...rest
|
|
2475
|
+
}
|
|
2476
|
+
));
|
|
2477
|
+
};
|
|
2478
|
+
var Drawer_default = ({ name: podName }) => {
|
|
2479
|
+
const [currentPod, setCurrentPod] = useState({ title: "", url: "" });
|
|
2480
|
+
const [fullPodOpen, setFullPodOpen] = useState(false);
|
|
2481
|
+
const { on, off } = useIframeRelayBridge_default();
|
|
2482
|
+
const openPod = useCallback(({ title, url, name }) => {
|
|
2483
|
+
if (name === podName) {
|
|
2484
|
+
setCurrentPod({ title, url });
|
|
2485
|
+
setFullPodOpen(true);
|
|
2486
|
+
}
|
|
2487
|
+
}, []);
|
|
2488
|
+
const onClosePod = useCallback(() => {
|
|
2489
|
+
setFullPodOpen(false);
|
|
2490
|
+
}, []);
|
|
2491
|
+
useEffect(() => {
|
|
2492
|
+
on("openPod", openPod);
|
|
2493
|
+
on("onClosePod", onClosePod);
|
|
2494
|
+
return () => {
|
|
2495
|
+
off("openPod", openPod);
|
|
2496
|
+
off("onClosePod", onClosePod);
|
|
2497
|
+
};
|
|
2498
|
+
}, [openPod, onClosePod]);
|
|
2499
|
+
return /* @__PURE__ */ jsx(
|
|
2500
|
+
Drawer,
|
|
2501
|
+
{
|
|
2502
|
+
className: "no-padding-drawer",
|
|
2503
|
+
destroyOnHidden: true,
|
|
2504
|
+
title: currentPod.title,
|
|
2505
|
+
classNames: {
|
|
2506
|
+
header: currentPod.title === false ? "hidden" : ""
|
|
2507
|
+
},
|
|
2508
|
+
width: "100%",
|
|
2509
|
+
open: fullPodOpen,
|
|
2510
|
+
onClose: () => setFullPodOpen(false),
|
|
2511
|
+
children: /* @__PURE__ */ jsx(MicroApp_default, { iframe: true, name: podName, url: currentPod.url, "router-mode": "pure" }, currentPod.url)
|
|
2512
|
+
}
|
|
2513
|
+
);
|
|
2514
|
+
};
|
|
2515
|
+
var Window_default = ({ defaultUrl, name: appName }) => {
|
|
2516
|
+
const [windowUrl, setWindowUrl] = useState("");
|
|
2517
|
+
const [windowUrlKey, setWindowUrlKey, getWindowUrlKey] = useRefState_default(0);
|
|
2518
|
+
const { on, off } = useIframeRelayBridge_default();
|
|
2519
|
+
const onWindowUrlChange = (url) => {
|
|
2520
|
+
setWindowUrl(url);
|
|
2521
|
+
setWindowUrlKey(getWindowUrlKey() + 1);
|
|
2522
|
+
};
|
|
2523
|
+
useEffect(() => {
|
|
2524
|
+
const urlParams = getAllUrlParams(location.href);
|
|
2525
|
+
if (urlParams[appName]) {
|
|
2526
|
+
const url = microApp.router.decode(urlParams[appName]);
|
|
2527
|
+
onWindowUrlChange(url);
|
|
2528
|
+
} else {
|
|
2529
|
+
onWindowUrlChange(defaultUrl);
|
|
2530
|
+
}
|
|
2531
|
+
}, [defaultUrl, appName]);
|
|
2532
|
+
const openWindow = useCallback(
|
|
2533
|
+
({ url, name }) => {
|
|
2534
|
+
if (appName === name) {
|
|
2535
|
+
onWindowUrlChange(url);
|
|
2536
|
+
}
|
|
2537
|
+
},
|
|
2538
|
+
[appName]
|
|
2539
|
+
);
|
|
2540
|
+
useEffect(() => {
|
|
2541
|
+
on("openWindow", openWindow);
|
|
2542
|
+
return () => {
|
|
2543
|
+
off("openWindow", openWindow);
|
|
2544
|
+
};
|
|
2545
|
+
}, [openWindow]);
|
|
2546
|
+
return windowUrl ? /* @__PURE__ */ jsx(MicroApp_default, { name: appName, url: windowUrl }, windowUrlKey) : null;
|
|
2547
|
+
};
|
|
2548
|
+
|
|
2385
2549
|
// src/components/Iframe/styles.module.less
|
|
2386
2550
|
var styles_module_default3 = {
|
|
2387
2551
|
iframe: "styles_module_iframe"
|
|
@@ -2434,6 +2598,7 @@ var HorizontalRule = TiptapHorizontalRule.extend({
|
|
|
2434
2598
|
// src/components/MarkdownEditor/pageNo/constant.ts
|
|
2435
2599
|
var PAGE_NO_TAG = "page-no";
|
|
2436
2600
|
var PAGE_NO_KEY = "PageNo";
|
|
2601
|
+
var SCROLL_TOP_OFFSET = 80;
|
|
2437
2602
|
|
|
2438
2603
|
// src/components/MarkdownEditor/pageNo/pageNoMark.ts
|
|
2439
2604
|
var pageNoMark_default = Node$1.create({
|
|
@@ -2563,7 +2728,7 @@ var PageNoExtension = Extension.create({
|
|
|
2563
2728
|
pageNos.forEach((node) => {
|
|
2564
2729
|
const rect = node.getBoundingClientRect();
|
|
2565
2730
|
const top = rect.top - containerTop;
|
|
2566
|
-
if (Math.abs(top) <=
|
|
2731
|
+
if (Math.abs(top) <= SCROLL_TOP_OFFSET) {
|
|
2567
2732
|
closestNode = node;
|
|
2568
2733
|
closestTopDiff = 0;
|
|
2569
2734
|
} else if (top < 0 && top > closestTopDiff) {
|
|
@@ -2903,7 +3068,7 @@ var FloatingElement = forwardRef(
|
|
|
2903
3068
|
const handleFloatingOpenChange = (open2) => {
|
|
2904
3069
|
if (!open2 && editor && resetTextSelectionOnClose) {
|
|
2905
3070
|
const tr = editor.state.tr.setSelection(
|
|
2906
|
-
Selection.near(editor.state.doc.resolve(0))
|
|
3071
|
+
Selection$1.near(editor.state.doc.resolve(0))
|
|
2907
3072
|
);
|
|
2908
3073
|
editor.view.dispatch(tr);
|
|
2909
3074
|
}
|
|
@@ -3016,7 +3181,7 @@ var FloatingElement = forwardRef(
|
|
|
3016
3181
|
const nodeBefore = $pos.nodeBefore;
|
|
3017
3182
|
if (!nodeBefore || nodeBefore.isBlock) return;
|
|
3018
3183
|
const tr = state.tr.setSelection(
|
|
3019
|
-
Selection.near(state.doc.resolve(posCoords.pos))
|
|
3184
|
+
Selection$1.near(state.doc.resolve(posCoords.pos))
|
|
3020
3185
|
);
|
|
3021
3186
|
view.dispatch(tr);
|
|
3022
3187
|
};
|
|
@@ -3241,7 +3406,7 @@ var AnnotationSidebar_default = ({
|
|
|
3241
3406
|
}
|
|
3242
3407
|
return createPortal(sidebarContent, container);
|
|
3243
3408
|
};
|
|
3244
|
-
var createHtmlMark = (markName, ATTRS,
|
|
3409
|
+
var createHtmlMark = (markName, ATTRS, classNames8) => {
|
|
3245
3410
|
return Mark.create({
|
|
3246
3411
|
name: markName,
|
|
3247
3412
|
priority: 1e3,
|
|
@@ -3270,7 +3435,7 @@ var createHtmlMark = (markName, ATTRS, classNames7) => {
|
|
|
3270
3435
|
return [
|
|
3271
3436
|
"div",
|
|
3272
3437
|
mergeAttributes$1(attrs, {
|
|
3273
|
-
class:
|
|
3438
|
+
class: classNames8
|
|
3274
3439
|
}),
|
|
3275
3440
|
0
|
|
3276
3441
|
];
|
|
@@ -3628,13 +3793,45 @@ function scrollEditorViewToPosInNextFrame(view, pos, options) {
|
|
|
3628
3793
|
const { align = "start", behavior = "auto", offset: offset3 = 0 } = options || {};
|
|
3629
3794
|
requestAnimationFrame(() => {
|
|
3630
3795
|
try {
|
|
3631
|
-
const result = view.domAtPos(pos);
|
|
3632
|
-
if (!result) return;
|
|
3633
|
-
const el = result.node.nodeType === Node.TEXT_NODE ? result.node.parentElement : result.node;
|
|
3634
|
-
if (!el) return;
|
|
3635
3796
|
const scrollParent = getScrollParent(view.dom);
|
|
3797
|
+
if (!scrollParent) return;
|
|
3636
3798
|
const parentRect = scrollParent.getBoundingClientRect();
|
|
3637
|
-
|
|
3799
|
+
if (!parentRect.height) return;
|
|
3800
|
+
let el = null;
|
|
3801
|
+
const nodeDom = view.nodeDOM?.(pos);
|
|
3802
|
+
if (nodeDom) {
|
|
3803
|
+
el = nodeDom.nodeType === Node.TEXT_NODE ? nodeDom.parentElement : nodeDom;
|
|
3804
|
+
}
|
|
3805
|
+
if (!el) {
|
|
3806
|
+
const result = view.domAtPos(pos);
|
|
3807
|
+
if (result) {
|
|
3808
|
+
if (result.node.nodeType === Node.TEXT_NODE) {
|
|
3809
|
+
el = result.node.parentElement;
|
|
3810
|
+
} else {
|
|
3811
|
+
const container = result.node;
|
|
3812
|
+
const nodeAtOffset = container.childNodes?.[result.offset];
|
|
3813
|
+
const nodeBeforeOffset = container.childNodes?.[result.offset - 1];
|
|
3814
|
+
if (nodeAtOffset?.nodeType === Node.ELEMENT_NODE) {
|
|
3815
|
+
el = nodeAtOffset;
|
|
3816
|
+
} else if (nodeBeforeOffset?.nodeType === Node.ELEMENT_NODE) {
|
|
3817
|
+
el = nodeBeforeOffset;
|
|
3818
|
+
} else {
|
|
3819
|
+
el = container;
|
|
3820
|
+
}
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
let targetRect = null;
|
|
3825
|
+
if (el) {
|
|
3826
|
+
targetRect = el.getBoundingClientRect();
|
|
3827
|
+
} else {
|
|
3828
|
+
try {
|
|
3829
|
+
const coords = view.coordsAtPos(pos);
|
|
3830
|
+
targetRect = new DOMRect(coords.left, coords.top, coords.right - coords.left, coords.bottom - coords.top);
|
|
3831
|
+
} catch {
|
|
3832
|
+
return;
|
|
3833
|
+
}
|
|
3834
|
+
}
|
|
3638
3835
|
let delta = 0;
|
|
3639
3836
|
if (align === "start") {
|
|
3640
3837
|
delta = targetRect.top - parentRect.top;
|
|
@@ -3643,8 +3840,10 @@ function scrollEditorViewToPosInNextFrame(view, pos, options) {
|
|
|
3643
3840
|
} else if (align === "end") {
|
|
3644
3841
|
delta = targetRect.bottom - parentRect.bottom;
|
|
3645
3842
|
}
|
|
3843
|
+
const maxTop = Math.max(0, scrollParent.scrollHeight - scrollParent.clientHeight);
|
|
3844
|
+
const nextTop = Math.max(0, Math.min(scrollParent.scrollTop + delta - offset3, maxTop));
|
|
3646
3845
|
scrollParent.scrollTo({
|
|
3647
|
-
top:
|
|
3846
|
+
top: nextTop,
|
|
3648
3847
|
behavior
|
|
3649
3848
|
});
|
|
3650
3849
|
} catch (e) {
|
|
@@ -8490,7 +8689,7 @@ var usePageNo = (pageNoConfig) => {
|
|
|
8490
8689
|
const setPageNoEditor = (newEditor) => {
|
|
8491
8690
|
setEditor(newEditor);
|
|
8492
8691
|
};
|
|
8493
|
-
const onPageChange = useDebounce_default((pageNo =
|
|
8692
|
+
const onPageChange = useDebounce_default((pageNo = 1) => {
|
|
8494
8693
|
lastScrollToPageNoRef.current = pageNo;
|
|
8495
8694
|
pageNoConfig?.onScrollPage?.(pageNo);
|
|
8496
8695
|
}, 300);
|
|
@@ -8519,7 +8718,7 @@ var usePageNo = (pageNoConfig) => {
|
|
|
8519
8718
|
const tryScroll = () => {
|
|
8520
8719
|
const foundPos = findTargetPos();
|
|
8521
8720
|
if (!isNullOrUnDef(foundPos)) {
|
|
8522
|
-
scrollEditorViewToPosInNextFrame(editor.view, foundPos, { align: "start",
|
|
8721
|
+
scrollEditorViewToPosInNextFrame(editor.view, foundPos, { align: "start", offset: SCROLL_TOP_OFFSET });
|
|
8523
8722
|
return;
|
|
8524
8723
|
}
|
|
8525
8724
|
tries += 1;
|
|
@@ -8533,271 +8732,293 @@ var usePageNo = (pageNoConfig) => {
|
|
|
8533
8732
|
onPageChange
|
|
8534
8733
|
};
|
|
8535
8734
|
};
|
|
8536
|
-
var MarkdownEditor_default = (
|
|
8537
|
-
|
|
8538
|
-
|
|
8539
|
-
|
|
8540
|
-
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
|
|
8544
|
-
|
|
8545
|
-
|
|
8546
|
-
|
|
8547
|
-
|
|
8548
|
-
|
|
8549
|
-
|
|
8550
|
-
|
|
8551
|
-
|
|
8552
|
-
|
|
8553
|
-
|
|
8554
|
-
|
|
8555
|
-
|
|
8556
|
-
|
|
8557
|
-
|
|
8558
|
-
|
|
8559
|
-
|
|
8560
|
-
|
|
8561
|
-
|
|
8562
|
-
|
|
8563
|
-
|
|
8564
|
-
|
|
8565
|
-
|
|
8566
|
-
|
|
8567
|
-
|
|
8568
|
-
|
|
8569
|
-
|
|
8570
|
-
|
|
8571
|
-
|
|
8572
|
-
|
|
8573
|
-
|
|
8574
|
-
|
|
8575
|
-
|
|
8576
|
-
|
|
8577
|
-
|
|
8578
|
-
|
|
8579
|
-
|
|
8580
|
-
|
|
8581
|
-
|
|
8582
|
-
|
|
8583
|
-
|
|
8584
|
-
|
|
8585
|
-
|
|
8586
|
-
|
|
8587
|
-
|
|
8588
|
-
},
|
|
8589
|
-
extensions: [
|
|
8590
|
-
Markdown,
|
|
8591
|
-
Mathematics.configure({
|
|
8592
|
-
// 可选:KaTeX 自定义配置
|
|
8593
|
-
katexOptions: {
|
|
8594
|
-
throwOnError: false
|
|
8595
|
-
}
|
|
8596
|
-
// 可选:内联公式点击回调
|
|
8597
|
-
// inlineOptions: {
|
|
8598
|
-
// onClick: (node, pos) => {
|
|
8599
|
-
// const newLaTeX = prompt('编辑公式 LaTeX:', node.attrs.latex)
|
|
8600
|
-
// if (newLaTeX) {
|
|
8601
|
-
// editor?.chain().setNodeSelection(pos).updateInlineMath({ latex: newLaTeX }).run()
|
|
8602
|
-
// }
|
|
8603
|
-
// }
|
|
8604
|
-
// }
|
|
8605
|
-
}),
|
|
8606
|
-
StarterKit.configure({
|
|
8607
|
-
horizontalRule: false,
|
|
8608
|
-
link: {
|
|
8609
|
-
openOnClick: false,
|
|
8610
|
-
enableClickSelection: true
|
|
8735
|
+
var MarkdownEditor_default = forwardRef(
|
|
8736
|
+
({
|
|
8737
|
+
value = ``,
|
|
8738
|
+
onChange,
|
|
8739
|
+
searchValue,
|
|
8740
|
+
disabled,
|
|
8741
|
+
extraNav,
|
|
8742
|
+
fixedToolbar = true,
|
|
8743
|
+
floatToolbar = true,
|
|
8744
|
+
onQuote,
|
|
8745
|
+
onDownloadFile,
|
|
8746
|
+
annotationConfig,
|
|
8747
|
+
collectionConfig,
|
|
8748
|
+
pageNoConfig
|
|
8749
|
+
}, ref) => {
|
|
8750
|
+
const isMobile = useIsBreakpoint();
|
|
8751
|
+
const lastContentRef = useRef("");
|
|
8752
|
+
const { setPageNoEditor, onPageChange } = usePageNo(pageNoConfig);
|
|
8753
|
+
const {
|
|
8754
|
+
setAnnotationEditor,
|
|
8755
|
+
annotations,
|
|
8756
|
+
setAnnotations,
|
|
8757
|
+
selectedAnnotationId,
|
|
8758
|
+
handleSelectAnnotation,
|
|
8759
|
+
showAnnotationModal,
|
|
8760
|
+
showAnnotation,
|
|
8761
|
+
onCreateAnnotation,
|
|
8762
|
+
closeAnnotationCreateModal,
|
|
8763
|
+
onCreateAnnotationConfirm,
|
|
8764
|
+
handleDeleteAnnotation,
|
|
8765
|
+
handleEditAnnotation,
|
|
8766
|
+
setShowAnnotation
|
|
8767
|
+
} = useAnnotations(annotationConfig);
|
|
8768
|
+
const {
|
|
8769
|
+
setCollectionEditor,
|
|
8770
|
+
collections,
|
|
8771
|
+
setCollections,
|
|
8772
|
+
selectedCollectionId,
|
|
8773
|
+
handleSelectCollection,
|
|
8774
|
+
showCollection,
|
|
8775
|
+
setShowCollection,
|
|
8776
|
+
onCreateCollection,
|
|
8777
|
+
handleDeleteCollection
|
|
8778
|
+
} = useCollections(collectionConfig);
|
|
8779
|
+
const editor = useEditor({
|
|
8780
|
+
immediatelyRender: false,
|
|
8781
|
+
editorProps: {
|
|
8782
|
+
attributes: {
|
|
8783
|
+
autocomplete: "off",
|
|
8784
|
+
autocorrect: "off",
|
|
8785
|
+
autocapitalize: "off",
|
|
8786
|
+
"aria-label": "\u4E3B\u5185\u5BB9\u533A\u57DF\uFF0C\u5F00\u59CB\u8F93\u5165\u6587\u672C..."
|
|
8611
8787
|
}
|
|
8612
|
-
}
|
|
8613
|
-
|
|
8614
|
-
|
|
8615
|
-
|
|
8616
|
-
|
|
8617
|
-
|
|
8618
|
-
|
|
8619
|
-
Typography$1,
|
|
8620
|
-
Superscript,
|
|
8621
|
-
Subscript,
|
|
8622
|
-
Selection$1,
|
|
8623
|
-
Table.configure({
|
|
8624
|
-
resizable: true
|
|
8625
|
-
// 可选,允许调整表格大小
|
|
8626
|
-
}),
|
|
8627
|
-
TableHeader,
|
|
8628
|
-
TableRow,
|
|
8629
|
-
TableCell,
|
|
8630
|
-
// ImageUploadNode.configure({
|
|
8631
|
-
// accept: 'image/*',
|
|
8632
|
-
// maxSize: MAX_FILE_SIZE,
|
|
8633
|
-
// limit: 3,
|
|
8634
|
-
// upload: handleImageUpload,
|
|
8635
|
-
// onError: (error) => console.error('上传失败:', error)
|
|
8636
|
-
// }),
|
|
8637
|
-
...pageNoConfig?.enabled ? [
|
|
8638
|
-
pageNoMark_default,
|
|
8639
|
-
PageNoExtension.configure({
|
|
8640
|
-
onPageChange,
|
|
8641
|
-
containerSelector: "#contentWrapper"
|
|
8642
|
-
})
|
|
8643
|
-
] : [],
|
|
8644
|
-
searchAndReplace_default.configure({
|
|
8645
|
-
searchResultClass: "cube-hl",
|
|
8646
|
-
// class to give to found items. default 'cube-hl'
|
|
8647
|
-
disableRegex: false
|
|
8648
|
-
// also no need to explain
|
|
8649
|
-
}),
|
|
8650
|
-
...annotationConfig?.enabled ? [
|
|
8651
|
-
AnnotationMark,
|
|
8652
|
-
AnnotationPlugin.configure({
|
|
8653
|
-
onAnnotationsChange: setAnnotations,
|
|
8654
|
-
onSelectAnnotation: (annotation) => {
|
|
8655
|
-
handleSelectAnnotation(annotation?.[ANNOTATION_ATTRS[0]]);
|
|
8788
|
+
},
|
|
8789
|
+
extensions: [
|
|
8790
|
+
Markdown,
|
|
8791
|
+
Mathematics.configure({
|
|
8792
|
+
// 可选:KaTeX 自定义配置
|
|
8793
|
+
katexOptions: {
|
|
8794
|
+
throwOnError: false
|
|
8656
8795
|
}
|
|
8657
|
-
|
|
8658
|
-
|
|
8659
|
-
|
|
8660
|
-
|
|
8661
|
-
|
|
8662
|
-
|
|
8663
|
-
|
|
8664
|
-
|
|
8665
|
-
|
|
8796
|
+
// 可选:内联公式点击回调
|
|
8797
|
+
// inlineOptions: {
|
|
8798
|
+
// onClick: (node, pos) => {
|
|
8799
|
+
// const newLaTeX = prompt('编辑公式 LaTeX:', node.attrs.latex)
|
|
8800
|
+
// if (newLaTeX) {
|
|
8801
|
+
// editor?.chain().setNodeSelection(pos).updateInlineMath({ latex: newLaTeX }).run()
|
|
8802
|
+
// }
|
|
8803
|
+
// }
|
|
8804
|
+
// }
|
|
8805
|
+
}),
|
|
8806
|
+
StarterKit.configure({
|
|
8807
|
+
horizontalRule: false,
|
|
8808
|
+
link: {
|
|
8809
|
+
openOnClick: false,
|
|
8810
|
+
enableClickSelection: true
|
|
8666
8811
|
}
|
|
8667
|
-
})
|
|
8668
|
-
|
|
8669
|
-
|
|
8670
|
-
|
|
8671
|
-
|
|
8672
|
-
|
|
8673
|
-
|
|
8674
|
-
|
|
8675
|
-
|
|
8676
|
-
|
|
8677
|
-
|
|
8678
|
-
|
|
8679
|
-
|
|
8680
|
-
|
|
8681
|
-
|
|
8682
|
-
|
|
8683
|
-
|
|
8684
|
-
|
|
8685
|
-
|
|
8686
|
-
|
|
8687
|
-
|
|
8688
|
-
|
|
8689
|
-
|
|
8690
|
-
|
|
8691
|
-
|
|
8692
|
-
|
|
8693
|
-
|
|
8694
|
-
|
|
8695
|
-
|
|
8696
|
-
|
|
8697
|
-
|
|
8698
|
-
|
|
8699
|
-
|
|
8700
|
-
|
|
8701
|
-
|
|
8702
|
-
|
|
8703
|
-
|
|
8704
|
-
|
|
8705
|
-
|
|
8706
|
-
|
|
8707
|
-
|
|
8708
|
-
|
|
8709
|
-
|
|
8710
|
-
|
|
8711
|
-
|
|
8712
|
-
|
|
8812
|
+
}),
|
|
8813
|
+
HorizontalRule,
|
|
8814
|
+
TextAlign.configure({ types: ["heading", "paragraph"] }),
|
|
8815
|
+
TaskList,
|
|
8816
|
+
TaskItem.configure({ nested: true }),
|
|
8817
|
+
Highlight.configure({ multicolor: true }),
|
|
8818
|
+
Image,
|
|
8819
|
+
Typography$1,
|
|
8820
|
+
Superscript,
|
|
8821
|
+
Subscript,
|
|
8822
|
+
Selection,
|
|
8823
|
+
Table.configure({
|
|
8824
|
+
resizable: true
|
|
8825
|
+
// 可选,允许调整表格大小
|
|
8826
|
+
}),
|
|
8827
|
+
TableHeader,
|
|
8828
|
+
TableRow,
|
|
8829
|
+
TableCell,
|
|
8830
|
+
// ImageUploadNode.configure({
|
|
8831
|
+
// accept: 'image/*',
|
|
8832
|
+
// maxSize: MAX_FILE_SIZE,
|
|
8833
|
+
// limit: 3,
|
|
8834
|
+
// upload: handleImageUpload,
|
|
8835
|
+
// onError: (error) => console.error('上传失败:', error)
|
|
8836
|
+
// }),
|
|
8837
|
+
...pageNoConfig?.enabled ? [
|
|
8838
|
+
pageNoMark_default,
|
|
8839
|
+
PageNoExtension.configure({
|
|
8840
|
+
onPageChange,
|
|
8841
|
+
containerSelector: "#contentWrapper"
|
|
8842
|
+
})
|
|
8843
|
+
] : [],
|
|
8844
|
+
searchAndReplace_default.configure({
|
|
8845
|
+
searchResultClass: "cube-hl",
|
|
8846
|
+
// class to give to found items. default 'cube-hl'
|
|
8847
|
+
disableRegex: false
|
|
8848
|
+
// also no need to explain
|
|
8849
|
+
}),
|
|
8850
|
+
...annotationConfig?.enabled ? [
|
|
8851
|
+
AnnotationMark,
|
|
8852
|
+
AnnotationPlugin.configure({
|
|
8853
|
+
onAnnotationsChange: setAnnotations,
|
|
8854
|
+
onSelectAnnotation: (annotation) => {
|
|
8855
|
+
handleSelectAnnotation(annotation?.[ANNOTATION_ATTRS[0]]);
|
|
8856
|
+
}
|
|
8857
|
+
})
|
|
8858
|
+
] : [],
|
|
8859
|
+
// 摘录功能扩展
|
|
8860
|
+
...collectionConfig?.enabled ? [
|
|
8861
|
+
CollectionMark,
|
|
8862
|
+
CollectionPlugin.configure({
|
|
8863
|
+
onCollectionsChange: setCollections,
|
|
8864
|
+
onSelectCollection: (collection) => {
|
|
8865
|
+
handleSelectCollection(collection?.[COLLECTION_ATTRS[0]]);
|
|
8866
|
+
}
|
|
8867
|
+
})
|
|
8868
|
+
] : []
|
|
8869
|
+
],
|
|
8870
|
+
content: value,
|
|
8871
|
+
contentType: "markdown",
|
|
8872
|
+
onUpdate: () => {
|
|
8873
|
+
const markdownOutput = getMarkdown();
|
|
8874
|
+
if (markdownOutput === lastContentRef.current) return;
|
|
8875
|
+
lastContentRef.current = markdownOutput;
|
|
8876
|
+
onChange?.(markdownOutput);
|
|
8877
|
+
}
|
|
8878
|
+
});
|
|
8879
|
+
const getMarkdown = () => {
|
|
8880
|
+
if (!editor) return "";
|
|
8881
|
+
if (editor.isEmpty) return "";
|
|
8882
|
+
return editor.getMarkdown();
|
|
8883
|
+
};
|
|
8884
|
+
useImperativeHandle(
|
|
8885
|
+
ref,
|
|
8886
|
+
() => ({
|
|
8887
|
+
getEditor: () => editor,
|
|
8888
|
+
getMarkdown,
|
|
8889
|
+
focus: (pos) => {
|
|
8890
|
+
if (!editor) return;
|
|
8891
|
+
editor.commands.focus(pos);
|
|
8892
|
+
},
|
|
8893
|
+
insertContent: (value2, options) => {
|
|
8894
|
+
if (!editor) return;
|
|
8895
|
+
editor.chain().focus().insertContent(value2, options).run();
|
|
8896
|
+
},
|
|
8897
|
+
insertContentAt: (position, value2, options) => {
|
|
8898
|
+
if (!editor) return;
|
|
8899
|
+
editor.chain().focus().insertContentAt(position, value2, options).run();
|
|
8900
|
+
}
|
|
8901
|
+
}),
|
|
8902
|
+
[editor]
|
|
8903
|
+
);
|
|
8904
|
+
useEffect(() => {
|
|
8905
|
+
if (!editor) return;
|
|
8906
|
+
setAnnotationEditor(editor);
|
|
8907
|
+
setCollectionEditor(editor);
|
|
8908
|
+
setPageNoEditor(editor);
|
|
8909
|
+
}, [editor]);
|
|
8910
|
+
useEffect(() => {
|
|
8911
|
+
if (!editor) return;
|
|
8912
|
+
if (lastContentRef.current === value) return;
|
|
8913
|
+
editor?.commands.setContent(value, { contentType: "markdown" });
|
|
8914
|
+
editor?.commands.focus("start");
|
|
8915
|
+
lastContentRef.current = value;
|
|
8916
|
+
}, [value, editor]);
|
|
8917
|
+
useEffect(() => {
|
|
8918
|
+
editor?.commands.setSearchTerm(searchValue || "");
|
|
8919
|
+
}, [searchValue, value, editor]);
|
|
8920
|
+
useEffect(() => {
|
|
8921
|
+
editor?.setEditable(!disabled);
|
|
8922
|
+
}, [disabled, editor]);
|
|
8923
|
+
const downloadFile2 = () => {
|
|
8924
|
+
onDownloadFile?.(getMarkdown(), "docx");
|
|
8925
|
+
};
|
|
8926
|
+
const fixedTools = useMemo(() => isArray(fixedToolbar) ? fixedToolbar : void 0, [fixedToolbar]);
|
|
8927
|
+
const floatTools = useMemo(() => isArray(floatToolbar) ? floatToolbar : void 0, [floatToolbar]);
|
|
8928
|
+
return /* @__PURE__ */ jsxs(Flex, { className: "height-full width-full", children: [
|
|
8929
|
+
/* @__PURE__ */ jsx("div", { className: classNames2("height-full", "flex-1", styles_module_default4.editorParent), children: /* @__PURE__ */ jsxs(EditorContext.Provider, { value: { editor }, children: [
|
|
8930
|
+
/* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8931
|
+
/* @__PURE__ */ jsxs(Flex, { justify: "end", align: "center", children: [
|
|
8932
|
+
fixedToolbar !== false && /* @__PURE__ */ jsx(
|
|
8933
|
+
EditorToolbar,
|
|
8934
|
+
{
|
|
8935
|
+
isBubble: false,
|
|
8936
|
+
onQuote,
|
|
8937
|
+
onCreateAnnotation: annotationConfig?.enabled ? onCreateAnnotation : void 0,
|
|
8938
|
+
onCreateCollection: collectionConfig?.enabled ? onCreateCollection : void 0,
|
|
8939
|
+
tools: fixedTools
|
|
8940
|
+
}
|
|
8941
|
+
),
|
|
8942
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default4.extraToolbar), children: [
|
|
8943
|
+
annotationConfig?.enabled && annotationConfig?.showListButton !== false && /* @__PURE__ */ jsx(
|
|
8944
|
+
Button,
|
|
8945
|
+
{
|
|
8946
|
+
size: "small",
|
|
8947
|
+
title: "\u6279\u6CE8\u5217\u8868",
|
|
8948
|
+
icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
8949
|
+
color: "primary",
|
|
8950
|
+
variant: "text",
|
|
8951
|
+
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8952
|
+
}
|
|
8953
|
+
),
|
|
8954
|
+
collectionConfig?.enabled && collectionConfig?.showListButton !== false && /* @__PURE__ */ jsx(
|
|
8955
|
+
Button,
|
|
8956
|
+
{
|
|
8957
|
+
style: { gap: "2px" },
|
|
8958
|
+
size: "small",
|
|
8959
|
+
title: "\u6458\u5F55\u5217\u8868",
|
|
8960
|
+
icon: /* @__PURE__ */ jsx(BookOutlined, {}),
|
|
8961
|
+
color: "primary",
|
|
8962
|
+
variant: "text",
|
|
8963
|
+
onClick: () => setShowCollection(!showCollection),
|
|
8964
|
+
children: "\u6458\u5F55"
|
|
8965
|
+
}
|
|
8966
|
+
),
|
|
8967
|
+
onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
|
|
8968
|
+
extraNav
|
|
8969
|
+
] })
|
|
8970
|
+
] }),
|
|
8971
|
+
!isMobile && floatToolbar !== false && /* @__PURE__ */ jsx(FloatingElement, { editor, zIndex: 188, resetTextSelectionOnClose: false, className: styles_module_default4.editorFloatingToolbar, children: /* @__PURE__ */ jsx(
|
|
8713
8972
|
EditorToolbar,
|
|
8714
8973
|
{
|
|
8715
|
-
isBubble:
|
|
8974
|
+
isBubble: true,
|
|
8716
8975
|
onQuote,
|
|
8717
8976
|
onCreateAnnotation: annotationConfig?.enabled ? onCreateAnnotation : void 0,
|
|
8718
8977
|
onCreateCollection: collectionConfig?.enabled ? onCreateCollection : void 0,
|
|
8719
|
-
tools:
|
|
8978
|
+
tools: floatTools
|
|
8720
8979
|
}
|
|
8721
|
-
)
|
|
8722
|
-
/* @__PURE__ */ jsxs(Flex, { gap: 8, align: "center", className: classNames2(styles_module_default4.extraToolbar), children: [
|
|
8723
|
-
annotationConfig?.enabled && annotationConfig?.showListButton !== false && /* @__PURE__ */ jsx(
|
|
8724
|
-
Button,
|
|
8725
|
-
{
|
|
8726
|
-
size: "small",
|
|
8727
|
-
title: "\u6279\u6CE8\u5217\u8868",
|
|
8728
|
-
icon: /* @__PURE__ */ jsx(MessageOutlined, {}),
|
|
8729
|
-
color: "primary",
|
|
8730
|
-
variant: "text",
|
|
8731
|
-
onClick: () => setShowAnnotation(!showAnnotation)
|
|
8732
|
-
}
|
|
8733
|
-
),
|
|
8734
|
-
collectionConfig?.enabled && collectionConfig?.showListButton !== false && /* @__PURE__ */ jsx(
|
|
8735
|
-
Button,
|
|
8736
|
-
{
|
|
8737
|
-
style: { gap: "2px" },
|
|
8738
|
-
size: "small",
|
|
8739
|
-
title: "\u6458\u5F55\u5217\u8868",
|
|
8740
|
-
icon: /* @__PURE__ */ jsx(BookOutlined, {}),
|
|
8741
|
-
color: "primary",
|
|
8742
|
-
variant: "text",
|
|
8743
|
-
onClick: () => setShowCollection(!showCollection),
|
|
8744
|
-
children: "\u6458\u5F55"
|
|
8745
|
-
}
|
|
8746
|
-
),
|
|
8747
|
-
onDownloadFile && /* @__PURE__ */ jsx(Button, { size: "small", color: "primary", variant: "text", onClick: downloadFile2, children: "\u4E0B\u8F7D" }),
|
|
8748
|
-
extraNav
|
|
8749
|
-
] })
|
|
8980
|
+
) })
|
|
8750
8981
|
] }),
|
|
8751
|
-
|
|
8752
|
-
|
|
8982
|
+
/* @__PURE__ */ jsx("div", { id: "contentWrapper", className: classNames2(styles_module_default4.contentWrapper, "scroll-fade-in"), children: /* @__PURE__ */ jsx(
|
|
8983
|
+
EditorContent,
|
|
8753
8984
|
{
|
|
8754
|
-
|
|
8755
|
-
|
|
8756
|
-
|
|
8757
|
-
onCreateCollection: collectionConfig?.enabled ? onCreateCollection : void 0,
|
|
8758
|
-
tools: floatTools
|
|
8985
|
+
editor,
|
|
8986
|
+
role: "presentation",
|
|
8987
|
+
className: classNames2(styles_module_default4.simpleEditorContent, "ns-markdown", { [styles_module_default4.noToolbar]: fixedToolbar === false })
|
|
8759
8988
|
}
|
|
8760
8989
|
) })
|
|
8990
|
+
] }) }),
|
|
8991
|
+
annotationConfig?.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8992
|
+
showAnnotation && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
|
|
8993
|
+
AnnotationSidebar_default,
|
|
8994
|
+
{
|
|
8995
|
+
disabled,
|
|
8996
|
+
annotations,
|
|
8997
|
+
selectedAnnotationId,
|
|
8998
|
+
handleSelectAnnotation: (id) => handleSelectAnnotation(id, "sidebar"),
|
|
8999
|
+
onEditAnnotation: handleEditAnnotation,
|
|
9000
|
+
onDeleteAnnotation: handleDeleteAnnotation,
|
|
9001
|
+
annotationConfig,
|
|
9002
|
+
onClose: () => setShowAnnotation(false)
|
|
9003
|
+
}
|
|
9004
|
+
) }),
|
|
9005
|
+
showAnnotationModal && /* @__PURE__ */ jsx(AnnotationModal_default, { visible: showAnnotationModal, onCancel: closeAnnotationCreateModal, onConfirm: onCreateAnnotationConfirm })
|
|
8761
9006
|
] }),
|
|
8762
|
-
/* @__PURE__ */ jsx("div", {
|
|
8763
|
-
|
|
8764
|
-
{
|
|
8765
|
-
editor,
|
|
8766
|
-
role: "presentation",
|
|
8767
|
-
className: classNames2(styles_module_default4.simpleEditorContent, "ns-markdown", { [styles_module_default4.noToolbar]: fixedToolbar === false })
|
|
8768
|
-
}
|
|
8769
|
-
) })
|
|
8770
|
-
] }) }),
|
|
8771
|
-
annotationConfig?.enabled && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
8772
|
-
showAnnotation && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
|
|
8773
|
-
AnnotationSidebar_default,
|
|
9007
|
+
collectionConfig?.enabled && showCollection && /* @__PURE__ */ jsx("div", { className: classNames2("height-full", styles_module_default4.extraSidebarParent), children: /* @__PURE__ */ jsx(
|
|
9008
|
+
collectionSidebar_default,
|
|
8774
9009
|
{
|
|
8775
9010
|
disabled,
|
|
8776
|
-
|
|
8777
|
-
|
|
8778
|
-
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
onClose: () => setShowAnnotation(false)
|
|
9011
|
+
collections,
|
|
9012
|
+
selectedCollectionId,
|
|
9013
|
+
handleSelectCollection: (id) => handleSelectCollection(id, "sidebar"),
|
|
9014
|
+
onDeleteCollection: handleDeleteCollection,
|
|
9015
|
+
collectionConfig,
|
|
9016
|
+
onClose: () => setShowCollection(false)
|
|
8783
9017
|
}
|
|
8784
|
-
) })
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
collectionSidebar_default,
|
|
8789
|
-
{
|
|
8790
|
-
disabled,
|
|
8791
|
-
collections,
|
|
8792
|
-
selectedCollectionId,
|
|
8793
|
-
handleSelectCollection: (id) => handleSelectCollection(id, "sidebar"),
|
|
8794
|
-
onDeleteCollection: handleDeleteCollection,
|
|
8795
|
-
collectionConfig,
|
|
8796
|
-
onClose: () => setShowCollection(false)
|
|
8797
|
-
}
|
|
8798
|
-
) })
|
|
8799
|
-
] });
|
|
8800
|
-
};
|
|
9018
|
+
) })
|
|
9019
|
+
] });
|
|
9020
|
+
}
|
|
9021
|
+
);
|
|
8801
9022
|
|
|
8802
9023
|
// src/components/MarkDrawing/styles.module.less
|
|
8803
9024
|
var styles_module_default7 = {
|
|
@@ -8900,6 +9121,6 @@ var UserAvatar_default = ({ size, avatarSrc, userName }) => {
|
|
|
8900
9121
|
return avatarSrc ? /* @__PURE__ */ jsx(Avatar, { size, src: avatarSrc }) : /* @__PURE__ */ jsx(Avatar, { size, className: "cursor-pointer", style: { backgroundColor: "var(--ant-color-primary)" }, children: userName?.slice(0, 1)?.toLocaleUpperCase() });
|
|
8901
9122
|
};
|
|
8902
9123
|
|
|
8903
|
-
export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
|
|
9124
|
+
export { AudioPlayer_default as AudioPlayer, BusinessCode, DEFAULT_DATE_FORMAT, DEFAULT_DATE_TIME_FORMAT, DEFAULT_YEAR_MONTH_DAY_FORMAT, DEFAULT_YEAR_MONTH_FORMAT, DocxPreview_default as DocxPreview, FileIcon_default as FileIcon, FilePreview_default as FilePreview, FilePreviewDrawer_default as FilePreviewDrawer, HttpStatus, Iframe_default as Iframe, LazyComponent_default as LazyComponent, MarkDrawing_default as MarkDrawing, MarkdownEditor_default as MarkdownEditor, MarkdownPreview_default as MarkdownPreview, MicroApp_default as MicroApp, Drawer_default as MicroAppDrawer, Window_default as MicroAppWindow, MultiEmailValidator, PdfImagePreview_default as PdfImagePreview, PdfPreview_default as PdfPreview, PhoneOrMobileValidator, RegBankCardNo, RegDetailAddress, RegEmail, RegFixedTelePhone, RegIdentityCardNo, RegMobile, RegNumNo, RegPassword, RegSmsCode, RegTaxNo, RegTelePhone, RenderMarkdown_default as RenderMarkdown, RenderWrapper_default as RenderWrapper, ThanNumLengthValidator, ThanNumValidator, UserAvatar_default as UserAvatar, VideoPlayer_default as VideoPlayer, absVal, addUrlLastSlash, aesDecrypt, aesEncrypt, arrToObj, buildUrlParams, cachedMessage, calculate, compareNum, convertCurrency, convertNewlineToBr, copyText, createRequest, createSecureManager, createTokenManager, decimalPlaces, deepCopy, deepEqual, deepMerge, dividedBy, downloadFile, emit, emitToChild, executeScript, findTreeNodesByIds, formatDate, formatNumberWithCommas, formatSize, genNonDuplicateID, generateRandomNumbers, getAllUrlParams, getDeviceId, getEndOfTimestamp, getFileName, getFileSuffixName, getRowSpanCount, getStartOfTimestamp, getTimestamp, getWebSocketUrl, htmlToMarkdown, htmlToText, importThirdPartyFile, is, isArray, isBlob, isBoolean, isDate, isDef, isElement, isEmpty, isEmptyObj, isExpire, isExternal, isFunction, isInteger, isJson, isLocalhost, isMap, isNegative, isNull, isNullOrUnDef, isNumber, isNumberNoNaN, isObject, isPromise, isReferenceType, isRegExp, isScriptSafe, isSet, isString, isUnDef, isWindow, markdownToText, minus, objToOptions, plus, precision, processItemList, propsMerge, setInterval2 as setInterval, setUrlMainSource, shouldRender, times, toFixed, transform, transforms, useAsyncQueue_default as useAsyncQueue, useAutoRefresh_default as useAutoRefresh, useCountDown_default as useCountDown, useCreateValtioContext_default as useCreateValtioContext, useDebounce_default as useDebounce, useDeepEffect_default as useDeepEffect, useIframeRelayBridge_default as useIframeRelayBridge, useRefState_default as useRefState, useSyncInput_default as useSyncInput, useThrottle_default as useThrottle, useWebSocket_default as useWebSocket };
|
|
8904
9125
|
//# sourceMappingURL=index.esm.js.map
|
|
8905
9126
|
//# sourceMappingURL=index.esm.js.map
|