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/9417

Vanessa3554333da9be
diff --git a/app/src/menus/protyle.ts b/app/src/menus/protyle.ts
index 9be5890328..0fe28bb038 100644
--- a/app/src/menus/protyle.ts
+++ b/app/src/menus/protyle.ts
@@ -1666,9 +1666,12 @@ export const setFold = (protyle: IProtyle, nodeElement: Element, isOpen?: boolea
}
nodeElement.querySelectorAll(".img--select, .av__cell--select, .av__row--select").forEach((item:HTMLElement) => {
if (item.classList.contains("av__row--select")) {
+ item.classList.remove("av__row--select");
+ item.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconUncheck");
updateHeader(item);
+ } else {
+ item.classList.remove("img--select", "av__cell--select");
}
- item.classList.remove("img--select", "av__cell--select", "av__row--select");
});
}
const id = nodeElement.getAttribute("data-node-id");
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index ce4b839014..487b45f6fe 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -159,7 +159,11 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
if (type === "updated" || type === "created" || (type === "block" && !cellElement.getAttribute("data-detached"))) {
selectRow(cellElement.parentElement.querySelector(".av__firstcol"), "toggle");
} else {
- selectRow(cellElement.parentElement.querySelector(".av__firstcol"), "unselect");
+ cellElement.parentElement.parentElement.querySelectorAll(".av__row--select").forEach(item => {
+ item.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconUncheck");
+ item.classList.remove("av__row--select");
+ });
+ updateHeader(cellElement.parentElement);
popTextCell(protyle, [cellElement]);
}
event.preventDefault();
diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts
index a34dfaf983..477de9e3a6 100644
--- a/app/src/protyle/render/av/cell.ts
+++ b/app/src/protyle/render/av/cell.ts
@@ -6,6 +6,7 @@ import {updateAttrViewCellAnimation} from "./action";
import {isCtrl} from "../../util/compatibility";
import {objEquals} from "../../../util/functions";
import {fetchPost} from "../../../util/fetch";
+import {focusBlock} from "../../util/selection";
export const getCalcValue = (column: IAVColumn) => {
if (!column.calc || !column.calc.result) {
@@ -523,6 +524,9 @@ const updateCellValue = (protyle: IProtyle, type: TAVCol, cellElements: HTMLElem
transaction(protyle, doOperations, undoOperations);
}
cellElements[0].classList.add("av__cell--select");
+ if (blockElement) {
+ focusBlock(blockElement);
+ }
setTimeout(() => {
avMaskElement.remove();
});
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 6d25e1015a..2a0e3da612 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -188,11 +188,12 @@ export class WYSIWYG {
// 图片移除选择状态应放在前面,否则 https://github.com/siyuan-note/siyuan/issues/4173
protyle.wysiwyg.element.querySelectorAll(".img--select, .av__cell--select, .av__row--select").forEach((item: HTMLElement) => {
if (item.classList.contains("av__row--select") && !hasClosestByClassName(element, "av")) {
- updateHeader(item);
item.classList.remove("av__row--select");
-
+ item.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconUncheck");
+ updateHeader(item);
+ } else {
+ item.classList.remove("img--select", "av__cell--select");
}
- item.classList.remove("img--select", "av__cell--select");
});
let nodeElement = element;
diff --git a/app/src/protyle/wysiwyg/keydown.ts b/app/src/protyle/wysiwyg/keydown.ts
index 6a052db01c..bf4970db96 100644
--- a/app/src/protyle/wysiwyg/keydown.ts
+++ b/app/src/protyle/wysiwyg/keydown.ts
@@ -69,6 +69,7 @@ import {escapeHtml} from "../../util/escape";
import {insertHTML} from "../util/insertHTML";
import {removeSearchMark} from "../toolbar/util";
import {copyPNG} from "../../menus/util";
+import {selectRow, updateHeader} from "../render/av/row";
const getContentByInlineHTML = (range: Range, cb: (content: string) => void) => {
@@ -122,7 +123,9 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
if (matchHotKey("⌘B", event) || matchHotKey("⌘I", event) || matchHotKey("⌘U", event)) {
event.preventDefault();
}
- return;
+ if (event.key !== "Escape") {
+ return;
+ }
}
if (nodeElement.classList.contains("protyle-wysiwyg--select") && !isCtrl(event) && !event.shiftKey && !event.altKey) {
if (event.key.toLowerCase() === "a") {
@@ -1214,7 +1217,11 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
// esc
if (event.key === "Escape") {
- if (!protyle.toolbar.element.classList.contains("fn__none") ||
+ const cellSelectElement = nodeElement.querySelector(".av__cell--select")
+ if (cellSelectElement) {
+ cellSelectElement.classList.remove("av__cell--select");
+ selectRow(cellSelectElement.parentElement.querySelector(".av__firstcol"), "select");
+ } else if (!protyle.toolbar.element.classList.contains("fn__none") ||
!protyle.hint.element.classList.contains("fn__none") ||
!protyle.toolbar.subElement.classList.contains("fn__none")) {
hideElements(["toolbar", "hint", "util"], protyle);
@@ -1230,6 +1237,12 @@ export const keydown = (protyle: IProtyle, editorElement: HTMLElement) => {
range.collapse(false);
nodeElement.classList.add("protyle-wysiwyg--select");
countBlockWord([nodeElement.getAttribute("data-node-id")], protyle.block.rootID);
+ const selectRowElement = nodeElement.querySelector(".av__row--select:not(.av__row--header)") as HTMLElement;
+ if (selectRowElement) {
+ selectRowElement.querySelector(".av__firstcol use").setAttribute("xlink:href", "#iconUncheck");
+ selectRowElement.classList.remove("av__row--select");
+ updateHeader(selectRowElement);
+ }
}
event.preventDefault();
return;