mirror of
https://github.com/siyuan-note/siyuan.git
synced 2026-02-02 21:51:49 +01:00
This commit is contained in:
parent
176328f0f5
commit
dafb7673bc
2 changed files with 6 additions and 11 deletions
|
|
@ -20,18 +20,14 @@ const renderRecentDocsContent = async (data: {
|
|||
}[], element: Element, key?: string) => {
|
||||
let tabHtml = "";
|
||||
let index = 0;
|
||||
|
||||
if (key) {
|
||||
data = data.filter((item) => {
|
||||
return item.title.toLowerCase().includes(key.toLowerCase());
|
||||
});
|
||||
}
|
||||
data.forEach((item) => {
|
||||
tabHtml += `<li data-index="${index}" data-node-id="${item.rootID}" class="b3-list-item${index === 0 ? " b3-list-item--focus" : ""}">
|
||||
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" : ""}">
|
||||
${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>
|
||||
</li>`;
|
||||
index++;
|
||||
index++;
|
||||
}
|
||||
});
|
||||
let switchPath = "";
|
||||
if (tabHtml) {
|
||||
|
|
@ -49,10 +45,10 @@ const renderRecentDocsContent = async (data: {
|
|||
<span class="b3-list-item__text">${window.siyuan.languages.riffCard}</span>
|
||||
<span class="b3-list-item__meta">${updateHotkeyTip(window.siyuan.config.keymap.general.riffCard.custom)}</span>
|
||||
</li>`;
|
||||
docIndex++;
|
||||
if (!switchPath) {
|
||||
switchPath = window.siyuan.languages.riffCard;
|
||||
}
|
||||
docIndex++;
|
||||
}
|
||||
getAllDocks().forEach((item) => {
|
||||
if (!key || item.title.toLowerCase().includes(key.toLowerCase())) {
|
||||
|
|
@ -153,7 +149,6 @@ export const openRecentDocs = () => {
|
|||
sortSelect.addEventListener("change", () => {
|
||||
// 重新调用 API 获取排序后的数据
|
||||
fetchPost("/api/storage/getRecentDocs", {sortBy: sortSelect.value}, (newResponse) => {
|
||||
response = newResponse;
|
||||
renderRecentDocsContent(newResponse.data, dialog.element, searchElement.value);
|
||||
});
|
||||
window.siyuan.storage[Constants.LOCAL_RECENT_DOCS].type = sortSelect.value;
|
||||
|
|
|
|||
|
|
@ -372,7 +372,7 @@ func getRecentDocs(sortBy string) (ret []*RecentDoc, err error) {
|
|||
switch sortBy {
|
||||
case "updated": // 按更新时间排序
|
||||
// 从数据库查询最近修改的文档
|
||||
sqlBlocks := sql.SelectBlocksRawStmt("SELECT * FROM blocks WHERE type = 'd' ORDER BY updated DESC", 1, 32)
|
||||
sqlBlocks := sql.SelectBlocksRawStmt("SELECT * FROM blocks WHERE type = 'd' ORDER BY updated DESC", 1, Conf.FileTree.RecentDocsMaxListCount)
|
||||
ret = []*RecentDoc{}
|
||||
if 1 > len(sqlBlocks) {
|
||||
return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue