Skip to content

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

:lipstick: Place database row navigation before breadcrumbs https://github.com/siyuan-note/siyuan/issues/20407

Daniel2d75c64a0afd
diff --git a/app/src/protyle/render/av/databaseRowNavigation.ts b/app/src/protyle/render/av/databaseRowNavigation.ts
index 5005dfe41a..9267a32562 100644
--- a/app/src/protyle/render/av/databaseRowNavigation.ts
+++ b/app/src/protyle/render/av/databaseRowNavigation.ts
@@ -99,18 +99,19 @@ export const getDatabaseRowNeighbors = async (data: IDatabaseRowOpenData) => {
};
export const mountDatabaseRowNavigation = (container: Element, data: IDatabaseRowOpenData,
- open: (data: IDatabaseRowOpenData) => Promise<boolean>) => {
- container.querySelector(":scope > [data-database-row-navigation]")?.remove();
+ open: (data: IDatabaseRowOpenData) => Promise<boolean>, breadcrumb?: HTMLElement) => {
+ container.querySelector(":scope > [data-database-row-navigation], :scope > .protyle-breadcrumb > [data-database-row-navigation]")?.remove();
if (!data.navigation) {
return;
}
const toolbar = document.createElement("div");
- toolbar.className = "block__icons";
+ const inline = breadcrumb && container.contains(breadcrumb);
+ toolbar.className = inline ? "fn__flex fn__flex-center fn__flex-shrink" : "block__icons";
toolbar.setAttribute("data-database-row-navigation", data.itemID);
toolbar.innerHTML = ["previous", "next"].map((name, index) =>
`<button type="button" disabled class="block__icon block__icon--show block__icon--touch ariaLabel" data-position="8south" aria-label="${escapeAttr(window.siyuan.languages[name])}"><svg><use xlink:href="#${index ? "iconDown" : "iconUp"}"></use></svg></button>`)
- .join('<span class="fn__space"></span>');
- container.prepend(toolbar);
+ .join(inline ? "" : '<span class="fn__space"></span>') + (inline ? '<span class="fn__space"></span>' : "");
+ (inline ? breadcrumb : container).prepend(toolbar);
const buttons = Array.from(toolbar.querySelectorAll("button"));
let busy = false;
const update = async () => {
diff --git a/app/src/protyle/render/av/openDatabaseRow.ts b/app/src/protyle/render/av/openDatabaseRow.ts
index 09f37434b8..59a3d7ab88 100644
--- a/app/src/protyle/render/av/openDatabaseRow.ts
+++ b/app/src/protyle/render/av/openDatabaseRow.ts
@@ -231,7 +231,7 @@ const mountDesktopDatabaseRowNavigation = (model: Editor | Custom, data: IDataba
showDatabaseRowPreview(opened.model, next, source);
}
return true;
- });
+ }, model instanceof Custom ? undefined : model.editor.protyle.breadcrumb?.element.parentElement);
};
/// #endif