mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-01-05 16:28:49 +01:00
This commit is contained in:
parent
85f68e9817
commit
b5df5e2f9a
2 changed files with 4 additions and 2 deletions
|
|
@ -204,7 +204,8 @@ export const getSelectionPosition = (nodeElement: Element, range?: Range) => {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
cursorRect = range.getBoundingClientRect();
|
||||
const rects = range.getClientRects(); // 由于长度过长折行,光标在行首时有多个 rects https://github.com/siyuan-note/siyuan/issues/6156
|
||||
cursorRect = rects[rects.length - 1];
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
|||
|
|
@ -592,7 +592,8 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
|
|||
nodeElement.contains(firstEditElement)
|
||||
) ||
|
||||
(!firstEditElement && nodeElement.isSameNode(protyle.wysiwyg.element.firstElementChild))) {
|
||||
if (nodeEditableElement?.textContent.substr(0, position.end).indexOf("\n") === -1) {
|
||||
// 不能用\n判断,否则文字过长折行将错误 https://github.com/siyuan-note/siyuan/issues/6156
|
||||
if (getSelectionPosition(nodeElement, range).top - protyle.wysiwyg.element.getBoundingClientRect().top < 40) {
|
||||
if (protyle.title && (protyle.wysiwyg.element.firstElementChild.getAttribute("data-eof") === "true" ||
|
||||
protyle.contentElement.scrollTop === 0)) {
|
||||
protyle.title.editElement.focus();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue