From 61473eefbcea529c70df49169b952d25d804f78c Mon Sep 17 00:00:00 2001 From: Vanessa Date: Fri, 6 Oct 2023 10:25:59 +0800 Subject: [PATCH] :art: database --- app/src/protyle/render/av/col.ts | 16 ++++++++++++---- app/src/protyle/render/av/openMenuPanel.ts | 1 + 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 732c5c927..65eef4f8d 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -14,7 +14,8 @@ export const duplicateCol = (options: { type: TAVCol, avID: string, colId: string, - newValue: string + newValue: string, + icon: string }) => { const id = Lute.NewNodeID(); const nameMatch = options.newValue.match(/^(.*) \((\d+)\)$/); @@ -38,6 +39,7 @@ export const duplicateCol = (options: { name: options.newValue, avID: options.avID, type: options.type, + data: options.icon, id }, { action: "sortAttrViewCol", @@ -61,6 +63,7 @@ export const duplicateCol = (options: { name: options.newValue, avID: options.avID, type: options.type, + data: options.icon, id }, { action: "sortAttrViewCol", @@ -78,6 +81,7 @@ export const duplicateCol = (options: { protyle: options.protyle, type: options.type, name: options.newValue, + icon: options.icon, previousId: options.colId, id }); @@ -334,7 +338,8 @@ export const addAttrViewColAnimation = (options: { type: TAVCol, name: string, previousId?: string, - id: string + id: string, + icon?: string }) => { if (!options.blockElement) { return; @@ -350,7 +355,7 @@ export const addAttrViewColAnimation = (options: { if (index === 0) { html = `
- + ${options.icon ? unicode2Emoji(options.icon, "av__cellicon", true) : ``} ${options.name}
@@ -394,7 +399,8 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen type: "readonly", label: ``, bind(element) { - const iconElement = element.querySelector(".block__icon") as HTMLElement + const iconElement = element.querySelector(".block__icon") as HTMLElement; + iconElement.setAttribute("data-icon", iconElement.dataset.icon); iconElement.addEventListener("click", (event) => { const rect = iconElement.getBoundingClientRect(); openEmojiPanel("", "av", { @@ -414,6 +420,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen avID, data: cellElement.dataset.icon, }]); + iconElement.setAttribute("data-icon", unicode); iconElement.innerHTML = unicode ? unicode2Emoji(unicode) : `` updateAttrViewCellAnimation(cellElement); }); @@ -555,6 +562,7 @@ export const showColMenu = (protyle: IProtyle, blockElement: Element, cellElemen type, avID, colId, + icon: menu.element.querySelector(".block__icon").getAttribute("data-icon"), newValue: (window.siyuan.menus.menu.element.querySelector(".b3-text-field") as HTMLInputElement).value }); } diff --git a/app/src/protyle/render/av/openMenuPanel.ts b/app/src/protyle/render/av/openMenuPanel.ts index 4c5313864..498c30b43 100644 --- a/app/src/protyle/render/av/openMenuPanel.ts +++ b/app/src/protyle/render/av/openMenuPanel.ts @@ -660,6 +660,7 @@ export const openMenuPanel = (options: { type: colData.type, avID, colId, + icon: colData.icon, newValue: colData.name }); avPanelElement.remove();