Skip to content

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

:bug: Align mobile print dialog options https://github.com/siyuan-note/siyuan/issues/20853

Daniel1a381055cb26
diff --git a/app/src/protyle/export/headingPageBreaksUI.ts b/app/src/protyle/export/headingPageBreaksUI.ts
index e93391748c..40e8ce72bb 100644
--- a/app/src/protyle/export/headingPageBreaksUI.ts
+++ b/app/src/protyle/export/headingPageBreaksUI.ts
@@ -16,7 +16,7 @@ export const openHeadingPageBreakDialog = (onConfirm: () => void) => {
const dialog = new Dialog({
title: window.siyuan.languages.print,
content: `<div class="b3-dialog__content">
- <label class="fn__flex b3-label">
+ <label class="fn__flex b3-label b3-label--inner">
<div class="fn__flex-1">${window.siyuan.languages.exportTitleImage}</div>
<span class="fn__space"></span>
<input id="titleImage" type="checkbox" class="b3-switch fn__flex-center" ${localData.titleImage !== false ? "checked" : ""}>
diff --git a/app/tests/pdfHeadingPageBreaks.test.js b/app/tests/pdfHeadingPageBreaks.test.js
index 2e37ff1193..90bb6835cf 100644
--- a/app/tests/pdfHeadingPageBreaks.test.js
+++ b/app/tests/pdfHeadingPageBreaks.test.js
@@ -71,6 +71,19 @@ const browserCases = async (headingSource, uiSource, desktopSource, mobileSource
});
ui.openHeadingPageBreakDialog(() => confirmed++);
check.equal(activeDialog.element.querySelector("#titleImage").checked, true);
+ for (const width of [280, 360]) {
+ activeDialog.element.style.width = `${width}px`;
+ for (const fontSize of [16, 24]) {
+ activeDialog.element.style.fontSize = `${fontSize}px`;
+ const titleImage = activeDialog.element.querySelector("#titleImage").getBoundingClientRect();
+ const headingSwitch = activeDialog.element.querySelector('input[value="1"]').getBoundingClientRect();
+ const imageLabel = activeDialog.element.querySelector("#titleImage").closest("label");
+ const headingLabel = activeDialog.element.querySelector('input[value="1"]').closest("label");
+ check.equal(imageLabel.getBoundingClientRect().left, headingLabel.getBoundingClientRect().left);
+ check.equal(titleImage.right, headingSwitch.right, "Mobile print switches align at narrow widths and large fonts");
+ check.equal(getComputedStyle(imageLabel).paddingLeft, "0px");
+ }
+ }
check.ok(parseFloat(getComputedStyle(activeDialog.element.querySelector(".ft__smaller")).fontSize) <
parseFloat(getComputedStyle(activeDialog.element.querySelector(".b3-dialog__content > div")).fontSize),
"Mobile print descriptions use a smaller font than their titles");