This commit is contained in:
Vanessa 2022-06-09 23:51:20 +08:00
parent 75e5f8787f
commit a138fc821b
3 changed files with 8 additions and 7 deletions

View file

@ -392,6 +392,9 @@ ${unicode2Emoji(emoji.unicode)}</button>`;
}; };
export const updateOutlineEmoji = (unicode: string) => { export const updateOutlineEmoji = (unicode: string) => {
if (isMobile()) {
return;
}
getAllModels().outline.forEach(model => { getAllModels().outline.forEach(model => {
model.headerElement.nextElementSibling.firstElementChild.innerHTML = unicode2Emoji(unicode || Constants.SIYUAN_IMAGE_FILE); model.headerElement.nextElementSibling.firstElementChild.innerHTML = unicode2Emoji(unicode || Constants.SIYUAN_IMAGE_FILE);
}); });
@ -400,11 +403,7 @@ export const updateOutlineEmoji = (unicode: string) => {
export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFile") => { export const updateFileTreeEmoji = (unicode: string, id: string, icon = "iconFile") => {
let emojiElement; let emojiElement;
if (isMobile()) { if (isMobile()) {
if (icon === "iconFile") { emojiElement = document.querySelector(`#sidebar [data-type="sidebar-file"] [data-node-id="${id}"] .b3-list-item__icon`);
emojiElement = document.querySelector(`#fileTree [data-node-id="${id}"] .b3-list-item__icon`);
} else {
emojiElement = document.querySelector(`#fileTree [data-node-id="${id}"] .b3-list-item__icon`) || document.querySelector(`#fileTree [data-url="${id}"] .b3-list-item__icon`);
}
} else { } else {
const files = getDockByType("file").data.file as Files; const files = getDockByType("file").data.file as Files;
if (icon === "iconFile") { if (icon === "iconFile") {

View file

@ -194,7 +194,7 @@ export class Files extends Model {
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
if (target.parentElement.getAttribute("data-type") === "navigation-file") { if (target.parentElement.getAttribute("data-type") === "navigation-file") {
openEmojiPanel(target.parentElement.getAttribute("data-node-id"), target, false); openEmojiPanel(target.parentElement.getAttribute("data-node-id"), target);
} else { } else {
openEmojiPanel(target.parentElement.parentElement.getAttribute("data-url"), target, true); openEmojiPanel(target.parentElement.parentElement.getAttribute("data-url"), target, true);
} }

View file

@ -235,7 +235,9 @@ export class Background {
id: protyle.block.rootID, id: protyle.block.rootID,
attrs: {"icon": emoji} attrs: {"icon": emoji}
}); });
protyle.model.parent.setDocIcon(emoji); if (protyle.model) {
protyle.model.parent.setDocIcon(emoji);
}
} }
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();