Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:art: https://github.com/siyuan-note/siyuan/issues/9761 2

Vanessaf69247b24ab7
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index 6d3ab975c0..a1020a8de6 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -161,7 +161,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
}
cellRect = cellElements[0].getBoundingClientRect();
let html = "";
- const style = `style="position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 25)}px;height: ${cellRect.height}px"`;
+ const style = `style="padding-top: 6.5px;position:absolute;left: ${cellRect.left}px;top: ${cellRect.top}px;width:${Math.max(cellRect.width, 25)}px;height: ${cellRect.height}px"`;
if (["text", "url", "email", "phone", "block", "template"].includes(type)) {
html = `<textarea ${style} class="b3-text-field">${cellElements[0].firstElementChild.textContent}</textarea>`;
} else if (type === "number") {
@@ -212,7 +212,14 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type
(event.key === "Enter" && !event.shiftKey && isNotCtrl(event))) {
updateCellValue(protyle, type, cellElements);
if (event.key === "Tab") {
- protyle.wysiwyg.element.dispatchEvent(new KeyboardEvent("keydown", {key: "Tab", keyCode: 9}))
+ protyle.wysiwyg.element.dispatchEvent(new KeyboardEvent("keydown", {
+ shiftKey: event.shiftKey,
+ ctrlKey: event.ctrlKey,
+ altKey: event.altKey,
+ metaKey: event.metaKey,
+ key: "Tab",
+ keyCode: 9
+ }));
}
event.preventDefault();
event.stopPropagation();
diff --git a/app/src/protyle/render/av/keydown.ts b/app/src/protyle/render/av/keydown.ts
index ffc0327518..d9387c833b 100644
--- a/app/src/protyle/render/av/keydown.ts
+++ b/app/src/protyle/render/av/keydown.ts
@@ -3,6 +3,7 @@ import {selectRow} from "./row";
import {cellScrollIntoView, popTextCell} from "./cell";
import {avContextmenu} from "./action";
import {hasClosestByClassName} from "../../util/hasClosest";
+import {Constants} from "../../../constants";
export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protyle: IProtyle) => {
if (!nodeElement.classList.contains("av") || !window.siyuan.menus.menu.element.classList.contains("fn__none")) {
@@ -97,8 +98,15 @@ export const avKeydown = (event: KeyboardEvent, nodeElement: HTMLElement, protyl
event.preventDefault();
return true;
}
- }
+ if (!Constants.KEYCODELIST[event.keyCode] ||
+ (Constants.KEYCODELIST[event.keyCode].length === 1 &&
+ !event.metaKey && !event.ctrlKey &&
+ !["⇧", "⌃", "⌥", "⌘"].includes(Constants.KEYCODELIST[event.keyCode]))) {
+ popTextCell(protyle, [selectCellElement]);
+ return true;
+ }
+ }
const selectRowElements = nodeElement.querySelectorAll(".av__row--select:not(.av__row--header)");
if (selectRowElements.length > 0) {
if (matchHotKey("⌘/", event)) {