Skip to content

Commit

Permalink
fix(md): 调整标题工具按钮选中文字后多余复制选取内容问题
Browse files Browse the repository at this point in the history
  • Loading branch information
GreatZPP committed Mar 5, 2024
1 parent 34b0ecd commit ee724eb
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/devui-vue/devui/editor-md/src/toolbar-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ class ToolBarHandler {

if (cursor.ch !== 0) {
editor.setCursor(cursor.line, 0);
editor.replaceSelection('# ' + selection);
editor.setCursor(cursor.line, cursor.ch + 2);
editor.replaceSelection('# ');
} else {
editor.replaceSelection('# ' + selection);
}
Expand All @@ -89,8 +88,7 @@ class ToolBarHandler {

if (cursor.ch !== 0) {
editor.setCursor(cursor.line, 0);
editor.replaceSelection('## ' + selection);
editor.setCursor(cursor.line, cursor.ch + 3);
editor.replaceSelection('## ');
} else {
editor.replaceSelection('## ' + selection);
}
Expand Down

0 comments on commit ee724eb

Please sign in to comment.