vditor 3.8.13 → 3.8.14
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 +0 -1
- package/dist/index.css +1807 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.min.js +1 -1
- package/dist/js/lute/lute.min.js +1 -1
- package/dist/method.min.js +1 -1
- package/package.json +3 -2
- package/src/assets/{scss/_content.scss → less/_content.less} +8 -9
- package/src/assets/{scss/_hint.scss → less/_hint.less} +0 -0
- package/src/assets/{scss/_ir.scss → less/_ir.less} +4 -4
- package/src/assets/{scss/_panel.scss → less/_panel.less} +4 -4
- package/src/assets/{scss/_reset.scss → less/_reset.less} +13 -13
- package/src/assets/{scss/_sv.scss → less/_sv.less} +1 -2
- package/src/assets/{scss/_toolbar.scss → less/_toolbar.less} +3 -3
- package/src/assets/{scss/_tooltipped.scss → less/_tooltipped.less} +15 -15
- package/src/assets/{scss/_wysiwyg.scss → less/_wysiwyg.less} +3 -3
- package/src/assets/{scss/index.scss → less/index.less} +27 -22
- package/src/index.ts +6 -3
- package/src/ts/tip/index.ts +13 -5
- package/src/ts/ui/initUI.ts +159 -155
- package/src/ts/util/editorCommonEvent.ts +2 -2
|
@@ -1,23 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
@errorColor: #d23f31;
|
|
2
|
+
@blurColor: #4285f4;
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
@font-family-base: "Helvetica Neue", "Luxi Sans", "DejaVu Sans",
|
|
5
|
+
"Hiragino Sans GB", "Microsoft Yahei", sans-serif, "Apple Color Emoji",
|
|
6
|
+
"Segoe UI Emoji", "Noto Color Emoji", "Segoe UI Symbol", "Android Emoji",
|
|
7
|
+
"EmojiSymbols";
|
|
8
|
+
@font-family-code: mononoki, Consolas, "Liberation Mono", Menlo, Courier,
|
|
9
|
+
monospace, "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji",
|
|
10
|
+
"Segoe UI Symbol", "Android Emoji", "EmojiSymbols";
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
@transition: all 0.15s ease-in-out;
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
@max-width: 520px;
|
|
10
15
|
|
|
11
16
|
.vditor {
|
|
12
17
|
--border-color: #d1d5da;
|
|
13
18
|
--second-color: rgba(88, 96, 105, 0.36);
|
|
14
19
|
|
|
15
20
|
--panel-background-color: #fff;
|
|
16
|
-
--panel-shadow: 0 1px 2px rgba(0, 0, 0, .2);
|
|
21
|
+
--panel-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
|
17
22
|
|
|
18
23
|
--toolbar-background-color: #f6f8fa;
|
|
19
24
|
--toolbar-icon-color: #586069;
|
|
20
|
-
--toolbar-icon-hover-color:
|
|
25
|
+
--toolbar-icon-hover-color: @blurColor;
|
|
21
26
|
--toolbar-height: 35px;
|
|
22
27
|
--toolbar-divider-margin-top: 8px;
|
|
23
28
|
|
|
@@ -29,7 +34,7 @@ $max-width: 520px !default;
|
|
|
29
34
|
--resize-hover-icon-color: var(--panel-background-color);
|
|
30
35
|
--resize-hover-background-color: var(--toolbar-icon-hover-color);
|
|
31
36
|
|
|
32
|
-
--count-background-color:rgba(27, 31, 35, .05);
|
|
37
|
+
--count-background-color: rgba(27, 31, 35, 0.05);
|
|
33
38
|
--heading-border-color: #eaecef;
|
|
34
39
|
--blockquote-color: #6a737d;
|
|
35
40
|
|
|
@@ -42,10 +47,10 @@ $max-width: 520px !default;
|
|
|
42
47
|
|
|
43
48
|
&--dark {
|
|
44
49
|
--border-color: #141414;
|
|
45
|
-
--second-color: rgba(185, 185, 185, .36);
|
|
50
|
+
--second-color: rgba(185, 185, 185, 0.36);
|
|
46
51
|
|
|
47
52
|
--panel-background-color: #24292e;
|
|
48
|
-
--panel-shadow: 0 1px 2px rgba(255, 255, 255, .2);
|
|
53
|
+
--panel-shadow: 0 1px 2px rgba(255, 255, 255, 0.2);
|
|
49
54
|
|
|
50
55
|
--toolbar-background-color: #1d2125;
|
|
51
56
|
--toolbar-icon-color: #b9b9b9;
|
|
@@ -57,9 +62,9 @@ $max-width: 520px !default;
|
|
|
57
62
|
--resize-icon-color: var(--border-color);
|
|
58
63
|
--resize-background-color: var(--second-color);
|
|
59
64
|
--resize-hover-icon-color: var(--toolbar-icon-hover-color);
|
|
60
|
-
--resize-hover-background-color: rgba(185, 185, 185, .86);
|
|
65
|
+
--resize-hover-background-color: rgba(185, 185, 185, 0.86);
|
|
61
66
|
|
|
62
|
-
--count-background-color:
|
|
67
|
+
--count-background-color: rgba(@blurColor, 0.36);
|
|
63
68
|
--heading-border-color: var(--textarea-text-color);
|
|
64
69
|
--blockquote-color: var(--toolbar-icon-color);
|
|
65
70
|
|
|
@@ -72,12 +77,12 @@ $max-width: 520px !default;
|
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
79
|
|
|
75
|
-
@import "
|
|
76
|
-
@import "
|
|
77
|
-
@import "
|
|
78
|
-
@import "
|
|
79
|
-
@import "
|
|
80
|
-
@import "
|
|
81
|
-
@import "
|
|
82
|
-
@import "
|
|
83
|
-
@import "
|
|
80
|
+
@import "_tooltipped";
|
|
81
|
+
@import "_panel";
|
|
82
|
+
@import "_toolbar";
|
|
83
|
+
@import "_content";
|
|
84
|
+
@import "_hint";
|
|
85
|
+
@import "_reset";
|
|
86
|
+
@import "_wysiwyg";
|
|
87
|
+
@import "_ir";
|
|
88
|
+
@import "_sv";
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "./assets/
|
|
1
|
+
import "./assets/less/index.less";
|
|
2
2
|
import VditorMethod from "./method";
|
|
3
3
|
import {Constants, VDITOR_VERSION} from "./ts/constants";
|
|
4
4
|
import {DevTools} from "./ts/devtools/index";
|
|
@@ -276,7 +276,7 @@ class Vditor extends VditorMethod {
|
|
|
276
276
|
/** 设置编辑器内容 */
|
|
277
277
|
public setValue(markdown: string, clearStack = false) {
|
|
278
278
|
if (this.vditor.currentMode === "sv") {
|
|
279
|
-
this.vditor.sv.element.innerHTML = this.vditor.lute.SpinVditorSVDOM(markdown)
|
|
279
|
+
this.vditor.sv.element.innerHTML = `<div data-block='0'>${this.vditor.lute.SpinVditorSVDOM(markdown)}</div>`;
|
|
280
280
|
processSVAfterRender(this.vditor, {
|
|
281
281
|
enableAddUndoStack: true,
|
|
282
282
|
enableHint: false,
|
|
@@ -327,7 +327,10 @@ class Vditor extends VditorMethod {
|
|
|
327
327
|
this.vditor.element.innerHTML = this.vditor.originalInnerHTML;
|
|
328
328
|
this.vditor.element.classList.remove("vditor");
|
|
329
329
|
this.vditor.element.removeAttribute("style");
|
|
330
|
-
document.getElementById("vditorIconScript")
|
|
330
|
+
const iconScript = document.getElementById("vditorIconScript")
|
|
331
|
+
if (iconScript) {
|
|
332
|
+
iconScript.remove();
|
|
333
|
+
}
|
|
331
334
|
this.clearCache();
|
|
332
335
|
|
|
333
336
|
UIUnbindListener();
|
package/src/ts/tip/index.ts
CHANGED
|
@@ -8,20 +8,28 @@ export class Tip {
|
|
|
8
8
|
|
|
9
9
|
public show(text: string, time: number = 6000) {
|
|
10
10
|
this.element.className = "vditor-tip vditor-tip--show";
|
|
11
|
-
|
|
12
11
|
if (time === 0) {
|
|
13
12
|
this.element.innerHTML = `<div class="vditor-tip__content">${text}
|
|
14
13
|
<div class="vditor-tip__close">X</div></div>`;
|
|
15
14
|
this.element.querySelector(".vditor-tip__close").addEventListener("click", () => {
|
|
16
15
|
this.hide();
|
|
17
16
|
});
|
|
18
|
-
|
|
17
|
+
} else {
|
|
18
|
+
this.element.innerHTML = `<div class="vditor-tip__content">${text}</div>`;
|
|
19
|
+
setTimeout(() => {
|
|
20
|
+
this.hide();
|
|
21
|
+
}, time);
|
|
19
22
|
}
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
// 需在动画结束后才能确定位置
|
|
25
|
+
this.element.removeAttribute("style")
|
|
22
26
|
setTimeout(() => {
|
|
23
|
-
this.
|
|
24
|
-
|
|
27
|
+
const rect = this.element.getBoundingClientRect();
|
|
28
|
+
if (rect.top < 46) {
|
|
29
|
+
this.element.style.position = "fixed"
|
|
30
|
+
this.element.style.top = "46px"
|
|
31
|
+
}
|
|
32
|
+
}, 150);
|
|
25
33
|
}
|
|
26
34
|
|
|
27
35
|
public hide() {
|
package/src/ts/ui/initUI.ts
CHANGED
|
@@ -6,177 +6,181 @@ import {setContentTheme} from "./setContentTheme";
|
|
|
6
6
|
import {setTheme} from "./setTheme";
|
|
7
7
|
|
|
8
8
|
declare global {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
interface Window {
|
|
10
|
+
visualViewport: HTMLElement;
|
|
11
|
+
}
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export const initUI = (vditor: IVditor) => {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
15
|
+
vditor.element.innerHTML = "";
|
|
16
|
+
vditor.element.classList.add("vditor");
|
|
17
|
+
// 支持 RTL
|
|
18
|
+
if (vditor.options.rtl) {
|
|
19
|
+
vditor.element.setAttribute("dir", "rtl")
|
|
20
|
+
}
|
|
21
|
+
setTheme(vditor);
|
|
22
|
+
setContentTheme(vditor.options.preview.theme.current, vditor.options.preview.theme.path);
|
|
23
|
+
if (typeof vditor.options.height === "number") {
|
|
24
|
+
vditor.element.style.height = vditor.options.height + "px";
|
|
25
|
+
} else {
|
|
26
|
+
vditor.element.style.height = vditor.options.height;
|
|
27
|
+
}
|
|
28
|
+
if (typeof vditor.options.minHeight === "number") {
|
|
29
|
+
vditor.element.style.minHeight = vditor.options.minHeight + "px";
|
|
30
|
+
}
|
|
31
|
+
if (typeof vditor.options.width === "number") {
|
|
32
|
+
vditor.element.style.width = vditor.options.width + "px";
|
|
33
|
+
} else {
|
|
34
|
+
vditor.element.style.width = vditor.options.width;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
vditor.element.appendChild(vditor.toolbar.element);
|
|
38
|
+
|
|
39
|
+
const contentElement = document.createElement("div");
|
|
40
|
+
contentElement.className = "vditor-content";
|
|
41
|
+
|
|
42
|
+
if (vditor.options.outline.position === "left") {
|
|
43
|
+
contentElement.appendChild(vditor.outline.element);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
contentElement.appendChild(vditor.wysiwyg.element.parentElement);
|
|
47
|
+
|
|
48
|
+
contentElement.appendChild(vditor.sv.element);
|
|
49
|
+
|
|
50
|
+
contentElement.appendChild(vditor.ir.element.parentElement);
|
|
51
|
+
|
|
52
|
+
contentElement.appendChild(vditor.preview.element);
|
|
53
|
+
|
|
54
|
+
if (vditor.toolbar.elements.devtools) {
|
|
55
|
+
contentElement.appendChild(vditor.devtools.element);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (vditor.options.outline.position === "right") {
|
|
59
|
+
vditor.outline.element.classList.add("vditor-outline--right");
|
|
60
|
+
contentElement.appendChild(vditor.outline.element);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if (vditor.upload) {
|
|
64
|
+
contentElement.appendChild(vditor.upload.element);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (vditor.options.resize.enable) {
|
|
68
|
+
contentElement.appendChild(vditor.resize.element);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
contentElement.appendChild(vditor.hint.element);
|
|
72
|
+
|
|
73
|
+
contentElement.appendChild(vditor.tip.element);
|
|
74
|
+
|
|
75
|
+
vditor.element.appendChild(contentElement);
|
|
76
|
+
|
|
77
|
+
contentElement.addEventListener("click", () => {
|
|
78
|
+
hidePanel(vditor, ["subToolbar"]);
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
if (vditor.toolbar.elements.export) {
|
|
82
|
+
// for export pdf
|
|
83
|
+
vditor.element.insertAdjacentHTML("beforeend",
|
|
84
|
+
'<iframe style="width: 100%;height: 0;border: 0"></iframe>');
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setEditMode(vditor, vditor.options.mode, afterRender(vditor));
|
|
88
|
+
|
|
89
|
+
document.execCommand("DefaultParagraphSeparator", false, "p");
|
|
90
|
+
|
|
91
|
+
if (navigator.userAgent.indexOf("iPhone") > -1 && typeof window.visualViewport !== "undefined") {
|
|
92
|
+
// https://github.com/Vanessa219/vditor/issues/379
|
|
93
|
+
let pendingUpdate = false;
|
|
94
|
+
const viewportHandler = (event: Event) => {
|
|
95
|
+
if (pendingUpdate) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
pendingUpdate = true;
|
|
99
|
+
|
|
100
|
+
requestAnimationFrame(() => {
|
|
101
|
+
pendingUpdate = false;
|
|
102
|
+
const layoutViewport = vditor.toolbar.element;
|
|
103
|
+
layoutViewport.style.transform = "none";
|
|
104
|
+
if (layoutViewport.getBoundingClientRect().top < 0) {
|
|
105
|
+
layoutViewport.style.transform = `translate(0, ${-layoutViewport.getBoundingClientRect().top}px)`;
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
};
|
|
109
|
+
window.visualViewport.addEventListener("scroll", viewportHandler);
|
|
110
|
+
window.visualViewport.addEventListener("resize", viewportHandler);
|
|
111
|
+
}
|
|
110
112
|
};
|
|
111
113
|
|
|
112
114
|
export const setPadding = (vditor: IVditor) => {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
115
|
+
const minPadding = window.innerWidth <= Constants.MOBILE_WIDTH ? 10 : 35;
|
|
116
|
+
if (vditor.wysiwyg.element.parentElement.style.display !== "none") {
|
|
117
|
+
const padding = (vditor.wysiwyg.element.parentElement.clientWidth
|
|
118
|
+
- vditor.options.preview.maxWidth) / 2;
|
|
119
|
+
vditor.wysiwyg.element.style.padding = `10px ${Math.max(minPadding, padding)}px`;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (vditor.ir.element.parentElement.style.display !== "none") {
|
|
123
|
+
const padding = (vditor.ir.element.parentElement.clientWidth
|
|
124
|
+
- vditor.options.preview.maxWidth) / 2;
|
|
125
|
+
vditor.ir.element.style.padding = `10px ${Math.max(minPadding, padding)}px`;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
if (vditor.preview.element.style.display !== "block") {
|
|
129
|
+
vditor.toolbar.element.style.paddingLeft = Math.max(5,
|
|
130
|
+
parseInt(vditor[vditor.currentMode].element.style.paddingLeft || "0", 10) +
|
|
131
|
+
(vditor.options.outline.position === "left" ? vditor.outline.element.offsetWidth : 0)) + "px";
|
|
132
|
+
} else {
|
|
133
|
+
vditor.toolbar.element.style.paddingLeft = (5 +
|
|
134
|
+
(vditor.options.outline.position === "left" ? vditor.outline.element.offsetWidth : 0)) + "px";
|
|
135
|
+
}
|
|
134
136
|
};
|
|
135
137
|
|
|
136
138
|
export const setTypewriterPosition = (vditor: IVditor) => {
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
139
|
+
if (!vditor.options.typewriterMode) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
let height: number = window.innerHeight;
|
|
143
|
+
if (typeof vditor.options.height === "number") {
|
|
144
|
+
height = vditor.options.height;
|
|
145
|
+
if (typeof vditor.options.minHeight === "number") {
|
|
146
|
+
height = Math.max(height, vditor.options.minHeight);
|
|
147
|
+
}
|
|
148
|
+
height = Math.min(window.innerHeight, height);
|
|
149
|
+
} else {
|
|
150
|
+
height = vditor.element.clientHeight;
|
|
151
|
+
}
|
|
152
|
+
if (vditor.element.classList.contains("vditor--fullscreen")) {
|
|
153
|
+
height = window.innerHeight;
|
|
154
|
+
}
|
|
155
|
+
// 由于 Firefox padding-bottom bug,只能使用 :after
|
|
156
|
+
vditor[vditor.currentMode].element.style.setProperty("--editor-bottom",
|
|
157
|
+
((height - vditor.toolbar.element.offsetHeight) / 2) + "px");
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
let resizeCb: () => void;
|
|
157
161
|
|
|
158
162
|
export function UIUnbindListener() {
|
|
159
|
-
|
|
163
|
+
window.removeEventListener("resize", resizeCb);
|
|
160
164
|
}
|
|
161
165
|
|
|
162
166
|
const afterRender = (vditor: IVditor) => {
|
|
167
|
+
setTypewriterPosition(vditor);
|
|
168
|
+
UIUnbindListener();
|
|
169
|
+
window.addEventListener("resize", resizeCb = () => {
|
|
170
|
+
setPadding(vditor);
|
|
163
171
|
setTypewriterPosition(vditor);
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
initValue = "";
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
return initValue || "";
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
// set default value
|
|
175
|
+
let initValue = accessLocalStorage() && localStorage.getItem(vditor.options.cache.id);
|
|
176
|
+
if (!vditor.options.cache.enable || !initValue) {
|
|
177
|
+
if (vditor.options.value) {
|
|
178
|
+
initValue = vditor.options.value;
|
|
179
|
+
} else if (vditor.originalInnerHTML) {
|
|
180
|
+
initValue = vditor.lute.HTML2Md(vditor.originalInnerHTML);
|
|
181
|
+
} else if (!vditor.options.cache.enable) {
|
|
182
|
+
initValue = "";
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return initValue || "";
|
|
182
186
|
};
|
|
@@ -99,11 +99,11 @@ export const scrollCenter = (vditor: IVditor) => {
|
|
|
99
99
|
}
|
|
100
100
|
const editorElement = vditor[vditor.currentMode].element;
|
|
101
101
|
const cursorTop = getCursorPosition(editorElement).top;
|
|
102
|
-
if (
|
|
102
|
+
if (vditor.options.height === "auto" && !vditor.element.classList.contains("vditor--fullscreen")) {
|
|
103
103
|
window.scrollTo(window.scrollX,
|
|
104
104
|
cursorTop + vditor.element.offsetTop + vditor.toolbar.element.offsetHeight - window.innerHeight / 2 + 10);
|
|
105
105
|
}
|
|
106
|
-
if (
|
|
106
|
+
if (vditor.options.height !== "auto" || vditor.element.classList.contains("vditor--fullscreen")) {
|
|
107
107
|
editorElement.scrollTop = cursorTop + editorElement.scrollTop - editorElement.clientHeight / 2 + 10;
|
|
108
108
|
}
|
|
109
109
|
};
|