Vanessa 2023-05-09 09:49:03 +08:00
parent 883c08810e
commit cae79fecd5
3 changed files with 32 additions and 7 deletions

View File

@ -34,8 +34,8 @@
}
&__img {
width: 96px;
height: 96px;
width: 100px;
height: 100px;
display: flex;
justify-content: center;
align-items: center;

View File

@ -632,6 +632,9 @@ declare interface IFile {
hMtime: string;
hCtime: string;
hSize: string;
dueFlashcardCount?: string;
newFlashcardCount?: string;
flashcardCount?: string;
id: string;
count: number;
subFileCount: number;

View File

@ -8,7 +8,7 @@ import {unicode2Emoji} from "../emoji";
import {Constants} from "../constants";
import {showMessage} from "../dialog/message";
export const getIdZoomInByPath = () => {
export const getIdZoomInByPath = () => {
const searchParams = new URLSearchParams(window.location.search);
const PWAURL = searchParams.get("url");
let id = "";
@ -128,7 +128,8 @@ export const moveToPath = (fromPaths: string[], toNotebook: string, toPath: stri
});
};
export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void, paths?: string[], range?: Range, title?: string, flashcard = false) => {
export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
paths?: string[], range?: Range, title?: string, flashcard = false) => {
const exitDialog = window.siyuan.dialogs.find((item) => {
if (item.element.querySelector("#foldList")) {
item.destroy();
@ -161,6 +162,8 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
}
}
});
// 文档树上引用数悬浮层不被遮挡
dialog.element.style.zIndex = "200";
if (paths && paths.length > 0) {
fetchPost("/api/filetree/getHPathsByPaths", {paths}, (response) => {
dialog.element.querySelector(".b3-dialog__header .ft__smaller").innerHTML = escapeHtml(response.data.join(" "));
@ -204,10 +207,25 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
flashcard,
}, (data) => {
let fileHTML = "";
data.data.forEach((item: { boxIcon: string, box: string, hPath: string, path: string }) => {
data.data.forEach((item: {
boxIcon: string,
box: string,
hPath: string,
path: string,
newFlashcardCount: string,
dueFlashcardCount: string,
flashcardCount: string
}) => {
let countHTML = "";
if (flashcard) {
countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.flashcardNewCard}">${item.newFlashcardCount}</span>
<span class="popover__block counter b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.flashcardReviewCard}">${item.dueFlashcardCount}</span>
<span class="popover__block counter b3-tooltips b3-tooltips__w" aria-label="${window.siyuan.languages.flashcardCard}">${item.flashcardCount}</span>`;
}
fileHTML += `<li style="padding: 4px" class="b3-list-item${fileHTML === "" ? " b3-list-item--focus" : ""}" data-path="${item.path}" data-box="${item.box}">
${unicode2Emoji(item.boxIcon || Constants.SIYUAN_IMAGE_NOTE, false, "b3-list-item__graphic", true)}
<span class="b3-list-item__showall">${escapeHtml(item.hPath)}</span>
${countHTML}
</li>`;
});
searchListElement.innerHTML = fileHTML;
@ -435,7 +453,7 @@ export const movePathTo = (cb: (toPath: string[], toNotebook: string[]) => void,
});
};
const getLeaf = (liElement: HTMLElement, flashcard:boolean) => {
const getLeaf = (liElement: HTMLElement, flashcard: boolean) => {
const toggleElement = liElement.querySelector(".b3-list-item__arrow");
if (toggleElement.classList.contains("b3-list-item__arrow--open")) {
toggleElement.classList.remove("b3-list-item__arrow--open");
@ -463,7 +481,11 @@ const getLeaf = (liElement: HTMLElement, flashcard:boolean) => {
let fileHTML = "";
response.data.files.forEach((item: IFile) => {
let countHTML = "";
if (item.count && item.count > 0) {
if (flashcard) {
countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.flashcardNewCard}">${item.newFlashcardCount}</span>
<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.flashcardReviewCard}">${item.dueFlashcardCount}</span>
<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.flashcardCard}">${item.flashcardCount}</span>`;
} else if (item.count && item.count > 0) {
countHTML = `<span class="popover__block counter b3-tooltips b3-tooltips__nw" aria-label="${window.siyuan.languages.ref}">${item.count}</span>`;
}
fileHTML += `<li title="${getDisplayName(item.name, true, true)} ${item.hSize}${item.bookmark ? "\n" + window.siyuan.languages.bookmark + " " + item.bookmark : ""}${item.name1 ? "\n" + window.siyuan.languages.name + " " + item.name1 : ""}${item.alias ? "\n" + window.siyuan.languages.alias + " " + item.alias : ""}${item.memo ? "\n" + window.siyuan.languages.memo + " " + item.memo : ""}${item.subFileCount !== 0 ? window.siyuan.languages.includeSubFile.replace("x", item.subFileCount) : ""}\n${window.siyuan.languages.modifiedAt} ${item.hMtime}\n${window.siyuan.languages.createdAt} ${item.hCtime}"