This commit is contained in:
parent
f8c6cacf22
commit
4be64ed121
10 changed files with 22 additions and 6 deletions
|
@ -518,6 +518,7 @@
|
|||
"customSort": "Custom Sorting",
|
||||
"collapse": "Collapse",
|
||||
"blockEmbed": "Embed Block",
|
||||
"rowTip": "Click to open menu<br>Drag to sort",
|
||||
"gutterTip": "Click to open menu<br>⌘Click to focus<br>⌥Click to fold/expand<br>⇧Click to update attr<br>Drag to move<br>⌃Drag to duplicate<br>⌥Drag to ref<br> ⇧Drag to embed<br>",
|
||||
"gutterTip2": "Click to open the menu<br>⇧Click Update attribute",
|
||||
"linkDistance": "Link distance",
|
||||
|
|
|
@ -518,6 +518,7 @@
|
|||
"customSort": "Clasificación personalizada",
|
||||
"collapse": "Colapsar",
|
||||
"blockEmbed": "Integrar Bloque",
|
||||
"rowTip": "Haz clic para abrir el menú<br>Arrastra para ordenar",
|
||||
"gutterTip": "Haga clic para abrir el menú<br>⌘Haga clic para enfocar<br>⌥Haga clic para plegar/expandir<br>⇧Haga clic para actualizar attr<br>Arrastre para mover<br>⌃Arrastre para duplicar<br>⌥ Arrastra para ref<br> ⇧Arrastra para incrustar<br>",
|
||||
"gutterTip2": "Haga clic para abrir el menú<br>⇧Haga clic en Actualizar atributo",
|
||||
"linkDistance": "Distancia de enlace",
|
||||
|
|
|
@ -518,6 +518,7 @@
|
|||
"customSort": "Tri personnalisé",
|
||||
"collapse": "Collapse",
|
||||
"blockEmbed": "incorporer le bloc",
|
||||
"rowTip": "Cliquez pour ouvrir le menu<br>Faites glisser pour trier",
|
||||
"gutterTip": "Cliquez pour ouvrir le menu<br>⌘Cliquez pour se concentrer<br>⌥Cliquez pour plier/agrandir<br>⇧Cliquez pour mettre à jour l'attribut<br>Faites glisser pour déplacer<br>⌃Faites glisser pour dupliquer<br>⌥ Faites glisser vers ref<br> ⇧Faites glisser pour incorporer<br>",
|
||||
"gutterTip2": "Cliquez pour ouvrir le menu<br>⇧Click Modifier les attribut",
|
||||
"linkDistance": "Distance du lien",
|
||||
|
|
|
@ -518,6 +518,7 @@
|
|||
"customSort": "自訂排序",
|
||||
"collapse": "摺疊",
|
||||
"blockEmbed": "嵌入塊",
|
||||
"rowTip": "點擊 打開菜單<br>拖拽 排序",
|
||||
"gutterTip": "點擊 打開菜單<br>⌘Click 聚焦<br>⌥Click 折疊/展開<br>⇧Click 修改屬性<br>拖拽 移動位置<br>⌃拖拽 重複<br>⌥拖拽 生成塊引用<br>⇧拖拽 生成嵌入塊<br>",
|
||||
"gutterTip2": "點擊 打開功能表<br>⇧Click 修改屬性",
|
||||
"linkDistance": "連結距離",
|
||||
|
|
|
@ -518,6 +518,7 @@
|
|||
"customSort": "自定义排序",
|
||||
"collapse": "折叠",
|
||||
"blockEmbed": "嵌入块",
|
||||
"rowTip": "点击 打开菜单<br>拖拽 排序",
|
||||
"gutterTip": "点击 打开菜单<br>⌘Click 聚焦<br>⌥Click 折叠/展开<br>⇧Click 修改属性<br>拖拽 移动位置<br>⌃拖拽 重复<br>⌥拖拽 生成块引用<br>⇧拖拽 生成嵌入块<br>",
|
||||
"gutterTip2": "点击 打开菜单<br>⇧Click 修改属性",
|
||||
"linkDistance": "链接距离",
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -43,12 +43,12 @@ export const avRender = (element: Element, cb?: () => void) => {
|
|||
// body
|
||||
data.rows.forEach((row: IAVRow) => {
|
||||
tableHTML += `<div class="av__row" data-id="${row.id}">
|
||||
<div class="av__gutters">
|
||||
<div class="av__gutters" data-position="right" aria-label="${window.siyuan.languages.rowTip}">
|
||||
<button><svg><use xlink:href="#iconLine"></use></svg></button>
|
||||
</div>
|
||||
<div class="av__firstcol"><svg><use xlink:href="#iconUncheck"></use></svg></div>`;
|
||||
row.cells.forEach((cell, index) => {
|
||||
tableHTML += `<div class="av__cell" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${cell.renderValue?.content || ""}</div>`;
|
||||
tableHTML += `<div class="av__cell" data-block-id="${cell.renderValue?.id || ""}" data-index="${index}" style="width: ${data.columns[index].width || 200}px;${cell.bgColor ? `background-color:${cell.bgColor};` : ""}${cell.color ? `color:${cell.color};` : ""}">${cell.renderValue?.content || ""}</div>`;
|
||||
});
|
||||
tableHTML += "<div></div></div>";
|
||||
});
|
||||
|
|
|
@ -289,8 +289,6 @@ const promiseTransaction = () => {
|
|||
// });
|
||||
// 更新引用块
|
||||
updateRef(protyle, operation.id);
|
||||
} else if (["addAttrViewCol", "insertAttrViewBlock"].includes(operation.action)) {
|
||||
refreshAV(protyle, operation);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
1
app/src/types/index.d.ts
vendored
1
app/src/types/index.d.ts
vendored
|
@ -837,5 +837,6 @@ interface IAVCell {
|
|||
value: string,
|
||||
renderValue: {
|
||||
content: string,
|
||||
id: string,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue