@yltrcc/vditor 0.0.7 → 0.0.8
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.css +2 -2
- package/dist/index.js +14 -7
- package/dist/index.min.js +1 -1
- package/dist/method.js +3 -3
- package/dist/method.min.js +1 -1
- package/dist/ts/wysiwyg/index.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/package.json +79 -79
- package/src/ts/constants.ts +90 -90
- package/src/ts/markdown/docLink.ts +202 -202
- package/src/ts/toolbar/Info.ts +43 -43
- package/src/ts/util/Options.ts +455 -454
- package/src/ts/wysiwyg/afterRenderEvent.ts +54 -47
- package/src/ts/wysiwyg/highlightToolbarWYSIWYG.ts +1156 -1156
- package/src/ts/wysiwyg/index.ts +2 -1
|
@@ -1,47 +1,54 @@
|
|
|
1
|
-
import {processDocLinkInWYSIWYG} from "../markdown/docLink";
|
|
2
|
-
import {getMarkdown} from "../markdown/getMarkdown";
|
|
3
|
-
import {accessLocalStorage} from "../util/compatibility";
|
|
4
|
-
|
|
5
|
-
export const afterRenderEvent = (vditor: IVditor, options = {
|
|
6
|
-
enableAddUndoStack: true,
|
|
7
|
-
enableHint: false,
|
|
8
|
-
enableInput: true,
|
|
9
|
-
}) => {
|
|
10
|
-
if (options.enableHint) {
|
|
11
|
-
vditor.hint.render(vditor);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if (vditor.
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
1
|
+
import {processDocLinkInWYSIWYG} from "../markdown/docLink";
|
|
2
|
+
import {getMarkdown} from "../markdown/getMarkdown";
|
|
3
|
+
import {accessLocalStorage} from "../util/compatibility";
|
|
4
|
+
|
|
5
|
+
export const afterRenderEvent = (vditor: IVditor, options = {
|
|
6
|
+
enableAddUndoStack: true,
|
|
7
|
+
enableHint: false,
|
|
8
|
+
enableInput: true,
|
|
9
|
+
}) => {
|
|
10
|
+
if (options.enableHint) {
|
|
11
|
+
vditor.hint.render(vditor);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// 处理文档链接渲染 - 独立执行,使用单独的延迟时间
|
|
15
|
+
if (vditor.wysiwyg.element) {
|
|
16
|
+
clearTimeout(vditor.wysiwyg.docLinkRenderTimeoutId);
|
|
17
|
+
vditor.wysiwyg.docLinkRenderTimeoutId = window.setTimeout(() => {
|
|
18
|
+
if (!vditor.wysiwyg.composingLock) {
|
|
19
|
+
processDocLinkInWYSIWYG(vditor.wysiwyg.element, vditor);
|
|
20
|
+
}
|
|
21
|
+
}, vditor.options.docLinkDelay || 50);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// 处理其他操作 - 使用主延迟时间
|
|
25
|
+
clearTimeout(vditor.wysiwyg.afterRenderTimeoutId);
|
|
26
|
+
vditor.wysiwyg.afterRenderTimeoutId = window.setTimeout(() => {
|
|
27
|
+
if (vditor.wysiwyg.composingLock) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
const text = getMarkdown(vditor);
|
|
31
|
+
if (typeof vditor.options.input === "function" && options.enableInput) {
|
|
32
|
+
vditor.options.input(text);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
if (vditor.options.counter.enable) {
|
|
36
|
+
vditor.counter.render(vditor, text);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (vditor.options.cache.enable && accessLocalStorage()) {
|
|
40
|
+
localStorage.setItem(vditor.options.cache.id, text);
|
|
41
|
+
if (vditor.options.cache.after) {
|
|
42
|
+
vditor.options.cache.after(text);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (vditor.devtools) {
|
|
47
|
+
vditor.devtools.renderEchart(vditor);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (options.enableAddUndoStack) {
|
|
51
|
+
vditor.undo.addToUndoStack(vditor);
|
|
52
|
+
}
|
|
53
|
+
}, vditor.options.undoDelay);
|
|
54
|
+
};
|