md-editor-v3 4.19.0-1 → 4.19.0-2
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/lib/cjs/chunks/config.cjs +18 -18
- package/lib/cjs/chunks/index.cjs +4 -1
- package/lib/cjs/chunks/index4.cjs +2 -2
- package/lib/es/chunks/config.mjs +18 -18
- package/lib/es/chunks/index.mjs +4 -1
- package/lib/es/chunks/index4.mjs +2 -2
- package/lib/types/MdEditor/config.d.ts +1 -1
- package/lib/types/MdEditor/utils/index.d.ts +1 -1
- package/lib/umd/index.js +3 -3
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ const prefix = "md-editor";
|
|
|
4
4
|
const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.js";
|
|
5
5
|
const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.css";
|
|
6
6
|
const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
7
|
-
const highlightUrl = `${cdnBase}/highlight.js/11.
|
|
7
|
+
const highlightUrl = `${cdnBase}/highlight.js/11.10.0/highlight.min.js`;
|
|
8
8
|
const prettierUrl = {
|
|
9
9
|
main: `${cdnBase}/prettier/2.8.0/standalone.js`,
|
|
10
10
|
markdown: `${cdnBase}/prettier/2.8.0/parser-markdown.js`
|
|
@@ -223,42 +223,42 @@ const katexUrl = {
|
|
|
223
223
|
};
|
|
224
224
|
const codeCss = {
|
|
225
225
|
a11y: {
|
|
226
|
-
light: `${cdnBase}/highlight.js/11.
|
|
227
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
226
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/a11y-light.min.css`,
|
|
227
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/a11y-dark.min.css`
|
|
228
228
|
},
|
|
229
229
|
atom: {
|
|
230
|
-
light: `${cdnBase}/highlight.js/11.
|
|
231
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
230
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/atom-one-light.min.css`,
|
|
231
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/atom-one-dark.min.css`
|
|
232
232
|
},
|
|
233
233
|
github: {
|
|
234
|
-
light: `${cdnBase}/highlight.js/11.
|
|
235
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
234
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/github.min.css`,
|
|
235
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/github-dark.min.css`
|
|
236
236
|
},
|
|
237
237
|
gradient: {
|
|
238
|
-
light: `${cdnBase}/highlight.js/11.
|
|
239
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
238
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/gradient-light.min.css`,
|
|
239
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/gradient-dark.min.css`
|
|
240
240
|
},
|
|
241
241
|
kimbie: {
|
|
242
|
-
light: `${cdnBase}/highlight.js/11.
|
|
243
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
242
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/kimbie-light.min.css`,
|
|
243
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/kimbie-dark.min.css`
|
|
244
244
|
},
|
|
245
245
|
paraiso: {
|
|
246
|
-
light: `${cdnBase}/highlight.js/11.
|
|
247
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
246
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/paraiso-light.min.css`,
|
|
247
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/paraiso-dark.min.css`
|
|
248
248
|
},
|
|
249
249
|
qtcreator: {
|
|
250
|
-
light: `${cdnBase}/highlight.js/11.
|
|
251
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
250
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/qtcreator-light.min.css`,
|
|
251
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/qtcreator-dark.min.css`
|
|
252
252
|
},
|
|
253
253
|
stackoverflow: {
|
|
254
|
-
light: `${cdnBase}/highlight.js/11.
|
|
255
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
254
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/stackoverflow-light.min.css`,
|
|
255
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/stackoverflow-dark.min.css`
|
|
256
256
|
}
|
|
257
257
|
};
|
|
258
258
|
const editorExtensionsAttrs = {
|
|
259
259
|
highlight: {
|
|
260
260
|
js: {
|
|
261
|
-
integrity: "sha384-
|
|
261
|
+
integrity: "sha384-GdEWAbCjn+ghjX0gLx7/N1hyTVmPAjdC2OvoAA0RyNcAOhqwtT8qnbCxWle2+uJX",
|
|
262
262
|
crossOrigin: "anonymous"
|
|
263
263
|
},
|
|
264
264
|
css: {
|
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -2238,7 +2238,10 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2238
2238
|
} else {
|
|
2239
2239
|
codeHtml = md.utils.escapeHtml(str);
|
|
2240
2240
|
}
|
|
2241
|
-
const codeSpan = showCodeRowNumber ? index$1.generateCodeRowNumber(
|
|
2241
|
+
const codeSpan = showCodeRowNumber ? index$1.generateCodeRowNumber(
|
|
2242
|
+
codeHtml.replace(/^\n+|\n+$/g, ""),
|
|
2243
|
+
str.replace(/^\n+|\n+$/g, "")
|
|
2244
|
+
) : `<span class="${config.prefix}-code-block">${codeHtml.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
2242
2245
|
return `<pre><code class="language-${language}" language=${language}>${codeSpan}</code></pre>`;
|
|
2243
2246
|
}
|
|
2244
2247
|
});
|
|
@@ -15,11 +15,11 @@ const base642File = (base64, fileName = "image.png") => {
|
|
|
15
15
|
}
|
|
16
16
|
return null;
|
|
17
17
|
};
|
|
18
|
-
const generateCodeRowNumber = (code) => {
|
|
18
|
+
const generateCodeRowNumber = (code, source) => {
|
|
19
19
|
if (!code) {
|
|
20
20
|
return code;
|
|
21
21
|
}
|
|
22
|
-
const list =
|
|
22
|
+
const list = source.split("\n");
|
|
23
23
|
const rowNumberList = ['<span rn-wrapper aria-hidden="true">'];
|
|
24
24
|
list.forEach(() => {
|
|
25
25
|
rowNumberList.push("<span></span>");
|
package/lib/es/chunks/config.mjs
CHANGED
|
@@ -3,7 +3,7 @@ const prefix = "md-editor";
|
|
|
3
3
|
const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.js";
|
|
4
4
|
const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.css";
|
|
5
5
|
const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
6
|
-
const highlightUrl = `${cdnBase}/highlight.js/11.
|
|
6
|
+
const highlightUrl = `${cdnBase}/highlight.js/11.10.0/highlight.min.js`;
|
|
7
7
|
const prettierUrl = {
|
|
8
8
|
main: `${cdnBase}/prettier/2.8.0/standalone.js`,
|
|
9
9
|
markdown: `${cdnBase}/prettier/2.8.0/parser-markdown.js`
|
|
@@ -222,42 +222,42 @@ const katexUrl = {
|
|
|
222
222
|
};
|
|
223
223
|
const codeCss = {
|
|
224
224
|
a11y: {
|
|
225
|
-
light: `${cdnBase}/highlight.js/11.
|
|
226
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
225
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/a11y-light.min.css`,
|
|
226
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/a11y-dark.min.css`
|
|
227
227
|
},
|
|
228
228
|
atom: {
|
|
229
|
-
light: `${cdnBase}/highlight.js/11.
|
|
230
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
229
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/atom-one-light.min.css`,
|
|
230
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/atom-one-dark.min.css`
|
|
231
231
|
},
|
|
232
232
|
github: {
|
|
233
|
-
light: `${cdnBase}/highlight.js/11.
|
|
234
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
233
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/github.min.css`,
|
|
234
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/github-dark.min.css`
|
|
235
235
|
},
|
|
236
236
|
gradient: {
|
|
237
|
-
light: `${cdnBase}/highlight.js/11.
|
|
238
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
237
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/gradient-light.min.css`,
|
|
238
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/gradient-dark.min.css`
|
|
239
239
|
},
|
|
240
240
|
kimbie: {
|
|
241
|
-
light: `${cdnBase}/highlight.js/11.
|
|
242
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
241
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/kimbie-light.min.css`,
|
|
242
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/kimbie-dark.min.css`
|
|
243
243
|
},
|
|
244
244
|
paraiso: {
|
|
245
|
-
light: `${cdnBase}/highlight.js/11.
|
|
246
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
245
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/paraiso-light.min.css`,
|
|
246
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/paraiso-dark.min.css`
|
|
247
247
|
},
|
|
248
248
|
qtcreator: {
|
|
249
|
-
light: `${cdnBase}/highlight.js/11.
|
|
250
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
249
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/qtcreator-light.min.css`,
|
|
250
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/qtcreator-dark.min.css`
|
|
251
251
|
},
|
|
252
252
|
stackoverflow: {
|
|
253
|
-
light: `${cdnBase}/highlight.js/11.
|
|
254
|
-
dark: `${cdnBase}/highlight.js/11.
|
|
253
|
+
light: `${cdnBase}/highlight.js/11.10.0/styles/stackoverflow-light.min.css`,
|
|
254
|
+
dark: `${cdnBase}/highlight.js/11.10.0/styles/stackoverflow-dark.min.css`
|
|
255
255
|
}
|
|
256
256
|
};
|
|
257
257
|
const editorExtensionsAttrs = {
|
|
258
258
|
highlight: {
|
|
259
259
|
js: {
|
|
260
|
-
integrity: "sha384-
|
|
260
|
+
integrity: "sha384-GdEWAbCjn+ghjX0gLx7/N1hyTVmPAjdC2OvoAA0RyNcAOhqwtT8qnbCxWle2+uJX",
|
|
261
261
|
crossOrigin: "anonymous"
|
|
262
262
|
},
|
|
263
263
|
css: {
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -2237,7 +2237,10 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2237
2237
|
} else {
|
|
2238
2238
|
codeHtml = md.utils.escapeHtml(str);
|
|
2239
2239
|
}
|
|
2240
|
-
const codeSpan = showCodeRowNumber ? generateCodeRowNumber(
|
|
2240
|
+
const codeSpan = showCodeRowNumber ? generateCodeRowNumber(
|
|
2241
|
+
codeHtml.replace(/^\n+|\n+$/g, ""),
|
|
2242
|
+
str.replace(/^\n+|\n+$/g, "")
|
|
2243
|
+
) : `<span class="${prefix}-code-block">${codeHtml.replace(/^\n+|\n+$/g, "")}</span>`;
|
|
2241
2244
|
return `<pre><code class="language-${language}" language=${language}>${codeSpan}</code></pre>`;
|
|
2242
2245
|
}
|
|
2243
2246
|
});
|
package/lib/es/chunks/index4.mjs
CHANGED
|
@@ -14,11 +14,11 @@ const base642File = (base64, fileName = "image.png") => {
|
|
|
14
14
|
}
|
|
15
15
|
return null;
|
|
16
16
|
};
|
|
17
|
-
const generateCodeRowNumber = (code) => {
|
|
17
|
+
const generateCodeRowNumber = (code, source) => {
|
|
18
18
|
if (!code) {
|
|
19
19
|
return code;
|
|
20
20
|
}
|
|
21
|
-
const list =
|
|
21
|
+
const list = source.split("\n");
|
|
22
22
|
const rowNumberList = ['<span rn-wrapper aria-hidden="true">'];
|
|
23
23
|
list.forEach(() => {
|
|
24
24
|
rowNumberList.push("<span></span>");
|
|
@@ -4,7 +4,7 @@ export declare const defaultEditorId = "md-editor-v3";
|
|
|
4
4
|
export declare const iconfontSvgUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.js";
|
|
5
5
|
export declare const iconfontClassUrl = "https://at.alicdn.com/t/c/font_2605852_cmafimm6hot.css";
|
|
6
6
|
export declare const cdnBase = "https://cdnjs.cloudflare.com/ajax/libs";
|
|
7
|
-
export declare const highlightUrl = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.
|
|
7
|
+
export declare const highlightUrl = "https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js";
|
|
8
8
|
export declare const prettierUrl: {
|
|
9
9
|
main: string;
|
|
10
10
|
markdown: string;
|
|
@@ -13,7 +13,7 @@ export declare const base642File: (base64: string, fileName?: string) => File |
|
|
|
13
13
|
* @param code 代码html内容
|
|
14
14
|
* @returns string
|
|
15
15
|
*/
|
|
16
|
-
export declare const generateCodeRowNumber: (code: string) => string;
|
|
16
|
+
export declare const generateCodeRowNumber: (code: string, source: string) => string;
|
|
17
17
|
/**
|
|
18
18
|
* 逻辑分离katex相关文本
|
|
19
19
|
* 不再采用正确匹配,会导致性能问题
|