diff --git a/app/appearance/langs/en_US.json b/app/appearance/langs/en_US.json index b0bd0d6c4..ac6b4bebb 100644 --- a/app/appearance/langs/en_US.json +++ b/app/appearance/langs/en_US.json @@ -518,6 +518,7 @@ "customSort": "Custom Sorting", "collapse": "Collapse", "blockEmbed": "Embed Block", + "rowTip": "Click to open menu
Drag to sort", "gutterTip": "Click to open menu
⌘Click to focus
⌥Click to fold/expand
⇧Click to update attr
Drag to move
⌃Drag to duplicate
⌥Drag to ref
⇧Drag to embed
", "gutterTip2": "Click to open the menu
⇧Click Update attribute", "linkDistance": "Link distance", diff --git a/app/appearance/langs/es_ES.json b/app/appearance/langs/es_ES.json index cb29c5afe..79b95bb6c 100644 --- a/app/appearance/langs/es_ES.json +++ b/app/appearance/langs/es_ES.json @@ -518,6 +518,7 @@ "customSort": "Clasificación personalizada", "collapse": "Colapsar", "blockEmbed": "Integrar Bloque", + "rowTip": "Haz clic para abrir el menú
Arrastra para ordenar", "gutterTip": "Haga clic para abrir el menú
⌘Haga clic para enfocar
⌥Haga clic para plegar/expandir
⇧Haga clic para actualizar attr
Arrastre para mover
⌃Arrastre para duplicar
⌥ Arrastra para ref
⇧Arrastra para incrustar
", "gutterTip2": "Haga clic para abrir el menú
⇧Haga clic en Actualizar atributo", "linkDistance": "Distancia de enlace", diff --git a/app/appearance/langs/fr_FR.json b/app/appearance/langs/fr_FR.json index 699c9c31e..ba90acccf 100644 --- a/app/appearance/langs/fr_FR.json +++ b/app/appearance/langs/fr_FR.json @@ -518,6 +518,7 @@ "customSort": "Tri personnalisé", "collapse": "Collapse", "blockEmbed": "incorporer le bloc", + "rowTip": "Cliquez pour ouvrir le menu
Faites glisser pour trier", "gutterTip": "Cliquez pour ouvrir le menu
⌘Cliquez pour se concentrer
⌥Cliquez pour plier/agrandir
⇧Cliquez pour mettre à jour l'attribut
Faites glisser pour déplacer
⌃Faites glisser pour dupliquer
⌥ Faites glisser vers ref
⇧Faites glisser pour incorporer
", "gutterTip2": "Cliquez pour ouvrir le menu
⇧Click Modifier les attribut", "linkDistance": "Distance du lien", diff --git a/app/appearance/langs/zh_CHT.json b/app/appearance/langs/zh_CHT.json index 1fd2f8ec5..e9dc45693 100644 --- a/app/appearance/langs/zh_CHT.json +++ b/app/appearance/langs/zh_CHT.json @@ -518,6 +518,7 @@ "customSort": "自訂排序", "collapse": "摺疊", "blockEmbed": "嵌入塊", + "rowTip": "點擊 打開菜單
拖拽 排序", "gutterTip": "點擊 打開菜單
⌘Click 聚焦
⌥Click 折疊/展開
⇧Click 修改屬性
拖拽 移動位置
⌃拖拽 重複
⌥拖拽 生成塊引用
⇧拖拽 生成嵌入塊
", "gutterTip2": "點擊 打開功能表
⇧Click 修改屬性", "linkDistance": "連結距離", diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index a2561dab9..b305b2111 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -518,6 +518,7 @@ "customSort": "自定义排序", "collapse": "折叠", "blockEmbed": "嵌入块", + "rowTip": "点击 打开菜单
拖拽 排序", "gutterTip": "点击 打开菜单
⌘Click 聚焦
⌥Click 折叠/展开
⇧Click 修改属性
拖拽 移动位置
⌃拖拽 重复
⌥拖拽 生成块引用
⇧拖拽 生成嵌入块
", "gutterTip2": "点击 打开菜单
⇧Click 修改属性", "linkDistance": "链接距离", diff --git a/app/src/block/popover.ts b/app/src/block/popover.ts index caef260f4..fddcb84d2 100644 --- a/app/src/block/popover.ts +++ b/app/src/block/popover.ts @@ -16,6 +16,7 @@ export const initBlockPopover = (app: App) => { } const aElement = hasClosestByAttribute(event.target, "data-type", "a", true) || hasClosestByAttribute(event.target, "data-type", "tab-header") || + hasClosestByClassName(event.target, "av__gutters") || hasClosestByClassName(event.target, "emojis__item") || hasClosestByClassName(event.target, "emojis__type") || hasClosestByAttribute(event.target, "data-type", "inline-memo"); diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index 6bdce785e..273402047 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -45,6 +45,14 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle return true; } + const gutterElement = hasClosestByClassName(event.target, "av__gutters"); + if (gutterElement) { + avContextmenu(protyle, event, gutterElement); + event.preventDefault(); + event.stopPropagation(); + return true; + } + const checkElement = hasClosestByClassName(event.target, "av__firstcol"); if (checkElement) { // TODO @@ -72,6 +80,9 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a if (!rowElement) { return false; } + if (rowElement.classList.contains("av__row--header")) { + return false + } const blockElement = hasClosestBlock(rowElement); if (!blockElement) { return false; @@ -83,7 +94,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a item.classList.remove("av__row--select"); }); const rowId = rowElement.getAttribute("data-id"); - const menu = new Menu("av-row"); + const menu = new Menu(); if (menu.isOpen) { return true; } @@ -101,7 +112,7 @@ export const avContextmenu = (protyle: IProtyle, event: MouseEvent & { detail: a click() { transaction(protyle, [{ action: "removeAttrViewBlock", - srcIDs: [rowId], + srcIDs: [rowElement.querySelector(".av__cell").getAttribute("data-block-id")], parentID: blockElement.getAttribute("data-av-id"), }], [{ action: "insertAttrViewBlock", diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index afaeff0e7..141f9128a 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -43,12 +43,12 @@ export const avRender = (element: Element, cb?: () => void) => { // body data.rows.forEach((row: IAVRow) => { tableHTML += `
-
+
`; row.cells.forEach((cell, index) => { - tableHTML += `
${cell.renderValue?.content || ""}
`; + tableHTML += `
${cell.renderValue?.content || ""}
`; }); tableHTML += "
"; }); diff --git a/app/src/protyle/wysiwyg/transaction.ts b/app/src/protyle/wysiwyg/transaction.ts index 288090564..d76deffe8 100644 --- a/app/src/protyle/wysiwyg/transaction.ts +++ b/app/src/protyle/wysiwyg/transaction.ts @@ -289,8 +289,6 @@ const promiseTransaction = () => { // }); // 更新引用块 updateRef(protyle, operation.id); - } else if (["addAttrViewCol", "insertAttrViewBlock"].includes(operation.action)) { - refreshAV(protyle, operation); } }); }); diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 9e59b5baa..787b500c6 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -837,5 +837,6 @@ interface IAVCell { value: string, renderValue: { content: string, + id: string, } }