Skip to content

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

:bug: Keep mobile database text actions above the keyboard https://github.com/siyuan-note/siyuan/issues/19949

Daniel6fffb3ec2569
diff --git a/app/src/assets/scss/business/_av.scss b/app/src/assets/scss/business/_av.scss
index 55535cd965..8c40bece69 100644
--- a/app/src/assets/scss/business/_av.scss
+++ b/app/src/assets/scss/business/_av.scss
@@ -950,7 +950,7 @@
justify-content: flex-end;
gap: 8px;
padding: 8px;
- border-top: 1px solid var(--b3-border-color);
+ border-bottom: 1px solid var(--b3-border-color);
background: var(--b3-theme-surface);
}
diff --git a/app/src/protyle/render/av/richTextEditor.ts b/app/src/protyle/render/av/richTextEditor.ts
index 4d818d0abb..0ba7b3a6dd 100644
--- a/app/src/protyle/render/av/richTextEditor.ts
+++ b/app/src/protyle/render/av/richTextEditor.ts
@@ -106,11 +106,11 @@ export const openAVRichTextEditor = (options: AVRichTextEditorOptions) => {
maskElement.dataset.avBlockId = options.nodeElement.dataset.nodeId;
maskElement.style.zIndex = (++window.siyuan.zIndex).toString();
maskElement.innerHTML = `<div class="av__richtext-editor" role="dialog">
- <div class="av__richtext-host"></div>
${mobile ? `<div class="av__richtext-actions">
<button type="button" class="b3-button b3-button--cancel" data-type="cancel">${escapeHtml(window.siyuan.languages.cancel)}</button>
<button type="button" class="b3-button b3-button--text" data-type="save">${escapeHtml(window.siyuan.languages.save)}</button>
</div>` : ""}
+ <div class="av__richtext-host"></div>
</div>`;
document.body.appendChild(maskElement);
// 独立记录详情使用未挂载的编辑器上下文,浮层生命周期跟随实际可见的详情面板。
diff --git a/app/tests/avRichTextEditor.test.js b/app/tests/avRichTextEditor.test.js
index 355bbcdb99..37a7dc6a42 100644
--- a/app/tests/avRichTextEditor.test.js
+++ b/app/tests/avRichTextEditor.test.js
@@ -100,6 +100,20 @@ const runCases = async (sources) => {
for (const mode of ["document", "desktop-row", "mobile-row"]) {
mobile = mode === "mobile-row";
const state = createOwner(mode !== "document");
+ if (mobile) {
+ const toolbar = document.createElement("div");
+ toolbar.className = "keyboard";
+ toolbar.style.zIndex = "100";
+ document.body.append(toolbar);
+ const save = document.querySelector('[data-type="save"]');
+ const cancel = document.querySelector('[data-type="cancel"]');
+ for (const button of [save, cancel]) {
+ const rect = button.getBoundingClientRect();
+ assert.ok(rect.bottom <= toolbar.getBoundingClientRect().top, "actions must remain above the keyboard toolbar");
+ assert.ok(button.contains(document.elementFromPoint(rect.left + rect.width / 2, rect.top + rect.height / 2)),
+ "mobile actions must receive pointer events");
+ }
+ }
for (const input of ["a", "b", "中文"]) {
fragment.input.append(document.createTextNode(input));
fragment.input.dispatchEvent(new InputEvent("input", {bubbles: true, data: input}));
@@ -183,6 +197,8 @@ const runElectron = async () => {
ts.transpileModule(readFileSync(path.join(__dirname, `../src/protyle/render/av/${name}.ts`), "utf8"),
{compilerOptions: {module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2020}}).outputText]));
await win.loadURL("data:text/html,<html><body></body></html>");
+ await win.webContents.insertCSS(require("sass").compile(path.join(__dirname, "../src/assets/scss/mobile.scss"),
+ {logger: {warn() {}}}).css);
await win.webContents.executeJavaScript(`(${runCases.toString()})(${JSON.stringify(sources)})`);
console.log("AV rich text editor lifecycle cases passed");
} catch (error) {