md-editor-v3 2.1.2 → 2.2.0-beta.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/README.md +1 -0
- package/lib/MdEditor/Editor.d.ts +7 -1
- package/lib/MdEditor/index.d.ts +18 -6
- package/lib/MdEditor/type.d.ts +2 -0
- package/lib/md-editor-v3.es.js +69 -56
- package/lib/md-editor-v3.umd.js +64 -64
- package/lib/style.css +1 -1
- package/package.json +10 -13
- package/lib/MdEditor/utils/config.d.ts +0 -3
package/README.md
CHANGED
|
@@ -67,6 +67,7 @@ mark and emoji extensions
|
|
|
67
67
|
| sanitize | (html: string) => string | (html) => html | Sanitize the html, prevent XSS |
|
|
68
68
|
| footers | Array<'markdownTotal' \| '=' \| 'scrollSwitch' \| number> | ['markdownTotal', '=', 'scrollSwitch'] | Show contents of footer, they are divided by `'='`. Set it to `[]` to hidden footer |
|
|
69
69
|
| scrollAuto | boolean | true | Scroll default setting |
|
|
70
|
+
| noIconfont | boolean | false | Not append iconfont script, [download](https://at.alicdn.com/t/font_2605852_pqekijay2ij.js) and import it by yourself |
|
|
70
71
|
|
|
71
72
|
<details>
|
|
72
73
|
<summary>[toolbars]</summary>
|
package/lib/MdEditor/Editor.d.ts
CHANGED
|
@@ -130,6 +130,9 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
130
130
|
defFooters: {
|
|
131
131
|
type: PropType<string | JSX.Element>;
|
|
132
132
|
};
|
|
133
|
+
noIconfont: {
|
|
134
|
+
type: PropType<boolean>;
|
|
135
|
+
};
|
|
133
136
|
}, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
134
137
|
modelValue: {
|
|
135
138
|
type: PropType<string>;
|
|
@@ -259,6 +262,9 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
259
262
|
defFooters: {
|
|
260
263
|
type: PropType<string | JSX.Element>;
|
|
261
264
|
};
|
|
265
|
+
noIconfont: {
|
|
266
|
+
type: PropType<boolean>;
|
|
267
|
+
};
|
|
262
268
|
}>>, {
|
|
263
269
|
pageFullScreen: boolean;
|
|
264
270
|
preview: boolean;
|
|
@@ -274,6 +280,7 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
274
280
|
style: string | CSSProperties;
|
|
275
281
|
class: string;
|
|
276
282
|
scrollAuto: boolean;
|
|
283
|
+
sanitize: (html: string) => string;
|
|
277
284
|
modelValue: string;
|
|
278
285
|
language: string;
|
|
279
286
|
toolbars: ToolbarNames[];
|
|
@@ -281,7 +288,6 @@ declare const Editor: import("vue").DefineComponent<{
|
|
|
281
288
|
markedHeadingId: MarkedHeadingId;
|
|
282
289
|
tableShape: number[];
|
|
283
290
|
noMermaid: boolean;
|
|
284
|
-
sanitize: (html: string) => string;
|
|
285
291
|
placeholder: string;
|
|
286
292
|
noKatex: boolean;
|
|
287
293
|
codeTheme: string;
|
package/lib/MdEditor/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import NormalToolbar from './extensions/NormalToolbar';
|
|
|
3
3
|
import DropdownToolbar from './extensions/DropdownToolbar';
|
|
4
4
|
import MdCatalog from './extensions/MdCatalog';
|
|
5
5
|
import ModalToolbar from './extensions/ModalToolbar';
|
|
6
|
-
import
|
|
6
|
+
import { config } from './config';
|
|
7
7
|
declare const _default: {
|
|
8
8
|
new (...args: any[]): {
|
|
9
9
|
$: import("vue").ComponentInternalInstance;
|
|
@@ -23,6 +23,7 @@ declare const _default: {
|
|
|
23
23
|
style: string | import("vue").CSSProperties;
|
|
24
24
|
class: string;
|
|
25
25
|
scrollAuto: boolean;
|
|
26
|
+
sanitize: (html: string) => string;
|
|
26
27
|
modelValue: string;
|
|
27
28
|
language: string;
|
|
28
29
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -30,7 +31,6 @@ declare const _default: {
|
|
|
30
31
|
markedHeadingId: import("./type").MarkedHeadingId;
|
|
31
32
|
tableShape: number[];
|
|
32
33
|
noMermaid: boolean;
|
|
33
|
-
sanitize: (html: string) => string;
|
|
34
34
|
placeholder: string;
|
|
35
35
|
noKatex: boolean;
|
|
36
36
|
codeTheme: string;
|
|
@@ -164,7 +164,10 @@ declare const _default: {
|
|
|
164
164
|
defFooters: {
|
|
165
165
|
type: import("vue").PropType<string | JSX.Element>;
|
|
166
166
|
};
|
|
167
|
-
|
|
167
|
+
noIconfont: {
|
|
168
|
+
type: import("vue").PropType<boolean>;
|
|
169
|
+
};
|
|
170
|
+
}>> & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, "pageFullScreen" | "preview" | "htmlPreview" | "editorId" | "noPrettier" | "tabWidth" | "theme" | "historyLength" | "previewOnly" | "showCodeRowNumber" | "previewTheme" | "style" | "class" | "scrollAuto" | "sanitize" | "modelValue" | "language" | "toolbars" | "toolbarsExclude" | "markedHeadingId" | "tableShape" | "noMermaid" | "placeholder" | "noKatex" | "codeTheme" | "footers">;
|
|
168
171
|
$attrs: {
|
|
169
172
|
[x: string]: unknown;
|
|
170
173
|
};
|
|
@@ -307,6 +310,9 @@ declare const _default: {
|
|
|
307
310
|
defFooters: {
|
|
308
311
|
type: import("vue").PropType<string | JSX.Element>;
|
|
309
312
|
};
|
|
313
|
+
noIconfont: {
|
|
314
|
+
type: import("vue").PropType<boolean>;
|
|
315
|
+
};
|
|
310
316
|
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, {
|
|
311
317
|
pageFullScreen: boolean;
|
|
312
318
|
preview: boolean;
|
|
@@ -322,6 +328,7 @@ declare const _default: {
|
|
|
322
328
|
style: string | import("vue").CSSProperties;
|
|
323
329
|
class: string;
|
|
324
330
|
scrollAuto: boolean;
|
|
331
|
+
sanitize: (html: string) => string;
|
|
325
332
|
modelValue: string;
|
|
326
333
|
language: string;
|
|
327
334
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -329,7 +336,6 @@ declare const _default: {
|
|
|
329
336
|
markedHeadingId: import("./type").MarkedHeadingId;
|
|
330
337
|
tableShape: number[];
|
|
331
338
|
noMermaid: boolean;
|
|
332
|
-
sanitize: (html: string) => string;
|
|
333
339
|
placeholder: string;
|
|
334
340
|
noKatex: boolean;
|
|
335
341
|
codeTheme: string;
|
|
@@ -483,6 +489,9 @@ declare const _default: {
|
|
|
483
489
|
defFooters: {
|
|
484
490
|
type: import("vue").PropType<string | JSX.Element>;
|
|
485
491
|
};
|
|
492
|
+
noIconfont: {
|
|
493
|
+
type: import("vue").PropType<boolean>;
|
|
494
|
+
};
|
|
486
495
|
}>> & import("vue").ShallowUnwrapRef<() => JSX.Element> & {} & {} & import("vue").ComponentCustomProperties;
|
|
487
496
|
__isFragment?: undefined;
|
|
488
497
|
__isTeleport?: undefined;
|
|
@@ -616,6 +625,9 @@ declare const _default: {
|
|
|
616
625
|
defFooters: {
|
|
617
626
|
type: import("vue").PropType<string | JSX.Element>;
|
|
618
627
|
};
|
|
628
|
+
noIconfont: {
|
|
629
|
+
type: import("vue").PropType<boolean>;
|
|
630
|
+
};
|
|
619
631
|
}>>, () => JSX.Element, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, "onSave" | "onError" | "onUploadImg" | "onChange" | "onHtmlChanged" | "onGetCatalog" | "update:modelValue", {
|
|
620
632
|
pageFullScreen: boolean;
|
|
621
633
|
preview: boolean;
|
|
@@ -631,6 +643,7 @@ declare const _default: {
|
|
|
631
643
|
style: string | import("vue").CSSProperties;
|
|
632
644
|
class: string;
|
|
633
645
|
scrollAuto: boolean;
|
|
646
|
+
sanitize: (html: string) => string;
|
|
634
647
|
modelValue: string;
|
|
635
648
|
language: string;
|
|
636
649
|
toolbars: import("./type").ToolbarNames[];
|
|
@@ -638,7 +651,6 @@ declare const _default: {
|
|
|
638
651
|
markedHeadingId: import("./type").MarkedHeadingId;
|
|
639
652
|
tableShape: number[];
|
|
640
653
|
noMermaid: boolean;
|
|
641
|
-
sanitize: (html: string) => string;
|
|
642
654
|
placeholder: string;
|
|
643
655
|
noKatex: boolean;
|
|
644
656
|
codeTheme: string;
|
|
@@ -648,7 +660,7 @@ declare const _default: {
|
|
|
648
660
|
readonly DropdownToolbar: typeof DropdownToolbar;
|
|
649
661
|
readonly MdCatalog: typeof MdCatalog;
|
|
650
662
|
readonly ModalToolbar: typeof ModalToolbar;
|
|
651
|
-
readonly config: typeof
|
|
663
|
+
readonly config: typeof config;
|
|
652
664
|
install: (app: App) => App;
|
|
653
665
|
};
|
|
654
666
|
export default _default;
|
package/lib/MdEditor/type.d.ts
CHANGED
package/lib/md-editor-v3.es.js
CHANGED
|
@@ -264,6 +264,23 @@ const codeCss = {
|
|
|
264
264
|
dark: `${cdnBase}/highlight.js/11.5.1/styles/stackoverflow-dark.min.css`
|
|
265
265
|
}
|
|
266
266
|
};
|
|
267
|
+
const configOption = {
|
|
268
|
+
markedRenderer: (r) => r,
|
|
269
|
+
markedExtensions: [],
|
|
270
|
+
markedOptions: {},
|
|
271
|
+
editorExtensions: {},
|
|
272
|
+
editorConfig: {}
|
|
273
|
+
};
|
|
274
|
+
const config = (option) => {
|
|
275
|
+
if (option) {
|
|
276
|
+
for (const key in option) {
|
|
277
|
+
const optionItem = option[key];
|
|
278
|
+
if (optionItem) {
|
|
279
|
+
configOption[key] = optionItem;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
};
|
|
267
284
|
class Bus {
|
|
268
285
|
constructor() {
|
|
269
286
|
this.pools = {};
|
|
@@ -771,10 +788,10 @@ const useKeyBoard = (props2, context) => {
|
|
|
771
788
|
}
|
|
772
789
|
});
|
|
773
790
|
};
|
|
774
|
-
const useProvide = (props2
|
|
791
|
+
const useProvide = (props2) => {
|
|
775
792
|
var _a;
|
|
776
793
|
const { editorId } = props2;
|
|
777
|
-
const highlightConfig = (_a =
|
|
794
|
+
const highlightConfig = (_a = configOption == null ? void 0 : configOption.editorExtensions) == null ? void 0 : _a.highlight;
|
|
778
795
|
provide("editorId", editorId);
|
|
779
796
|
provide("tabWidth", props2.tabWidth);
|
|
780
797
|
provide("theme", computed(() => props2.theme));
|
|
@@ -790,7 +807,7 @@ const useProvide = (props2, extension) => {
|
|
|
790
807
|
provide("showCodeRowNumber", props2.showCodeRowNumber);
|
|
791
808
|
const usedLanguageText = computed(() => {
|
|
792
809
|
var _a2;
|
|
793
|
-
const allText = __spreadValues(__spreadValues({}, staticTextDefault), (_a2 =
|
|
810
|
+
const allText = __spreadValues(__spreadValues({}, staticTextDefault), (_a2 = configOption == null ? void 0 : configOption.editorConfig) == null ? void 0 : _a2.languageUserDefined);
|
|
794
811
|
if (allText[props2.language]) {
|
|
795
812
|
return allText[props2.language];
|
|
796
813
|
} else {
|
|
@@ -799,39 +816,44 @@ const useProvide = (props2, extension) => {
|
|
|
799
816
|
});
|
|
800
817
|
provide("usedLanguageText", usedLanguageText);
|
|
801
818
|
provide("previewTheme", computed(() => props2.previewTheme));
|
|
802
|
-
provide("extension", extension);
|
|
803
819
|
};
|
|
804
|
-
const useExpansion = (props2
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
820
|
+
const useExpansion = (props2) => {
|
|
821
|
+
var _a, _b, _c, _d, _e, _f;
|
|
822
|
+
const { noPrettier, previewOnly, noIconfont } = props2;
|
|
823
|
+
const { editorExtensions } = configOption;
|
|
824
|
+
const noPrettierScript = noPrettier || !!((_b = (_a = configOption.editorExtensions) == null ? void 0 : _a.prettier) == null ? void 0 : _b.prettierInstance);
|
|
825
|
+
const noParserMarkdownScript = noPrettier || !!((_d = (_c = configOption.editorExtensions) == null ? void 0 : _c.prettier) == null ? void 0 : _d.parserMarkdownInstance);
|
|
826
|
+
const noCropperScript = !!((_f = (_e = configOption.editorExtensions) == null ? void 0 : _e.cropper) == null ? void 0 : _f.instance);
|
|
809
827
|
onMounted(() => {
|
|
810
|
-
var
|
|
828
|
+
var _a2, _b2, _c2, _d2;
|
|
811
829
|
const iconfontScript = document.createElement("script");
|
|
812
|
-
iconfontScript.src = (
|
|
830
|
+
iconfontScript.src = (editorExtensions == null ? void 0 : editorExtensions.iconfont) || iconfontUrl;
|
|
813
831
|
iconfontScript.id = `${prefix}-icon`;
|
|
814
832
|
const prettierScript = document.createElement("script");
|
|
815
833
|
const prettierMDScript = document.createElement("script");
|
|
816
|
-
prettierScript.src = ((
|
|
834
|
+
prettierScript.src = ((_a2 = editorExtensions == null ? void 0 : editorExtensions.prettier) == null ? void 0 : _a2.standaloneJs) || prettierUrl.main;
|
|
817
835
|
prettierScript.id = `${prefix}-prettier`;
|
|
818
|
-
prettierMDScript.src = ((
|
|
836
|
+
prettierMDScript.src = ((_b2 = editorExtensions == null ? void 0 : editorExtensions.prettier) == null ? void 0 : _b2.parserMarkdownJs) || prettierUrl.markdown;
|
|
819
837
|
prettierMDScript.id = `${prefix}-prettierMD`;
|
|
820
838
|
const cropperLink = document.createElement("link");
|
|
821
839
|
cropperLink.rel = "stylesheet";
|
|
822
|
-
cropperLink.href = ((
|
|
840
|
+
cropperLink.href = ((_c2 = editorExtensions == null ? void 0 : editorExtensions.cropper) == null ? void 0 : _c2.css) || cropperUrl.css;
|
|
823
841
|
cropperLink.id = `${prefix}-cropperCss`;
|
|
824
842
|
const cropperScript = document.createElement("script");
|
|
825
|
-
cropperScript.src = ((
|
|
843
|
+
cropperScript.src = ((_d2 = editorExtensions == null ? void 0 : editorExtensions.cropper) == null ? void 0 : _d2.js) || cropperUrl.js;
|
|
826
844
|
cropperScript.id = `${prefix}-cropper`;
|
|
827
845
|
if (!previewOnly) {
|
|
828
|
-
|
|
829
|
-
|
|
846
|
+
if (!noIconfont) {
|
|
847
|
+
appendHandler(iconfontScript);
|
|
848
|
+
}
|
|
849
|
+
if (!noCropperScript) {
|
|
830
850
|
appendHandler(cropperLink);
|
|
831
851
|
appendHandler(cropperScript);
|
|
832
852
|
}
|
|
833
|
-
if (!
|
|
853
|
+
if (!noPrettierScript) {
|
|
834
854
|
appendHandler(prettierScript);
|
|
855
|
+
}
|
|
856
|
+
if (!noParserMarkdownScript) {
|
|
835
857
|
appendHandler(prettierMDScript);
|
|
836
858
|
}
|
|
837
859
|
}
|
|
@@ -1343,8 +1365,7 @@ var ClipModal = defineComponent({
|
|
|
1343
1365
|
var _a, _b;
|
|
1344
1366
|
const ult = inject("usedLanguageText");
|
|
1345
1367
|
const editorId = inject("editorId");
|
|
1346
|
-
|
|
1347
|
-
let Cropper = (_b = (_a = extension == null ? void 0 : extension.editorExtensions) == null ? void 0 : _a.cropper) == null ? void 0 : _b.instance;
|
|
1368
|
+
let Cropper = (_b = (_a = configOption == null ? void 0 : configOption.editorExtensions) == null ? void 0 : _a.cropper) == null ? void 0 : _b.instance;
|
|
1348
1369
|
const uploadRef = ref();
|
|
1349
1370
|
const uploadImgRef = ref();
|
|
1350
1371
|
const previewTargetRef = ref();
|
|
@@ -1521,9 +1542,8 @@ const useSreenfull = (props2) => {
|
|
|
1521
1542
|
var _a, _b, _c, _d;
|
|
1522
1543
|
const editorId = inject("editorId");
|
|
1523
1544
|
const previewOnly = inject("previewOnly");
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
const screenfullJs = (_d = (_c = extension.editorExtensions) == null ? void 0 : _c.screenfull) == null ? void 0 : _d.js;
|
|
1545
|
+
let screenfull = (_b = (_a = configOption.editorExtensions) == null ? void 0 : _a.screenfull) == null ? void 0 : _b.instance;
|
|
1546
|
+
const screenfullJs = (_d = (_c = configOption.editorExtensions) == null ? void 0 : _c.screenfull) == null ? void 0 : _d.js;
|
|
1527
1547
|
const screenfullMe = ref(false);
|
|
1528
1548
|
const fullScreenHandler = () => {
|
|
1529
1549
|
if (!screenfull) {
|
|
@@ -4875,13 +4895,14 @@ const splitHelp = (textarea) => {
|
|
|
4875
4895
|
};
|
|
4876
4896
|
};
|
|
4877
4897
|
const directive2flag = (direct, selectedText = "", inputArea, params) => {
|
|
4898
|
+
var _a, _b, _c, _d, _e;
|
|
4878
4899
|
let targetValue = "";
|
|
4879
4900
|
let deviationStart = 0;
|
|
4880
4901
|
let deviationEnd = 0;
|
|
4881
4902
|
let select = false;
|
|
4882
4903
|
let prefixVal;
|
|
4883
4904
|
let subfixVal;
|
|
4884
|
-
const mermaidTemplate =
|
|
4905
|
+
const mermaidTemplate = (_a = configOption.editorConfig) == null ? void 0 : _a.mermaidTemplate;
|
|
4885
4906
|
if (/^h[1-6]{1}$/.test(direct)) {
|
|
4886
4907
|
const pix = direct.replace(/^h(\d)/, (_, num) => {
|
|
4887
4908
|
return new Array(Number(num)).fill("#", 0, num).join("");
|
|
@@ -4889,16 +4910,20 @@ const directive2flag = (direct, selectedText = "", inputArea, params) => {
|
|
|
4889
4910
|
targetValue = `${pix} ${selectedText}`;
|
|
4890
4911
|
deviationStart = pix.length + 1;
|
|
4891
4912
|
} else if (direct === "prettier") {
|
|
4892
|
-
|
|
4913
|
+
const prettier = window.prettier || ((_c = (_b = configOption.editorExtensions) == null ? void 0 : _b.prettier) == null ? void 0 : _c.prettierInstance);
|
|
4914
|
+
const prettierPlugins = window.prettierPlugins || [
|
|
4915
|
+
(_e = (_d = configOption.editorExtensions) == null ? void 0 : _d.prettier) == null ? void 0 : _e.parserMarkdownInstance
|
|
4916
|
+
];
|
|
4917
|
+
if (!prettier || prettierPlugins[0] === void 0) {
|
|
4893
4918
|
bus.emit(params.editorId, "errorCatcher", {
|
|
4894
4919
|
name: "prettier",
|
|
4895
4920
|
message: "prettier is undefined"
|
|
4896
4921
|
});
|
|
4897
4922
|
return inputArea.value;
|
|
4898
4923
|
}
|
|
4899
|
-
return
|
|
4924
|
+
return prettier.format(inputArea.value, {
|
|
4900
4925
|
parser: "markdown",
|
|
4901
|
-
plugins:
|
|
4926
|
+
plugins: prettierPlugins
|
|
4902
4927
|
});
|
|
4903
4928
|
} else {
|
|
4904
4929
|
switch (direct) {
|
|
@@ -5396,7 +5421,7 @@ const useMarked = (props2, mermaidData) => {
|
|
|
5396
5421
|
markedOptions,
|
|
5397
5422
|
editorExtensions,
|
|
5398
5423
|
editorConfig
|
|
5399
|
-
} =
|
|
5424
|
+
} = configOption;
|
|
5400
5425
|
const showCodeRowNumber = inject("showCodeRowNumber");
|
|
5401
5426
|
const editorId = inject("editorId");
|
|
5402
5427
|
const highlightUrl2 = inject("highlight");
|
|
@@ -5437,8 +5462,8 @@ const useMarked = (props2, mermaidData) => {
|
|
|
5437
5462
|
}
|
|
5438
5463
|
return markedCode.call(renderer, code, language, isEscaped);
|
|
5439
5464
|
};
|
|
5440
|
-
renderer.image = (href, title
|
|
5441
|
-
return `<span class="figure"><img src="${href}" title="${title}" alt="${desc}" zoom><span class="figcaption">${desc}</span></span>`;
|
|
5465
|
+
renderer.image = (href, title, desc) => {
|
|
5466
|
+
return `<span class="figure"><img src="${href}" title="${title || ""}" alt="${desc || ""}" zoom><span class="figcaption">${desc || ""}</span></span>`;
|
|
5442
5467
|
};
|
|
5443
5468
|
renderer.listitem = (text, task) => {
|
|
5444
5469
|
if (task) {
|
|
@@ -5482,7 +5507,7 @@ const useMarked = (props2, mermaidData) => {
|
|
|
5482
5507
|
const hljsLang = highlightIns.getLanguage(language);
|
|
5483
5508
|
if (language && hljsLang) {
|
|
5484
5509
|
codeHtml = highlightIns.highlight(code, {
|
|
5485
|
-
language
|
|
5510
|
+
language,
|
|
5486
5511
|
ignoreIllegals: true
|
|
5487
5512
|
}).value;
|
|
5488
5513
|
} else {
|
|
@@ -5518,7 +5543,7 @@ const useMarked = (props2, mermaidData) => {
|
|
|
5518
5543
|
const hljsLang = window.hljs.getLanguage(language);
|
|
5519
5544
|
if (language && hljsLang) {
|
|
5520
5545
|
codeHtml = window.hljs.highlight(code, {
|
|
5521
|
-
language
|
|
5546
|
+
language,
|
|
5522
5547
|
ignoreIllegals: true
|
|
5523
5548
|
}).value;
|
|
5524
5549
|
} else {
|
|
@@ -5634,9 +5659,12 @@ const useAutoScroll = (props2, html, textAreaRef, previewRef, htmlRef) => {
|
|
|
5634
5659
|
});
|
|
5635
5660
|
onMounted(() => {
|
|
5636
5661
|
initCopyEntry();
|
|
5637
|
-
if (!previewOnly &&
|
|
5662
|
+
if (!previewOnly && (previewRef.value || htmlRef.value)) {
|
|
5638
5663
|
[initScrollAuto, clearScrollAuto] = scrollAuto(textAreaRef.value, previewRef.value || htmlRef.value);
|
|
5639
5664
|
}
|
|
5665
|
+
if (props2.scrollAuto) {
|
|
5666
|
+
initScrollAuto();
|
|
5667
|
+
}
|
|
5640
5668
|
});
|
|
5641
5669
|
};
|
|
5642
5670
|
const useAutoGenrator = (props2, textAreaRef) => {
|
|
@@ -5679,7 +5707,6 @@ ${nextOrder}. `, {}));
|
|
|
5679
5707
|
callback(direct, params = {}) {
|
|
5680
5708
|
props2.onChange(directive2flag(direct, selectedText.value, textAreaRef.value, __spreadProps(__spreadValues({}, params), {
|
|
5681
5709
|
tabWidth,
|
|
5682
|
-
mermaidTemplate: props2.mermaidTemplate,
|
|
5683
5710
|
editorId
|
|
5684
5711
|
})));
|
|
5685
5712
|
}
|
|
@@ -5698,7 +5725,7 @@ ${nextOrder}. `, {}));
|
|
|
5698
5725
|
};
|
|
5699
5726
|
const useMermaid = (props2) => {
|
|
5700
5727
|
const theme = inject("theme");
|
|
5701
|
-
const { editorExtensions } =
|
|
5728
|
+
const { editorExtensions } = configOption;
|
|
5702
5729
|
const mermaidConf = editorExtensions == null ? void 0 : editorExtensions.mermaid;
|
|
5703
5730
|
const mermaidData = reactive({
|
|
5704
5731
|
reRender: false,
|
|
@@ -5822,10 +5849,6 @@ var Content = defineComponent({
|
|
|
5822
5849
|
type: Boolean,
|
|
5823
5850
|
default: false
|
|
5824
5851
|
},
|
|
5825
|
-
mermaidTemplate: {
|
|
5826
|
-
type: Object,
|
|
5827
|
-
default: () => ({})
|
|
5828
|
-
},
|
|
5829
5852
|
scrollAuto: {
|
|
5830
5853
|
type: Boolean
|
|
5831
5854
|
}
|
|
@@ -6302,6 +6325,9 @@ const props = {
|
|
|
6302
6325
|
},
|
|
6303
6326
|
defFooters: {
|
|
6304
6327
|
type: [String, Object]
|
|
6328
|
+
},
|
|
6329
|
+
noIconfont: {
|
|
6330
|
+
type: Boolean
|
|
6305
6331
|
}
|
|
6306
6332
|
};
|
|
6307
6333
|
const Editor = defineComponent({
|
|
@@ -6312,20 +6338,19 @@ const Editor = defineComponent({
|
|
|
6312
6338
|
const {
|
|
6313
6339
|
editorId
|
|
6314
6340
|
} = props2;
|
|
6315
|
-
const extension = Editor.extension || {};
|
|
6316
6341
|
const state = reactive({
|
|
6317
6342
|
scrollAuto: props2.scrollAuto
|
|
6318
6343
|
});
|
|
6319
6344
|
useKeyBoard(props2, context);
|
|
6320
|
-
useProvide(props2
|
|
6321
|
-
useExpansion(props2
|
|
6345
|
+
useProvide(props2);
|
|
6346
|
+
useExpansion(props2);
|
|
6322
6347
|
const [setting, updateSetting] = useConfig(props2, context);
|
|
6323
6348
|
const [catalogVisible, catalogShow] = useCatalog(props2);
|
|
6324
6349
|
onBeforeUnmount(() => {
|
|
6325
6350
|
bus.clear(editorId);
|
|
6326
6351
|
});
|
|
6327
6352
|
return () => {
|
|
6328
|
-
var _a
|
|
6353
|
+
var _a;
|
|
6329
6354
|
const defToolbars = getSlot({
|
|
6330
6355
|
props: props2,
|
|
6331
6356
|
ctx: context
|
|
@@ -6377,9 +6402,8 @@ const Editor = defineComponent({
|
|
|
6377
6402
|
"sanitize": props2.sanitize,
|
|
6378
6403
|
"placeholder": props2.placeholder,
|
|
6379
6404
|
"noKatex": props2.noKatex,
|
|
6380
|
-
"mermaidTemplate": (_a = extension == null ? void 0 : extension.editorConfig) == null ? void 0 : _a.mermaidTemplate,
|
|
6381
6405
|
"scrollAuto": state.scrollAuto
|
|
6382
|
-
}, null), !props2.previewOnly && ((
|
|
6406
|
+
}, null), !props2.previewOnly && ((_a = props2.footers) == null ? void 0 : _a.length) > 0 && createVNode(Footer, {
|
|
6383
6407
|
"modelValue": props2.modelValue,
|
|
6384
6408
|
"footers": props2.footers,
|
|
6385
6409
|
"defFooters": defFooters,
|
|
@@ -6578,17 +6602,6 @@ var ModalToolbar = defineComponent({
|
|
|
6578
6602
|
};
|
|
6579
6603
|
}
|
|
6580
6604
|
});
|
|
6581
|
-
const config = function(option = {
|
|
6582
|
-
markedRenderer: (r) => r,
|
|
6583
|
-
markedExtensions: [],
|
|
6584
|
-
markedOptions: {},
|
|
6585
|
-
editorExtensions: {}
|
|
6586
|
-
}) {
|
|
6587
|
-
Reflect.defineProperty(this, "extension", {
|
|
6588
|
-
value: option,
|
|
6589
|
-
enumerable: true
|
|
6590
|
-
});
|
|
6591
|
-
};
|
|
6592
6605
|
Editor.install = (app) => {
|
|
6593
6606
|
app.component(Editor.name, Editor);
|
|
6594
6607
|
app.component(NormalToolbar.name, NormalToolbar);
|