md-editor-v3 4.19.2 → 4.20.1
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 +18 -46
- package/lib/cjs/MdEditor.cjs +22 -12
- package/lib/cjs/chunks/config.cjs +5 -1
- package/lib/cjs/chunks/index.cjs +17 -1
- package/lib/es/MdEditor.mjs +22 -12
- package/lib/es/chunks/config.mjs +5 -1
- package/lib/es/chunks/index.mjs +17 -1
- package/lib/types/MdEditor/layouts/Content/composition/useResize.d.ts +1 -0
- package/lib/types/MdEditor/layouts/Content/type.d.ts +2 -0
- package/lib/types/MdEditor/type.d.ts +7 -1
- package/lib/umd/index.js +27 -27
- package/package.json +4 -3
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# 🎄 md-editor-v3
|
|
2
2
|
|
|
3
|
-
   
|
|
3
|
+
    
|
|
4
4
|
|
|
5
5
|
English \| [中文](https://github.com/imzbf/md-editor-v3/blob/develop/README-CN.md)
|
|
6
6
|
|
|
@@ -392,41 +392,19 @@ onMounted(() => {
|
|
|
392
392
|
|
|
393
393
|
Get the internal state of the editor, including pageFullscreen, fullscreen, preview, htmlPreview, catalog, etc.
|
|
394
394
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
editorRef.value?.on('fullscreen', (status) => console.log(status));
|
|
405
|
-
```
|
|
406
|
-
|
|
407
|
-
- preview
|
|
408
|
-
|
|
409
|
-
```js
|
|
410
|
-
editorRef.value?.on('preview', (status) => console.log(status));
|
|
411
|
-
```
|
|
412
|
-
|
|
413
|
-
- previewOnly
|
|
414
|
-
|
|
415
|
-
```js
|
|
416
|
-
editorRef.value?.on('previewOnly', (status) => console.log(status));
|
|
417
|
-
```
|
|
418
|
-
|
|
419
|
-
- htmlPreview
|
|
420
|
-
|
|
421
|
-
```js
|
|
422
|
-
editorRef.value?.on('htmlPreview', (status) => console.log(status));
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
- catalog
|
|
395
|
+
```ts
|
|
396
|
+
type Keys =
|
|
397
|
+
| 'pageFullscreen'
|
|
398
|
+
| 'fullscreen'
|
|
399
|
+
| 'preview'
|
|
400
|
+
| 'previewOnly'
|
|
401
|
+
| 'htmlPreview'
|
|
402
|
+
| 'catalog';
|
|
403
|
+
```
|
|
426
404
|
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
405
|
+
```js
|
|
406
|
+
editorRef.value?.on('pageFullscreen', (status) => console.log(status));
|
|
407
|
+
```
|
|
430
408
|
|
|
431
409
|
### 💻 togglePageFullscreen
|
|
432
410
|
|
|
@@ -478,9 +456,7 @@ editorRef.value?.toggleCatalog(true);
|
|
|
478
456
|
|
|
479
457
|
### 💾 triggerSave
|
|
480
458
|
|
|
481
|
-
|
|
482
|
-
editorRef.value?.triggerSave();
|
|
483
|
-
```
|
|
459
|
+
Save actions will be triggered.
|
|
484
460
|
|
|
485
461
|
### 💉 insert
|
|
486
462
|
|
|
@@ -525,18 +501,10 @@ editorRef.value?.focus(option);
|
|
|
525
501
|
|
|
526
502
|
Re render the content.
|
|
527
503
|
|
|
528
|
-
```js
|
|
529
|
-
editorRef.value?.rerender();
|
|
530
|
-
```
|
|
531
|
-
|
|
532
504
|
### 🔍 getSelectedText
|
|
533
505
|
|
|
534
506
|
Get the currently selected text.
|
|
535
507
|
|
|
536
|
-
```js
|
|
537
|
-
console.log(editorRef.value?.getSelectedText());
|
|
538
|
-
```
|
|
539
|
-
|
|
540
508
|
### 🗑 resetHistory
|
|
541
509
|
|
|
542
510
|
Clear current history.
|
|
@@ -561,6 +529,10 @@ Insert content into the editor via trigger.
|
|
|
561
529
|
editorRef.value?.execCommand('bold');
|
|
562
530
|
```
|
|
563
531
|
|
|
532
|
+
### 🔖 getEditorView
|
|
533
|
+
|
|
534
|
+
Get codemirror instance.
|
|
535
|
+
|
|
564
536
|
## 💴 Config Editor
|
|
565
537
|
|
|
566
538
|
Use `config(option: ConfigOption)` to reconfigure `markdown-it` and so on.
|
package/lib/cjs/MdEditor.cjs
CHANGED
|
@@ -1358,15 +1358,15 @@ const directive2flag = async (direct, codeMirrorUt, params) => {
|
|
|
1358
1358
|
break;
|
|
1359
1359
|
}
|
|
1360
1360
|
case "sub": {
|
|
1361
|
-
targetValue =
|
|
1362
|
-
deviationStart =
|
|
1363
|
-
deviationEnd = -
|
|
1361
|
+
targetValue = `~${selectedText}~`;
|
|
1362
|
+
deviationStart = 1;
|
|
1363
|
+
deviationEnd = -1;
|
|
1364
1364
|
break;
|
|
1365
1365
|
}
|
|
1366
1366
|
case "sup": {
|
|
1367
|
-
targetValue =
|
|
1368
|
-
deviationStart =
|
|
1369
|
-
deviationEnd = -
|
|
1367
|
+
targetValue = `^${selectedText}^`;
|
|
1368
|
+
deviationStart = 1;
|
|
1369
|
+
deviationEnd = -1;
|
|
1370
1370
|
break;
|
|
1371
1371
|
}
|
|
1372
1372
|
case "codeRow": {
|
|
@@ -2423,7 +2423,8 @@ const useCodeMirror = (props2) => {
|
|
|
2423
2423
|
return config.configOption.codeMirrorExtensions(
|
|
2424
2424
|
theme.value,
|
|
2425
2425
|
extensions,
|
|
2426
|
-
getDefaultKeymaps()
|
|
2426
|
+
getDefaultKeymaps(),
|
|
2427
|
+
{ editorId }
|
|
2427
2428
|
);
|
|
2428
2429
|
};
|
|
2429
2430
|
vue.onMounted(() => {
|
|
@@ -2620,6 +2621,7 @@ const useResize = (props2, contentRef, resizeRef) => {
|
|
|
2620
2621
|
left: props2.inputBoxWitdh,
|
|
2621
2622
|
display: "initial"
|
|
2622
2623
|
});
|
|
2624
|
+
const showPreviewWrapper = vue.ref(props2.setting.preview || props2.setting.htmlPreview);
|
|
2623
2625
|
const resizeMousemove = (e) => {
|
|
2624
2626
|
var _a, _b, _c;
|
|
2625
2627
|
const maxWidth = ((_a = contentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
@@ -2678,19 +2680,22 @@ const useResize = (props2, contentRef, resizeRef) => {
|
|
|
2678
2680
|
if (props2.setting.previewOnly) {
|
|
2679
2681
|
inputWrapperStyle.width = "0%";
|
|
2680
2682
|
resizeOperateStyle.display = "none";
|
|
2683
|
+
showPreviewWrapper.value = true;
|
|
2681
2684
|
} else if (!props2.setting.htmlPreview && !props2.setting.preview) {
|
|
2682
2685
|
inputWrapperStyle.width = "100%";
|
|
2683
2686
|
resizeOperateStyle.display = "none";
|
|
2687
|
+
showPreviewWrapper.value = false;
|
|
2684
2688
|
} else {
|
|
2685
2689
|
inputWrapperStyle.width = state2.resizedWidth;
|
|
2686
2690
|
resizeOperateStyle.display = "initial";
|
|
2691
|
+
showPreviewWrapper.value = true;
|
|
2687
2692
|
}
|
|
2688
2693
|
},
|
|
2689
2694
|
{
|
|
2690
2695
|
immediate: true
|
|
2691
2696
|
}
|
|
2692
2697
|
);
|
|
2693
|
-
return { inputWrapperStyle, resizeOperateStyle };
|
|
2698
|
+
return { inputWrapperStyle, resizeOperateStyle, showPreviewWrapper };
|
|
2694
2699
|
};
|
|
2695
2700
|
const Content = /* @__PURE__ */ vue.defineComponent({
|
|
2696
2701
|
name: "MDEditorContent",
|
|
@@ -2707,7 +2712,8 @@ const Content = /* @__PURE__ */ vue.defineComponent({
|
|
|
2707
2712
|
} = useCodeMirror(props2);
|
|
2708
2713
|
const {
|
|
2709
2714
|
inputWrapperStyle,
|
|
2710
|
-
resizeOperateStyle
|
|
2715
|
+
resizeOperateStyle,
|
|
2716
|
+
showPreviewWrapper
|
|
2711
2717
|
} = useResize(props2, contentRef, resizeRef);
|
|
2712
2718
|
useAutoScroll(props2, html, codeMirrorUt);
|
|
2713
2719
|
ctx.expose({
|
|
@@ -2719,11 +2725,15 @@ const Content = /* @__PURE__ */ vue.defineComponent({
|
|
|
2719
2725
|
var _a;
|
|
2720
2726
|
(_a = codeMirrorUt.value) == null ? void 0 : _a.focus(options);
|
|
2721
2727
|
},
|
|
2722
|
-
resetHistory
|
|
2728
|
+
resetHistory,
|
|
2729
|
+
getEditorView() {
|
|
2730
|
+
var _a;
|
|
2731
|
+
return (_a = codeMirrorUt.value) == null ? void 0 : _a.view;
|
|
2732
|
+
}
|
|
2723
2733
|
});
|
|
2724
2734
|
return () => {
|
|
2725
2735
|
return vue.createVNode("div", {
|
|
2726
|
-
"class": `${config.prefix}-content${
|
|
2736
|
+
"class": `${config.prefix}-content${showPreviewWrapper.value ? " has-preview" : ""}`,
|
|
2727
2737
|
"ref": contentRef
|
|
2728
2738
|
}, [vue.createVNode("div", {
|
|
2729
2739
|
"class": `${config.prefix}-input-wrapper`,
|
|
@@ -2733,7 +2743,7 @@ const Content = /* @__PURE__ */ vue.defineComponent({
|
|
|
2733
2743
|
"class": `${config.prefix}-resize-operate`,
|
|
2734
2744
|
"style": resizeOperateStyle,
|
|
2735
2745
|
"ref": resizeRef
|
|
2736
|
-
}, null), vue.createVNode(MdPreview.ContentPreview, {
|
|
2746
|
+
}, null), showPreviewWrapper.value && vue.createVNode(MdPreview.ContentPreview, {
|
|
2737
2747
|
"modelValue": props2.modelValue,
|
|
2738
2748
|
"onChange": props2.onChange,
|
|
2739
2749
|
"setting": props2.setting,
|
|
@@ -436,7 +436,11 @@ const configOption = {
|
|
|
436
436
|
katexConfig: (c) => c
|
|
437
437
|
};
|
|
438
438
|
const config = (option) => {
|
|
439
|
-
return util.deepMerge(configOption, option
|
|
439
|
+
return util.deepMerge(configOption, option, {
|
|
440
|
+
excludeKeys(key) {
|
|
441
|
+
return /[iI]{1}nstance/.test(key);
|
|
442
|
+
}
|
|
443
|
+
});
|
|
440
444
|
};
|
|
441
445
|
const MinInputBoxWidth = 170;
|
|
442
446
|
exports.MinInputBoxWidth = MinInputBoxWidth;
|
package/lib/cjs/chunks/index.cjs
CHANGED
|
@@ -8,6 +8,8 @@ const mediumZoom = require("medium-zoom");
|
|
|
8
8
|
const copy = require("copy-to-clipboard");
|
|
9
9
|
const mdit = require("markdown-it");
|
|
10
10
|
const ImageFiguresPlugin = require("markdown-it-image-figures");
|
|
11
|
+
const SubPlugin = require("markdown-it-sub");
|
|
12
|
+
const SupPlugin = require("markdown-it-sup");
|
|
11
13
|
const index$1 = require("./index5.cjs");
|
|
12
14
|
const lruCache = require("lru-cache");
|
|
13
15
|
function _mergeNamespaces(n, m) {
|
|
@@ -583,7 +585,7 @@ const HeadingPlugin = (md, options) => {
|
|
|
583
585
|
var _a;
|
|
584
586
|
const token = tokens[idx];
|
|
585
587
|
const text = ((_a = tokens[idx + 1].children) == null ? void 0 : _a.reduce((p, c) => {
|
|
586
|
-
return p + (["text", "code_inline"].includes(c.type) ? c.content || "" : "");
|
|
588
|
+
return p + (["text", "code_inline", "math_inline"].includes(c.type) ? c.content || "" : "");
|
|
587
589
|
}, "")) || "";
|
|
588
590
|
const level = token.markup.length;
|
|
589
591
|
options.headsRef.value.push({
|
|
@@ -2161,6 +2163,16 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2161
2163
|
type: "xss",
|
|
2162
2164
|
plugin: XSSPlugin,
|
|
2163
2165
|
options: {}
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
type: "sub",
|
|
2169
|
+
plugin: SubPlugin,
|
|
2170
|
+
options: {}
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
type: "sup",
|
|
2174
|
+
plugin: SupPlugin,
|
|
2175
|
+
options: {}
|
|
2164
2176
|
}
|
|
2165
2177
|
];
|
|
2166
2178
|
if (!props.noKatex) {
|
|
@@ -2932,6 +2944,10 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
|
|
|
2932
2944
|
},
|
|
2933
2945
|
execCommand(direct) {
|
|
2934
2946
|
eventName.bus.emit(editorId, eventName.REPLACE, direct);
|
|
2947
|
+
},
|
|
2948
|
+
getEditorView() {
|
|
2949
|
+
var _a;
|
|
2950
|
+
return (_a = codeRef.value) == null ? void 0 : _a.getEditorView();
|
|
2935
2951
|
}
|
|
2936
2952
|
};
|
|
2937
2953
|
ctx.expose(exposeParam);
|
package/lib/es/MdEditor.mjs
CHANGED
|
@@ -1357,15 +1357,15 @@ const directive2flag = async (direct, codeMirrorUt, params) => {
|
|
|
1357
1357
|
break;
|
|
1358
1358
|
}
|
|
1359
1359
|
case "sub": {
|
|
1360
|
-
targetValue =
|
|
1361
|
-
deviationStart =
|
|
1362
|
-
deviationEnd = -
|
|
1360
|
+
targetValue = `~${selectedText}~`;
|
|
1361
|
+
deviationStart = 1;
|
|
1362
|
+
deviationEnd = -1;
|
|
1363
1363
|
break;
|
|
1364
1364
|
}
|
|
1365
1365
|
case "sup": {
|
|
1366
|
-
targetValue =
|
|
1367
|
-
deviationStart =
|
|
1368
|
-
deviationEnd = -
|
|
1366
|
+
targetValue = `^${selectedText}^`;
|
|
1367
|
+
deviationStart = 1;
|
|
1368
|
+
deviationEnd = -1;
|
|
1369
1369
|
break;
|
|
1370
1370
|
}
|
|
1371
1371
|
case "codeRow": {
|
|
@@ -2422,7 +2422,8 @@ const useCodeMirror = (props2) => {
|
|
|
2422
2422
|
return configOption.codeMirrorExtensions(
|
|
2423
2423
|
theme.value,
|
|
2424
2424
|
extensions,
|
|
2425
|
-
getDefaultKeymaps()
|
|
2425
|
+
getDefaultKeymaps(),
|
|
2426
|
+
{ editorId }
|
|
2426
2427
|
);
|
|
2427
2428
|
};
|
|
2428
2429
|
onMounted(() => {
|
|
@@ -2619,6 +2620,7 @@ const useResize = (props2, contentRef, resizeRef) => {
|
|
|
2619
2620
|
left: props2.inputBoxWitdh,
|
|
2620
2621
|
display: "initial"
|
|
2621
2622
|
});
|
|
2623
|
+
const showPreviewWrapper = ref(props2.setting.preview || props2.setting.htmlPreview);
|
|
2622
2624
|
const resizeMousemove = (e) => {
|
|
2623
2625
|
var _a, _b, _c;
|
|
2624
2626
|
const maxWidth = ((_a = contentRef.value) == null ? void 0 : _a.offsetWidth) || 0;
|
|
@@ -2677,19 +2679,22 @@ const useResize = (props2, contentRef, resizeRef) => {
|
|
|
2677
2679
|
if (props2.setting.previewOnly) {
|
|
2678
2680
|
inputWrapperStyle.width = "0%";
|
|
2679
2681
|
resizeOperateStyle.display = "none";
|
|
2682
|
+
showPreviewWrapper.value = true;
|
|
2680
2683
|
} else if (!props2.setting.htmlPreview && !props2.setting.preview) {
|
|
2681
2684
|
inputWrapperStyle.width = "100%";
|
|
2682
2685
|
resizeOperateStyle.display = "none";
|
|
2686
|
+
showPreviewWrapper.value = false;
|
|
2683
2687
|
} else {
|
|
2684
2688
|
inputWrapperStyle.width = state.resizedWidth;
|
|
2685
2689
|
resizeOperateStyle.display = "initial";
|
|
2690
|
+
showPreviewWrapper.value = true;
|
|
2686
2691
|
}
|
|
2687
2692
|
},
|
|
2688
2693
|
{
|
|
2689
2694
|
immediate: true
|
|
2690
2695
|
}
|
|
2691
2696
|
);
|
|
2692
|
-
return { inputWrapperStyle, resizeOperateStyle };
|
|
2697
|
+
return { inputWrapperStyle, resizeOperateStyle, showPreviewWrapper };
|
|
2693
2698
|
};
|
|
2694
2699
|
const Content = /* @__PURE__ */ defineComponent({
|
|
2695
2700
|
name: "MDEditorContent",
|
|
@@ -2706,7 +2711,8 @@ const Content = /* @__PURE__ */ defineComponent({
|
|
|
2706
2711
|
} = useCodeMirror(props2);
|
|
2707
2712
|
const {
|
|
2708
2713
|
inputWrapperStyle,
|
|
2709
|
-
resizeOperateStyle
|
|
2714
|
+
resizeOperateStyle,
|
|
2715
|
+
showPreviewWrapper
|
|
2710
2716
|
} = useResize(props2, contentRef, resizeRef);
|
|
2711
2717
|
useAutoScroll(props2, html, codeMirrorUt);
|
|
2712
2718
|
ctx.expose({
|
|
@@ -2718,11 +2724,15 @@ const Content = /* @__PURE__ */ defineComponent({
|
|
|
2718
2724
|
var _a;
|
|
2719
2725
|
(_a = codeMirrorUt.value) == null ? void 0 : _a.focus(options);
|
|
2720
2726
|
},
|
|
2721
|
-
resetHistory
|
|
2727
|
+
resetHistory,
|
|
2728
|
+
getEditorView() {
|
|
2729
|
+
var _a;
|
|
2730
|
+
return (_a = codeMirrorUt.value) == null ? void 0 : _a.view;
|
|
2731
|
+
}
|
|
2722
2732
|
});
|
|
2723
2733
|
return () => {
|
|
2724
2734
|
return createVNode("div", {
|
|
2725
|
-
"class": `${prefix}-content${
|
|
2735
|
+
"class": `${prefix}-content${showPreviewWrapper.value ? " has-preview" : ""}`,
|
|
2726
2736
|
"ref": contentRef
|
|
2727
2737
|
}, [createVNode("div", {
|
|
2728
2738
|
"class": `${prefix}-input-wrapper`,
|
|
@@ -2732,7 +2742,7 @@ const Content = /* @__PURE__ */ defineComponent({
|
|
|
2732
2742
|
"class": `${prefix}-resize-operate`,
|
|
2733
2743
|
"style": resizeOperateStyle,
|
|
2734
2744
|
"ref": resizeRef
|
|
2735
|
-
}, null), createVNode(ContentPreview, {
|
|
2745
|
+
}, null), showPreviewWrapper.value && createVNode(ContentPreview, {
|
|
2736
2746
|
"modelValue": props2.modelValue,
|
|
2737
2747
|
"onChange": props2.onChange,
|
|
2738
2748
|
"setting": props2.setting,
|
package/lib/es/chunks/config.mjs
CHANGED
|
@@ -435,7 +435,11 @@ const configOption = {
|
|
|
435
435
|
katexConfig: (c) => c
|
|
436
436
|
};
|
|
437
437
|
const config = (option) => {
|
|
438
|
-
return deepMerge(configOption, option
|
|
438
|
+
return deepMerge(configOption, option, {
|
|
439
|
+
excludeKeys(key) {
|
|
440
|
+
return /[iI]{1}nstance/.test(key);
|
|
441
|
+
}
|
|
442
|
+
});
|
|
439
443
|
};
|
|
440
444
|
const MinInputBoxWidth = 170;
|
|
441
445
|
export {
|
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import mediumZoom from "medium-zoom";
|
|
|
7
7
|
import copy from "copy-to-clipboard";
|
|
8
8
|
import mdit from "markdown-it";
|
|
9
9
|
import ImageFiguresPlugin from "markdown-it-image-figures";
|
|
10
|
+
import SubPlugin from "markdown-it-sub";
|
|
11
|
+
import SupPlugin from "markdown-it-sup";
|
|
10
12
|
import { c as generateCodeRowNumber, d as getNextId } from "./index5.mjs";
|
|
11
13
|
import { LRUCache } from "lru-cache";
|
|
12
14
|
function _mergeNamespaces(n, m) {
|
|
@@ -582,7 +584,7 @@ const HeadingPlugin = (md, options) => {
|
|
|
582
584
|
var _a;
|
|
583
585
|
const token = tokens[idx];
|
|
584
586
|
const text = ((_a = tokens[idx + 1].children) == null ? void 0 : _a.reduce((p, c) => {
|
|
585
|
-
return p + (["text", "code_inline"].includes(c.type) ? c.content || "" : "");
|
|
587
|
+
return p + (["text", "code_inline", "math_inline"].includes(c.type) ? c.content || "" : "");
|
|
586
588
|
}, "")) || "";
|
|
587
589
|
const level = token.markup.length;
|
|
588
590
|
options.headsRef.value.push({
|
|
@@ -2160,6 +2162,16 @@ const useMarkdownIt = (props, previewOnly) => {
|
|
|
2160
2162
|
type: "xss",
|
|
2161
2163
|
plugin: XSSPlugin,
|
|
2162
2164
|
options: {}
|
|
2165
|
+
},
|
|
2166
|
+
{
|
|
2167
|
+
type: "sub",
|
|
2168
|
+
plugin: SubPlugin,
|
|
2169
|
+
options: {}
|
|
2170
|
+
},
|
|
2171
|
+
{
|
|
2172
|
+
type: "sup",
|
|
2173
|
+
plugin: SupPlugin,
|
|
2174
|
+
options: {}
|
|
2163
2175
|
}
|
|
2164
2176
|
];
|
|
2165
2177
|
if (!props.noKatex) {
|
|
@@ -2931,6 +2943,10 @@ const useExpose$1 = (props, ctx, catalogVisible, setting, updateSetting, codeRef
|
|
|
2931
2943
|
},
|
|
2932
2944
|
execCommand(direct) {
|
|
2933
2945
|
bus.emit(editorId, REPLACE, direct);
|
|
2946
|
+
},
|
|
2947
|
+
getEditorView() {
|
|
2948
|
+
var _a;
|
|
2949
|
+
return (_a = codeRef.value) == null ? void 0 : _a.getEditorView();
|
|
2934
2950
|
}
|
|
2935
2951
|
};
|
|
2936
2952
|
ctx.expose(exposeParam);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EditorView } from 'codemirror';
|
|
1
2
|
import { FocusOption } from '../../type';
|
|
2
3
|
export interface ContentExposeParam {
|
|
3
4
|
/**
|
|
@@ -14,4 +15,5 @@ export interface ContentExposeParam {
|
|
|
14
15
|
* 重置已经存在的历史记录
|
|
15
16
|
*/
|
|
16
17
|
resetHistory(): void;
|
|
18
|
+
getEditorView(): EditorView | undefined;
|
|
17
19
|
}
|
|
@@ -277,7 +277,9 @@ export interface ConfigOption {
|
|
|
277
277
|
*
|
|
278
278
|
* @params keyBindings md-editor-v3内置的快捷键
|
|
279
279
|
*/
|
|
280
|
-
codeMirrorExtensions: (theme: Themes, extensions: Array<Extension>, keyBindings: Array<KeyBinding
|
|
280
|
+
codeMirrorExtensions: (theme: Themes, extensions: Array<Extension>, keyBindings: Array<KeyBinding>, options: {
|
|
281
|
+
editorId: string;
|
|
282
|
+
}) => Array<Extension>;
|
|
281
283
|
/**
|
|
282
284
|
* 自定义markdown-it核心库扩展、属性等
|
|
283
285
|
*/
|
|
@@ -469,6 +471,10 @@ export interface ExposeParam {
|
|
|
469
471
|
* @param direct
|
|
470
472
|
*/
|
|
471
473
|
execCommand(direct: ToolDirective): void;
|
|
474
|
+
/**
|
|
475
|
+
* 获取编辑器实例
|
|
476
|
+
*/
|
|
477
|
+
getEditorView(): EditorView | undefined;
|
|
472
478
|
}
|
|
473
479
|
export type ExposePreviewParam = Pick<ExposeParam, 'rerender'>;
|
|
474
480
|
export type EditorProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>;
|