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

Vanessa6136e5e86369
diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts
index 09a07a7b8e..27f0a5bc12 100644
--- a/app/src/protyle/render/av/action.ts
+++ b/app/src/protyle/render/av/action.ts
@@ -22,7 +22,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
}], [{
action: "removeAttrViewCol",
id,
- parentID: blockElement.getAttribute("data-av-type"),
+ parentID: blockElement.getAttribute("data-av-id"),
}]);
}
});
@@ -103,7 +103,7 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
transaction(protyle, [{
action: "removeAttrViewCol",
id,
- parentID: blockElement.getAttribute("data-av-type"),
+ parentID: blockElement.getAttribute("data-av-id"),
}], [{
action: "addAttrViewCol",
name: cellElement.textContent.trim(),
@@ -135,3 +135,41 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
}
return false;
};
+
+
+export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: any }, target: HTMLElement) => {
+ const rowElement = hasClosestByClassName(target, "av__row");
+ if (rowElement) {
+ const menu = new Menu("av-row");
+ menu.addItem({
+ icon: "iconCopy",
+ label: window.siyuan.languages.duplicate,
+ click() {
+
+ }
+ });
+ menu.addItem({
+ icon: "iconTrashcan",
+ label: window.siyuan.languages.delete,
+ click() {
+
+ }
+ });
+ menu.addSeparator();
+ menu.addItem({
+ icon: "iconTrashcan",
+ label: window.siyuan.languages.open,
+ click() {
+
+ }
+ });
+ menu.open({
+ x: event.clientX,
+ y: event.clientY,
+ });
+ event.preventDefault();
+ event.stopPropagation();
+ return true;
+ }
+ return false
+}
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index c8e52af1cf..592ca4d63b 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -66,7 +66,7 @@ import {getBacklinkHeadingMore, loadBreadcrumb} from "./renderBacklink";
import {removeSearchMark} from "../toolbar/util";
import {activeBlur, hideKeyboardToolbar} from "../../mobile/util/keyboardToolbar";
import {commonClick} from "./commonClick";
-import {avClick} from "../render/av/action";
+import {avClick, avContextmenu} from "../render/av/action";
export class WYSIWYG {
public lastHTMLs: { [key: string]: string } = {};
@@ -1247,6 +1247,10 @@ export class WYSIWYG {
return false;
}
const nodeElement = hasClosestBlock(target);
+
+ if (avContextmenu(protyle, event, target)) {
+ return;
+ }
if (!nodeElement) {
return false;
}