Skip to content

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

:art: Remove redundant map overview and refresh controls https://github.com/siyuan-note/siyuan/issues/20129

Danielf504ec9f60e7
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 628c6e29a3..0e06310a30 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -7,13 +7,6 @@
margin: 8px 0;
}
-.av__map-actions {
- display: flex;
- flex-wrap: wrap;
- align-items: center;
- gap: 8px;
-}
-
.av__map-setting-value {
min-width: 0;
max-width: min(160px, 45vw);
diff --git a/app/src/protyle/render/av/map/render.test.ts b/app/src/protyle/render/av/map/render.test.ts
index 031be5ead8..c1f289968e 100644
--- a/app/src/protyle/render/av/map/render.test.ts
+++ b/app/src/protyle/render/av/map/render.test.ts
@@ -125,7 +125,7 @@ test("published maps render a status without inline settings, runtime credential
assert.deepEqual(scenario.calls, []);
assert.equal(scenario.hosts.length, 0);
assert.equal(scenario.status(), "mapPublicFallback");
- assert.doesNotMatch(scenario.roots[0].innerHTML, /av__map-settings|data-map-setting|data-map-configure/);
+ assert.doesNotMatch(scenario.roots[0].innerHTML, /av__map-settings|data-map-setting|data-map-configure|av__map-actions|data-map-fit|data-map-retry/);
});
test("unconfigured, unavailable host, offline and incompatible maps never request runtime credentials", async () => {
@@ -151,7 +151,7 @@ test("map sends only IDs and coordinates and opens the existing row detail for a
assert.equal(JSON.stringify(host.points), JSON.stringify([{id: "row", longitude: 0, latitude: 0, coordinateSystem: "wgs84"}]));
assert.doesNotMatch(JSON.stringify(host.options), /Private|primary-value|notebook/);
host.options.onReady();
- assert.doesNotMatch(scenario.roots[0].innerHTML, /av__map-settings|data-map-setting|data-map-configure/);
+ assert.doesNotMatch(scenario.roots[0].innerHTML, /av__map-settings|data-map-setting|data-map-configure|av__map-actions|data-map-fit|data-map-retry/);
host.options.onMarkerClick("other", host.revision);
host.options.onMarkerClick("row", host.revision - 1);
assert.equal(scenario.opened.length, 0);
diff --git a/app/src/protyle/render/av/map/render.ts b/app/src/protyle/render/av/map/render.ts
index c0ad7f5c79..7b2f107c4c 100644
--- a/app/src/protyle/render/av/map/render.ts
+++ b/app/src/protyle/render/av/map/render.ts
@@ -41,17 +41,12 @@ export const renderMap = async (blockElement: HTMLElement, protyle: IProtyle, da
<div class="av__map-status ft__on-surface" role="status"></div>
<div class="av__map-canvas fn__none"></div>
<div class="ft__smaller fn__none" data-map-attribution></div>
-<div class="av__map-actions">
- <button type="button" class="b3-button b3-button--outline fn__none" data-map-fit>${window.siyuan.languages.mapFitMarkers}</button>
- <button type="button" class="block__icon block__icon--show ariaLabel" data-map-retry aria-label="${escapeAttr(window.siyuan.languages.refresh)}"><svg><use xlink:href="#iconRefresh"></use></svg></button>
-</div>`;
+`;
records.before(root);
["click", "keydown", "pointerdown"].forEach(type => root.addEventListener(type, event => event.stopPropagation()));
const status = root.querySelector<HTMLElement>(".av__map-status");
const canvas = root.querySelector<HTMLElement>(".av__map-canvas");
const attribution = root.querySelector<HTMLElement>("[data-map-attribution]");
- const fitButton = root.querySelector<HTMLButtonElement>("[data-map-fit]");
- const retryButton = root.querySelector<HTMLButtonElement>("[data-map-retry]");
let host: AVMapHost;
let themeObserver: MutationObserver;
let resizeObserver: ResizeObserver;
@@ -76,16 +71,12 @@ export const renderMap = async (blockElement: HTMLElement, protyle: IProtyle, da
attribution.classList.add("fn__none");
status.textContent = message;
canvas.classList.add("fn__none");
- fitButton.classList.add("fn__none");
};
- retryButton.addEventListener("click", () => { void renderMap(blockElement, protyle, data); });
if (window.siyuan.isPublish) {
- retryButton.classList.add("fn__none");
fallback(window.siyuan.languages.mapPublicFallback);
return;
}
if (protyle.options.history?.created || protyle.options.history?.snapshot) {
- retryButton.classList.add("fn__none");
fallback(window.siyuan.languages.mapUnsupportedClient);
return;
}
@@ -172,7 +163,6 @@ export const renderMap = async (blockElement: HTMLElement, protyle: IProtyle, da
}
status.textContent = "";
attribution.classList.remove("fn__none");
- fitButton.classList.remove("fn__none");
},
onError: () => fallback(navigator.onLine ? window.siyuan.languages.mapLoadError : window.siyuan.languages.mapOffline),
onMarkerClick: (id, markerRevision) => {
@@ -182,7 +172,6 @@ export const renderMap = async (blockElement: HTMLElement, protyle: IProtyle, da
},
});
host.setPoints(points, activeRevision);
- fitButton.addEventListener("click", () => host?.fit());
themeObserver = new MutationObserver(() => host?.setTheme(getTheme()));
themeObserver.observe(document.documentElement, {attributes: true, attributeFilter: ["data-theme-mode"]});
resizeObserver = new ResizeObserver(() => host?.resize());