@8btc/mditor 0.0.2 → 0.0.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
@@ -1809,21 +1809,15 @@
1809
1809
  .vditor-sv__marker--strong {
1810
1810
  font-weight: bold;
1811
1811
  }
1812
- .vditor--linenumber .vditor-reset {
1813
- counter-reset: linenumber;
1814
- padding-left: 4em;
1815
- /* 预留固定左侧行号栏位 */
1816
- }
1817
- .vditor--linenumber .vditor-reset > ul::before,
1818
- .vditor--linenumber .vditor-reset ol::before {
1812
+ .vditor--linenumber .vditor-reset > ul [data-linenumber]:before,
1813
+ .vditor--linenumber .vditor-reset ol [data-linenumber]:before {
1819
1814
  margin-left: -4.5rem !important;
1820
1815
  }
1821
- .vditor--linenumber .vditor-reset > [data-block="0"] {
1816
+ .vditor--linenumber .vditor-reset [data-linenumber] {
1822
1817
  position: relative;
1823
- counter-increment: linenumber;
1824
1818
  }
1825
- .vditor--linenumber .vditor-reset > [data-block="0"]::before {
1826
- content: counter(linenumber);
1819
+ .vditor--linenumber .vditor-reset [data-linenumber]:before {
1820
+ content: attr(data-linenumber);
1827
1821
  float: left;
1828
1822
  padding-right: 0.25rem;
1829
1823
  margin-left: -2.5rem;
package/dist/index.js CHANGED
@@ -8676,9 +8676,202 @@ var highlightToolbarIR = function (vditor) {
8676
8676
  }, 200);
8677
8677
  };
8678
8678
 
8679
+ ;// CONCATENATED MODULE: ./src/ts/util/attachLineNumbers.ts
8680
+ /**
8681
+ * 为编辑区域中所有包含 `data-block` 的块级节点添加 `data-linenumber` 属性。
8682
+ * 通过解析传入的 Markdown 源文本,建立块内容到源文件行号的映射,
8683
+ * 并在 DOM 上写入对应的行号,兼顾多行文本、重复内容以及空白/特殊字符。
8684
+ */
8685
+ var attachLineNumbersToBlocks = function (root, sourceMarkdown) {
8686
+ if (!root || !sourceMarkdown) {
8687
+ return;
8688
+ }
8689
+ var ZWSP = "\u200b";
8690
+ var normalize = function (text) {
8691
+ return text
8692
+ .replace(/\r\n|\r/g, "\n")
8693
+ .replace(new RegExp(ZWSP, "g"), "")
8694
+ .replace(/\u00a0/g, " ")
8695
+ .replace(/\u2006/g, "")
8696
+ .replace(/[\t\f\v ]+/g, " ");
8697
+ };
8698
+ var srcNorm = normalize(sourceMarkdown);
8699
+ var srcLines = srcNorm.split("\n");
8700
+ var stripInlineMD = function (text) {
8701
+ return (text
8702
+ .replace(/\\([*_`~])/g, "$1")
8703
+ .replace(/\*\*|__/g, "")
8704
+ .replace(/\*|_/g, "")
8705
+ .replace(/~~/g, "")
8706
+ .replace(/`+/g, "")
8707
+ // 数学行内分隔符:保留内容,仅移除分隔符
8708
+ .replace(/\\\(/g, "(")
8709
+ .replace(/\\\)/g, ")")
8710
+ .replace(/\\\[/g, "[")
8711
+ .replace(/\\\]/g, "]")
8712
+ .replace(/\$/g, "")
8713
+ .trim());
8714
+ };
8715
+ var strippedLines = srcLines.map(function (l) { return stripInlineMD(l); });
8716
+ var lineLookup = new Map();
8717
+ for (var i = 0; i < strippedLines.length; i++) {
8718
+ var key = strippedLines[i];
8719
+ if (!lineLookup.has(key)) {
8720
+ lineLookup.set(key, [i + 1]);
8721
+ }
8722
+ else {
8723
+ lineLookup.get(key).push(i + 1);
8724
+ }
8725
+ }
8726
+ var usedLines = new Set();
8727
+ var pickFirstUnused = function (candidates) {
8728
+ if (!candidates || candidates.length === 0)
8729
+ return -1;
8730
+ for (var _i = 0, candidates_1 = candidates; _i < candidates_1.length; _i++) {
8731
+ var ln = candidates_1[_i];
8732
+ if (!usedLines.has(ln))
8733
+ return ln;
8734
+ }
8735
+ return -1;
8736
+ };
8737
+ var findLineNumberByText = function (text) {
8738
+ var stripped = stripInlineMD(text);
8739
+ var ln = pickFirstUnused(lineLookup.get(stripped));
8740
+ if (ln !== -1)
8741
+ return ln;
8742
+ for (var i = 0; i < strippedLines.length; i++) {
8743
+ if (!usedLines.has(i + 1) &&
8744
+ stripped &&
8745
+ strippedLines[i].indexOf(stripped) !== -1) {
8746
+ return i + 1;
8747
+ }
8748
+ }
8749
+ return -1;
8750
+ };
8751
+ var blocks = root.querySelectorAll("[data-block]");
8752
+ blocks.forEach(function (el) {
8753
+ try {
8754
+ var text = el.textContent || "";
8755
+ var normText = normalize(text);
8756
+ // 跳过纯空白块
8757
+ if (!normText.trim()) {
8758
+ el.setAttribute("data-linenumber", "");
8759
+ return;
8760
+ }
8761
+ var lineNumber = -1;
8762
+ var tag_1 = el.tagName;
8763
+ if (tag_1 === "UL" || tag_1 === "OL") {
8764
+ var listEl = el;
8765
+ var items = Array.from(listEl.querySelectorAll(":scope > li"));
8766
+ var cursor_1 = 0;
8767
+ items.forEach(function (liEl) {
8768
+ var raw = normalize(liEl.textContent || "");
8769
+ if (!raw.trim()) {
8770
+ liEl.setAttribute("data-linenumber", "");
8771
+ return;
8772
+ }
8773
+ var firstLine = raw.split("\n").find(function (l) { return l.trim().length > 0; }) || raw;
8774
+ var strippedLi = stripInlineMD(firstLine);
8775
+ var ln = -1;
8776
+ if (tag_1 === "UL") {
8777
+ for (var i = Math.max(0, cursor_1); i < srcLines.length; i++) {
8778
+ if (usedLines.has(i + 1))
8779
+ continue;
8780
+ var s = srcLines[i];
8781
+ if (/^\s*[-*+]\s+/.test(s)) {
8782
+ var content = stripInlineMD(s.replace(/^\s*[-*+]\s+(\[[ xX]\]\s+)?/, ""));
8783
+ if (content.indexOf(strippedLi) !== -1) {
8784
+ ln = i + 1;
8785
+ cursor_1 = i + 1;
8786
+ break;
8787
+ }
8788
+ }
8789
+ }
8790
+ }
8791
+ else {
8792
+ for (var i = Math.max(0, cursor_1); i < srcLines.length; i++) {
8793
+ if (usedLines.has(i + 1))
8794
+ continue;
8795
+ var s = srcLines[i];
8796
+ if (/^\s*\d+\.\s+/.test(s)) {
8797
+ var content = stripInlineMD(s.replace(/^\s*\d+\.\s+/, ""));
8798
+ if (content.indexOf(strippedLi) !== -1) {
8799
+ ln = i + 1;
8800
+ cursor_1 = i + 1;
8801
+ break;
8802
+ }
8803
+ }
8804
+ }
8805
+ }
8806
+ if (ln === -1) {
8807
+ for (var i = 0; i < srcLines.length; i++) {
8808
+ if (usedLines.has(i + 1))
8809
+ continue;
8810
+ var s = srcLines[i];
8811
+ var isListLine = tag_1 === "UL"
8812
+ ? /^\s*[-*+]\s+/.test(s)
8813
+ : /^\s*\d+\.\s+/.test(s);
8814
+ if (!isListLine)
8815
+ continue;
8816
+ var content = stripInlineMD(tag_1 === "UL"
8817
+ ? s.replace(/^\s*[-*+]\s+(\[[ xX]\]\s+)?/, "")
8818
+ : s.replace(/^\s*\d+\.\s+/, ""));
8819
+ if (content.indexOf(strippedLi) !== -1) {
8820
+ ln = i + 1;
8821
+ cursor_1 = i + 1;
8822
+ break;
8823
+ }
8824
+ }
8825
+ }
8826
+ if (ln !== -1) {
8827
+ usedLines.add(ln);
8828
+ liEl.setAttribute("data-linenumber", String(ln));
8829
+ }
8830
+ else {
8831
+ liEl.setAttribute("data-linenumber", "");
8832
+ }
8833
+ });
8834
+ return;
8835
+ }
8836
+ else if (tag_1 === "BLOCKQUOTE") {
8837
+ var firstLine = normText.split("\n").find(function (l) { return l.trim().length > 0; }) ||
8838
+ normText;
8839
+ var stripped = stripInlineMD(firstLine);
8840
+ for (var i = 0; i < srcLines.length; i++) {
8841
+ if (usedLines.has(i + 1))
8842
+ continue;
8843
+ if (/^\s*>+\s/.test(srcLines[i])) {
8844
+ var content = stripInlineMD(srcLines[i].replace(/^\s*>+\s+/, ""));
8845
+ if (content.indexOf(stripped) !== -1) {
8846
+ lineNumber = i + 1;
8847
+ break;
8848
+ }
8849
+ }
8850
+ }
8851
+ }
8852
+ else {
8853
+ var firstLine = normText.split("\n").find(function (l) { return l.trim().length > 0; }) ||
8854
+ normText;
8855
+ lineNumber = findLineNumberByText(firstLine);
8856
+ }
8857
+ if (lineNumber !== -1) {
8858
+ usedLines.add(lineNumber);
8859
+ el.setAttribute("data-linenumber", String(lineNumber));
8860
+ }
8861
+ else {
8862
+ el.setAttribute("data-linenumber", "");
8863
+ }
8864
+ }
8865
+ catch (_a) {
8866
+ void 0;
8867
+ }
8868
+ });
8869
+ };
8870
+
8679
8871
  ;// CONCATENATED MODULE: ./src/ts/wysiwyg/afterRenderEvent.ts
8680
8872
 
8681
8873
 
8874
+
8682
8875
  var afterRenderEvent = function (vditor, options) {
8683
8876
  if (options === void 0) { options = {
8684
8877
  enableAddUndoStack: true,
@@ -8712,6 +8905,12 @@ var afterRenderEvent = function (vditor, options) {
8712
8905
  if (options.enableAddUndoStack) {
8713
8906
  vditor.undo.addToUndoStack(vditor);
8714
8907
  }
8908
+ try {
8909
+ attachLineNumbersToBlocks(vditor.wysiwyg.element, text);
8910
+ }
8911
+ catch (_a) {
8912
+ void 0;
8913
+ }
8715
8914
  }, vditor.options.undoDelay);
8716
8915
  };
8717
8916
 
@@ -11197,6 +11396,7 @@ var selectEvent = function (vditor, editorElement) {
11197
11396
 
11198
11397
 
11199
11398
 
11399
+
11200
11400
  var processPaste = function (vditor, text) {
11201
11401
  var range = (0,selection/* getEditorRange */.zh)(vditor);
11202
11402
  range.extractContents();
@@ -11207,9 +11407,10 @@ var processPaste = function (vditor, text) {
11207
11407
  blockElement = vditor.sv.element;
11208
11408
  }
11209
11409
  var spinHTML = vditor.lute.SpinVditorSVDOM(blockElement.textContent);
11210
- spinHTML = "<div data-block='0'>" +
11211
- spinHTML.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g, '<span data-type="newline"><br /><span style="display: none">\n</span></span><span data-type="newline"><br /><span style="display: none">\n</span></span></div><div data-block="0"><') +
11212
- "</div>";
11410
+ spinHTML =
11411
+ "<div data-block='0'>" +
11412
+ spinHTML.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g, '<span data-type="newline"><br /><span style="display: none">\n</span></span><span data-type="newline"><br /><span style="display: none">\n</span></span></div><div data-block="0"><') +
11413
+ "</div>";
11213
11414
  if (blockElement.isEqualNode(vditor.sv.element)) {
11214
11415
  blockElement.innerHTML = spinHTML;
11215
11416
  }
@@ -11242,9 +11443,10 @@ var getSideByType = function (spanNode, type, isPrevious) {
11242
11443
  var processSpinVditorSVDOM = function (html, vditor) {
11243
11444
  log("SpinVditorSVDOM", html, "argument", vditor.options.debugger);
11244
11445
  var spinHTML = vditor.lute.SpinVditorSVDOM(html);
11245
- html = "<div data-block='0'>" +
11246
- spinHTML.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g, '<span data-type="newline"><br /><span style="display: none">\n</span></span><span data-type="newline"><br /><span style="display: none">\n</span></span></div><div data-block="0"><') +
11247
- "</div>";
11446
+ html =
11447
+ "<div data-block='0'>" +
11448
+ spinHTML.replace(/<span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span><span data-type="newline"><br \/><span style="display: none">\n<\/span><\/span></g, '<span data-type="newline"><br /><span style="display: none">\n</span></span><span data-type="newline"><br /><span style="display: none">\n</span></span></div><div data-block="0"><') +
11449
+ "</div>";
11248
11450
  log("SpinVditorSVDOM", html, "result", vditor.options.debugger);
11249
11451
  return html;
11250
11452
  };
@@ -11252,21 +11454,32 @@ var processPreviousMarkers = function (spanElement) {
11252
11454
  var spanType = spanElement.getAttribute("data-type");
11253
11455
  var previousElement = spanElement.previousElementSibling;
11254
11456
  // 有内容的子列表/标题,在其 marker 后换行
11255
- var markerText = (spanType && spanType !== "text" && spanType !== "table" && spanType !== "heading-marker" &&
11256
- spanType !== "newline" && spanType !== "yaml-front-matter-open-marker" && spanType !== "yaml-front-matter-close-marker"
11257
- && spanType !== "code-block-info" && spanType !== "code-block-close-marker" && spanType !== "code-block-open-marker") ?
11258
- spanElement.textContent : "";
11457
+ var markerText = spanType &&
11458
+ spanType !== "text" &&
11459
+ spanType !== "table" &&
11460
+ spanType !== "heading-marker" &&
11461
+ spanType !== "newline" &&
11462
+ spanType !== "yaml-front-matter-open-marker" &&
11463
+ spanType !== "yaml-front-matter-close-marker" &&
11464
+ spanType !== "code-block-info" &&
11465
+ spanType !== "code-block-close-marker" &&
11466
+ spanType !== "code-block-open-marker"
11467
+ ? spanElement.textContent
11468
+ : "";
11259
11469
  var hasNL = false;
11260
11470
  if (spanType === "newline") {
11261
11471
  hasNL = true;
11262
11472
  }
11263
11473
  while (previousElement && !hasNL) {
11264
11474
  var previousType = previousElement.getAttribute("data-type");
11265
- if (previousType === "li-marker" || previousType === "blockquote-marker" || previousType === "task-marker" ||
11475
+ if (previousType === "li-marker" ||
11476
+ previousType === "blockquote-marker" ||
11477
+ previousType === "task-marker" ||
11266
11478
  previousType === "padding") {
11267
11479
  var previousText = previousElement.textContent;
11268
11480
  if (previousType === "li-marker" &&
11269
- (spanType === "code-block-open-marker" || spanType === "code-block-info")) {
11481
+ (spanType === "code-block-open-marker" ||
11482
+ spanType === "code-block-info")) {
11270
11483
  // https://github.com/Vanessa219/vditor/issues/586
11271
11484
  markerText = previousText.replace(/\S/g, " ") + markerText;
11272
11485
  }
@@ -11321,6 +11534,12 @@ var processAfterRender = function (vditor, options) {
11321
11534
  if (options.enableAddUndoStack && !vditor.sv.composingLock) {
11322
11535
  vditor.undo.addToUndoStack(vditor);
11323
11536
  }
11537
+ try {
11538
+ attachLineNumbersToBlocks(vditor.sv.element, text);
11539
+ }
11540
+ catch (_a) {
11541
+ void 0;
11542
+ }
11324
11543
  }, vditor.options.undoDelay);
11325
11544
  };
11326
11545
  var processHeading = function (vditor, value) {
@@ -11356,8 +11575,13 @@ var processToolbar = function (vditor, actionBtn, prefix, suffix) {
11356
11575
  document.execCommand("insertHTML", false, html);
11357
11576
  return;
11358
11577
  }
11359
- else if (commandName === "italic" || commandName === "bold" || commandName === "strike" ||
11360
- commandName === "inline-code" || commandName === "code" || commandName === "table" || commandName === "line") {
11578
+ else if (commandName === "italic" ||
11579
+ commandName === "bold" ||
11580
+ commandName === "strike" ||
11581
+ commandName === "inline-code" ||
11582
+ commandName === "code" ||
11583
+ commandName === "table" ||
11584
+ commandName === "line") {
11361
11585
  var html = void 0;
11362
11586
  // https://github.com/Vanessa219/vditor/issues/563 代码块不需要后面的 ```
11363
11587
  if (range.toString() === "") {
@@ -11366,7 +11590,10 @@ var processToolbar = function (vditor, actionBtn, prefix, suffix) {
11366
11590
  else {
11367
11591
  html = "".concat(prefix).concat(range.toString()).concat(Lute.Caret).concat(commandName === "code" ? "" : suffix);
11368
11592
  }
11369
- if (commandName === "table" || (commandName === "code" && spanElement && spanElement.textContent !== "")) {
11593
+ if (commandName === "table" ||
11594
+ (commandName === "code" &&
11595
+ spanElement &&
11596
+ spanElement.textContent !== "")) {
11370
11597
  html = "\n\n" + html;
11371
11598
  }
11372
11599
  else if (commandName === "line") {
@@ -11375,7 +11602,9 @@ var processToolbar = function (vditor, actionBtn, prefix, suffix) {
11375
11602
  document.execCommand("insertHTML", false, html);
11376
11603
  return;
11377
11604
  }
11378
- else if (commandName === "check" || commandName === "list" || commandName === "ordered-list" ||
11605
+ else if (commandName === "check" ||
11606
+ commandName === "list" ||
11607
+ commandName === "ordered-list" ||
11379
11608
  commandName === "quote") {
11380
11609
  if (spanElement) {
11381
11610
  var marker = "* ";
@@ -13682,6 +13911,7 @@ var templateObject_1;
13682
13911
 
13683
13912
 
13684
13913
 
13914
+
13685
13915
  var processHint = function (vditor) {
13686
13916
  var _a, _b;
13687
13917
  vditor.hint.render(vditor);
@@ -13689,16 +13919,20 @@ var processHint = function (vditor) {
13689
13919
  // 代码块语言提示
13690
13920
  var preBeforeElement = (0,hasClosest/* hasClosestByAttribute */.a1)(startContainer, "data-type", "code-block-info");
13691
13921
  if (preBeforeElement) {
13692
- if (preBeforeElement.textContent.replace(constants/* Constants.ZWSP */.g.ZWSP, "") === "" && vditor.hint.recentLanguage) {
13693
- preBeforeElement.textContent = constants/* Constants.ZWSP */.g.ZWSP + vditor.hint.recentLanguage;
13922
+ if (preBeforeElement.textContent.replace(constants/* Constants.ZWSP */.g.ZWSP, "") === "" &&
13923
+ vditor.hint.recentLanguage) {
13924
+ preBeforeElement.textContent =
13925
+ constants/* Constants.ZWSP */.g.ZWSP + vditor.hint.recentLanguage;
13694
13926
  var range = (0,selection/* getEditorRange */.zh)(vditor);
13695
13927
  range.selectNodeContents(preBeforeElement);
13696
13928
  }
13697
13929
  else {
13698
13930
  var matchLangData_1 = [];
13699
- var key_1 = preBeforeElement.textContent.substring(0, (0,selection/* getSelectPosition */.im)(preBeforeElement, vditor.ir.element).start)
13931
+ var key_1 = preBeforeElement.textContent
13932
+ .substring(0, (0,selection/* getSelectPosition */.im)(preBeforeElement, vditor.ir.element).start)
13700
13933
  .replace(constants/* Constants.ZWSP */.g.ZWSP, "");
13701
- (vditor.options.preview.hljs.langs || constants/* Constants.ALIAS_CODE_LANGUAGES.concat */.g.ALIAS_CODE_LANGUAGES.concat(((_b = (_a = window.hljs) === null || _a === void 0 ? void 0 : _a.listLanguages()) !== null && _b !== void 0 ? _b : []).sort())).forEach(function (keyName) {
13934
+ (vditor.options.preview.hljs.langs ||
13935
+ constants/* Constants.ALIAS_CODE_LANGUAGES.concat */.g.ALIAS_CODE_LANGUAGES.concat(((_b = (_a = window.hljs) === null || _a === void 0 ? void 0 : _a.listLanguages()) !== null && _b !== void 0 ? _b : []).sort())).forEach(function (keyName) {
13702
13936
  if (keyName.indexOf(key_1.toLowerCase()) > -1) {
13703
13937
  matchLangData_1.push({
13704
13938
  html: keyName,
@@ -13743,11 +13977,18 @@ var process_processAfterRender = function (vditor, options) {
13743
13977
  if (options.enableAddUndoStack) {
13744
13978
  vditor.undo.addToUndoStack(vditor);
13745
13979
  }
13980
+ try {
13981
+ attachLineNumbersToBlocks(vditor.ir.element, text);
13982
+ }
13983
+ catch (_a) {
13984
+ void 0;
13985
+ }
13746
13986
  }, vditor.options.undoDelay);
13747
13987
  };
13748
13988
  var process_processHeading = function (vditor, value) {
13749
13989
  var range = (0,selection/* getEditorRange */.zh)(vditor);
13750
- var headingElement = (0,hasClosest/* hasClosestBlock */.F9)(range.startContainer) || range.startContainer;
13990
+ var headingElement = (0,hasClosest/* hasClosestBlock */.F9)(range.startContainer) ||
13991
+ range.startContainer;
13751
13992
  if (headingElement) {
13752
13993
  var headingMarkerElement = headingElement.querySelector(".vditor-ir__marker--heading");
13753
13994
  if (headingMarkerElement) {
@@ -13770,7 +14011,8 @@ var removeInline = function (range, vditor, type) {
13770
14011
  range.insertNode(document.createElement("wbr"));
13771
14012
  var tempElement = document.createElement("div");
13772
14013
  tempElement.innerHTML = vditor.lute.SpinVditorIRDOM(inlineElement.outerHTML);
13773
- inlineElement.outerHTML = tempElement.firstElementChild.innerHTML.trim();
14014
+ inlineElement.outerHTML =
14015
+ tempElement.firstElementChild.innerHTML.trim();
13774
14016
  }
13775
14017
  };
13776
14018
  var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
@@ -13787,8 +14029,10 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
13787
14029
  var quoteElement = (0,hasClosest/* hasClosestByMatchTag */.lG)(typeElement, "BLOCKQUOTE");
13788
14030
  if (quoteElement) {
13789
14031
  range.insertNode(document.createElement("wbr"));
13790
- quoteElement.outerHTML = quoteElement.innerHTML.trim() === "" ?
13791
- "<p data-block=\"0\">".concat(quoteElement.innerHTML, "</p>") : quoteElement.innerHTML;
14032
+ quoteElement.outerHTML =
14033
+ quoteElement.innerHTML.trim() === ""
14034
+ ? "<p data-block=\"0\">".concat(quoteElement.innerHTML, "</p>")
14035
+ : quoteElement.innerHTML;
13792
14036
  }
13793
14037
  }
13794
14038
  else if (commandName === "link") {
@@ -13800,7 +14044,9 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
13800
14044
  aElement.outerHTML = aTextElement.innerHTML;
13801
14045
  }
13802
14046
  else {
13803
- aElement.outerHTML = aElement.querySelector(".vditor-ir__link").innerHTML + "<wbr>";
14047
+ aElement.outerHTML =
14048
+ aElement.querySelector(".vditor-ir__link").innerHTML +
14049
+ "<wbr>";
13804
14050
  }
13805
14051
  }
13806
14052
  }
@@ -13816,7 +14062,9 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
13816
14062
  else if (commandName === "inline-code") {
13817
14063
  removeInline(range, vditor, "code");
13818
14064
  }
13819
- else if (commandName === "check" || commandName === "list" || commandName === "ordered-list") {
14065
+ else if (commandName === "check" ||
14066
+ commandName === "list" ||
14067
+ commandName === "ordered-list") {
13820
14068
  listToggle(vditor, range, commandName);
13821
14069
  useHighlight = false;
13822
14070
  actionBtn.classList.remove("vditor-menu--current");
@@ -13860,8 +14108,12 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
13860
14108
  useHighlight = false;
13861
14109
  actionBtn.classList.add("vditor-menu--current");
13862
14110
  }
13863
- else if (commandName === "italic" || commandName === "bold" || commandName === "strike"
13864
- || commandName === "inline-code" || commandName === "code" || commandName === "table") {
14111
+ else if (commandName === "italic" ||
14112
+ commandName === "bold" ||
14113
+ commandName === "strike" ||
14114
+ commandName === "inline-code" ||
14115
+ commandName === "code" ||
14116
+ commandName === "table") {
13865
14117
  var html = void 0;
13866
14118
  if (range.toString() === "") {
13867
14119
  html = "".concat(prefix, "<wbr>").concat(suffix);
@@ -13890,10 +14142,16 @@ var process_processToolbar = function (vditor, actionBtn, prefix, suffix) {
13890
14142
  (0,selection/* setSelectionFocus */.Hc)(range);
13891
14143
  }
13892
14144
  }
13893
- else if (commandName === "check" || commandName === "list" || commandName === "ordered-list") {
14145
+ else if (commandName === "check" ||
14146
+ commandName === "list" ||
14147
+ commandName === "ordered-list") {
13894
14148
  listToggle(vditor, range, commandName, false);
13895
14149
  useHighlight = false;
13896
- removeCurrentToolbar(vditor.toolbar.elements, ["check", "list", "ordered-list"]);
14150
+ removeCurrentToolbar(vditor.toolbar.elements, [
14151
+ "check",
14152
+ "list",
14153
+ "ordered-list",
14154
+ ]);
13897
14155
  actionBtn.classList.add("vditor-menu--current");
13898
14156
  }
13899
14157
  }