Skip to content

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

:art: Use single-line inputs for data repo key import https://github.com/siyuan-note/siyuan/issues/18595

Daniele7f9f5bc72de
diff --git a/app/src/config/tabs/syncTab.ts b/app/src/config/tabs/syncTab.ts
index 3fb9676123..d162f106df 100644
--- a/app/src/config/tabs/syncTab.ts
+++ b/app/src/config/tabs/syncTab.ts
@@ -215,25 +215,24 @@ const mountRepoKey = (root: HTMLElement) => {
root.querySelector("#importKey")?.addEventListener("click", () => {
const passwordDialog = new Dialog({
title: "🔑 " + window.siyuan.languages.key,
- content: `<div class="b3-dialog__content" style="display:flex">
- <textarea spellcheck="false" style="resize: none;flex:1" class="b3-text-field fn__block" placeholder="${window.siyuan.languages.keyPlaceholder}"></textarea>
+ content: `<div class="b3-dialog__content">
+ <input type="text" spellcheck="false" class="b3-text-field fn__block" placeholder="${window.siyuan.languages.keyPlaceholder}">
</div>
<div class="b3-dialog__action">
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
</div>`,
width: "520px",
- height: "260px",
});
passwordDialog.element.setAttribute("data-key", Constants.DIALOG_PASSWORD);
- const textAreaElement = passwordDialog.element.querySelector("textarea");
- textAreaElement.focus();
+ const inputElement = passwordDialog.element.querySelector("input");
+ inputElement.focus();
const btnsElement = passwordDialog.element.querySelectorAll(".b3-button");
btnsElement[0].addEventListener("click", () => {
passwordDialog.destroy();
});
btnsElement[1].addEventListener("click", () => {
- fetchPost("/api/repo/importRepoKey", {key: textAreaElement.value}, (response) => {
+ fetchPost("/api/repo/importRepoKey", {key: inputElement.value}, (response) => {
window.siyuan.config.repo.key = response.data.key;
toggleRepoKeyActions();
passwordDialog.destroy();
diff --git a/app/src/menus/dataMigration.ts b/app/src/menus/dataMigration.ts
index 940a78392b..5a6076de75 100644
--- a/app/src/menus/dataMigration.ts
+++ b/app/src/menus/dataMigration.ts
@@ -33,23 +33,22 @@ const getImportButton = (type: string, accept: string) => `<button class="b3-but
const openRepoKeyImport = (onComplete?: () => void) => {
const dialog = new Dialog({
title: `🔑 ${window.siyuan.languages.key}`,
- content: `<div class="b3-dialog__content" style="display:flex">
- <textarea spellcheck="false" style="resize:none;flex:1" class="b3-text-field fn__block" placeholder="${window.siyuan.languages.keyPlaceholder}"></textarea>
+ content: `<div class="b3-dialog__content">
+ <input type="text" spellcheck="false" class="b3-text-field fn__block" placeholder="${window.siyuan.languages.keyPlaceholder}">
</div>
<div class="b3-dialog__action">
<button class="b3-button b3-button--cancel">${window.siyuan.languages.cancel}</button><div class="fn__space"></div>
<button class="b3-button b3-button--text">${window.siyuan.languages.confirm}</button>
</div>`,
width: "520px",
- height: "260px",
});
dialog.element.setAttribute("data-key", Constants.DIALOG_PASSWORD);
- const textAreaElement = dialog.element.querySelector("textarea") as HTMLTextAreaElement;
+ const inputElement = dialog.element.querySelector("input") as HTMLInputElement;
const buttons = dialog.element.querySelectorAll(".b3-button");
- textAreaElement.focus();
+ inputElement.focus();
buttons[0].addEventListener("click", () => dialog.destroy());
buttons[1].addEventListener("click", () => {
- fetchPost("/api/repo/importRepoKey", {key: textAreaElement.value}, (response) => {
+ fetchPost("/api/repo/importRepoKey", {key: inputElement.value}, (response) => {
window.siyuan.config.repo.key = response.data.key;
dialog.destroy();
showMessage(window.siyuan.languages.imported);