md-editor-v3 4.1.1 → 4.2.0-beta.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 +13 -8
- package/lib/cjs/MdEditor.cjs +14 -14
- package/lib/cjs/chunks/index.cjs +1 -1
- package/lib/cjs/index.cjs +1 -1
- package/lib/es/MdEditor.mjs +357 -335
- package/lib/es/chunks/index.mjs +2 -2
- package/lib/es/index.mjs +15 -14
- package/lib/types/MdEditor/layouts/Content/codemirror/index.d.ts +2 -1
- package/lib/types/MdEditor/type.d.ts +11 -2
- package/lib/umd/index.js +28 -28
- package/package.json +1 -1
package/lib/es/chunks/index.mjs
CHANGED
|
@@ -637,8 +637,8 @@ const Q = "onSave", Y = "changeCatalogVisible", Ce = "changeFullscreen", V = "pa
|
|
|
637
637
|
insert(i) {
|
|
638
638
|
y.emit(a, "replace", "universal", { generate: i });
|
|
639
639
|
},
|
|
640
|
-
focus() {
|
|
641
|
-
y.emit(a, Se);
|
|
640
|
+
focus(i) {
|
|
641
|
+
y.emit(a, Se, i);
|
|
642
642
|
}
|
|
643
643
|
};
|
|
644
644
|
o.expose(c);
|
package/lib/es/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { default as
|
|
2
|
-
import { M as
|
|
3
|
-
import { default as
|
|
4
|
-
import { D as
|
|
5
|
-
import { M as
|
|
6
|
-
import { default as
|
|
7
|
-
import { c as
|
|
1
|
+
import { default as C } from "./MdEditor.mjs";
|
|
2
|
+
import { M as N } from "./chunks/index.mjs";
|
|
3
|
+
import { default as h } from "./NormalToolbar.mjs";
|
|
4
|
+
import { D as k } from "./chunks/index2.mjs";
|
|
5
|
+
import { M as y } from "./chunks/index3.mjs";
|
|
6
|
+
import { default as A } from "./MdCatalog.mjs";
|
|
7
|
+
import { c as F } from "./chunks/config.mjs";
|
|
8
8
|
import "vue";
|
|
9
9
|
import "./chunks/index4.mjs";
|
|
10
10
|
import "@vavt/util";
|
|
@@ -13,6 +13,7 @@ import "codemirror";
|
|
|
13
13
|
import "@codemirror/view";
|
|
14
14
|
import "@codemirror/language-data";
|
|
15
15
|
import "@codemirror/lang-markdown";
|
|
16
|
+
import "@codemirror/lang-html";
|
|
16
17
|
import "@codemirror/commands";
|
|
17
18
|
import "@codemirror/language";
|
|
18
19
|
import "@lezer/highlight";
|
|
@@ -26,11 +27,11 @@ import "markdown-it-image-figures";
|
|
|
26
27
|
import "markdown-it-task-lists";
|
|
27
28
|
import "lru-cache";
|
|
28
29
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
k as DropdownToolbar,
|
|
31
|
+
A as MdCatalog,
|
|
32
|
+
C as MdEditor,
|
|
33
|
+
N as MdPreview,
|
|
34
|
+
y as ModalToolbar,
|
|
35
|
+
h as NormalToolbar,
|
|
36
|
+
F as config
|
|
36
37
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Extension } from '@codemirror/state';
|
|
2
2
|
import { EditorView } from '@codemirror/view';
|
|
3
|
+
import { FocusOption } from '../../../../MdEditor/type';
|
|
3
4
|
export default class CodeMirrorUt {
|
|
4
5
|
view: EditorView;
|
|
5
6
|
private toggleTabSize;
|
|
@@ -49,7 +50,7 @@ export default class CodeMirrorUt {
|
|
|
49
50
|
* @param t 目标内容
|
|
50
51
|
*/
|
|
51
52
|
setPlaceholder(t: string): void;
|
|
52
|
-
focus(): void;
|
|
53
|
+
focus(options: FocusOption): void;
|
|
53
54
|
setDisabled(d: boolean): void;
|
|
54
55
|
setReadOnly(r: boolean): void;
|
|
55
56
|
setMaxLength(ml: number): void;
|
|
@@ -215,9 +215,11 @@ export interface ConfigOption {
|
|
|
215
215
|
*
|
|
216
216
|
* @params theme 当前主题
|
|
217
217
|
* @params innerExtensions 当前主题下的扩展列表
|
|
218
|
-
* [keymap, minimalSetup, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
218
|
+
* [keymap, minimalSetup, html, markdown, EditorView.lineWrapping, EditorView.updateListener, EditorView.domEventHandlers, oneDark??oneLight]
|
|
219
219
|
* [快捷键, 最低配置, markdown识别, 横向自动换行, 更新事件, dom监听事件, oneDark主题(暗夜模式下), oneLight(默认模式下)]
|
|
220
220
|
*
|
|
221
|
+
* 如果要添加其他自带的扩展,比如java,注意添加到markdown之前,不然自动提示不正常
|
|
222
|
+
*
|
|
221
223
|
* @params keyBindings md-editor-v3内置的快捷键
|
|
222
224
|
*/
|
|
223
225
|
codeMirrorExtensions?: (theme: Themes, extensions: Array<Extension>, keyBindings: Array<KeyBinding>) => Array<Extension>;
|
|
@@ -264,6 +266,11 @@ export interface InsertParam {
|
|
|
264
266
|
deviationEnd: number;
|
|
265
267
|
}
|
|
266
268
|
export type InsertContentGenerator = (selectedText: string) => InsertParam;
|
|
269
|
+
export type FocusOption = 'start' | 'end' | {
|
|
270
|
+
rangeAnchor?: number;
|
|
271
|
+
rangeHead?: number;
|
|
272
|
+
cursorPos: number;
|
|
273
|
+
};
|
|
267
274
|
export interface ExposeParam {
|
|
268
275
|
/**
|
|
269
276
|
* 添加事件监听
|
|
@@ -323,8 +330,10 @@ export interface ExposeParam {
|
|
|
323
330
|
insert(generate: InsertContentGenerator): void;
|
|
324
331
|
/**
|
|
325
332
|
* 手动聚焦
|
|
333
|
+
*
|
|
334
|
+
* @param options 聚焦时光标的位置,不提供默认上次失焦时的位置
|
|
326
335
|
*/
|
|
327
|
-
focus(): void;
|
|
336
|
+
focus(options?: FocusOption): void;
|
|
328
337
|
}
|
|
329
338
|
export type EditorProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof editorProps>>>>;
|
|
330
339
|
export type MdPreviewProps = Readonly<LooseRequired<Readonly<ExtractPropTypes<typeof mdPreviewProps>>>>;
|