Skip to content

Commit f06b1a3

Browse files
committed
🎨 fix #729
1 parent 8d44f86 commit f06b1a3

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
### v3.10.6 / 2024-09
2121

22+
* [井号后输入空格就渲染标题](https://github.com/Vanessa219/vditor/issues/729) `改进功能`
2223
* [ir 模式下标题删除报错](https://github.com/Vanessa219/vditor/issues/1666) `修复缺陷`
2324
* [升级 echarts 至 5.5.1](https://github.com/Vanessa219/vditor/issues/1664) `开发重构`
2425
* [添加 `insertMD` 方法](https://github.com/Vanessa219/vditor/issues/1640) `引入特性`

src/ts/ir/input.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ export const input = (vditor: IVditor, range: Range, ignoreSpace = false, event?
5757
}
5858
return;
5959
}
60+
61+
// https://github.com/Vanessa219/vditor/issues/729
62+
if (endSpace && /^#{1,6} $/.test(blockElement.textContent)) {
63+
endSpace = false;
64+
}
65+
6066
if (endSpace) {
6167
const markerElement = hasClosestByClassName(range.startContainer, "vditor-ir__marker");
6268
if (markerElement) {

src/ts/wysiwyg/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,11 @@ class WYSIWYG {
380380
}
381381
}
382382

383+
// https://github.com/Vanessa219/vditor/issues/729
384+
if (endSpace && /^#{1,6} $/.test(blockElement.textContent)) {
385+
endSpace = false;
386+
}
387+
383388
const headingElement = hasClosestByHeadings(getSelection().getRangeAt(0).startContainer);
384389
if (headingElement && headingElement.textContent === "") {
385390
// heading 为空删除 https://github.com/Vanessa219/vditor/issues/150

0 commit comments

Comments
 (0)