Vanessa 2024-10-25 16:58:06 +08:00
parent 1bacf63b0c
commit b0229e6c7a
15 changed files with 48 additions and 40 deletions

View file

@ -1137,12 +1137,12 @@ export const windowKeyDown = (app: App, event: KeyboardEvent) => {
const initData = item.headElement.getAttribute("data-initdata"); const initData = item.headElement.getAttribute("data-initdata");
if (item.model instanceof Editor) { if (item.model instanceof Editor) {
rootId = ` data-node-id="${item.model.editor.protyle.block.rootID}"`; rootId = ` data-node-id="${item.model.editor.protyle.block.rootID}"`;
icon = unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic", true); icon = unicode2Emoji(item.docIcon || window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-list-item__graphic", true);
} else if (initData) { } else if (initData) {
const initDataObj = JSON.parse(initData); const initDataObj = JSON.parse(initData);
if (initDataObj.instance === "Editor") { if (initDataObj.instance === "Editor") {
rootId = ` data-node-id="${initDataObj.rootId}"`; rootId = ` data-node-id="${initDataObj.rootId}"`;
icon = unicode2Emoji(item.docIcon || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic", true); icon = unicode2Emoji(item.docIcon || window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-list-item__graphic", true);
} }
} }
tabHtml += `<li data-index="${index}" data-id="${item.id}"${rootId} class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${escapeHtml(item.title)}</span></li>`; tabHtml += `<li data-index="${index}" data-id="${item.id}"${rootId} class="b3-list-item${currentId === item.id ? " b3-list-item--focus" : ""}"${currentId === item.id ? ' data-original="true"' : ""}>${icon}<span class="b3-list-item__text">${escapeHtml(item.title)}</span></li>`;

View file

@ -16,7 +16,7 @@ const getHTML = async (data: { rootID: string, icon: string, title: string }[],
data.forEach((item) => { data.forEach((item) => {
if (!key || item.title.toLowerCase().includes(key.toLowerCase())) { if (!key || item.title.toLowerCase().includes(key.toLowerCase())) {
tabHtml += `<li data-index="${index}" data-node-id="${item.rootID}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}"> tabHtml += `<li data-index="${index}" data-node-id="${item.rootID}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">
${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic", true)} ${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-list-item__graphic", true)}
<span class="b3-list-item__text">${escapeHtml(item.title)}</span> <span class="b3-list-item__text">${escapeHtml(item.title)}</span>
</li>`; </li>`;
index++; index++;

View file

@ -122,6 +122,7 @@ export abstract class Constants {
public static readonly LOCAL_SESSION_FIRSTLOAD = "local-session-firstload"; public static readonly LOCAL_SESSION_FIRSTLOAD = "local-session-firstload";
public static readonly LOCAL_OUTLINE = "local-outline"; public static readonly LOCAL_OUTLINE = "local-outline";
public static readonly LOCAL_PLUGIN_DOCKS = "local-plugin-docks"; public static readonly LOCAL_PLUGIN_DOCKS = "local-plugin-docks";
public static readonly LOCAL_IMAGES = "local-images";
// dialog // dialog
public static readonly DIALOG_OPENCARD = "dialog-opencard"; public static readonly DIALOG_OPENCARD = "dialog-opencard";
@ -642,9 +643,6 @@ export abstract class Constants {
<path fill="#ffdd4e" d="M15.396 8.403l11.659 15.921c0.401 0.579 0.432 1.317 0.081 1.924-0.361 0.594-1.005 0.985-1.741 0.985-0.008 0-0.017-0-0.025-0h-9.344l-0.63-18.83z"></path> <path fill="#ffdd4e" d="M15.396 8.403l11.659 15.921c0.401 0.579 0.432 1.317 0.081 1.924-0.361 0.594-1.005 0.985-1.741 0.985-0.008 0-0.017-0-0.025-0h-9.344l-0.63-18.83z"></path>
<path fill="#ffd00f" d="M13.868 6.478c0 0.946 0.767 1.712 1.712 1.712s1.712-0.767 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0zM28.577 10.818c0 0.945 0.766 1.712 1.712 1.712s1.712-0.766 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0zM0 10.822c0 0.945 0.766 1.712 1.712 1.712s1.712-0.766 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0z"></path> <path fill="#ffd00f" d="M13.868 6.478c0 0.946 0.767 1.712 1.712 1.712s1.712-0.767 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0zM28.577 10.818c0 0.945 0.766 1.712 1.712 1.712s1.712-0.766 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0zM0 10.822c0 0.945 0.766 1.712 1.712 1.712s1.712-0.766 1.712-1.712v0c0-0.945-0.766-1.712-1.712-1.712s-1.712 0.766-1.712 1.712v0z"></path>
</svg>`; </svg>`;
public static readonly SIYUAN_IMAGE_FILE: string = "1f4c4";
public static readonly SIYUAN_IMAGE_NOTE: string = "1f5c3";
public static readonly SIYUAN_IMAGE_FOLDER: string = "1f4d1";
// assets // assets
public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif"]; public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif"];

View file

@ -482,7 +482,7 @@ export const updateOutlineEmoji = (unicode: string, id: string) => {
/// #if !MOBILE /// #if !MOBILE
getAllModels().outline.forEach(model => { getAllModels().outline.forEach(model => {
if (model.blockId === id) { if (model.blockId === id) {
model.headerElement.nextElementSibling.firstElementChild.outerHTML = unicode2Emoji(unicode || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic", true); model.headerElement.nextElementSibling.firstElementChild.outerHTML = unicode2Emoji(unicode || window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-list-item__graphic", true);
} }
}); });
/// #endif /// #endif
@ -504,7 +504,7 @@ export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFil
} }
/// #endif /// #endif
if (emojiElement) { if (emojiElement) {
emojiElement.innerHTML = unicode2Emoji(unicode || (icon === "iconFile" ? (emojiElement.previousElementSibling.classList.contains("fn__hidden") ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER) : Constants.SIYUAN_IMAGE_NOTE)); emojiElement.innerHTML = unicode2Emoji(unicode || (icon === "iconFile" ? (emojiElement.previousElementSibling.classList.contains("fn__hidden") ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder) : window.siyuan.storage[Constants.LOCAL_IMAGES].note));
} }
if (icon !== "iconFile") { if (icon !== "iconFile") {
setNoteBook(); setNoteBook();

View file

@ -611,7 +611,7 @@ export class Wnd {
} }
} else if (!graphicElement) { } else if (!graphicElement) {
// 没有图标的文档 // 没有图标的文档
iconHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE, "b3-menu__icon", true); iconHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-menu__icon", true);
} }
window.siyuan.menus.menu.append(new MenuItem({ window.siyuan.menus.menu.append(new MenuItem({
label: escapeHtml(item.querySelector(".item__text").textContent), label: escapeHtml(item.querySelector(".item__text").textContent),

View file

@ -710,7 +710,7 @@ export class Files extends Model {
} }
private genNotebook(item: INotebook) { private genNotebook(item: INotebook) {
const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE)}</span>`; const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
if (item.closed) { if (item.closed) {
return `<li data-type="open" data-url="${item.id}" class="b3-list-item b3-list-item--hide-action"> return `<li data-type="open" data-url="${item.id}" class="b3-list-item b3-list-item--hide-action">
<span class="b3-list-item__toggle fn__hidden"> <span class="b3-list-item__toggle fn__hidden">
@ -829,8 +829,8 @@ export class Files extends Model {
iconElement.parentElement.classList.add("fn__hidden"); iconElement.parentElement.classList.add("fn__hidden");
} }
const emojiElement = iconElement.parentElement.nextElementSibling; const emojiElement = iconElement.parentElement.nextElementSibling;
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file);
} }
} }
targetElement.parentElement.remove(); targetElement.parentElement.remove();
@ -902,8 +902,8 @@ export class Files extends Model {
sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__toggle").classList.add("fn__hidden"); sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__toggle").classList.add("fn__hidden");
sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open"); sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");
const emojiElement = sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__icon"); const emojiElement = sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file);
} }
} }
sourceElement.parentElement.remove(); sourceElement.parentElement.remove();
@ -916,8 +916,8 @@ export class Files extends Model {
if (newElement) { if (newElement) {
newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden"); newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");
const emojiElement = newElement.querySelector(".b3-list-item__icon"); const emojiElement = newElement.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder);
} }
const arrowElement = newElement.querySelector(".b3-list-item__arrow"); const arrowElement = newElement.querySelector(".b3-list-item__arrow");
if (arrowElement.classList.contains("b3-list-item__arrow--open")) { if (arrowElement.classList.contains("b3-list-item__arrow--open")) {
@ -993,8 +993,8 @@ export class Files extends Model {
arrowElement.classList.add("b3-list-item__arrow--open"); arrowElement.classList.add("b3-list-item__arrow--open");
arrowElement.parentElement.classList.remove("fn__hidden"); arrowElement.parentElement.classList.remove("fn__hidden");
const emojiElement = liElement.querySelector(".b3-list-item__icon"); const emojiElement = liElement.querySelector(".b3-list-item__icon");
if (emojiElement.textContent === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) { if (emojiElement.textContent === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file)) {
emojiElement.textContent = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER); emojiElement.textContent = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder);
} }
liElement.insertAdjacentHTML("afterend", `<ul>${fileHTML}</ul>`); liElement.insertAdjacentHTML("afterend", `<ul>${fileHTML}</ul>`);
if (setStorage) { if (setStorage) {
@ -1139,7 +1139,7 @@ class="b3-list-item b3-list-item--hide-action" data-path="${item.path}">
<span style="padding-left: ${(item.path.split("/").length - 2) * 18 + 22}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}"> <span style="padding-left: ${(item.path.split("/").length - 2) * 18 + 22}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span> </span>
<span class="b3-list-item__icon b3-tooltips b3-tooltips__n" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))}</span> <span class="b3-list-item__icon b3-tooltips b3-tooltips__n" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
<span class="b3-list-item__text ariaLabel" data-position="parentE" <span class="b3-list-item__text ariaLabel" data-position="parentE"
aria-label="${escapeHtml(ariaLabel)}">${getDisplayName(item.name, true, true)}</span> aria-label="${escapeHtml(ariaLabel)}">${getDisplayName(item.name, true, true)}</span>
<span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}"> <span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}">

View file

@ -342,7 +342,7 @@ export class Outline extends Model {
const docTitleElement = this.headerElement.nextElementSibling as HTMLElement; const docTitleElement = this.headerElement.nextElementSibling as HTMLElement;
if (this.type === "pin") { if (this.type === "pin") {
if (ial) { if (ial) {
let iconHTML = `${unicode2Emoji(ial.icon || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic", true)}`; let iconHTML = `${unicode2Emoji(ial.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-list-item__graphic", true)}`;
if (ial.icon === Constants.ZWSP && docTitleElement.firstElementChild) { if (ial.icon === Constants.ZWSP && docTitleElement.firstElementChild) {
iconHTML = docTitleElement.firstElementChild.outerHTML; iconHTML = docTitleElement.firstElementChild.outerHTML;
} }

View file

@ -395,7 +395,7 @@ export const workspaceMenu = (app: App, rect: DOMRect) => {
if (!item.closed) { if (!item.closed) {
submenu.push({ submenu.push({
label: escapeHtml(item.name), label: escapeHtml(item.name),
iconHTML: unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE, "b3-menu__icon", true), iconHTML: unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-menu__icon", true),
accelerator: window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] === item.id ? window.siyuan.config.keymap.general.dailyNote.custom : "", accelerator: window.siyuan.storage[Constants.LOCAL_DAILYNOTEID] === item.id ? window.siyuan.config.keymap.general.dailyNote.custom : "",
click: () => { click: () => {
fetchNewDailyNote(app, item.id); fetchNewDailyNote(app, item.id);

View file

@ -262,7 +262,7 @@ export class MobileFiles extends Model {
} }
private genNotebook(item: INotebook) { private genNotebook(item: INotebook) {
const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE)}</span>`; const emojiHTML = `<span class="b3-list-item__icon b3-tooltips b3-tooltips__e" aria-label="${window.siyuan.languages.changeIcon}">${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note)}</span>`;
if (item.closed) { if (item.closed) {
return `<li data-type="open" data-url="${item.id}" class="b3-list-item"> return `<li data-type="open" data-url="${item.id}" class="b3-list-item">
<span class="b3-list-item__toggle fn__hidden"> <span class="b3-list-item__toggle fn__hidden">
@ -346,8 +346,8 @@ export class MobileFiles extends Model {
sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__toggle").classList.add("fn__hidden"); sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__toggle").classList.add("fn__hidden");
sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open"); sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");
const emojiElement = sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__icon"); const emojiElement = sourceElement.parentElement.previousElementSibling.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file);
} }
} }
sourceElement.parentElement.remove(); sourceElement.parentElement.remove();
@ -359,8 +359,8 @@ export class MobileFiles extends Model {
// 重新展开移动到的新文件夹 // 重新展开移动到的新文件夹
if (newElement) { if (newElement) {
const emojiElement = newElement.querySelector(".b3-list-item__icon"); const emojiElement = newElement.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder);
} }
newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden"); newElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");
newElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open"); newElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");
@ -399,8 +399,8 @@ export class MobileFiles extends Model {
targetElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open"); targetElement.querySelector(".b3-list-item__arrow").classList.remove("b3-list-item__arrow--open");
targetElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden"); targetElement.querySelector(".b3-list-item__toggle").classList.remove("fn__hidden");
const emojiElement = targetElement.querySelector(".b3-list-item__icon"); const emojiElement = targetElement.querySelector(".b3-list-item__icon");
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FILE)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder);
} }
if (targetElement.nextElementSibling && targetElement.nextElementSibling.tagName === "UL") { if (targetElement.nextElementSibling && targetElement.nextElementSibling.tagName === "UL") {
targetElement.nextElementSibling.remove(); targetElement.nextElementSibling.remove();
@ -460,8 +460,8 @@ export class MobileFiles extends Model {
iconElement.parentElement.classList.add("fn__hidden"); iconElement.parentElement.classList.add("fn__hidden");
} }
const emojiElement = iconElement.parentElement.nextElementSibling; const emojiElement = iconElement.parentElement.nextElementSibling;
if (emojiElement.innerHTML === unicode2Emoji(Constants.SIYUAN_IMAGE_FOLDER)) { if (emojiElement.innerHTML === unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].folder)) {
emojiElement.innerHTML = unicode2Emoji(Constants.SIYUAN_IMAGE_FILE); emojiElement.innerHTML = unicode2Emoji(window.siyuan.storage[Constants.LOCAL_IMAGES].file);
} }
} }
targetElement.parentElement.remove(); targetElement.parentElement.remove();
@ -709,7 +709,7 @@ class="b3-list-item" data-path="${item.path}">
<span style="padding-left: ${(item.path.split("/").length - 2) * 20 + 24}px" class="b3-list-item__toggle${item.subFileCount === 0 ? " fn__hidden" : ""}"> <span style="padding-left: ${(item.path.split("/").length - 2) * 20 + 24}px" class="b3-list-item__toggle${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span> </span>
<span class="b3-list-item__icon">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER))}</span> <span class="b3-list-item__icon">${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder))}</span>
<span class="b3-list-item__text">${getDisplayName(item.name, true, true)}</span> <span class="b3-list-item__text">${getDisplayName(item.name, true, true)}</span>
<span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}"> <span data-type="more-file" class="b3-list-item__action b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.more}">
<svg><use xlink:href="#iconMore"></use></svg> <svg><use xlink:href="#iconMore"></use></svg>

View file

@ -12,7 +12,7 @@ export const getRecentDocs = (app: App) => {
let html = ""; let html = "";
response.data.forEach((item: any, index: number) => { response.data.forEach((item: any, index: number) => {
html += `<li data-index="${index}" data-node-id="${item.rootID}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}"> html += `<li data-index="${index}" data-node-id="${item.rootID}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">
${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_FILE, "b3-list-item__graphic", true)} ${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].file, "b3-list-item__graphic", true)}
<span class="b3-list-item__text">${escapeHtml(item.title)}</span> <span class="b3-list-item__text">${escapeHtml(item.title)}</span>
</li>`; </li>`;
}); });

View file

@ -172,7 +172,7 @@ const onRecentBlocks = (data: IBlock[], config: Config.IUILayoutTabSearchConfig,
<span class="b3-list-item__toggle b3-list-item__toggle--hl"> <span class="b3-list-item__toggle b3-list-item__toggle--hl">
<svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg>
</span> </span>
${unicode2Emoji(getNotebookIcon(item.box) || Constants.SIYUAN_IMAGE_NOTE, "b3-list-item__graphic", true)} ${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)}
<span class="b3-list-item__text" style="color: var(--b3-theme-on-surface)">${escapeGreat(title)}</span> <span class="b3-list-item__text" style="color: var(--b3-theme-on-surface)">${escapeGreat(title)}</span>
</div><div>`; </div><div>`;
item.children.forEach((childItem, childIndex) => { item.children.forEach((childItem, childIndex) => {

View file

@ -206,7 +206,12 @@ export const getLocalStorage = (cb: () => void) => {
defaultStorage[Constants.LOCAL_FILEPOSITION] = {}; // {id: IScrollAttr} defaultStorage[Constants.LOCAL_FILEPOSITION] = {}; // {id: IScrollAttr}
defaultStorage[Constants.LOCAL_DIALOGPOSITION] = {}; // {id: IPosition} defaultStorage[Constants.LOCAL_DIALOGPOSITION] = {}; // {id: IPosition}
defaultStorage[Constants.LOCAL_HISTORY] = { defaultStorage[Constants.LOCAL_HISTORY] = {
notebookId: "%", type: 0, operation: "all", sideWidth: "256px", sideDocWidth: "256px", sideDiffWidth: "256px", notebookId: "%",
type: 0,
operation: "all",
sideWidth: "256px",
sideDocWidth: "256px",
sideDiffWidth: "256px",
}; };
defaultStorage[Constants.LOCAL_FLASHCARD] = { defaultStorage[Constants.LOCAL_FLASHCARD] = {
fullscreen: false fullscreen: false
@ -235,6 +240,11 @@ export const getLocalStorage = (cb: () => void) => {
defaultStorage[Constants.LOCAL_DOCINFO] = { defaultStorage[Constants.LOCAL_DOCINFO] = {
id: "", id: "",
}; };
defaultStorage[Constants.LOCAL_IMAGES] = {
file: "1f4c4",
note: "1f5c3",
folder: "1f4d1"
};
defaultStorage[Constants.LOCAL_FONTSTYLES] = []; defaultStorage[Constants.LOCAL_FONTSTYLES] = [];
defaultStorage[Constants.LOCAL_FILESPATHS] = []; // filesPath[] defaultStorage[Constants.LOCAL_FILESPATHS] = []; // filesPath[]
defaultStorage[Constants.LOCAL_SEARCHDATA] = { defaultStorage[Constants.LOCAL_SEARCHDATA] = {
@ -271,7 +281,7 @@ export const getLocalStorage = (cb: () => void) => {
Constants.LOCAL_SEARCHDATA, Constants.LOCAL_ZOOM, Constants.LOCAL_LAYOUTS, Constants.LOCAL_AI, Constants.LOCAL_SEARCHDATA, Constants.LOCAL_ZOOM, Constants.LOCAL_LAYOUTS, Constants.LOCAL_AI,
Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD, Constants.LOCAL_PLUGINTOPUNPIN, Constants.LOCAL_SEARCHASSET, Constants.LOCAL_FLASHCARD,
Constants.LOCAL_DIALOGPOSITION, Constants.LOCAL_SEARCHUNREF, Constants.LOCAL_HISTORY, Constants.LOCAL_DIALOGPOSITION, Constants.LOCAL_SEARCHUNREF, Constants.LOCAL_HISTORY,
Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS, Constants.LOCAL_OUTLINE, Constants.LOCAL_FILEPOSITION, Constants.LOCAL_FILESPATHS, Constants.LOCAL_IMAGES,
Constants.LOCAL_PLUGIN_DOCKS].forEach((key) => { Constants.LOCAL_PLUGIN_DOCKS].forEach((key) => {
if (typeof response.data[key] === "string") { if (typeof response.data[key] === "string") {
try { try {

View file

@ -1400,7 +1400,7 @@ const onSearch = (data: IBlock[], edit: Protyle, element: Element, config: Confi
<span class="b3-list-item__toggle b3-list-item__toggle--hl"> <span class="b3-list-item__toggle b3-list-item__toggle--hl">
<svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow b3-list-item__arrow--open"><use xlink:href="#iconRight"></use></svg>
</span> </span>
${unicode2Emoji(getNotebookIcon(item.box) || Constants.SIYUAN_IMAGE_NOTE, "b3-list-item__graphic", true)} ${unicode2Emoji(getNotebookIcon(item.box) || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)}
<span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span> <span class="b3-list-item__text ariaLabel" style="color: var(--b3-theme-on-surface)" aria-label="${escapeAriaLabel(title)}">${escapeGreat(title)}</span>
</div><div>`; </div><div>`;
item.children.forEach((childItem, childIndex) => { item.children.forEach((childItem, childIndex) => {

View file

@ -129,7 +129,7 @@ ${item.label ? "data-label='" + item.label + "'" : ""}>
iconHTML = `<svg data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}" style="height: 22px;width: 10px;"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`; iconHTML = `<svg data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}" style="height: 22px;width: 10px;"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`;
} else { } else {
if (item.type === "NodeDocument") { if (item.type === "NodeDocument") {
iconHTML = `<span data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}">${unicode2Emoji(item.ial.icon || Constants.SIYUAN_IMAGE_FILE)}</span>`; iconHTML = `<span data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}">${unicode2Emoji(item.ial.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].file)}</span>`;
} else { } else {
iconHTML = `<svg data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`; iconHTML = `<svg data-defids='["${item.defID}"]' class="b3-list-item__graphic popover__block" data-id="${item.id}"><use xlink:href="#${getIconByType(item.type, item.subType)}"></use></svg>`;
} }

View file

@ -195,7 +195,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
<span class="b3-list-item__toggle b3-list-item__toggle--hl"> <span class="b3-list-item__toggle b3-list-item__toggle--hl">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span> </span>
${unicode2Emoji(item.icon || Constants.SIYUAN_IMAGE_NOTE, "b3-list-item__graphic", true)} ${unicode2Emoji(item.icon || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)}
<span class="b3-list-item__text">${escapeHtml(item.name)}</span> <span class="b3-list-item__text">${escapeHtml(item.name)}</span>
${countHTML} ${countHTML}
</li></ul>`; </li></ul>`;
@ -242,7 +242,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
<span class="counter counter--right b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.flashcardCard}">${item.flashcardCount}</span>`; <span class="counter counter--right b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.flashcardCard}">${item.flashcardCount}</span>`;
} }
fileHTML += `<li class="b3-list-item${fileHTML === "" ? " b3-list-item--focus" : ""}" data-path="${item.path}" data-box="${item.box}"> fileHTML += `<li class="b3-list-item${fileHTML === "" ? " b3-list-item--focus" : ""}" data-path="${item.path}" data-box="${item.box}">
${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE, "b3-list-item__graphic", true)} ${unicode2Emoji(item.boxIcon || window.siyuan.storage[Constants.LOCAL_IMAGES].note, "b3-list-item__graphic", true)}
<span class="b3-list-item__showall" style="padding:4px 0">${escapeHtml(item.hPath)}</span> <span class="b3-list-item__showall" style="padding:4px 0">${escapeHtml(item.hPath)}</span>
${countHTML} ${countHTML}
</li>`; </li>`;
@ -516,7 +516,7 @@ const getLeaf = (liElement: HTMLElement, flashcard: boolean) => {
<span style="padding-left: ${item.path.split("/").length * 8}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}"> <span style="padding-left: ${item.path.split("/").length * 8}px" class="b3-list-item__toggle b3-list-item__toggle--hl${item.subFileCount === 0 ? " fn__hidden" : ""}">
<svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg> <svg class="b3-list-item__arrow"><use xlink:href="#iconRight"></use></svg>
</span> </span>
${unicode2Emoji(item.icon || (item.subFileCount === 0 ? Constants.SIYUAN_IMAGE_FILE : Constants.SIYUAN_IMAGE_FOLDER), "b3-list-item__graphic", true)} ${unicode2Emoji(item.icon || (item.subFileCount === 0 ? window.siyuan.storage[Constants.LOCAL_IMAGES].file : window.siyuan.storage[Constants.LOCAL_IMAGES].folder), "b3-list-item__graphic", true)}
<span class="b3-list-item__text ariaLabel" data-position="parentE" aria-label="${getDisplayName(item.name, true, true)} <small class='ft__on-surface'>${item.hSize}</small>${item.bookmark ? "<br>" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "<br>" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "<br>" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "<br>" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${item.hMtime}<br>${window.siyuan.languages.createdAt} ${item.hCtime}">${getDisplayName(item.name, true, true)}</span> <span class="b3-list-item__text ariaLabel" data-position="parentE" aria-label="${getDisplayName(item.name, true, true)} <small class='ft__on-surface'>${item.hSize}</small>${item.bookmark ? "<br>" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "<br>" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "<br>" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "<br>" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}<br>${window.siyuan.languages.modifiedAt} ${item.hMtime}<br>${window.siyuan.languages.createdAt} ${item.hCtime}">${getDisplayName(item.name, true, true)}</span>
${countHTML} ${countHTML}
</li>`; </li>`;