Skip to content

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

:art: Stack lock screen wallpaper actions with icons https://github.com/siyuan-note/siyuan/issues/20797

Daniel6b2567414256
diff --git a/app/src/config/tabs/lockScreenWallpaper.ts b/app/src/config/tabs/lockScreenWallpaper.ts
index fa994c2bf2..dcab7ac5de 100644
--- a/app/src/config/tabs/lockScreenWallpaper.ts
+++ b/app/src/config/tabs/lockScreenWallpaper.ts
@@ -14,10 +14,10 @@ export const genLockScreenWallpaperHtml = () => {
<img class="config-lock-screen-wallpaper fn__none" alt="${lang.lockScreenWallpaper}" data-wallpaper-preview>
</div>
<span class="fn__space"></span>
- <div class="fn__flex fn__flex-center fn__size200">
- <button class="b3-button b3-button--outline fn__flex-1" data-wallpaper-upload>${lang.upload}</button>
- <span class="fn__space"></span>
- <button class="b3-button b3-button--outline fn__flex-1" data-wallpaper-reset>${lang.reset}</button>
+ <div class="fn__flex fn__flex-column fn__flex-center fn__size200">
+ <button class="b3-button b3-button--outline fn__flex-center fn__size200" data-wallpaper-upload><svg><use xlink:href="#iconUpload"></use></svg>${lang.upload}</button>
+ <div class="fn__hr--small"></div>
+ <button class="b3-button b3-button--outline fn__flex-center fn__size200" data-wallpaper-reset><svg><use xlink:href="#iconUndo"></use></svg>${lang.reset}</button>
</div>
<input class="fn__none" type="file" accept="image/jpeg,image/png,image/webp" data-wallpaper-file>
</div>`;
diff --git a/app/tests/lockScreenWallpaperLayout.test.js b/app/tests/lockScreenWallpaperLayout.test.js
index b39a0d7750..5dcc2869d5 100644
--- a/app/tests/lockScreenWallpaperLayout.test.js
+++ b/app/tests/lockScreenWallpaperLayout.test.js
@@ -38,8 +38,17 @@ const checkSettingsLayout = async (html, css, fontSize) => {
preview.classList.toggle("fn__none", !showPreview);
const rect = item.getBoundingClientRect();
const group = actions.getBoundingClientRect();
+ const upload = item.querySelector("[data-wallpaper-upload]");
+ const reset = item.querySelector("[data-wallpaper-reset]");
+ const uploadRect = upload.getBoundingClientRect();
+ const resetRect = reset.getBoundingClientRect();
check.ok(item.scrollWidth <= item.clientWidth, "wallpaper setting does not overflow horizontally");
check.ok(group.left >= rect.left && group.right <= rect.right, "actions fit the setting row");
+ check.ok(resetRect.top >= uploadRect.bottom, "reset appears below upload");
+ check.ok(Math.abs(uploadRect.left - resetRect.left) < 1 && Math.abs(uploadRect.right - resetRect.right) < 1,
+ "stacked actions share horizontal bounds");
+ check.equal(upload.querySelector("use").getAttribute("xlink:href"), "#iconUpload");
+ check.equal(reset.querySelector("use").getAttribute("xlink:href"), "#iconUndo");
if (innerWidth > 750) {
const reference = document.querySelector("[data-reference]").getBoundingClientRect();
const main = item.querySelector(".config-item__main").getBoundingClientRect();
@@ -47,7 +56,7 @@ const checkSettingsLayout = async (html, css, fontSize) => {
check.ok(Math.abs(group.right - reference.right) < 1, "actions align with adjacent setting controls");
check.equal(group.width, 200);
for (const button of actions.querySelectorAll("button")) {
- check.ok(Math.abs(button.getBoundingClientRect().width - 96) < 1);
+ check.ok(Math.abs(button.getBoundingClientRect().width - reference.width) < 1);
}
}
}