mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-20 16:40:13 +01:00
This commit is contained in:
parent
01f93d1687
commit
d1b5051ec4
2 changed files with 15 additions and 3 deletions
|
|
@ -36,9 +36,10 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const cellElement = hasClosestByClassName(event.target, "av__cell");
|
const cellElement = hasClosestByClassName(event.target, "av__cell");
|
||||||
if (cellElement && blockElement) {
|
if (cellElement && blockElement) {
|
||||||
const type = cellElement.getAttribute("data-dtype");
|
const type = cellElement.getAttribute("data-dtype") as TAVCol;
|
||||||
const menu = new Menu("av-header-cell");
|
const menu = new Menu("av-header-cell");
|
||||||
menu.addItem({
|
menu.addItem({
|
||||||
icon: getIconByType(type),
|
icon: getIconByType(type),
|
||||||
|
|
@ -98,7 +99,18 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle
|
||||||
icon: "iconTrashcan",
|
icon: "iconTrashcan",
|
||||||
label: window.siyuan.languages.delete,
|
label: window.siyuan.languages.delete,
|
||||||
click() {
|
click() {
|
||||||
|
const id = cellElement.getAttribute("data-id")
|
||||||
|
transaction(protyle, [{
|
||||||
|
action: "removeAttrViewCol",
|
||||||
|
id,
|
||||||
|
parentID: blockElement.getAttribute("data-av-type"),
|
||||||
|
}], [{
|
||||||
|
action: "addAttrViewCol",
|
||||||
|
name: cellElement.textContent.trim(),
|
||||||
|
parentID: blockElement.getAttribute("data-av-id"),
|
||||||
|
type: type,
|
||||||
|
id
|
||||||
|
}]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
menu.addSeparator();
|
menu.addSeparator();
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import {fetchPost} from "../../../util/fetch";
|
import {fetchPost} from "../../../util/fetch";
|
||||||
|
|
||||||
export const getIconByType = (type: string) => {
|
export const getIconByType = (type: TAVCol) => {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case "text":
|
case "text":
|
||||||
return "iconAlignLeft";
|
return "iconAlignLeft";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue