diff --git a/app/appearance/icons/ant/icon.js b/app/appearance/icons/ant/icon.js index 4e9088be8..4453571fe 100644 --- a/app/appearance/icons/ant/icon.js +++ b/app/appearance/icons/ant/icon.js @@ -1,5 +1,8 @@ document.body.insertAdjacentHTML('afterbegin', ` + + + diff --git a/app/appearance/icons/ant/icon.json b/app/appearance/icons/ant/icon.json index 669816a92..6e5dceed1 100644 --- a/app/appearance/icons/ant/icon.json +++ b/app/appearance/icons/ant/icon.json @@ -2,5 +2,5 @@ "name": "ant", "author": "Vanessa", "url": "https://github.com/Vanessa219", - "version": "1.32.0" + "version": "1.33.0" } diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html index 51a1cd6f1..90bbac711 100644 --- a/app/appearance/icons/index.html +++ b/app/appearance/icons/index.html @@ -34,6 +34,12 @@ iconCamera +
+ + + + iconGallery +
diff --git a/app/appearance/icons/material/icon.js b/app/appearance/icons/material/icon.js index b61d9860f..5b426af25 100644 --- a/app/appearance/icons/material/icon.js +++ b/app/appearance/icons/material/icon.js @@ -1,5 +1,8 @@ document.body.insertAdjacentHTML('afterbegin', ` + + + diff --git a/app/appearance/icons/material/icon.json b/app/appearance/icons/material/icon.json index d0bbda16b..9c3960a25 100644 --- a/app/appearance/icons/material/icon.json +++ b/app/appearance/icons/material/icon.json @@ -2,5 +2,5 @@ "name": "material", "author": "Vanessa", "url": "https://github.com/Vanessa219", - "version": "1.32.0" + "version": "1.33.0" } diff --git a/app/appearance/langs/zh_CN.json b/app/appearance/langs/zh_CN.json index 78fecc86d..3a44c2817 100644 --- a/app/appearance/langs/zh_CN.json +++ b/app/appearance/langs/zh_CN.json @@ -1,4 +1,5 @@ { + "gallery": "看板", "newTag": "新建标签", "pleaseWait": "请稍等片刻...", "reconnectPrompt": "切换应用后再次进入需要一些时间恢复思源内核运行,请稍等几秒或者点击“重试”按钮", diff --git a/app/src/protyle/render/av/view.ts b/app/src/protyle/render/av/view.ts index 386523919..d452aa110 100644 --- a/app/src/protyle/render/av/view.ts +++ b/app/src/protyle/render/av/view.ts @@ -346,16 +346,50 @@ export const getSwitcherHTML = (views: IAVView[], viewId: string) => { export const addView = (protyle: IProtyle, blockElement: Element) => { const id = Lute.NewNodeID(); const avID = blockElement.getAttribute("data-av-id"); - transaction(protyle, [{ - action: "addAttrViewView", - avID, - id, - blockID: blockElement.getAttribute("data-node-id") - }], [{ - action: "removeAttrViewView", - avID, - id, - blockID: blockElement.getAttribute("data-node-id") - }]); - blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id); + const viewElement = blockElement.querySelector(".av__views"); + const addMenu = new Menu(undefined, () => { + viewElement.classList.remove("av__views--show"); + }); + addMenu.addItem({ + icon: "iconTable", + label: window.siyuan.languages.table, + click() { + transaction(protyle, [{ + action: "addAttrViewView", + avID, + id, + blockID: blockElement.getAttribute("data-node-id") + }], [{ + action: "removeAttrViewView", + avID, + id, + blockID: blockElement.getAttribute("data-node-id") + }]); + blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id); + } + }); + addMenu.addItem({ + icon: "iconGallery", + label: window.siyuan.languages.gallery, + click() { + transaction(protyle, [{ + action: "addAttrViewView", + avID, + id, + blockID: blockElement.getAttribute("data-node-id") + }], [{ + action: "removeAttrViewView", + avID, + id, + blockID: blockElement.getAttribute("data-node-id") + }]); + blockElement.setAttribute(Constants.CUSTOM_SY_AV_VIEW, id); + } + }); + viewElement.classList.add("av__views--show"); + const addRect = viewElement.querySelector('.block__icon[data-type="av-add"]')?.getBoundingClientRect(); + addMenu.open({ + x: addRect.left, + y: addRect.bottom + 8 + }); };