From ac61d1652015b3a9ef3e5ec7e81d7fd4c3a1973f Mon Sep 17 00:00:00 2001 From: Vanessa Date: Sat, 1 Jul 2023 10:24:12 +0800 Subject: [PATCH] :art: selected https://github.com/siyuan-note/siyuan/issues/7536 --- app/appearance/icons/ant/icon.js | 6 +++ app/appearance/icons/index.html | 12 +++++ app/appearance/icons/material/icon.js | 6 +++ app/appearance/langs/zh_CN.json | 4 ++ app/src/protyle/render/av/action.ts | 76 +++++++++++++++++++++++++++ app/src/protyle/render/av/cell.ts | 2 +- 6 files changed, 105 insertions(+), 1 deletion(-) diff --git a/app/appearance/icons/ant/icon.js b/app/appearance/icons/ant/icon.js index c2679beeb..555d9212e 100644 --- a/app/appearance/icons/ant/icon.js +++ b/app/appearance/icons/ant/icon.js @@ -1,5 +1,11 @@ document.body.insertAdjacentHTML('afterbegin', ` + + + + + + diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html index 469ae5811..c23c262a6 100644 --- a/app/appearance/icons/index.html +++ b/app/appearance/icons/index.html @@ -28,6 +28,18 @@

SiYuan

+
+ + + + iconCalendar +
+
+ + + + iconNumber +
diff --git a/app/appearance/icons/material/icon.js b/app/appearance/icons/material/icon.js index 206a6a3cb..033913d21 100644 --- a/app/appearance/icons/material/icon.js +++ b/app/appearance/icons/material/icon.js @@ -1,5 +1,11 @@ document.body.insertAdjacentHTML('afterbegin', ` + + + + + + diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 5efd6e099..7e8489a26 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1,4 +1,8 @@ { + "number": "数字", + "date": "日期", + "select": "单选", + "multiSelect": "多选", "commandEmpty": "暂无命令,点击前往集市下载更多插件", "commandPanel": "命令面板", "cloudRegionNorthAmerica": "流云(北美数据中心)", diff --git a/app/src/protyle/render/av/action.ts b/app/src/protyle/render/av/action.ts index d97812b5d..4ebfa4c56 100644 --- a/app/src/protyle/render/av/action.ts +++ b/app/src/protyle/render/av/action.ts @@ -34,6 +34,82 @@ export const avClick = (protyle: IProtyle, event: MouseEvent & { target: HTMLEle }]); } }); + menu.addItem({ + icon: "iconNumber", + label: window.siyuan.languages.number, + click() { + const id = Lute.NewNodeID(); + const type = "text"; + transaction(protyle, [{ + action: "addAttrViewCol", + name: "Text", + parentID: blockElement.getAttribute("data-av-id"), + type, + id + }], [{ + action: "removeAttrViewCol", + id, + parentID: blockElement.getAttribute("data-av-id"), + }]); + } + }); + menu.addItem({ + icon: "iconListItem", + label: window.siyuan.languages.select, + click() { + const id = Lute.NewNodeID(); + const type = "text"; + transaction(protyle, [{ + action: "addAttrViewCol", + name: "Text", + parentID: blockElement.getAttribute("data-av-id"), + type, + id + }], [{ + action: "removeAttrViewCol", + id, + parentID: blockElement.getAttribute("data-av-id"), + }]); + } + }); + menu.addItem({ + icon: "iconList", + label: window.siyuan.languages.multiSelect, + click() { + const id = Lute.NewNodeID(); + const type = "text"; + transaction(protyle, [{ + action: "addAttrViewCol", + name: "Text", + parentID: blockElement.getAttribute("data-av-id"), + type, + id + }], [{ + action: "removeAttrViewCol", + id, + parentID: blockElement.getAttribute("data-av-id"), + }]); + } + }); + menu.addItem({ + icon: "iconCalendar", + label: window.siyuan.languages.date, + click() { + const id = Lute.NewNodeID(); + const type = "text"; + transaction(protyle, [{ + action: "addAttrViewCol", + name: "Text", + parentID: blockElement.getAttribute("data-av-id"), + type, + id + }], [{ + action: "removeAttrViewCol", + id, + parentID: blockElement.getAttribute("data-av-id"), + }]); + } + }); const addRect = addElement.getBoundingClientRect(); menu.open({ x: addRect.left, diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index ec887f68b..ad969f4d7 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -8,7 +8,7 @@ export const popTextCell = (protyle: IProtyle, cellElement: HTMLElement) => { const cellRect = cellElement.getBoundingClientRect(); let html = ""; if (type === "block" || type === "text") { - html = ``; + html = ``; } document.body.insertAdjacentHTML("beforeend", `
${html}