vditor 3.10.8 → 3.10.9
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/dist/index.css +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.js +19 -10
- package/dist/index.min.js +1 -1
- package/dist/method.js +4 -4
- package/dist/method.min.js +1 -1
- package/package.json +3 -3
- package/src/index.ts +6 -1
- package/src/ts/markdown/highlightRender.ts +1 -1
- package/src/ts/undo/index.ts +8 -4
- package/src/ts/util/fixBrowserBehavior.ts +2 -2
package/README.md
CHANGED
|
@@ -547,6 +547,7 @@ if (xhr.status === 200) {
|
|
|
547
547
|
| unHlCommentIds(ids: string[]) | 取消评论高亮 |
|
|
548
548
|
| removeCommentIds(removeIds: string[]) | 删除评论 |
|
|
549
549
|
| updateToolbarConfig(config: {hide?: boolean, pin?: boolean}) | 更新工具栏配置 |
|
|
550
|
+
| insertEmptyBlock(position: InsertPosition) | 插入空快 |
|
|
550
551
|
|
|
551
552
|
#### static methods
|
|
552
553
|
|
package/dist/index.css
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v3.10.
|
|
2
|
+
* Vditor v3.10.9 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
/*!
|
|
28
|
-
* Vditor v3.10.
|
|
28
|
+
* Vditor v3.10.9 - A markdown editor written in TypeScript.
|
|
29
29
|
*
|
|
30
30
|
* MIT License
|
|
31
31
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -62,6 +62,8 @@ declare class Vditor extends VditorMethod {
|
|
|
62
62
|
insertMD(md: string): void;
|
|
63
63
|
/** 设置编辑器内容 */
|
|
64
64
|
setValue(markdown: string, clearStack?: boolean): void;
|
|
65
|
+
/** 空块 */
|
|
66
|
+
insertEmptyBlock(position: InsertPosition): void;
|
|
65
67
|
/** 清空 undo & redo 栈 */
|
|
66
68
|
clearStack(): void;
|
|
67
69
|
/** 销毁编辑器 */
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* Vditor v3.10.
|
|
2
|
+
* Vditor v3.10.9 - A markdown editor written in TypeScript.
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
@@ -2633,7 +2633,7 @@ var Vditor = /** @class */ (function () {
|
|
|
2633
2633
|
/* harmony export */ Y: () => (/* binding */ Constants),
|
|
2634
2634
|
/* harmony export */ g: () => (/* binding */ _VDITOR_VERSION)
|
|
2635
2635
|
/* harmony export */ });
|
|
2636
|
-
var _VDITOR_VERSION = "3.10.
|
|
2636
|
+
var _VDITOR_VERSION = "3.10.9";
|
|
2637
2637
|
|
|
2638
2638
|
var Constants = /** @class */ (function () {
|
|
2639
2639
|
function Constants() {
|
|
@@ -2681,7 +2681,7 @@ var Constants = /** @class */ (function () {
|
|
|
2681
2681
|
// 别名
|
|
2682
2682
|
"js", "ts", "html", "toml", "c#", "bat"
|
|
2683
2683
|
];
|
|
2684
|
-
Constants.CDN = "https://unpkg.com/vditor@".concat("3.10.
|
|
2684
|
+
Constants.CDN = "https://unpkg.com/vditor@".concat("3.10.9");
|
|
2685
2685
|
Constants.MARKDOWN_OPTIONS = {
|
|
2686
2686
|
autoSpace: false,
|
|
2687
2687
|
gfmAutoLink: true,
|
|
@@ -3169,7 +3169,7 @@ var highlightRender = function (hljsOption, element, cdn) {
|
|
|
3169
3169
|
if (hljsOption.defaultLang !== "" && block.className.indexOf("language-") === -1) {
|
|
3170
3170
|
block.classList.add("language-" + hljsOption.defaultLang);
|
|
3171
3171
|
}
|
|
3172
|
-
var language =
|
|
3172
|
+
var language = block.className.replace("language-", "");
|
|
3173
3173
|
if (!window.hljs.getLanguage(language)) {
|
|
3174
3174
|
language = "plaintext";
|
|
3175
3175
|
}
|
|
@@ -10786,8 +10786,8 @@ var fixBlockquote = function (vditor, range, event, pElement) {
|
|
|
10786
10786
|
};
|
|
10787
10787
|
var fixTask = function (vditor, range, event) {
|
|
10788
10788
|
var startContainer = range.startContainer;
|
|
10789
|
-
var taskItemElement = (0,hasClosest/*
|
|
10790
|
-
if (taskItemElement) {
|
|
10789
|
+
var taskItemElement = (0,hasClosest/* hasClosestByMatchTag */._Y)(startContainer, "li");
|
|
10790
|
+
if (taskItemElement && taskItemElement.classList.contains("vditor-task")) {
|
|
10791
10791
|
if (matchHotKey("⇧⌘J", event)) {
|
|
10792
10792
|
// ctrl + shift: toggle checked
|
|
10793
10793
|
var inputElement = taskItemElement.firstElementChild;
|
|
@@ -14258,7 +14258,12 @@ var undo_Undo = /** @class */ (function () {
|
|
|
14258
14258
|
vditor[vditor.currentMode].element.querySelectorAll(".vditor-".concat(vditor.currentMode, "__preview"))
|
|
14259
14259
|
.forEach(function (blockElement) {
|
|
14260
14260
|
if (blockElement.parentElement.querySelector(".language-echarts")) {
|
|
14261
|
-
|
|
14261
|
+
if (vditor.currentMode === "ir") {
|
|
14262
|
+
blockElement.parentElement.outerHTML = vditor.lute.SpinVditorIRDOM(blockElement.parentElement.outerHTML);
|
|
14263
|
+
}
|
|
14264
|
+
else {
|
|
14265
|
+
blockElement.parentElement.outerHTML = vditor.lute.SpinVditorDOM(blockElement.parentElement.outerHTML);
|
|
14266
|
+
}
|
|
14262
14267
|
}
|
|
14263
14268
|
});
|
|
14264
14269
|
vditor[vditor.currentMode].element.querySelectorAll(".vditor-".concat(vditor.currentMode, "__preview[data-render='2']"))
|
|
@@ -14332,8 +14337,8 @@ var undo_Undo = /** @class */ (function () {
|
|
|
14332
14337
|
range.insertNode(wbrElement);
|
|
14333
14338
|
}
|
|
14334
14339
|
}
|
|
14335
|
-
// 移除数学公式、echart 渲染 https://github.com/
|
|
14336
|
-
var cloneElement = vditor.
|
|
14340
|
+
// 移除数学公式、echart 渲染 https://github.com/Vanessa219/vditor/issues/1738
|
|
14341
|
+
var cloneElement = vditor[vditor.currentMode].element.cloneNode(true);
|
|
14337
14342
|
cloneElement.querySelectorAll(".vditor-".concat(vditor.currentMode, "__preview[data-render='1']"))
|
|
14338
14343
|
.forEach(function (item) {
|
|
14339
14344
|
if (!item.firstElementChild) {
|
|
@@ -14353,7 +14358,7 @@ var undo_Undo = /** @class */ (function () {
|
|
|
14353
14358
|
item.firstElementChild.removeAttribute("data-math");
|
|
14354
14359
|
}
|
|
14355
14360
|
});
|
|
14356
|
-
var text =
|
|
14361
|
+
var text = cloneElement.innerHTML;
|
|
14357
14362
|
vditor[vditor.currentMode].element.querySelectorAll(".vditor-wbr").forEach(function (item) {
|
|
14358
14363
|
item.remove();
|
|
14359
14364
|
// 使用 item.outerHTML = "" 会产生 https://github.com/Vanessa219/vditor/pull/686;
|
|
@@ -15666,6 +15671,10 @@ var Vditor = /** @class */ (function (_super) {
|
|
|
15666
15671
|
this.clearStack();
|
|
15667
15672
|
}
|
|
15668
15673
|
};
|
|
15674
|
+
/** 空块 */
|
|
15675
|
+
Vditor.prototype.insertEmptyBlock = function (position) {
|
|
15676
|
+
insertEmptyBlock(this.vditor, position);
|
|
15677
|
+
};
|
|
15669
15678
|
/** 清空 undo & redo 栈 */
|
|
15670
15679
|
Vditor.prototype.clearStack = function () {
|
|
15671
15680
|
this.vditor.undo.clearStack(this.vditor);
|