mirror of
https://github.com/marktext/marktext.git
synced 2025-05-19 10:20:54 +08:00
Fix: enter error in code block (#1506)
This commit is contained in:
parent
2c9d3f1e86
commit
5f0ef2c8e6
@ -242,7 +242,8 @@ const enterCtrl = ContentState => {
|
|||||||
}
|
}
|
||||||
return this.partialRender()
|
return this.partialRender()
|
||||||
} else if (
|
} else if (
|
||||||
block.type === 'span' && block.functionType === 'codeContent'
|
block.type === 'span' &&
|
||||||
|
block.functionType === 'codeContent'
|
||||||
) {
|
) {
|
||||||
const { text, key } = block
|
const { text, key } = block
|
||||||
const autoIndent = checkAutoIndent(text, start.offset)
|
const autoIndent = checkAutoIndent(text, start.offset)
|
||||||
|
@ -431,8 +431,9 @@ class Selection {
|
|||||||
if (child.classList && child.classList.contains(CLASS_OR_ID.AG_FRONT_ICON)) {
|
if (child.classList && child.classList.contains(CLASS_OR_ID.AG_FRONT_ICON)) {
|
||||||
continue
|
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.
|
// 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 (
|
if (
|
||||||
child.classList && child.classList.contains('ag-inline-image')
|
child.classList && child.classList.contains('ag-inline-image')
|
||||||
) {
|
) {
|
||||||
|
Loading…
Reference in New Issue
Block a user