An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:art: ctrl+p database table view cell
Vanessa9634480890ef
diff --git a/app/src/boot/globalEvent/keydown.ts b/app/src/boot/globalEvent/keydown.tsindex 41c2296342..3447466567 100644--- a/app/src/boot/globalEvent/keydown.ts+++ b/app/src/boot/globalEvent/keydown.ts@@ -323,7 +323,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")) {+ if (target.tagName !== "TABLE" && ["INPUT", "TEXTAREA"].includes(target.tagName)) {return false;}if (matchHotKey(window.siyuan.config.keymap.editor.general.backlinks.custom, event)) {@@ -653,7 +653,7 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {return true;}const target = event.target as HTMLElement;- if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" ||+ if (["INPUT", "TEXTAREA"].includes(target.tagName) ||hasClosestByAttribute(target, "contenteditable", null) ||hasClosestByClassName(target, "protyle", true)) {return false;@@ -834,7 +834,7 @@ const fileTreeKeydown = (app: App, event: KeyboardEvent) => {const panelTreeKeydown = (app: App, event: KeyboardEvent) => {// 面板折叠展开操作const target = event.target as HTMLElement;- if (target.tagName === "INPUT" || target.tagName === "TEXTAREA" ||+ if (["INPUT", "TEXTAREA"].includes(target.tagName) ||hasClosestByAttribute(target, "contenteditable", null) ||hasClosestByClassName(target, "protyle", true)) {return false;@@ -1280,7 +1280,7 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {event.preventDefault();return;}- if (matchHotKey("⌘A", event) && target.tagName !== "INPUT" && target.tagName !== "TEXTAREA") {+ if (matchHotKey("⌘A", event) && !["INPUT", "TEXTAREA"].includes(target.tagName)) {event.preventDefault();return;}diff --git a/app/src/boot/onGetConfig.ts b/app/src/boot/onGetConfig.tsindex f002d7ca8e..09480ccff3 100644--- a/app/src/boot/onGetConfig.ts+++ b/app/src/boot/onGetConfig.ts@@ -213,13 +213,7 @@ export const initWindow = async (app: App) => {ipcRenderer.on(Constants.SIYUAN_EVENT, (event, cmd) => {if (cmd === "focus") {if (getSelection().rangeCount > 0) {- const range = getSelection().getRangeAt(0);- const startNode = range.startContainer.childNodes[range.startOffset] as HTMLElement;- if (startNode && startNode.nodeType !== 3 && (startNode.tagName === "TEXTAREA" || startNode.tagName === "INPUT")) {- startNode.focus();- } else {- focusByRange(getSelection().getRangeAt(0));- }+ focusByRange(getSelection().getRangeAt(0));}exportLayout({reload: false,diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.tsindex 677f4a1d09..ef0cf8f9c3 100644--- a/app/src/menus/Menu.ts+++ b/app/src/menus/Menu.ts@@ -253,7 +253,7 @@ export const bindMenuKeydown = (event: KeyboardEvent) => {return false;}const target = event.target as HTMLElement;- if (window.siyuan.menus.menu.element.contains(target) && (target.tagName === "INPUT" || target.tagName === "TEXTAREA")) {+ if (window.siyuan.menus.menu.element.contains(target) && ["INPUT", "TEXTAREA"].includes(target.tagName)) {return false;}const eventCode = Constants.KEYCODELIST[event.keyCode];diff --git a/app/src/mobile/util/keyboardToolbar.ts b/app/src/mobile/util/keyboardToolbar.tsindex 7804e57924..a3c2ba5982 100644--- a/app/src/mobile/util/keyboardToolbar.ts+++ b/app/src/mobile/util/keyboardToolbar.ts@@ -308,8 +308,7 @@ const renderKeyboardToolbar = () => {window.screen.height - window.innerHeight < 160 || // reloadSync 会导致 selectionchange,从而导致键盘没有弹起的情况下出现工具栏!document.activeElement || (document.activeElement &&- document.activeElement.tagName !== "INPUT" &&- document.activeElement.tagName !== "TEXTAREA" &&+ !["INPUT", "TEXTAREA"].includes(document.activeElement.tagName) &&!document.activeElement.classList.contains("protyle-wysiwyg") &&document.activeElement.getAttribute("contenteditable") !== "true")) {@@ -318,8 +317,7 @@ const renderKeyboardToolbar = () => {}// 编辑器设置界面点击空白或关闭,焦点不知何故会飘移到编辑器上if (document.activeElement &&- document.activeElement.tagName !== "INPUT" &&- document.activeElement.tagName !== "TEXTAREA" && (+ !["INPUT", "TEXTAREA"].includes(document.activeElement.tagName) && (document.getElementById("menu").style.transform === "translateX(0px)" ||document.getElementById("model").style.transform === "translateY(0px)")) {diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.tsindex 350f8ed5f6..8e7887ab2c 100644--- a/app/src/protyle/render/av/cell.ts+++ b/app/src/protyle/render/av/cell.ts@@ -204,16 +204,13 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type});});}- inputElement.addEventListener("blur", () => {- updateCellValue(protyle, type, cellElements);- });inputElement.addEventListener("keydown", (event) => {if (event.isComposing) {return;}if (event.key === "Escape" || event.key === "Tab" ||(event.key === "Enter" && !event.shiftKey && isNotCtrl(event))) {- inputElement.blur();+ updateCellValue(protyle, type, cellElements);if (event.key === "Tab") {protyle.wysiwyg.element.dispatchEvent(new KeyboardEvent("keydown", {shiftKey: event.shiftKey,@@ -231,6 +228,7 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type}avMaskElement.addEventListener("click", (event) => {if ((event.target as HTMLElement).classList.contains("av__mask")) {+ updateCellValue(protyle, type, cellElements);avMaskElement?.remove();}});diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.tsindex e94162a899..2cbc4f4d32 100644--- a/app/src/protyle/render/av/render.ts+++ b/app/src/protyle/render/av/render.ts@@ -296,7 +296,10 @@ ${cell.color ? `color:${cell.color};` : ""}">${text}</div>`;if (newCellElement) {newCellElement.classList.add("av__cell--select");}- if (!document.querySelector(".av__panel")) {+ const avMaskElement = document.querySelector(".av__mask");+ if (avMaskElement) {+ (avMaskElement.querySelector(" textarea") as HTMLTextAreaElement).focus();+ } else if (!document.querySelector(".av__panel")) {focusBlock(e);}}diff --git a/app/src/protyle/util/selection.ts b/app/src/protyle/util/selection.tsindex 4b1d09b7d4..a4bd198c0d 100644--- a/app/src/protyle/util/selection.ts+++ b/app/src/protyle/util/selection.ts@@ -475,6 +475,12 @@ export const focusByRange = (range: Range) => {if (!range) {return;}++ const startNode = range.startContainer.childNodes[range.startOffset] as HTMLElement;+ if (startNode && startNode.nodeType !== 3 && ["INPUT", "TEXTAREA"].includes(startNode.tagName)) {+ startNode.focus();+ return;+ }const selection = window.getSelection();selection.removeAllRanges();selection.addRange(range);