Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

:iphone: https://github.com/siyuan-note/siyuan/issues/7948

Vanessa56cfc90c8cfa
diff --git a/app/src/mobile/menu/search.ts b/app/src/mobile/menu/search.ts
index 29bda51172..1ef6a8674a 100644
--- a/app/src/mobile/menu/search.ts
+++ b/app/src/mobile/menu/search.ts
@@ -149,7 +149,7 @@ const updateConfig = (element: Element, newConfig: ISearchOption, config: ISearc
window.siyuan.menus.menu.remove();
};
-const onRecentBlocks = (data: IBlock[], config: ISearchOption, response?:IWebSocketData) => {
+const onRecentBlocks = (data: IBlock[], config: ISearchOption, response?: IWebSocketData) => {
const listElement = document.querySelector("#searchList");
let resultHTML = "";
data.forEach((item: IBlock, index: number) => {
@@ -191,13 +191,11 @@ ${unicode2Emoji(childItem.ial.icon, false, "b3-list-item__graphic", true)}
listElement.scrollTop = 0;
let countHTML = "";
if (response) {
- countHTML = `<div class="b3-list--empty">
- ${config.page}/${response.data.pageCount || 1}
- <span class="fn__space"></span>
- ${window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount)}
-</div>`;
+ countHTML = `${window.siyuan.languages.findInDoc.replace("${x}", response.data.matchedRootCount).replace("${y}", response.data.matchedBlockCount)}
+<span class="fn__flex-1"></span>
+${config.page}/${response.data.pageCount || 1}`;
}
- listElement.previousElementSibling.innerHTML = countHTML;
+ listElement.previousElementSibling.querySelector('[data-type="result"]').innerHTML = countHTML;
};
let toolbarSearchTimeout = 0;
@@ -542,7 +540,13 @@ export const popSearch = (config = window.siyuan.storage[Constants.LOCAL_SEARCHD
<div class="fn__space"></div>
</div>
<div id="criteria" style="background-color: var(--b3-theme-background);" class="b3-chips"></div>
- <div></div>
+ <div class="toolbar">
+ <span class="fn__space"></span>
+ <span data-type="result" class="fn__flex-1 fn__flex"></span>
+ <span class="fn__space"></span>
+ <svg data-type="previous" disabled="disabled" class="toolbar__icon"><use xlink:href="#iconLeft"></use></svg>
+ <svg data-type="next" disabled="disabled" class="toolbar__icon"><use xlink:href="#iconRight"></use></svg>
+ </div>
<div id="searchList" style="overflow:auto;" class="fn__flex-1 b3-list b3-list--background"></div>
<div id="searchPath" class="b3-chips${config.hPath ? "" : " fn__none"}" style="background-color: var(--b3-theme-background);">
<div class="b3-chip b3-chip--middle">
@@ -552,8 +556,6 @@ export const popSearch = (config = window.siyuan.storage[Constants.LOCAL_SEARCHD
</div>
<div class="toolbar">
<span class="fn__flex-1"></span>
- <svg data-type="previous" disabled="disabled" class="toolbar__icon"><use xlink:href="#iconLeft"></use></svg>
- <svg data-type="next" disabled="disabled" class="toolbar__icon"><use xlink:href="#iconRight"></use></svg>
<svg data-type="toggle-replace" class="toolbar__icon${config.hasReplace ? " toolbar__icon--active" : ""}"><use xlink:href="#iconReplace"></use></svg>
<svg data-type="query" class="toolbar__icon"><use xlink:href="#iconRegex"></use></svg>
<svg data-type="filter" class="toolbar__icon"><use xlink:href="#iconFilter"></use></svg>
diff --git a/app/src/protyle/header/Background.ts b/app/src/protyle/header/Background.ts
index 698bb0bb26..4ed8e26e89 100644
--- a/app/src/protyle/header/Background.ts
+++ b/app/src/protyle/header/Background.ts
@@ -13,9 +13,12 @@ import {
import {upDownHint} from "../../util/upDownHint";
/// #if !MOBILE
import {openGlobalSearch} from "../../search/util";
+/// #else
+import {popSearch} from "../../mobile/menu/search";
/// #endif
import {getEventName} from "../util/compatibility";
import {Dialog} from "../../dialog";
+import {Constants} from "../../constants";
export class Background {
public element: HTMLElement;
@@ -335,6 +338,21 @@ export class Background {
} else if (type === "open-search") {
/// #if !MOBILE
openGlobalSearch(`#${target.textContent}#`, !window.siyuan.ctrlIsPressed);
+ /// #else
+ const searchOption = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
+ popSearch({
+ removed: searchOption.removed,
+ sort: searchOption.sort,
+ group: searchOption.group,
+ hasReplace: false,
+ method: 0,
+ hPath: "",
+ idPath: [],
+ k: `#${target.textContent}#`,
+ r: "",
+ page: 1,
+ types: Object.assign({}, searchOption.types)
+ });
/// #endif
event.preventDefault();
event.stopPropagation();
diff --git a/app/src/protyle/wysiwyg/index.ts b/app/src/protyle/wysiwyg/index.ts
index 6b2ab38860..5bdd1e8962 100644
--- a/app/src/protyle/wysiwyg/index.ts
+++ b/app/src/protyle/wysiwyg/index.ts
@@ -51,6 +51,8 @@ import {getAllModels} from "../../layout/getAll";
import {pushBack} from "../../util/backForward";
import {openAsset, openBy, openFileById} from "../../editor/util";
import {openGlobalSearch} from "../../search/util";
+/// #else
+import {popSearch} from "../../mobile/menu/search";
/// #endif
import {BlockPanel} from "../../block/Panel";
import {isCtrl, openByMobile} from "../util/compatibility";
@@ -1684,14 +1686,29 @@ export class WYSIWYG {
return;
}
- /// #if !MOBILE
const tagElement = hasClosestByAttribute(event.target, "data-type", "tag");
- if (tagElement && !event.altKey && protyle.model) {
+ if (tagElement && !event.altKey) {
+ /// #if !MOBILE
openGlobalSearch(`#${tagElement.textContent}#`, !ctrlIsPressed);
hideElements(["dialog"]);
+ /// #else
+ const searchOption = window.siyuan.storage[Constants.LOCAL_SEARCHDATA];
+ popSearch({
+ removed: searchOption.removed,
+ sort: searchOption.sort,
+ group: searchOption.group,
+ hasReplace: false,
+ method: 0,
+ hPath: "",
+ idPath: [],
+ k: `#${tagElement.textContent}#`,
+ r: "",
+ page: 1,
+ types: Object.assign({}, searchOption.types)
+ });
+ /// #endif
return;
}
- /// #endif
const embedItemElement = hasClosestByClassName(event.target, "protyle-wysiwyg__embed");
if (embedItemElement) {