vditor 4.0.2-alpha.2 → 4.0.2-alpha.3

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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v4.0.2-alpha.2 - A markdown editor written in TypeScript.
2
+ * Vditor v4.0.2-alpha.3 - 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 v4.0.2-alpha.2 - A markdown editor written in TypeScript.
28
+ * Vditor v4.0.2-alpha.3 - A markdown editor written in TypeScript.
29
29
  *
30
30
  * MIT License
31
31
  *
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * Vditor v4.0.2-alpha.2 - A markdown editor written in TypeScript.
2
+ * Vditor v4.0.2-alpha.3 - A markdown editor written in TypeScript.
3
3
  *
4
4
  * MIT License
5
5
  *
@@ -2127,8 +2127,8 @@ var codeRender = __webpack_require__(320);
2127
2127
  var flowchartRender = __webpack_require__(386);
2128
2128
  // EXTERNAL MODULE: ./src/ts/markdown/graphvizRender.ts
2129
2129
  var graphvizRender = __webpack_require__(107);
2130
- // EXTERNAL MODULE: ./src/ts/markdown/highlightRender.ts
2131
- var highlightRender = __webpack_require__(552);
2130
+ // EXTERNAL MODULE: ./src/ts/markdown/highlightRender.ts + 1 modules
2131
+ var highlightRender = __webpack_require__(967);
2132
2132
  ;// CONCATENATED MODULE: ./src/ts/markdown/lazyLoadImageRender.ts
2133
2133
  var lazyLoadImageRender = function (element) {
2134
2134
  if (element === void 0) { element = document; }
@@ -2647,7 +2647,7 @@ var Vditor = /** @class */ (function () {
2647
2647
  /* harmony export */ "H": () => (/* binding */ _VDITOR_VERSION),
2648
2648
  /* harmony export */ "g": () => (/* binding */ Constants)
2649
2649
  /* harmony export */ });
2650
- var _VDITOR_VERSION = "4.0.2-alpha.2";
2650
+ var _VDITOR_VERSION = "4.0.2-alpha.3";
2651
2651
 
2652
2652
  var Constants = /** @class */ (function () {
2653
2653
  function Constants() {
@@ -2695,7 +2695,7 @@ var Constants = /** @class */ (function () {
2695
2695
  // 别名
2696
2696
  "js", "ts", "html", "toml", "c#", "bat"
2697
2697
  ];
2698
- Constants.CDN = "https://unpkg.com/vditor@".concat("4.0.2-alpha.2");
2698
+ Constants.CDN = "https://unpkg.com/vditor@".concat("4.0.2-alpha.3");
2699
2699
  Constants.MARKDOWN_OPTIONS = {
2700
2700
  autoSpace: false,
2701
2701
  callout: true,
@@ -3142,24 +3142,70 @@ var graphvizRender = function (element, cdn) {
3142
3142
 
3143
3143
  /***/ }),
3144
3144
 
3145
- /***/ 552:
3145
+ /***/ 967:
3146
3146
  /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3147
3147
 
3148
3148
  "use strict";
3149
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3150
- /* harmony export */ "s": () => (/* binding */ highlightRender)
3151
- /* harmony export */ });
3152
- /* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(428);
3153
- /* harmony import */ var _util_addScript__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(899);
3154
- /* harmony import */ var _util_addStyle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(140);
3149
+
3150
+ // EXPORTS
3151
+ __webpack_require__.d(__webpack_exports__, {
3152
+ "s": () => (/* binding */ highlightRender)
3153
+ });
3154
+
3155
+ // EXTERNAL MODULE: ./src/ts/constants.ts
3156
+ var constants = __webpack_require__(428);
3157
+ // EXTERNAL MODULE: ./src/ts/util/addScript.ts
3158
+ var addScript = __webpack_require__(899);
3159
+ // EXTERNAL MODULE: ./src/ts/util/addStyle.ts
3160
+ var addStyle = __webpack_require__(140);
3161
+ ;// CONCATENATED MODULE: ./src/ts/util/codeSelection.ts
3162
+ var setCodeHighlight = function (code, html) {
3163
+ var selection = getSelection();
3164
+ var endpoints = [selection.anchorNode, selection.focusNode].map(function (node, index) {
3165
+ var offset = index === 0 ? selection.anchorOffset : selection.focusOffset;
3166
+ if (!node || !code.contains(node)) {
3167
+ return { node: node, offset: offset, inside: false };
3168
+ }
3169
+ var range = document.createRange();
3170
+ range.selectNodeContents(code);
3171
+ range.setEnd(node, offset);
3172
+ return { node: node, offset: range.toString().length, inside: true };
3173
+ });
3174
+ code.innerHTML = html;
3175
+ if (!endpoints.some(function (endpoint) { return endpoint.inside; })) {
3176
+ return;
3177
+ }
3178
+ // 高亮会重建嵌套文本节点,按正文偏移恢复正向、反向及跨代码块选区。
3179
+ endpoints.forEach(function (endpoint) {
3180
+ if (!endpoint.inside) {
3181
+ return;
3182
+ }
3183
+ var walker = document.createTreeWalker(code, NodeFilter.SHOW_TEXT);
3184
+ var node = walker.nextNode();
3185
+ while (node) {
3186
+ if (endpoint.offset <= node.textContent.length) {
3187
+ endpoint.node = node;
3188
+ return;
3189
+ }
3190
+ endpoint.offset -= node.textContent.length;
3191
+ node = walker.nextNode();
3192
+ }
3193
+ endpoint.node = code;
3194
+ endpoint.offset = code.childNodes.length;
3195
+ });
3196
+ selection.setBaseAndExtent(endpoints[0].node, endpoints[0].offset, endpoints[1].node, endpoints[1].offset);
3197
+ };
3198
+
3199
+ ;// CONCATENATED MODULE: ./src/ts/markdown/highlightRender.ts
3155
3200
 
3156
3201
 
3157
3202
 
3158
- var highlightRender = function (hljsOption, element, cdn) {
3203
+
3204
+ var highlightRender = function (hljsOption, element, cdn, canRenderEditable) {
3159
3205
  if (element === void 0) { element = document; }
3160
- if (cdn === void 0) { cdn = _constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CDN */ .g.CDN; }
3206
+ if (cdn === void 0) { cdn = constants/* Constants.CDN */.g.CDN; }
3161
3207
  var style = hljsOption.style;
3162
- if (!_constants__WEBPACK_IMPORTED_MODULE_0__/* .Constants.CODE_THEME.includes */ .g.CODE_THEME.includes(style)) {
3208
+ if (!constants/* Constants.CODE_THEME.includes */.g.CODE_THEME.includes(style)) {
3163
3209
  style = "github";
3164
3210
  }
3165
3211
  var vditorHljsStyle = document.getElementById("vditorHljsStyle");
@@ -3167,7 +3213,7 @@ var highlightRender = function (hljsOption, element, cdn) {
3167
3213
  if (vditorHljsStyle && vditorHljsStyle.getAttribute('href') !== href) {
3168
3214
  vditorHljsStyle.remove();
3169
3215
  }
3170
- (0,_util_addStyle__WEBPACK_IMPORTED_MODULE_1__/* .addStyle */ .c)("".concat(cdn, "/dist/js/highlight.js/styles/").concat(style, ".min.css"), "vditorHljsStyle");
3216
+ (0,addStyle/* addStyle */.c)("".concat(cdn, "/dist/js/highlight.js/styles/").concat(style, ".min.css"), "vditorHljsStyle");
3171
3217
  if (hljsOption.enable === false) {
3172
3218
  return;
3173
3219
  }
@@ -3175,12 +3221,15 @@ var highlightRender = function (hljsOption, element, cdn) {
3175
3221
  if (codes.length === 0) {
3176
3222
  return;
3177
3223
  }
3178
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/highlight.js/highlight.min.js?v=11.7.0"), "vditorHljsScript").then(function () {
3179
- (0,_util_addScript__WEBPACK_IMPORTED_MODULE_2__/* .addScript */ .G)("".concat(cdn, "/dist/js/highlight.js/third-languages.js?v=1.0.1"), "vditorHljsThirdScript").then(function () {
3224
+ (0,addScript/* addScript */.G)("".concat(cdn, "/dist/js/highlight.js/highlight.min.js?v=11.7.0"), "vditorHljsScript").then(function () {
3225
+ (0,addScript/* addScript */.G)("".concat(cdn, "/dist/js/highlight.js/third-languages.js?v=1.0.1"), "vditorHljsThirdScript").then(function () {
3180
3226
  element.querySelectorAll("pre > code").forEach(function (block) {
3181
- // ir & wysiwyg 区域不渲染
3182
- if (block.parentElement.classList.contains("vditor-ir__marker--pre") ||
3183
- block.parentElement.classList.contains("vditor-wysiwyg__pre")) {
3227
+ var _a;
3228
+ if (canRenderEditable && (!canRenderEditable() || block.querySelector("wbr"))) {
3229
+ return;
3230
+ }
3231
+ if (!canRenderEditable && (block.parentElement.classList.contains("vditor-ir__marker--pre") ||
3232
+ block.parentElement.classList.contains("vditor-wysiwyg__pre"))) {
3184
3233
  return;
3185
3234
  }
3186
3235
  if (block.classList.contains("language-mermaid") || block.classList.contains("language-flowchart") ||
@@ -3190,19 +3239,27 @@ var highlightRender = function (hljsOption, element, cdn) {
3190
3239
  block.classList.contains("language-math")) {
3191
3240
  return;
3192
3241
  }
3193
- if (hljsOption.defaultLang !== "" && block.className.indexOf("language-") === -1) {
3242
+ if (!canRenderEditable && hljsOption.defaultLang !== "" && block.className.indexOf("language-") === -1) {
3194
3243
  block.classList.add("language-" + hljsOption.defaultLang);
3195
3244
  }
3196
- var language = block.className.replace("language-", "");
3245
+ var language = ((_a = Array.from(block.classList).find(function (name) { return name.startsWith("language-"); })) === null || _a === void 0 ? void 0 : _a.slice(9)) ||
3246
+ hljsOption.defaultLang;
3197
3247
  if (!window.hljs.getLanguage(language)) {
3198
3248
  language = "plaintext";
3199
3249
  }
3200
- block.innerHTML = window.hljs.highlight(block.textContent, {
3250
+ var html = window.hljs.highlight(block.textContent, {
3201
3251
  language: language,
3202
3252
  ignoreIllegals: true
3203
3253
  }).value;
3254
+ if (canRenderEditable) {
3255
+ block.setAttribute("data-code-highlight", "true");
3256
+ setCodeHighlight(block, html);
3257
+ }
3258
+ else {
3259
+ block.innerHTML = html;
3260
+ }
3204
3261
  block.classList.add("hljs");
3205
- if (!hljsOption.lineNumber) {
3262
+ if (canRenderEditable || !hljsOption.lineNumber) {
3206
3263
  return;
3207
3264
  }
3208
3265
  block.classList.add("vditor-linenumber");
@@ -4125,6 +4182,8 @@ var plantumlRender = function (element, cdn) {
4125
4182
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4126
4183
  /* harmony export */ "X": () => (/* binding */ setLute)
4127
4184
  /* harmony export */ });
4185
+ /* harmony import */ var _util_codeDOM__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(9);
4186
+
4128
4187
  var setLute = function (options) {
4129
4188
  var lute = Lute.New();
4130
4189
  lute.PutEmojis(options.emojis);
@@ -4151,6 +4210,13 @@ var setLute = function (options) {
4151
4210
  }
4152
4211
  lute.SetSup(options.sup);
4153
4212
  lute.SetSub(options.sub);
4213
+ // 编辑区的高亮是临时展示,传入 Lute 的代码正文需保留纯文本和光标标记。
4214
+ var conversions = ["SpinVditorDOM", "SpinVditorIRDOM", "VditorDOM2Md", "VditorIRDOM2Md",
4215
+ "VditorDOM2HTML", "VditorIRDOM2HTML"];
4216
+ conversions.forEach(function (name) {
4217
+ var convert = lute[name].bind(lute);
4218
+ lute[name] = function (html) { return convert((0,_util_codeDOM__WEBPACK_IMPORTED_MODULE_0__/* .normalizeCodeHTML */ .C)(html)); };
4219
+ });
4154
4220
  return lute;
4155
4221
  };
4156
4222
 
@@ -4453,6 +4519,38 @@ var code160to32 = function (text) {
4453
4519
  };
4454
4520
 
4455
4521
 
4522
+ /***/ }),
4523
+
4524
+ /***/ 9:
4525
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4526
+
4527
+ "use strict";
4528
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4529
+ /* harmony export */ "M": () => (/* binding */ normalizeCodeDOM),
4530
+ /* harmony export */ "C": () => (/* binding */ normalizeCodeHTML)
4531
+ /* harmony export */ });
4532
+ var normalizeCodeDOM = function (element) {
4533
+ element.querySelectorAll("code[data-code-highlight]").forEach(function (code) {
4534
+ code.removeAttribute("data-code-highlight");
4535
+ code.classList.remove("hljs");
4536
+ code.querySelectorAll("span").forEach(function (span) {
4537
+ if (!span.classList.contains("vditor-wbr")) {
4538
+ span.replaceWith.apply(span, Array.from(span.childNodes));
4539
+ }
4540
+ });
4541
+ });
4542
+ };
4543
+ var normalizeCodeHTML = function (html) {
4544
+ if (!html.includes("data-code-highlight")) {
4545
+ return html;
4546
+ }
4547
+ var element = document.createElement("div");
4548
+ element.innerHTML = html;
4549
+ normalizeCodeDOM(element);
4550
+ return element.innerHTML;
4551
+ };
4552
+
4553
+
4456
4554
  /***/ }),
4457
4555
 
4458
4556
  /***/ 624:
@@ -5375,7 +5473,7 @@ var hidePanel = function (vditor, panels, exceptElement) {
5375
5473
  }
5376
5474
  }
5377
5475
  if (panels.includes("hint")) {
5378
- vditor.hint.element.style.display = "none";
5476
+ vditor.hint.hide();
5379
5477
  }
5380
5478
  if (vditor.wysiwyg.popover && panels.includes("popover")) {
5381
5479
  vditor.wysiwyg.popover.style.display = "none";
@@ -5432,8 +5530,8 @@ var codeRender = __webpack_require__(320);
5432
5530
  var flowchartRender = __webpack_require__(386);
5433
5531
  // EXTERNAL MODULE: ./src/ts/markdown/graphvizRender.ts
5434
5532
  var graphvizRender = __webpack_require__(107);
5435
- // EXTERNAL MODULE: ./src/ts/markdown/highlightRender.ts
5436
- var highlightRender = __webpack_require__(552);
5533
+ // EXTERNAL MODULE: ./src/ts/markdown/highlightRender.ts + 1 modules
5534
+ var highlightRender = __webpack_require__(967);
5437
5535
  // EXTERNAL MODULE: ./src/ts/markdown/mathRender.ts
5438
5536
  var mathRender = __webpack_require__(679);
5439
5537
  // EXTERNAL MODULE: ./src/ts/markdown/mermaidRender.ts
@@ -5505,7 +5603,18 @@ var processPasteCode = function (html, text, type) {
5505
5603
  }
5506
5604
  return false;
5507
5605
  };
5606
+ var highlightEditableCode = function (previewPanel, vditor) {
5607
+ var source = previewPanel.previousElementSibling;
5608
+ var mode = vditor.currentMode;
5609
+ if ((source === null || source === void 0 ? void 0 : source.tagName) === "PRE" && mode !== "sv") {
5610
+ (0,highlightRender/* highlightRender */.s)(vditor.options.preview.hljs, source, vditor.options.cdn, function () {
5611
+ return vditor.currentMode === mode && !vditor[mode].composingLock &&
5612
+ vditor[mode].element.contains(source);
5613
+ });
5614
+ }
5615
+ };
5508
5616
  var processCodeRender = function (previewPanel, vditor) {
5617
+ var _a;
5509
5618
  if (!previewPanel) {
5510
5619
  return;
5511
5620
  }
@@ -5514,7 +5623,8 @@ var processCodeRender = function (previewPanel, vditor) {
5514
5623
  previewPanel.setAttribute("data-render", "1");
5515
5624
  return;
5516
5625
  }
5517
- var language = previewPanel.firstElementChild.className.replace("language-", "");
5626
+ var language = ((_a = previewPanel.firstElementChild.className.split(/\s+/)
5627
+ .find(function (name) { return name.startsWith("language-"); })) === null || _a === void 0 ? void 0 : _a.slice(9)) || "";
5518
5628
  if (language === "abc") {
5519
5629
  (0,abcRender/* abcRender */.Q)(previewPanel, vditor.options.cdn);
5520
5630
  }
@@ -5557,6 +5667,7 @@ var processCodeRender = function (previewPanel, vditor) {
5557
5667
  });
5558
5668
  if (!cRender) {
5559
5669
  previewPanel.classList.add("vditor-code__preview");
5670
+ highlightEditableCode(previewPanel, vditor);
5560
5671
  (0,highlightRender/* highlightRender */.s)(Object.assign({}, vditor.options.preview.hljs), previewPanel, vditor.options.cdn);
5561
5672
  (0,codeRender/* codeRender */.O)(previewPanel, vditor.options.preview.hljs);
5562
5673
  }
@@ -8462,7 +8573,7 @@ var highlightToolbarWYSIWYG = function (vditor) {
8462
8573
  }
8463
8574
  if (event.key === "Escape" &&
8464
8575
  vditor.hint.element.style.display === "block") {
8465
- vditor.hint.element.style.display = "none";
8576
+ vditor.hint.hide();
8466
8577
  event.preventDefault();
8467
8578
  return;
8468
8579
  }
@@ -9737,7 +9848,7 @@ var hotkeyEvent = function (vditor, editorElement) {
9737
9848
  // esc
9738
9849
  if (event.key === "Escape") {
9739
9850
  if (vditor.hint.element.style.display === "block") {
9740
- vditor.hint.element.style.display = "none";
9851
+ vditor.hint.hide();
9741
9852
  }
9742
9853
  else if (vditor.options.esc && !event.isComposing) {
9743
9854
  vditor.options.esc(getMarkdown(vditor));
@@ -11934,8 +12045,14 @@ var Hint = /** @class */ (function () {
11934
12045
  var _this = this;
11935
12046
  this.splitChar = "";
11936
12047
  this.lastIndex = -1;
12048
+ this.requestId = 0;
12049
+ this.dismiss = function (event) {
12050
+ if (!_this.element.contains(event.target)) {
12051
+ _this.hide();
12052
+ }
12053
+ };
11937
12054
  this.fillEmoji = function (element, vditor) {
11938
- _this.element.style.display = "none";
12055
+ _this.hide();
11939
12056
  if (vditor.currentMode === "sv") {
11940
12057
  return;
11941
12058
  }
@@ -12016,23 +12133,34 @@ var Hint = /** @class */ (function () {
12016
12133
  this.element.className = "vditor-hint";
12017
12134
  this.recentLanguage = "";
12018
12135
  hintExtends.push({ key: ":" });
12019
- }
12136
+ document.addEventListener("pointerdown", this.dismiss, true);
12137
+ document.addEventListener("focusin", this.dismiss, true);
12138
+ this.element.addEventListener("pointerdown", function (event) { return event.preventDefault(); });
12139
+ }
12140
+ Hint.prototype.hide = function () {
12141
+ this.requestId++;
12142
+ clearTimeout(this.timeId);
12143
+ this.element.style.display = "none";
12144
+ };
12145
+ Hint.prototype.destroy = function () {
12146
+ this.hide();
12147
+ document.removeEventListener("pointerdown", this.dismiss, true);
12148
+ document.removeEventListener("focusin", this.dismiss, true);
12149
+ };
12020
12150
  Hint.prototype.render = function (vditor) {
12021
12151
  var _this = this;
12152
+ this.hide();
12022
12153
  if (vditor.currentMode === "sv") {
12023
- this.element.style.display = "none";
12024
12154
  return;
12025
12155
  }
12026
12156
  if (!window.getSelection().focusNode) {
12027
12157
  return;
12028
12158
  }
12029
- var currentLineValue;
12030
12159
  var range = getSelection().getRangeAt(0);
12031
- currentLineValue = range.startContainer.textContent.substring(0, range.startOffset) || "";
12160
+ var currentLineValue = range.startContainer.textContent.substring(0, range.startOffset) || "";
12032
12161
  var key = this.getKey(currentLineValue, vditor.options.hint.extend);
12033
12162
  if (typeof key === "undefined") {
12034
- this.element.style.display = "none";
12035
- clearTimeout(this.timeId);
12163
+ return;
12036
12164
  }
12037
12165
  else {
12038
12166
  if (this.splitChar === ":") {
@@ -12060,15 +12188,17 @@ var Hint = /** @class */ (function () {
12060
12188
  vditor.options.hint.extend.forEach(function (item) {
12061
12189
  if (item.key === _this.splitChar) {
12062
12190
  clearTimeout(_this.timeId);
12191
+ var requestId_1 = _this.requestId;
12063
12192
  _this.timeId = window.setTimeout(function () { return hint_awaiter(_this, void 0, void 0, function () {
12064
- var _a;
12065
- return hint_generator(this, function (_b) {
12066
- switch (_b.label) {
12067
- case 0:
12068
- _a = this.genHTML;
12069
- return [4 /*yield*/, item.hint(key)];
12193
+ var data;
12194
+ return hint_generator(this, function (_a) {
12195
+ switch (_a.label) {
12196
+ case 0: return [4 /*yield*/, item.hint(key)];
12070
12197
  case 1:
12071
- _a.apply(this, [_b.sent(), key, vditor]);
12198
+ data = _a.sent();
12199
+ if (requestId_1 === this.requestId) {
12200
+ this.genHTML(data, key, vditor);
12201
+ }
12072
12202
  return [2 /*return*/];
12073
12203
  }
12074
12204
  });
@@ -12081,7 +12211,7 @@ var Hint = /** @class */ (function () {
12081
12211
  Hint.prototype.genHTML = function (data, key, vditor) {
12082
12212
  var _this = this;
12083
12213
  if (data.length === 0) {
12084
- this.element.style.display = "none";
12214
+ this.hide();
12085
12215
  return;
12086
12216
  }
12087
12217
  var editorElement = vditor[vditor.currentMode].element;
@@ -14590,6 +14720,8 @@ var Toolbar = /** @class */ (function () {
14590
14720
 
14591
14721
  // EXTERNAL MODULE: ./node_modules/.pnpm/diff-match-patch@1.0.5/node_modules/diff-match-patch/index.js
14592
14722
  var diff_match_patch = __webpack_require__(784);
14723
+ // EXTERNAL MODULE: ./src/ts/util/codeDOM.ts
14724
+ var codeDOM = __webpack_require__(9);
14593
14725
  ;// CONCATENATED MODULE: ./src/ts/undo/index.ts
14594
14726
 
14595
14727
 
@@ -14600,6 +14732,7 @@ var diff_match_patch = __webpack_require__(784);
14600
14732
 
14601
14733
 
14602
14734
 
14735
+
14603
14736
  var undo_Undo = /** @class */ (function () {
14604
14737
  function Undo() {
14605
14738
  this.stackSize = 50;
@@ -14777,6 +14910,8 @@ var undo_Undo = /** @class */ (function () {
14777
14910
  .forEach(function (item) {
14778
14911
  processCodeRender(item, vditor);
14779
14912
  });
14913
+ vditor[vditor.currentMode].element.querySelectorAll(".vditor-code__preview")
14914
+ .forEach(function (item) { return highlightEditableCode(item, vditor); });
14780
14915
  if (this[vditor.currentMode].undoStack.length > 1) {
14781
14916
  enableToolbar(vditor.toolbar.elements, ["undo"]);
14782
14917
  }
@@ -14829,6 +14964,7 @@ var undo_Undo = /** @class */ (function () {
14829
14964
  }
14830
14965
  // 移除数学公式、echart 渲染 https://github.com/Vanessa219/vditor/issues/1738
14831
14966
  var cloneElement = vditor[vditor.currentMode].element.cloneNode(true);
14967
+ (0,codeDOM/* normalizeCodeDOM */.M)(cloneElement);
14832
14968
  cloneElement.querySelectorAll(".vditor-".concat(vditor.currentMode, "__preview[data-render='1']"))
14833
14969
  .forEach(function (item) {
14834
14970
  if (!item.firstElementChild) {
@@ -16208,6 +16344,7 @@ var Vditor = /** @class */ (function (_super) {
16208
16344
  };
16209
16345
  /** 销毁编辑器 */
16210
16346
  Vditor.prototype.destroy = function () {
16347
+ this.vditor.hint.destroy();
16211
16348
  this.vditor.element.innerHTML = this.vditor.originalInnerHTML;
16212
16349
  this.vditor.element.classList.remove("vditor");
16213
16350
  this.vditor.element.removeAttribute("style");