@zero-library/common 2.2.4 → 2.2.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 +21 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.esm.js +21 -4
- package/dist/index.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -305,10 +305,14 @@ try {
|
|
|
305
305
|
md.use(alertInlinePlugin);
|
|
306
306
|
} catch {
|
|
307
307
|
}
|
|
308
|
+
var filterMarkdown = (content = "") => {
|
|
309
|
+
if (!content) return content;
|
|
310
|
+
return content.replace(/<!--[\s\S]*?(?:-->|$)/g, "");
|
|
311
|
+
};
|
|
308
312
|
var RenderMarkdown_default = ({ content = "", searchValue, customComponents, ...rest }) => {
|
|
309
313
|
const reactContent = React16.useMemo(() => {
|
|
310
314
|
if (!content) return null;
|
|
311
|
-
const { text: preprocessed, placeholders } = alertMarkClean(content);
|
|
315
|
+
const { text: preprocessed, placeholders } = alertMarkClean(filterMarkdown(content));
|
|
312
316
|
let rawHtml = md.render(preprocessed);
|
|
313
317
|
rawHtml = searchValue ? highlightKeywords(rawHtml, [searchValue]) : rawHtml;
|
|
314
318
|
let lazyIndex = -1;
|
|
@@ -1227,6 +1231,19 @@ function formatSize(value, options = {}) {
|
|
|
1227
1231
|
}
|
|
1228
1232
|
return `${toFixed(size, precision2, !trimZero)}${UNIT_LIST[index]}`;
|
|
1229
1233
|
}
|
|
1234
|
+
var markdownToText = (() => {
|
|
1235
|
+
const md2 = new markdownit__default.default({
|
|
1236
|
+
html: true,
|
|
1237
|
+
linkify: true,
|
|
1238
|
+
typographer: false
|
|
1239
|
+
});
|
|
1240
|
+
return (markdown) => {
|
|
1241
|
+
if (!isString(markdown)) return "";
|
|
1242
|
+
const html = md2.render(markdown);
|
|
1243
|
+
const text = html.replace(/<[^>]+>/g, "").replace(/\s+/g, " ").replace(/"/g, '"').replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/'/g, "'").trim();
|
|
1244
|
+
return text;
|
|
1245
|
+
};
|
|
1246
|
+
})();
|
|
1230
1247
|
|
|
1231
1248
|
// src/hooks/useDeepEffect.ts
|
|
1232
1249
|
var useDeepEffect_default = (effect, deps) => {
|
|
@@ -2050,10 +2067,10 @@ var PdfPreview_default = ({ password, fileUrl, pageNo = 1, scale = 1, isHasThumb
|
|
|
2050
2067
|
] }) })
|
|
2051
2068
|
] }) }) });
|
|
2052
2069
|
};
|
|
2053
|
-
var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue }) => {
|
|
2070
|
+
var FilePreview_default = ({ suffix, fileUrl, pdfParams, password, searchValue, emptyProps }) => {
|
|
2054
2071
|
const Preview = React16.useMemo(() => {
|
|
2055
2072
|
if (!fileUrl) {
|
|
2056
|
-
return /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, {});
|
|
2073
|
+
return /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { ...emptyProps });
|
|
2057
2074
|
}
|
|
2058
2075
|
switch (suffix?.toUpperCase()) {
|
|
2059
2076
|
case "PNG":
|
|
@@ -6096,6 +6113,7 @@ exports.isSet = isSet;
|
|
|
6096
6113
|
exports.isString = isString;
|
|
6097
6114
|
exports.isUnDef = isUnDef;
|
|
6098
6115
|
exports.isWindow = isWindow;
|
|
6116
|
+
exports.markdownToText = markdownToText;
|
|
6099
6117
|
exports.minus = minus;
|
|
6100
6118
|
exports.objToOptions = objToOptions;
|
|
6101
6119
|
exports.plus = plus;
|