fix: ATX heading error when press shortcut

This commit is contained in:
Jocs 2018-04-18 23:43:33 +08:00
parent ec56014040
commit 193b62023e

View File

@ -298,9 +298,9 @@ const paragraphCtrl = ContentState => {
newType = newLevel === 0 ? 'p' : `h${newLevel}` newType = newLevel === 0 ? 'p' : `h${newLevel}`
} }
start.offset += newLevel - hash.length start.offset += newLevel - hash.length + 1
end.offset += newLevel - hash.length end.offset += newLevel - hash.length + 1
block.text = '#'.repeat(newLevel) + partText block.text = '#'.repeat(newLevel) + ` ${partText}`
block.type = newType block.type = newType
this.cursor = { start, end } this.cursor = { start, end }
break break