This commit is contained in:
Vanessa 2024-09-29 10:55:24 +08:00
parent e80354ebbb
commit 5cdcd27faa
7 changed files with 10 additions and 10 deletions

View file

@ -45,7 +45,7 @@ export const saveScroll = (protyle: IProtyle, getObject = false) => {
setStorageVal(Constants.LOCAL_FILEPOSITION, window.siyuan.storage[Constants.LOCAL_FILEPOSITION], () => {
resolve(true);
});
})
});
};
export const getDocByScroll = (options: {

View file

@ -5,7 +5,7 @@ import * as dayjs from "dayjs";
import {transaction, updateTransaction} from "./transaction";
import {mathRender} from "../render/mathRender";
import {highlightRender} from "../render/highlightRender";
import {getContenteditableElement, getNextBlock, hasNextSibling, isNotEditBlock} from "./getBlock";
import {getContenteditableElement, hasNextSibling, isNotEditBlock} from "./getBlock";
import {genEmptyBlock} from "../../block/util";
import {blockRender} from "../render/blockRender";
import {hideElements} from "../ui/hideElements";

View file

@ -735,7 +735,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
event.preventDefault();
} else if (nodeEditableElement?.innerText.substr(position.end).indexOf("\n") === -1 || position.end >= nodeEditableElement.innerText.trimEnd().length) {
// 需使用 innerText否则 td 中的 br 无法转换为 \n; position.end 不能加1否则倒数第二行行末无法下移
range.collapse(false)
range.collapse(false);
const nextFoldElement = getNextBlock(nodeElement) as HTMLElement;
if (nextFoldElement) {
if(nodeEditableElement.getBoundingClientRect().bottom - getSelectionPosition(nodeElement, range).top < 40) {
@ -844,7 +844,7 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
}
if (nextSibling.nodeType === 1 && nextSibling.classList.contains("img")) {
// 光标需在图片前 https://github.com/siyuan-note/siyuan/issues/12452
const textPosition = getSelectionOffset(range.startContainer, protyle.wysiwyg.element, range)
const textPosition = getSelectionOffset(range.startContainer, protyle.wysiwyg.element, range);
if (textPosition.start === range.startContainer.textContent.length) {
removeImage(nextSibling as Element, nodeElement, range, protyle);
event.stopPropagation();