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

Vanessa6e5f3ad0a028
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index c03fde0264..4150da378b 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -1546,8 +1546,21 @@ export class WYSIWYG {
/// #endif
return false;
}
+
+ const nodeElement = hasClosestBlock(target);
+ if (!nodeElement) {
+ return false;
+ }
const avCellElement = hasClosestByClassName(target, "av__cell");
if (avCellElement) {
+ if (avCellElement.classList.contains("av__cell--header")) {
+ if (!protyle.disabled) {
+ showColMenu(protyle, nodeElement, avCellElement);
+ }
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
if (getTypeByCellElement(avCellElement) === "mAsset") {
const assetImgElement = hasClosestByClassName(target, "av__cellassetimg") || hasClosestByClassName(target, "av__celltext--url");
if (assetImgElement) {
@@ -1574,7 +1587,6 @@ export class WYSIWYG {
}
}
}
-
// 在 span 前面,防止单元格哪 block-ref 被修改
const avRowElement = hasClosestByClassName(target, "av__row");
if (avRowElement && avContextmenu(protyle, avRowElement, {
@@ -1586,6 +1598,26 @@ export class WYSIWYG {
event.preventDefault();
return;
}
+
+ const avTabHeaderElement = hasClosestByClassName(target, "item");
+ if (nodeElement.classList.contains("av") && avTabHeaderElement) {
+ if (avTabHeaderElement.classList.contains("item--focus")) {
+ openViewMenu({protyle, blockElement: nodeElement, element: avTabHeaderElement});
+ } else {
+ nodeElement.removeAttribute("data-render");
+ avRender(nodeElement, protyle, () => {
+ openViewMenu({
+ protyle,
+ blockElement: nodeElement,
+ element: nodeElement.querySelector(".item.item--focus")
+ });
+ }, avTabHeaderElement.dataset.id);
+ }
+ event.stopPropagation();
+ event.preventDefault();
+ return;
+ }
+
protyle.toolbar.range = getEditorRange(protyle.element);
if (target.tagName === "SPAN") { // https://ld246.com/article/1665141518103
let types = protyle.toolbar.getCurrentType(protyle.toolbar.range);
@@ -1633,37 +1665,6 @@ export class WYSIWYG {
});
return false;
}
- const nodeElement = hasClosestBlock(target);
- if (!nodeElement) {
- return false;
- }
- const avCellHeaderElement = hasClosestByClassName(target, "av__cell--header");
- if (avCellHeaderElement) {
- if (!protyle.disabled) {
- showColMenu(protyle, nodeElement, avCellHeaderElement);
- }
- event.stopPropagation();
- event.preventDefault();
- return;
- }
- const avTabHeaderElement = hasClosestByClassName(target, "item");
- if (nodeElement.classList.contains("av") && avTabHeaderElement) {
- if (avTabHeaderElement.classList.contains("item--focus")) {
- openViewMenu({protyle, blockElement: nodeElement, element: avTabHeaderElement});
- } else {
- nodeElement.removeAttribute("data-render");
- avRender(nodeElement, protyle, () => {
- openViewMenu({
- protyle,
- blockElement: nodeElement,
- element: nodeElement.querySelector(".item.item--focus")
- });
- }, avTabHeaderElement.dataset.id);
- }
- event.stopPropagation();
- event.preventDefault();
- return;
- }
if (!isNotEditBlock(nodeElement) && !nodeElement.classList.contains("protyle-wysiwyg--select") &&
!hasClosestByClassName(target, "protyle-action") && // https://github.com/siyuan-note/siyuan/issues/8983
(isMobile() || event.detail.target || (beforeContextmenuRange && nodeElement.contains(beforeContextmenuRange.startContainer)))