Fix: enter error in code block (#1506)

This commit is contained in:
Ran Luo 2019-10-23 03:01:40 +08:00 committed by Felix Häusler
parent 2c9d3f1e86
commit 5f0ef2c8e6
2 changed files with 4 additions and 2 deletions

View File

@ -242,7 +242,8 @@ const enterCtrl = ContentState => {
}
return this.partialRender()
} else if (
block.type === 'span' && block.functionType === 'codeContent'
block.type === 'span' &&
block.functionType === 'codeContent'
) {
const { text, key } = block
const autoIndent = checkAutoIndent(text, start.offset)

View File

@ -431,8 +431,9 @@ class Selection {
if (child.classList && child.classList.contains(CLASS_OR_ID.AG_FRONT_ICON)) {
continue
}
// Fix #1460 - put the cursor at the next text node or element if it can be put at the last of /^\n$/ or the next text node/element.
if (/^\n$/.test(textContent) ? count + textLength > offset : count + textLength >= offset) {
if (/^\n$/.test(textContent) && i !== len - 1 ? count + textLength > offset : count + textLength >= offset) {
if (
child.classList && child.classList.contains('ag-inline-image')
) {