@zero-library/common 2.2.11 → 2.2.13
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 +15 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +11 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +9 -3
package/dist/index.esm.js
CHANGED
|
@@ -8,12 +8,18 @@ import { forwardRef, useState, useMemo, useEffect, useRef, lazy, Suspense, creat
|
|
|
8
8
|
import AES from 'crypto-js/aes';
|
|
9
9
|
import encUtf8 from 'crypto-js/enc-utf8';
|
|
10
10
|
import MarkdownIt from 'markdown-it';
|
|
11
|
+
import markdownItDefList from 'markdown-it-deflist';
|
|
12
|
+
import { full } from 'markdown-it-emoji';
|
|
13
|
+
import markdownItFootnote from 'markdown-it-footnote';
|
|
14
|
+
import markdownItTaskLists from 'markdown-it-task-lists';
|
|
11
15
|
import Decimal from 'decimal.js';
|
|
12
16
|
import dayjs from 'dayjs';
|
|
13
17
|
import relativeTime from 'dayjs/plugin/relativeTime';
|
|
14
18
|
import axios from 'axios';
|
|
19
|
+
import markdownItKatex from '@traptitech/markdown-it-katex';
|
|
15
20
|
import parse from 'html-react-parser';
|
|
16
21
|
import { jsonrepair } from 'jsonrepair';
|
|
22
|
+
import 'katex/dist/katex.min.css';
|
|
17
23
|
import { Worker, Viewer, PasswordStatus } from '@react-pdf-viewer/core';
|
|
18
24
|
import { pageNavigationPlugin } from '@react-pdf-viewer/page-navigation';
|
|
19
25
|
import { thumbnailPlugin } from '@react-pdf-viewer/thumbnail';
|
|
@@ -771,13 +777,12 @@ var formatSize = (value, options = {}) => {
|
|
|
771
777
|
var markdownToText = (() => {
|
|
772
778
|
const md2 = new MarkdownIt({
|
|
773
779
|
html: true,
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
});
|
|
780
|
+
breaks: true
|
|
781
|
+
}).use(markdownItTaskLists).use(full).use(markdownItFootnote).use(markdownItDefList);
|
|
777
782
|
return (markdown) => {
|
|
778
783
|
if (!isString(markdown)) return "";
|
|
779
784
|
const html = md2.render(markdown);
|
|
780
|
-
const text = html.replace(/<[^>]+>/g, "
|
|
785
|
+
const text = html.replace(/<[^>]+>/g, " ").replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").replace(/\s+/g, " ").trim();
|
|
781
786
|
return text;
|
|
782
787
|
};
|
|
783
788
|
})();
|
|
@@ -1288,7 +1293,7 @@ var LazyComponent_default = ({ type, customComponents, ...rest }) => {
|
|
|
1288
1293
|
] });
|
|
1289
1294
|
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx("div", { children: "\u52A0\u8F7D\u4E2D..." }), children: /* @__PURE__ */ jsx(LazyComponent, { ...rest }) });
|
|
1290
1295
|
};
|
|
1291
|
-
var md = MarkdownIt({ html: true, breaks: true });
|
|
1296
|
+
var md = MarkdownIt({ html: true, breaks: true }).use(markdownItTaskLists).use(full).use(markdownItFootnote).use(markdownItDefList).use(markdownItKatex);
|
|
1292
1297
|
md.renderer.rules.link_open = function(tokens, idx, options, env, self) {
|
|
1293
1298
|
const token = tokens[idx];
|
|
1294
1299
|
token.attrPush(["target", "_blank"]);
|
|
@@ -1602,7 +1607,7 @@ var useDeepEffect_default = (effect, deps) => {
|
|
|
1602
1607
|
prevDepsRef.current = deps;
|
|
1603
1608
|
return effect();
|
|
1604
1609
|
}
|
|
1605
|
-
}, [depsChanged]);
|
|
1610
|
+
}, [depsChanged, effect, ...deps]);
|
|
1606
1611
|
};
|
|
1607
1612
|
var useRefState_default = (init) => {
|
|
1608
1613
|
const [state, setState] = useState(init);
|