Bläddra i källkod

:bug: fix https://github.com/Vanessa219/vditor/issues/1354

Vanessa 2 år sedan
förälder
incheckning
87000697d2
3 ändrade filer med 9 tillägg och 3 borttagningar
  1. 2 2
      .editorconfig
  2. 4 0
      CHANGELOG.md
  3. 3 1
      src/ts/ir/process.ts

+ 2 - 2
.editorconfig

@@ -1,8 +1,8 @@
 [*]
-tab_width = 2
+tab_width = 4
 trim_trailing_whitespace = true
 end_of_line = lf
-indent_size = 2
+indent_size = 4
 indent_style = space
 insert_final_newline = true
 charset = utf-8

+ 4 - 0
CHANGELOG.md

@@ -105,6 +105,10 @@
 
 * [open issues](https://github.com/Vanessa219/vditor/issues)
 
+### v3.9.1 / 2023-03
+
+* [IR 模式选择内容设置为代码块时异常](https://github.com/Vanessa219/vditor/issues/1354) `修复缺陷`
+
 ### v3.9.0 / 2023-01-15
 
 * [1345](https://github.com/Vanessa219/vditor/issues/1345) 移除复制代码块末尾的换行 `改进功能`

+ 3 - 1
src/ts/ir/process.ts

@@ -185,7 +185,9 @@ export const processToolbar = (vditor: IVditor, actionBtn: Element, prefix: stri
             if (range.toString() === "") {
                 html = `${prefix}<wbr>${suffix}`;
             } else {
-                if (commandName === "code" || commandName === "table") {
+                if (commandName === "code") {
+                    html = `${prefix}\n${range.toString()}<wbr>${suffix}`;
+                } else if (commandName === "table") {
                     html = `${prefix}${range.toString()}<wbr>${suffix}`;
                 } else {
                     html = `${prefix}${range.toString()}${suffix}<wbr>`;