diff --git a/app/appearance/icons/ant/icon.js b/app/appearance/icons/ant/icon.js index 256e7ff3f..e377d2d7d 100644 --- a/app/appearance/icons/ant/icon.js +++ b/app/appearance/icons/ant/icon.js @@ -18,9 +18,6 @@ document.body.insertAdjacentHTML('afterbegin', ` - - - @@ -276,7 +273,7 @@ document.body.insertAdjacentHTML('afterbegin', ` - + diff --git a/app/appearance/icons/ant/icon.json b/app/appearance/icons/ant/icon.json index a5438987d..88aff836f 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.23.0" + "version": "1.23.1" } diff --git a/app/appearance/icons/index.html b/app/appearance/icons/index.html index 8a3ebfc9b..80222a668 100644 --- a/app/appearance/icons/index.html +++ b/app/appearance/icons/index.html @@ -508,12 +508,6 @@ iconBazaar -
- - - - iconCalendar -
diff --git a/app/appearance/icons/material/icon.js b/app/appearance/icons/material/icon.js index 4118c5fb7..752c15c21 100644 --- a/app/appearance/icons/material/icon.js +++ b/app/appearance/icons/material/icon.js @@ -270,9 +270,6 @@ document.body.insertAdjacentHTML('afterbegin', ` - - - diff --git a/app/appearance/icons/material/icon.json b/app/appearance/icons/material/icon.json index 05206308b..3d8ce7088 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.23.0" + "version": "1.23.1" } diff --git a/app/src/menus/Menu.ts b/app/src/menus/Menu.ts index 8849a3a47..4c1f5fa39 100644 --- a/app/src/menus/Menu.ts +++ b/app/src/menus/Menu.ts @@ -206,7 +206,7 @@ export class MenuItem { if (typeof options.iconHTML === "string") { html = options.iconHTML + html; } else { - html = `${html}`; + html = `${html}`; } if (options.accelerator) { html += `${updateHotkeyTip(options.accelerator)}`; diff --git a/app/src/menus/commonMenuItem.ts b/app/src/menus/commonMenuItem.ts index 9d4e2774c..f83f9c259 100644 --- a/app/src/menus/commonMenuItem.ts +++ b/app/src/menus/commonMenuItem.ts @@ -431,6 +431,7 @@ export const exportMd = (id: string) => { icon: "iconUpload", submenu: [{ label: window.siyuan.languages.template, + iconClass: "ft__error", icon: "iconMarkdown", click: async () => { const result = await fetchSyncPost("/api/block/getRefText", {id: id}); @@ -536,6 +537,7 @@ export const exportMd = (id: string) => { } }, { label: "HTML (SiYuan)", + iconClass: "ft__error", icon: "iconHTML5", click: () => { saveExport({type: "html", id}); diff --git a/app/src/protyle/render/av/addCol.ts b/app/src/protyle/render/av/addCol.ts index 371e0c9cc..3202914dd 100644 --- a/app/src/protyle/render/av/addCol.ts +++ b/app/src/protyle/render/av/addCol.ts @@ -230,5 +230,30 @@ export const addCol = (protyle: IProtyle, blockElement: Element) => { }); } }); + menu.addItem({ + icon: "iconMath", + label: window.siyuan.languages.template, + click() { + const id = Lute.NewNodeID(); + transaction(protyle, [{ + action: "addAttrViewCol", + name: window.siyuan.languages.template, + avID, + type: "template", + id + }], [{ + action: "removeAttrViewCol", + id, + avID, + }]); + addAttrViewColAnimation({ + blockElement: blockElement, + protyle: protyle, + type: "template", + name: window.siyuan.languages.template, + id + }); + } + }); return menu; }; diff --git a/app/src/protyle/render/av/blockAttr.ts b/app/src/protyle/render/av/blockAttr.ts index 8523c87eb..833fea2b4 100644 --- a/app/src/protyle/render/av/blockAttr.ts +++ b/app/src/protyle/render/av/blockAttr.ts @@ -47,6 +47,9 @@ export const genAVValueHTML = (value: IAVCellValue) => { `; break; + case "template": + html = ``; + break; case "email": html = ` @@ -83,7 +86,7 @@ export const renderAVAttribute = (element: HTMLElement, id: string, protyle?: IP
+class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone", "template"].includes(item.values[0].type) ? "" : " custom-attr__avvalue"}"> ${genAVValueHTML(item.values[0])}
`; @@ -117,7 +120,7 @@ class="fn__flex-1 fn__flex${["url", "text", "number", "email", "phone"].includes element.querySelectorAll(".b3-text-field--text").forEach((item: HTMLInputElement) => { item.addEventListener("change", () => { let value; - if (["url", "text", "email", "phone"].includes(item.parentElement.dataset.type)) { + if (["url", "text", "email", "phone", "template"].includes(item.parentElement.dataset.type)) { value = { [item.parentElement.dataset.type]: { content: item.value diff --git a/app/src/protyle/render/av/cell.ts b/app/src/protyle/render/av/cell.ts index a9c19d14d..10b6ccddf 100644 --- a/app/src/protyle/render/av/cell.ts +++ b/app/src/protyle/render/av/cell.ts @@ -85,7 +85,7 @@ export const genCellValue = (colType: TAVCol, value: string | any) => { } }; } - } else if (["text", "block", "url", "phone", "email"].includes(colType)) { + } else if (["text", "block", "url", "phone", "email", "template"].includes(colType)) { cellValue = { type: colType, [colType]: { @@ -353,7 +353,9 @@ export const popTextCell = (protyle: IProtyle, cellElements: HTMLElement[], type const blockElement = hasClosestBlock(cellElements[0]); if (["text", "url", "email", "phone", "block"].includes(type)) { html = ``; - } else if (type === "number") { + } else if (type === "template") { + html = ``; + }else if (type === "number") { html = ``; } else if (["select", "mSelect"].includes(type) && blockElement) { openMenuPanel({protyle, blockElement, type: "select", cellElements}); diff --git a/app/src/protyle/render/av/col.ts b/app/src/protyle/render/av/col.ts index 238bd8160..0d5d059a0 100644 --- a/app/src/protyle/render/av/col.ts +++ b/app/src/protyle/render/av/col.ts @@ -251,6 +251,8 @@ export const getColIconByType = (type: TAVCol) => { return "iconEmail"; case "phone": return "iconPhone"; + case "template": + return "iconMath"; } }; diff --git a/app/src/protyle/render/av/filter.ts b/app/src/protyle/render/av/filter.ts index ea2bd9958..7f55524cd 100644 --- a/app/src/protyle/render/av/filter.ts +++ b/app/src/protyle/render/av/filter.ts @@ -11,7 +11,7 @@ export const getDefaultOperatorByType = (type: TAVCol) => { if (type === "number" || type === "select") { return "="; } - if (["text", "mSelect", "url", "block", "email", "phone"].includes(type)) { + if (["text", "mSelect", "url", "block", "email", "phone", "template"].includes(type)) { return "Contains"; } }; @@ -140,6 +140,7 @@ export const setFilter = (options: { case "text": case "url": case "phone": + case "template": case "email": selectHTML = ` @@ -214,7 +215,7 @@ export const setFilter = (options: { } }); }); - } else if (["text", "url", "block", "email", "phone"].includes(colData.type)) { + } else if (["text", "url", "block", "email", "phone", "template"].includes(colData.type)) { menu.addItem({ iconHTML: "", label: `` diff --git a/app/src/protyle/render/av/render.ts b/app/src/protyle/render/av/render.ts index 9eb8541af..4e4725e12 100644 --- a/app/src/protyle/render/av/render.ts +++ b/app/src/protyle/render/av/render.ts @@ -64,6 +64,8 @@ style="width: ${column.width || "200px"}">${getCalcValue(column) || '${cell.value?.text.content || ""}`; + } else if (cell.valueType === "template") { + text = `${cell.value?.template.renderedContent || ""}`; } else if (["url", "email", "phone"].includes(cell.valueType)) { const urlContent = cell.value ? cell.value[cell.valueType as "url"].content : ""; // https://github.com/siyuan-note/siyuan/issues/9291 diff --git a/app/src/types/index.d.ts b/app/src/types/index.d.ts index 15628667a..1d5b5098b 100644 --- a/app/src/types/index.d.ts +++ b/app/src/types/index.d.ts @@ -62,6 +62,7 @@ type TAVCol = | "email" | "phone" | "mAsset" + | "template" type THintSource = "search" | "av" | "hint"; type TAVFilterOperator = "=" @@ -929,6 +930,7 @@ interface IModels { } interface IMenu { + iconClass?: string, label?: string, click?: (element: HTMLElement, event: MouseEvent) => boolean | void | Promise type?: "separator" | "submenu" | "readonly", @@ -1071,6 +1073,10 @@ interface IAVCellValue { email?: { content: string } + template?: { + content: string + renderedContent?:string + } date?: IAVCellDateValue }