This commit is contained in:
Vanessa 2023-09-21 11:47:24 +08:00
parent f7ff2efaf8
commit 96a618f4a3
2 changed files with 8 additions and 3 deletions

View file

@ -283,9 +283,7 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
return true;
}
const target = event.target as HTMLElement;
if (target.tagName !== "TABLE" && (
target.tagName === "INPUT" || target.tagName === "TEXTAREA" || hasClosestByAttribute(target, "contenteditable", null)
)) {
if (target.tagName !== "TABLE" && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) {
return false;
}
if (matchHotKey(window.siyuan.config.keymap.editor.general.refresh.custom, event)) {
@ -316,6 +314,9 @@ const editKeydown = (app: App, event: KeyboardEvent) => {
event.preventDefault();
return true;
}
if (hasClosestByClassName(target, "protyle-title__input")) {
return false;
}
// 没有光标时,无法撤销 https://ld246.com/article/1624021111567
if (matchHotKey(window.siyuan.config.keymap.editor.general.undo.custom, event)) {
protyle.undo.undo(protyle);

View file

@ -6,6 +6,10 @@ import {hasClosestByClassName} from "./hasClosest";
import {preventScroll} from "../scroll/preventScroll";
export const reloadProtyle = (protyle: IProtyle, focus: boolean) => {
if (!protyle.preview.element.classList.contains("fn__none")) {
protyle.preview.render(protyle);
return;
}
if (window.siyuan.config.editor.displayBookmarkIcon) {
protyle.wysiwyg.element.classList.add("protyle-wysiwyg--attr");
} else {