Skip to content

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

:bug: Preserve batch order when moving documents https://github.com/siyuan-note/siyuan/issues/19607

Danielf1eff21f0fda
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 5ab63a7fab..9c9e7e1850 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -2199,8 +2199,8 @@
"fileTree21": "‫بعد التمكين، سيتم استخدام تنسيق JSON ذي السطر الواحد عند حفظ مستندات .sy وقاعدة بيانات .json، مما يقلل حجم الملف بحوالي 30٪ وتحسين كفاءة القراءة والكتابة بنسبة 50٪‬",
"fileTree22": "تنبيه ملف كبير",
"fileTree23": "إشعار عند تجاوز ملفات ‎.sy‎ أو قاعدة بيانات ‎.json‎ لهذا الحجم",
- "fileTree24": "وضع دفاتر الملاحظات والمستندات الجديدة في الأعلى",
- "fileTree25": "عند التمكين، ستوضع دفاتر الملاحظات والمستندات الجديدة ودليل المستخدم عند فتحه في أعلى قوائمها (ينطبق فقط عند تمكين الترتيب المخصص)",
+ "fileTree24": "وضع دفاتر الملاحظات والمستندات الجديدة والمستندات الفرعية المنقولة في الأعلى",
+ "fileTree25": "عند التفعيل، توضع دفاتر الملاحظات والمستندات الجديدة والمستندات الفرعية المنقولة ودليل المستخدم المفتوح في أعلى القوائم، وإلا ففي الأسفل (للترتيب المخصص فقط؛ لا يؤثر على النقل الصريح قبل مستند أو بعده)",
"fileTree26": "مسار الحفظ الافتراضي للمذكرات السريعة",
"fileTree27": "على سبيل المثال، <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>، إذا لم يتم استخدام متغير قالب، ستُضاف المذكرة السريعة إلى نهاية المستند في المسار المحدد",
"export10": "‫على سبيل المثال ‪<code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>‬، إذا كان فارغاً، سيتم استخدام العلامة المائية من النص المخصص أو مسار ملف العلامة المائية.‬",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 6b38d6fc7f..4b5f9c4dbd 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Nach der Aktivierung wird beim Speichern von .sy-Dokumenten und Datenbank-.json-Dateien das Einzeilige JSON-Format verwendet, was die Dateigröße um etwa 30 % reduzieren und die Lese- und Schreibgeschwindigkeit um 50 % verbessern kann",
"fileTree22": "Großdatei-Warnung",
"fileTree23": "Benachrichtigen, wenn .sy-Dateien oder die Datenbank .json diese Größe überschreiten",
- "fileTree24": "Neue Notizbücher und Dokumente oben platzieren",
- "fileTree25": "Wenn aktiviert, werden neu erstellte Notizbücher und Dokumente sowie das geöffnete Benutzerhandbuch am Anfang der jeweiligen Liste platziert (wirkt nur, wenn die benutzerdefinierte Sortierung aktiviert ist)",
+ "fileTree24": "Neue Notizbücher und Dokumente sowie verschobene Unterdokumente oben platzieren",
+ "fileTree25": "Neue Notizbücher und Dokumente, verschobene Unterdokumente und das geöffnete Benutzerhandbuch werden oben in der Liste platziert, sonst unten (nur bei benutzerdefinierter Sortierung; gezieltes Verschieben vor oder hinter ein Dokument bleibt unverändert)",
"fileTree26": "Standard-Speicherort für neue Kurznotizen",
"fileTree27": "Zum Beispiel <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, wenn keine Vorlagenvariable verwendet wird, wird die Kurznotiz am Ende des Dokuments im angegebenen Pfad angehängt",
"export10": "Beispiel <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, wenn leer, verwenden Sie Wasserzeichentext oder den Pfad zur Wasserzeichen-Datei.",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index 762181b219..123c052049 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -2199,8 +2199,8 @@
"fileTree21": "When enabled, the single-line JSON format will be used when saving .sy docs and database .json files, which can reduce the file size by about 30% and improve read and write efficiency by 50%",
"fileTree22": "Large File Warning",
"fileTree23": "Notify when .sy files or database .json exceed this size",
- "fileTree24": "Place new notebooks and documents at the top",
- "fileTree25": "When enabled, newly created notebooks and documents, and the user guide when opened, will be placed at the top of their lists (only takes effect when custom sorting is enabled)",
+ "fileTree24": "Place new notebooks and documents, and moved child documents, at the top",
+ "fileTree25": "When enabled, newly created notebooks and documents, moved child documents, and the user guide when opened are placed at the top of their lists; otherwise at the bottom (custom sorting only; moves explicitly before or after a document are unaffected)",
"fileTree26": "Default shorthand save path",
"fileTree27": "For example, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, if no template variable is used the shorthand will be appended to the end of the document at the specified path",
"export10": "For example <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, if empty, use watermark text or watermark file path.",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 02720fd908..7dcc1a5771 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Después de habilitarlo, se utilizará el formato JSON de una sola línea al guardar documentos .sy y archivos .json de bases de datos, lo que puede reducir el tamaño del archivo en aproximadamente un 30 % y mejorar la eficiencia de lectura y escritura en un 50 %.",
"fileTree22": "Aviso de archivo grande",
"fileTree23": "Notificar cuando los archivos .sy o la base de datos .json superen este tamaño",
- "fileTree24": "Colocar los nuevos cuadernos de notas y documentos en la parte superior",
- "fileTree25": "Al habilitar, los cuadernos de notas y documentos nuevos, así como la guía del usuario al abrirla, se colocarán en la parte superior de sus listas (solo surte efecto cuando el orden personalizado esté habilitado)",
+ "fileTree24": "Colocar arriba los nuevos cuadernos y documentos y los subdocumentos movidos",
+ "fileTree25": "Al activar, los nuevos cuadernos y documentos, los subdocumentos movidos y la guía de usuario abierta se colocan al principio de sus listas; de lo contrario, al final (solo con orden personalizado; no afecta a los movimientos explícitos antes o después de un documento)",
"fileTree26": "Ruta de guardado predeterminada para notas rápidas",
"fileTree27": "Por ejemplo, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, si no se usa una variable de plantilla, la nota rápida se añadirá al final del documento en la ruta especificada",
"export10": "Por ejemplo <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, si está vacío, utilice texto de marca de agua o ruta del archivo de marca de agua.",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index 547e54869a..bb6632f3b1 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Après activation, le format JSON sur une seule ligne sera utilisé lors de l'enregistrement des documents .sy et des fichiers .json de base de données, ce qui peut réduire la taille du fichier d'environ 30 % et améliorer l'efficacité de lecture et d'écriture de 50 %",
"fileTree22": "Alerte de fichier volumineux",
"fileTree23": "Notifier lorsque les fichiers .sy ou la base de données .json dépassent cette taille",
- "fileTree24": "Placer les nouveaux carnets de notes et documents en haut",
- "fileTree25": "Si activé, les nouveaux carnets de notes et documents ainsi que le guide utilisateur à son ouverture seront placés en haut de leurs listes (ne prend effet que lorsque le tri personnalisé est activé)",
+ "fileTree24": "Placer en haut les nouveaux carnets et documents et les sous-documents déplacés",
+ "fileTree25": "Si activé, les nouveaux carnets et documents, les sous-documents déplacés et le guide utilisateur ouvert sont placés en haut de leur liste, sinon en bas (tri personnalisé uniquement ; les déplacements explicites avant ou après un document restent inchangés)",
"fileTree26": "Chemin d'enregistrement par défaut pour les notes rapides",
"fileTree27": "Par exemple, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, si aucune variable de modèle n'est utilisée, la note rapide sera ajoutée à la fin du document dans le chemin spécifié",
"export10": "Par exemple <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, s'il est vide, utilisez le texte du filigrane ou le chemin du fichier du filigrane.",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index b582f7d238..d0dabb421f 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -2199,8 +2199,8 @@
"fileTree21": "לאחר הפעלת אפשרות זו, פורמט ה-JSON בשורה אחת ישמש בעת שמירת קבצי .sy ומסדי נתונים .json, מה שיכול להפחית את גודל הקובץ בכ-30% ולשפר את יעילות הקריאה והכתיבה ב-50%",
"fileTree22": "התראה על קובץ גדול",
"fileTree23": "הצג התראה כאשר קובץ ‎.sy‎ או מסד נתונים ‎.json‎ חורג מגודל זה",
- "fileTree24": "הצב מחברות ומסמכים חדשים בראש הרשימה",
- "fileTree25": "כאשר האפשרות מופעלת, מחברות ומסמכים חדשים וכן מדריך המשתמש בעת פתיחתו יוצבו בראש הרשימות שלהם (פועל רק כאשר מיון מותאם אישית מופעל)",
+ "fileTree24": "הצבת מחברות ומסמכים חדשים ומסמכי משנה שהועברו בראש הרשימה",
+ "fileTree25": "כאשר מופעל, מחברות ומסמכים חדשים, מסמכי משנה שהועברו ומדריך המשתמש שנפתח מוצבים בראש הרשימות, אחרת בתחתיתן (במיון מותאם אישית בלבד; העברה מפורשת לפני מסמך או אחריו אינה מושפעת)",
"fileTree26": "נתיב שמירה ברירת מחדל לרשומות מהירות",
"fileTree27": "לדוגמה, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, אם לא נעשה שימוש במשתנה תבנית, הרשומה המהירה תתווסף לסוף המסמך בנתיב שצוין",
"export10": "למשל <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, אם ריק, השתמש בטקסט סימן מים או בנתיב קובץ סימן מים.",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index 06f26968b9..5751ce968b 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -2199,8 +2199,8 @@
"fileTree21": "सक्षम होने पर, .sy दस्तावेज़ और डेटाबेस .json फ़ाइलें सहेजते समय एकल-पंक्ति JSON प्रारूप का उपयोग किया जाएगा, जो फ़ाइल आकार को लगभग 30% कम कर सकता है और पढ़ने और लिखने की दक्षता में 50% सुधार कर सकता है",
"fileTree22": "बड़ी फ़ाइल चेतावनी",
"fileTree23": ".sy फ़ाइलें या डेटाबेस .json इस आकार से अधिक होने पर सूचित करें",
- "fileTree24": "नई नोटबुक और दस्तावेज़ शीर्ष पर रखें",
- "fileTree25": "सक्षम होने पर, नई नोटबुक और दस्तावेज़ तथा उपयोगकर्ता मार्गदर्शिका खोले जाने पर अपनी-अपनी सूचियों के शीर्ष पर रखे जाएंगे (केवल तभी प्रभावी जब कस्टम क्रमबद्धता सक्षम हो)",
+ "fileTree24": "नई नोटबुक और दस्तावेज़ तथा स्थानांतरित उप-दस्तावेज़ सबसे ऊपर रखें",
+ "fileTree25": "सक्षम होने पर नई नोटबुक और दस्तावेज़, स्थानांतरित उप-दस्तावेज़ और खोली गई उपयोगकर्ता मार्गदर्शिका सूची के ऊपर रखे जाते हैं, अन्यथा नीचे (केवल कस्टम क्रम में; किसी दस्तावेज़ के ठीक पहले या बाद में स्थानांतरण अप्रभावित रहता है)",
"fileTree26": "त्वरित नोट्स के लिए डिफ़ॉल्ट सहेजें पथ",
"fileTree27": "उदाहरण के लिए, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, यदि कोई टेम्पलेट चर का उपयोग नहीं किया जाता है, तो त्वरित नोट निर्दिष्ट पथ पर दस्तावेज़ के अंत में जोड़ा जाएगा",
"export10": "उदाहरण के लिए <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, यदि खाली है, तो वॉटरमार्क पाठ या वॉटरमार्क फ़ाइल पथ का उपयोग करें।",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index 50df6aaae0..4351b45256 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Saat diaktifkan, format JSON satu baris akan digunakan saat menyimpan dokumen .sy dan file database .json, yang dapat mengurangi ukuran file sekitar 30% dan meningkatkan efisiensi baca dan tulis sebesar 50%",
"fileTree22": "Peringatan File Besar",
"fileTree23": "Beritahu ketika file .sy atau database .json melebihi ukuran ini",
- "fileTree24": "Tempatkan buku catatan dan dokumen baru di bagian atas",
- "fileTree25": "Saat diaktifkan, buku catatan dan dokumen baru serta panduan pengguna ketika dibuka akan ditempatkan di bagian atas daftar masing-masing (hanya berlaku saat penyortiran kustom diaktifkan)",
+ "fileTree24": "Tempatkan buku catatan dan dokumen baru serta subdokumen yang dipindahkan di atas",
+ "fileTree25": "Jika diaktifkan, buku catatan dan dokumen baru, subdokumen yang dipindahkan, serta panduan pengguna yang dibuka ditempatkan di awal daftar; jika tidak, di akhir (hanya pengurutan khusus; pemindahan eksplisit sebelum atau sesudah dokumen tidak terpengaruh)",
"fileTree26": "Lokasi penyimpanan default untuk catatan cepat",
"fileTree27": "Misalnya, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, jika tidak ada variabel template yang digunakan, catatan cepat akan ditambahkan ke akhir dokumen di jalur yang ditentukan",
"export10": "Misalnya <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, jika kosong, gunakan teks watermark atau jalur file watermark.",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index 4898e22212..75b63c4810 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Dopo l'abilitazione, il formato JSON a riga singola verrà utilizzato quando si salvano documenti .sy e file di database .json, il che può ridurre le dimensioni del file del 30% circa e migliorare l'efficienza di lettura e scrittura del 50%",
"fileTree22": "Avviso file di grandi dimensioni",
"fileTree23": "Notifica quando i file .sy e il database .json superano questa dimensione",
- "fileTree24": "Posiziona i nuovi taccuini e documenti in cima",
- "fileTree25": "Se abilitato, i nuovi taccuini e documenti e la guida utente quando viene aperta saranno posizionati in cima ai rispettivi elenchi (funziona solo quando l'ordinamento personalizzato è abilitato)",
+ "fileTree24": "Posiziona in cima nuovi taccuini e documenti e sottodocumenti spostati",
+ "fileTree25": "Se attivo, nuovi taccuini e documenti, sottodocumenti spostati e la guida utente aperta vengono posizionati in cima alle liste, altrimenti in fondo (solo con ordinamento personalizzato; gli spostamenti espliciti prima o dopo un documento restano invariati)",
"fileTree26": "Percorso di salvataggio predefinito per le note rapide",
"fileTree27": "Ad esempio, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, se non viene utilizzata alcuna variabile di modello, la nota rapida verrà aggiunta alla fine del documento nel percorso specificato",
"export10": "Ad esempio <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, se vuoto, utilizza il testo della filigrana o il percorso del file della filigrana.",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index 2a27ad199e..1842598132 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -2199,8 +2199,8 @@
"fileTree21": "ドキュメントとデータベースファイルを保存する際に改行を行わない JSON フォーマットを使用します。これによりファイルサイズが約 30% 削減され、読み書きの効率が 50% 向上します",
"fileTree22": "大きなファイルの警告",
"fileTree23": ".sy ドキュメントやデータベース .json がこのサイズを超えると通知します",
- "fileTree24": "新しいノートブックとドキュメントを先頭に配置",
- "fileTree25": "有効にすると、新しく作成されたノートブックとドキュメント、および開いたユーザーガイドがそれぞれの一覧の先頭に配置されます(カスタム並び替えが有効な場合のみ動作します)",
+ "fileTree24": "新しいノートブックと文書、移動した子文書を先頭に配置",
+ "fileTree25": "有効にすると、新しいノートブックと文書、移動した子文書、開いたユーザーガイドをリストの先頭に、無効にすると末尾に配置します(カスタム順のみ。文書の前後を明示した移動には影響しません)",
"fileTree26": "クイックメモのデフォルト保存場所",
"fileTree27": "例: <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>、テンプレート変数を使用しない場合、クイックメモは指定されたパスのドキュメントの末尾に追加されます",
"export10": "例: <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code><br>空の場合は透かしテキストまたは透かし画像ファイルのパスを使用します",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 9c57b9e986..cc34938edd 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -2199,8 +2199,8 @@
"fileTree21": "활성화하면 .sy 문서 및 데이터베이스 .json을 저장할 때 한 줄 JSON 형식이 사용되어 파일 크기를 약 30% 줄이고 읽기 및 쓰기 효율성을 50% 향상시킬 수 있습니다",
"fileTree22": "대용량 파일 경고",
"fileTree23": ".sy 파일 또는 데이터베이스 .json이 이 크기를 초과할 때 알림",
- "fileTree24": "새 노트북과 문서를 맨 위에 배치",
- "fileTree25": "활성화하면 새로 생성된 노트북과 문서 및 열린 사용자 가이드가 각각의 목록 맨 위에 배치됩니다(사용자 지정 정렬이 활성화된 경우에만 적용됨)",
+ "fileTree24": "새 노트북과 문서, 이동한 하위 문서를 맨 위에 배치",
+ "fileTree25": "활성화하면 새 노트북과 문서, 이동한 하위 문서, 연 사용자 가이드를 목록 맨 위에 배치하고, 비활성화하면 맨 아래에 배치합니다 (사용자 지정 정렬에만 적용되며, 문서 앞이나 뒤로 명시적으로 이동하는 작업에는 영향을 주지 않음)",
"fileTree26": "빠른 메모의 기본 저장 경로",
"fileTree27": "예: <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, 템플릿 변수를 사용하지 않으면 빠른 메모가 지정된 경로의 문서 끝에 추가됩니다",
"export10": "예: <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, 비어 있으면 워터마크 텍스트 또는 워터마크 파일 경로를 사용합니다.",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index 7a036a817d..35a8ce973c 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Bij inschakelen wordt enkelregelige JSON gebruikt bij opslaan van .sy-documenten en database-.json. Dit verkleint de bestandsgrootte met ~30% en verbetert lees-/schrijfefficiëntie met 50%",
"fileTree22": "Waarschuwing groot bestand",
"fileTree23": "Melden wanneer .sy-bestanden of database-.json deze grootte overschrijden",
- "fileTree24": "Nieuwe notitieboeken en documenten bovenaan plaatsen",
- "fileTree25": "Indien ingeschakeld worden nieuwe notitieboeken en documenten en de gebruikersgids bij het openen bovenaan hun lijsten geplaatst (werkt alleen wanneer aangepaste sortering is ingeschakeld)",
+ "fileTree24": "Nieuwe notitieboeken en documenten en verplaatste subdocumenten bovenaan plaatsen",
+ "fileTree25": "Indien ingeschakeld worden nieuwe notitieboeken en documenten, verplaatste subdocumenten en de geopende gebruikershandleiding bovenaan hun lijsten geplaatst, anders onderaan (alleen bij aangepaste sortering; expliciet verplaatsen voor of na een document blijft ongewijzigd)",
"fileTree26": "Standaard opslaglocatie voor snelle notities",
"fileTree27": "Bv. <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, als er geen sjabloonvariabele wordt gebruikt, wordt de snelle notitie toegevoegd aan het einde van het document op het opgegeven pad",
"export10": "Bijv. <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, indien leeg wordt watermerktekst of watermerkbestandspad gebruikt.",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index c4b23642e7..01af16dbb3 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Po włączeniu, format JSON w pojedynczej linii będzie używany przy zapisywaniu .sy dokumentów i plików .json bazy danych, co może zmniejszyć rozmiar pliku o około 30% i poprawić wydajność odczytu i zapisu o 50%",
"fileTree22": "Powiadomienie o dużym pliku",
"fileTree23": "Powiadom, gdy plik .sy lub baza danych .json przekroczy ten rozmiar",
- "fileTree24": "Umieszczaj nowe notesy i dokumenty na górze",
- "fileTree25": "Po włączeniu nowe notesy i dokumenty oraz podręcznik użytkownika po otwarciu będą umieszczane na początku odpowiednich list (działa tylko, gdy włączone jest niestandardowe sortowanie)",
+ "fileTree24": "Umieszczaj nowe notatniki i dokumenty oraz przeniesione poddokumenty na górze",
+ "fileTree25": "Po włączeniu nowe notatniki i dokumenty, przeniesione poddokumenty oraz otwarty podręcznik użytkownika trafiają na początek listy, w przeciwnym razie na koniec (tylko przy sortowaniu niestandardowym; nie dotyczy przenoszenia bezpośrednio przed lub za dokument)",
"fileTree26": "Domyślna ścieżka zapisu dla szybkich notatek",
"fileTree27": "Na przykład, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, jeśli nie użyto zmiennej szablonu, szybka notatka zostanie dodana na końcu dokumentu w określonej ścieżce",
"export10": "Na przykład <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, jeśli jest puste, użyj tekstu znaków wodnych lub ścieżki pliku znaku wodnego.",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 07592f6e34..c05149ca83 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Quando ativado, o formato JSON de linha única será usado ao salvar documentos .sy e arquivos .json de banco de dados, o que pode reduzir o tamanho do arquivo em cerca de 30% e melhorar a eficiência de leitura/gravação em 50%",
"fileTree22": "Aviso de arquivo grande",
"fileTree23": "Notificar quando arquivos .sy e banco de dados .json excederem este tamanho",
- "fileTree24": "Colocar novos blocos de notas e documentos no topo",
- "fileTree25": "Ao ativar, novos blocos de notas e documentos e o guia do usuário ao ser aberto serão colocados no topo de suas respectivas listas (somente tem efeito quando a ordenação personalizada estiver ativada)",
+ "fileTree24": "Colocar novos cadernos e documentos e subdocumentos movidos no topo",
+ "fileTree25": "Quando ativado, novos cadernos e documentos, subdocumentos movidos e o guia do usuário aberto são colocados no topo das listas; caso contrário, no final (apenas na ordenação personalizada; movimentos explícitos antes ou depois de um documento não são afetados)",
"fileTree26": "Caminho de salvamento padrão para notas rápidas",
"fileTree27": "Por exemplo, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, se nenhuma variável de modelo for usada, a nota rápida será anexada ao final do documento no caminho especificado",
"export10": "Por exemplo <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, se vazio, use texto de marca d'água ou caminho do arquivo de marca d'água.",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index 9f1e0114ea..c85ac3541c 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -2199,8 +2199,8 @@
"fileTree21": "После включения однострочный формат JSON будет использоваться при сохранении .sy документов и файлов баз данных .json, что может снизить размер файла примерно на 30% и улучшить эффективность чтения и записи на 50%",
"fileTree22": "Уведомление о большом файле",
"fileTree23": "Появится уведомление, если размер файла .sy или базы данных .json превышает этот предел",
- "fileTree24": "Размещать новые блокноты и документы вверху",
- "fileTree25": "Если включено, новые блокноты и документы, а также руководство пользователя при открытии будут помещаться в начало соответствующих списков (действует только при включённой пользовательской сортировке)",
+ "fileTree24": "Размещать новые блокноты и документы, а также перемещённые дочерние документы сверху",
+ "fileTree25": "Если включено, новые блокноты и документы, перемещённые дочерние документы и открытое руководство пользователя размещаются в начале списка, иначе в конце (только при пользовательской сортировке; явное перемещение перед документом или после него не затрагивается)",
"fileTree26": "Путь сохранения по умолчанию для быстрых заметок",
"fileTree27": "Например, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, если переменная шаблона не используется, быстрая заметка будет добавлена в конец документа по указанному пути",
"export10": "Например <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, если пусто, использовать текст водяного знака или путь к файлу водяного знака.",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 3e16ed96b9..426c55411f 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -2199,8 +2199,8 @@
"fileTree21": "JSON formát v jednom riadku (.sy súbory) šetrí miesto a čas",
"fileTree22": "Varovanie pri veľkom súbore",
"fileTree23": "Upozorniť, ak .sy alebo .json prekročí túto veľkosť",
- "fileTree24": "Nové zápisníky a dokumenty navrch",
- "fileTree25": "Po zapnutí sa nové zápisníky a dokumenty aj príručka pri otvorení umiestnia na začiatok príslušných zoznamov (platí len pri vlastnom zoradení)",
+ "fileTree24": "Umiestniť nové zápisníky a dokumenty a presunuté poddokumenty navrch",
+ "fileTree25": "Po zapnutí sa nové zápisníky a dokumenty, presunuté poddokumenty a otvorená používateľská príručka umiestnia na začiatok zoznamu, inak na koniec (iba pri vlastnom zoradení; výslovné presuny pred alebo za dokument zostávajú nezmenené)",
"fileTree26": "Predvolené umiestnenie pre rýchle poznámky",
"fileTree27": "Napr. <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, ak sa nepoužije premenná šablóny, rýchla poznámka sa pridá na koniec dokumentu na zadanej ceste",
"export10": "Napríklad <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, ak je prázdne, použije sa text vodoznaku alebo cesta k súboru vodoznaku.",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index 10d58403a2..afcbe768d8 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Kada je uključeno, pri čuvanju .sy dokumenata i .json fajlova baze koristi se jednoredni JSON format, čime se veličina fajla smanjuje za oko 30%, a efikasnost čitanja i pisanja poboljšava za 50%",
"fileTree22": "Upozorenje o velikom fajlu",
"fileTree23": "Obavesti kada .sy fajlovi ili .json fajlovi baze premaše ovu veličinu",
- "fileTree24": "Postavi nove beležnice i dokumente na vrh",
- "fileTree25": "Kada je uključeno, novoformirane beležnice i dokumenti, kao i vodič za korisnike pri otvaranju, postavljaju se na vrh svoje liste (deluje samo kada je uključeno prilagođeno ređanje)",
+ "fileTree24": "Postavi nove beležnice i dokumente i premeštene poddokumente na vrh",
+ "fileTree25": "Kada je uključeno, nove beležnice i dokumenti, premešteni poddokumenti i otvoreni korisnički vodič postavljaju se na vrh liste, inače na dno (samo pri prilagođenom ređanju; izričito pomeranje ispred ili iza dokumenta ostaje nepromenjeno)",
"fileTree26": "Podrazumevana putanja za čuvanje brzih beležaka",
"fileTree27": "Na primer, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, ako se ne koristi promenljiva šablona, brza beleška se dodaje na kraj dokumenta na navedenoj putanji",
"export10": "Na primer <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>, ako je prazno, koristi se tekst vodenog žiga ili putanja do fajla vodenog žiga",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 15d32af0b2..67e8a80013 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -2199,8 +2199,8 @@
"fileTree21": "เมื่อเปิดใช้งานจะใช้รูปแบบ JSON แบบบรรทัดเดียวเมื่อบันทึกไฟล์ .sy และ .json ของฐานข้อมูล ซึ่งสามารถลดขนาดไฟล์ได้ประมาณ 30% และเพิ่มประสิทธิภาพการอ่านเขียนได้ 50%",
"fileTree22": "คำเตือนไฟล์ขนาดใหญ่",
"fileTree23": "แจ้งเตือนเมื่อไฟล์ .sy หรือ .json ของฐานข้อมูลเกินขนาดนี้",
- "fileTree24": "วางสมุดบันทึกและเอกสารใหม่ไว้ด้านบน",
- "fileTree25": "เมื่อเปิดใช้งาน สมุดบันทึกและเอกสารใหม่ รวมถึงคู่มือเมื่อเปิด จะถูกวางไว้ด้านบนสุดของรายการที่เกี่ยวข้อง (มีผลเฉพาะเมื่อเปิดใช้งานการเรียงลำดับแบบกำหนดเอง)",
+ "fileTree24": "วางสมุดบันทึกและเอกสารใหม่ รวมถึงเอกสารย่อยที่ย้ายไว้ด้านบน",
+ "fileTree25": "เมื่อเปิดใช้งาน สมุดบันทึกและเอกสารใหม่ เอกสารย่อยที่ย้าย และคู่มือผู้ใช้ที่เปิดจะอยู่ด้านบนของรายการ มิฉะนั้นจะอยู่ด้านล่าง (เฉพาะการเรียงลำดับแบบกำหนดเอง ไม่ส่งผลต่อการย้ายที่ระบุไว้ก่อนหรือหลังเอกสารอย่างชัดเจน)",
"fileTree26": "ที่ตั้งบันทึกเริ่มต้นของบันทึกย่อ",
"fileTree27": "เช่น <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, หากไม่ใช่ตัวแปรแม่แบบ บันทึกย่อจะถูกเพิ่มที่ส่วนท้ายของเอกสารในเส้นทางที่ระบุ",
"export10": "เช่น <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code> หากเว้นว่างจะใช้ข้อความลายน้ำหรือเส้นทางไฟล์ลายน้ำ",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index a1a15d32a3..61ea812877 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Etkinleştirildiğinde .sy ve .json dosyaları tek satır JSON biçiminde kaydedilir, bu dosya boyutunu yaklaşık %30 azaltır ve %50 daha verimli okuma/yazma sağlar",
"fileTree22": "Büyük dosya uyarısı",
"fileTree23": ".sy veya .json dosyaları bu boyutu aşarsa uyar",
- "fileTree24": "Yeni not defterlerini ve belgeleri en üste yerleştir",
- "fileTree25": "Etkinleştirildiğinde yeni not defterleri ve belgeler ile açılan kullanım kılavuzu ilgili listelerin en üstüne yerleştirilir (sadece özel sıralama etkinse geçerli)",
+ "fileTree24": "Yeni not defterlerini ve belgeleri, taşınan alt belgeleri üste yerleştir",
+ "fileTree25": "Etkinleştirildiğinde yeni not defterleri ve belgeler, taşınan alt belgeler ve açılan kullanıcı kılavuzu listenin başına, aksi halde sonuna yerleştirilir (yalnızca özel sıralamada; bir belgenin önüne veya arkasına açıkça taşıma etkilenmez)",
"fileTree26": "Hızlı notlar için varsayılan kayıt yolu",
"fileTree27": "Örneğin, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, eğer şablon değişkeni kullanılmazsa, hızlı not belirtilen yoldaki belgenin sonuna eklenecektir",
"export10": "Örnek: <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>. Boşsa filigran metni veya dosya yolu kullanılır",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 9854d9a590..1be9bd766b 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -2199,8 +2199,8 @@
"fileTree21": "Якщо увімкнено, при збереженні .sy документів і .json файлів баз даних використовуватиметься однорядковий JSON, що може зменшити розмір файлу приблизно на 30% і підвищити ефективність читання/запису на 50%",
"fileTree22": "Попередження про великі файли",
"fileTree23": "Сповіщати, коли .sy файли або .json файли баз даних перевищують цей розмір",
- "fileTree24": "Розміщувати нові блокноти й документи зверху",
- "fileTree25": "Якщо увімкнено, нові блокноти й документи, а також посібник користувача під час відкриття буде розміщено на початку відповідних списків (працює лише при користувацькому сортуванні)",
+ "fileTree24": "Розміщувати нові блокноти й документи та переміщені дочірні документи вгорі",
+ "fileTree25": "Якщо ввімкнено, нові блокноти й документи, переміщені дочірні документи та відкритий посібник користувача розміщуються на початку списку, інакше в кінці (лише за власного сортування; явне переміщення перед документом або після нього не змінюється)",
"fileTree26": "Типовий шлях збереження для швидких нотаток",
"fileTree27": "Наприклад, <code class=\"fn__code\">/shorthands/{{now | date \"20060102150405\"}}</code>, якщо змінна шаблону не використовується, швидка нотатка буде додана в кінець документа за вказаним шляхом",
"export10": "Наприклад <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code>; якщо порожньо, використовується текст водяного знака або шлях до файла водяного знака.",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index e6a812d301..ed6804f5aa 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -2199,8 +2199,8 @@
"fileTree21": "启用后保存 .sy 文档和数据库 .json 时将使用单行 JSON 格式,大约能减少 30% 文件大小并提升 50% 读写效率",
"fileTree22": "超大文件提醒",
"fileTree23": ".sy 文档和数据库 .json 超过该大小时弹出通知提醒",
- "fileTree24": "新建笔记本和文档放置在顶部",
- "fileTree25": "启用后新建的笔记本和文档以及打开的用户指南将放置在对应列表的顶部(仅在自定义排序启用时生效)",
+ "fileTree24": "新建的笔记本和文档、移动的子文档放置在顶部",
+ "fileTree25": "开启后,新建的笔记本和文档、移动的子文档、打开的用户指南放置在列表顶部,否则放置在底部(仅自定义排序时生效,不影响明确移动到文档之前或之后的操作)",
"fileTree26": "新建闪念速记的默认存放路径",
"fileTree27": "例如 <code class='fn__code'>/闪念速记/{{now | date \"20060102150405\"}}</code>,不使用模板变量时闪念速记将添加到该路径指定文档内容的末尾",
"export10": "例如 <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code> ,为空时使用水印文本或水印文件路径。",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 7fbb5051b0..dcb0dc3c72 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -2199,8 +2199,8 @@
"fileTree21": "啟用後儲存 .sy 檔案和資料庫 .json 時將使用單行 JSON 格式,大約能減少 30% 檔案大小並提升 50% 讀寫效率",
"fileTree22": "超大檔案提醒",
"fileTree23": ".sy 檔案和資料庫 .json 超過該大小時彈出通知提醒",
- "fileTree24": "新建筆記本和文件放置在頂部",
- "fileTree25": "啟用後新建的筆記本和文件以及開啟的用戶指南將放置在對應列表的頂部(僅在自訂排序啟用時生效)",
+ "fileTree24": "新建的筆記本和文件、移動的子文件放置在頂部",
+ "fileTree25": "開啟後,新建的筆記本和文件、移動的子文件、開啟的使用者指南放置在清單頂部,否則放置在底部(僅自訂排序時生效,不影響明確移動到文件之前或之後的操作)",
"fileTree26": "新建閃念速記的默認存放路徑",
"fileTree27": "例如 <code class=\"fn__code\">/閃念速記/{{now | date \"20060102150405\"}}</code>,不使用模板變量時閃念速記將添加到該路徑指定文件內容的末尾",
"export10": "例如 <code class='fn__code'>&lt;span style=\"color: #fff;background-color: black;padding: 4px;border-radius: 5px;float:right;\"&gt;SiYuan&lt;/span&gt;</code> ,為空時使用水印文字或浮水印檔案路徑。",
diff --git a/kernel/model/file.go b/kernel/model/file.go
index 571bc5bac6..3bab1271f1 100644
--- a/kernel/model/file.go
+++ b/kernel/model/file.go
@@ -24,6 +24,7 @@ import (
"os"
"path"
"path/filepath"
+ "slices"
"sort"
"strconv"
"strings"
@@ -1695,6 +1696,10 @@ func orderMoveDocPaths(fromPaths []string, pathsBoxes map[string]*Box) (ret []st
}
func MoveDocs(fromPaths []string, toBoxID, toPath string, callback any) (err error) {
+ return moveDocs(fromPaths, toBoxID, toPath, callback, true)
+}
+
+func moveDocs(fromPaths []string, toBoxID, toPath string, callback any, placeByConf bool) (err error) {
toBox := Conf.Box(toBoxID)
if nil == toBox {
err = errors.New(Conf.Language(0))
@@ -1774,6 +1779,20 @@ func MoveDocs(fromPaths []string, toBoxID, toPath string, callback any) (err err
movedDocs := make([]moveDocResult, 0, len(fromPaths))
defer func() {
if 0 < len(movedDocs) {
+ // 部分移动失败时也保存已完成文档的整组顺序,再通知前端刷新。
+ if placeByConf {
+ ids := make([]string, 0, len(movedDocs))
+ for _, moved := range movedDocs {
+ ids = append(ids, util.GetTreeID(moved.NewPath))
+ }
+ position := "after"
+ if Conf.FileTree.CreateDocAtTop != nil && *Conf.FileTree.CreateDocAtTop {
+ position = "before"
+ }
+ if sortErr := toBox.placeDocsInSiblingOrder(strings.TrimSuffix(toPath, ".sy"), ids, "", position); sortErr != nil {
+ err = errors.Join(err, sortErr)
+ }
+ }
evt := util.NewCmdResult("moveDocs", 0, util.PushModeBroadcast)
evt.Data = map[string]any{"moves": movedDocs}
evt.Callback = callback
@@ -3081,6 +3100,10 @@ func (box *Box) addMinSort(parentPath, id string) {
}
func (box *Box) placeDocInSiblingOrder(parentPath, id, targetID, position string) error {
+ return box.placeDocsInSiblingOrder(parentPath, []string{id}, targetID, position)
+}
+
+func (box *Box) placeDocsInSiblingOrder(parentPath string, ids []string, targetID, position string) error {
fileTreeSortLock.Lock()
confDir := filepath.Join(util.DataDir, box.ID, ".siyuan")
if err := os.MkdirAll(confDir, 0755); nil != err {
@@ -3098,9 +3121,13 @@ func (box *Box) placeDocInSiblingOrder(parentPath, id, targetID, position string
fileTreeSortLock.Unlock()
return err
}
- orderedIDs := make([]string, 0, len(currentIDs)+1)
+ orderedIDs := make([]string, 0, len(currentIDs)+len(ids))
+ movedIDs := make(map[string]bool, len(ids))
+ for _, id := range ids {
+ movedIDs[id] = true
+ }
for _, currentID := range currentIDs {
- if currentID != id {
+ if !movedIDs[currentID] {
orderedIDs = append(orderedIDs, currentID)
}
}
@@ -3124,9 +3151,7 @@ func (box *Box) placeDocInSiblingOrder(parentPath, id, targetID, position string
return fmt.Errorf("sort target document [%s] not found", targetID)
}
}
- orderedIDs = append(orderedIDs, "")
- copy(orderedIDs[insertIndex+1:], orderedIDs[insertIndex:])
- orderedIDs[insertIndex] = id
+ orderedIDs = slices.Insert(orderedIDs, insertIndex, ids...)
sortIDs := make(map[string]int, len(orderedIDs))
for i, orderedID := range orderedIDs {
sortIDs[orderedID] = i + 1
diff --git a/kernel/model/file_move_sort_test.go b/kernel/model/file_move_sort_test.go
new file mode 100644
index 0000000000..f5f96c3528
--- /dev/null
+++ b/kernel/model/file_move_sort_test.go
@@ -0,0 +1,120 @@
+//go:build fts5
+
+package model
+
+import (
+ "os"
+ "os/exec"
+ "path/filepath"
+ "testing"
+
+ "github.com/siyuan-note/siyuan/kernel/conf"
+ "github.com/siyuan-note/siyuan/kernel/filesys"
+ "github.com/siyuan-note/siyuan/kernel/sql"
+ "github.com/siyuan-note/siyuan/kernel/treenode"
+ "github.com/siyuan-note/siyuan/kernel/util"
+)
+
+func TestMoveDocsBatchCustomOrder(t *testing.T) {
+ for _, crossBox := range []bool{false, true} {
+ for _, atTop := range []bool{false, true} {
+ t.Run(filepath.Join(map[bool]string{false: "same", true: "cross"}[crossBox], map[bool]string{false: "bottom", true: "top"}[atTop]), func(t *testing.T) {
+ if os.Getenv("SIYUAN_TEST_MOVE_SORT") != t.Name() {
+ cmd := exec.Command(os.Args[0], "-test.run=^TestMoveDocsBatchCustomOrder$", "-test.v")
+ cmd.Env = append(os.Environ(), "SIYUAN_TEST_MOVE_SORT="+t.Name())
+ if os.Getenv("SIYUAN_TEST_MOVE_SORT") != "" {
+ return
+ }
+ if output, err := cmd.CombinedOutput(); err != nil {
+ t.Fatalf("move sort subprocess failed: %v\n%s", err, output)
+ }
+ return
+ }
+ f := setupFileOperationTest(t)
+ util.TempDir = t.TempDir()
+ util.QueueDir = filepath.Join(util.TempDir, "queue")
+ util.ConfDir = filepath.Join(util.TempDir, "conf")
+ util.DBPath = filepath.Join(util.TempDir, util.DBName)
+ util.HistoryDBPath = filepath.Join(util.TempDir, "history.db")
+ util.AssetContentDBPath = filepath.Join(util.TempDir, "asset_content.db")
+ if err := os.MkdirAll(util.ConfDir, 0755); err != nil {
+ t.Fatal(err)
+ }
+ sql.InitDatabase(true)
+ sql.InitHistoryDatabase(true)
+ sql.InitAssetContentDatabase(true)
+ t.Cleanup(sql.CloseDatabase)
+ for _, p := range []string{f.sourcePath, f.targetPath} {
+ tree, err := filesys.LoadTree(f.box.ID, p, util.NewLute())
+ if err != nil {
+ t.Fatal(err)
+ }
+ treenode.UpsertBlockTree(tree)
+ }
+ Conf.FileTree.CreateDocAtTop = &atTop
+ a := addFileOperationTestDoc(t, f, "20260718000003-abcdefg", "A", false)
+ b := addFileOperationTestDoc(t, f, "20260718000004-abcdefg", "B", false)
+ if err := MoveDocs([]string{a.Path, b.Path}, f.box.ID, f.sourcePath, nil); err != nil {
+ t.Fatal(err)
+ }
+ targetBox := f.box
+ if crossBox {
+ targetBox = &Box{ID: "20260718000010-abcdefg"}
+ boxConf := conf.NewBoxConf()
+ boxConf.Closed = false
+ if err := targetBox.SaveConf(boxConf); err != nil {
+ t.Fatal(err)
+ }
+ if err := MoveDocs([]string{f.targetPath}, targetBox.ID, "/", nil); err != nil {
+ t.Fatal(err)
+ }
+ }
+ // 源列表使用旧版零起点编号,目标列表中包含相同编号。
+ if err := writeSortConfMap(filepath.Join(util.DataDir, f.box.ID, ".siyuan", "sort.json"), map[string]int{a.ID: 0, b.ID: 1, f.sourceID: 1, f.targetID: 1}); err != nil {
+ t.Fatal(err)
+ }
+ paths := []string{"/" + f.sourceID + "/" + b.ID + ".sy", "/" + f.sourceID + "/" + a.ID + ".sy"}
+ if err := MoveDocs(paths, targetBox.ID, "/", nil); err != nil {
+ t.Fatal(err)
+ }
+ existing := []string{f.targetID, f.sourceID}
+ if crossBox {
+ existing = []string{f.targetID}
+ }
+ want := append(existing, b.ID, a.ID)
+ if atTop {
+ want = append([]string{b.ID, a.ID}, existing...)
+ }
+ assertSiblingCustomOrder(t, targetBox.ID, "/", want)
+ // 同时覆盖移动到已有子文档的父文档下,以及明确的前后落点。
+ if err := MoveDocs([]string{"/" + a.ID + ".sy"}, targetBox.ID, f.targetPath, nil); err != nil {
+ t.Fatal(err)
+ }
+ if err := MoveDocs([]string{"/" + b.ID + ".sy"}, targetBox.ID, f.targetPath, nil); err != nil {
+ t.Fatal(err)
+ }
+ childOrder := []string{a.ID, b.ID}
+ if atTop {
+ childOrder = []string{b.ID, a.ID}
+ }
+ assertSiblingCustomOrder(t, targetBox.ID, "/"+f.targetID, childOrder)
+ position := "before"
+ if atTop {
+ position = "after"
+ }
+ Conf.FileTree.Sort = util.SortModeCustom
+ if _, err := ReorderDocTree([]string{b.ID, a.ID}, f.targetID, position, false, true); err != nil {
+ t.Fatal(err)
+ }
+ want = []string{b.ID, a.ID, f.targetID}
+ if atTop {
+ want = []string{f.targetID, b.ID, a.ID}
+ }
+ if !crossBox {
+ want = append(want, f.sourceID)
+ }
+ assertSiblingCustomOrder(t, targetBox.ID, "/", want)
+ })
+ }
+ }
+}
diff --git a/kernel/model/file_tree_reorder.go b/kernel/model/file_tree_reorder.go
index 7e705b8549..f1bc138334 100644
--- a/kernel/model/file_tree_reorder.go
+++ b/kernel/model/file_tree_reorder.go
@@ -201,7 +201,7 @@ func ReorderDocTree(sourceIDs []string, targetID, position string, preview, remo
}
}
if len(fromPaths) > 0 {
- if err = MoveDocs(fromPaths, box.ID, listPath, nil); err != nil {
+ if err = moveDocs(fromPaths, box.ID, listPath, nil, false); err != nil {
return ret, err
}
}
diff --git a/kernel/model/import.go b/kernel/model/import.go
index b2eaf9f664..93a55870bf 100644
--- a/kernel/model/import.go
+++ b/kernel/model/import.go
@@ -246,7 +246,7 @@ func buildImportedSYSortValues(importedDocs []*importedSYSortDoc, sourceSortIDs
sortValues := map[string]int{}
for _, docs := range groups {
for sortValue, doc := range docs {
- sortValues[doc.newID] = sortValue
+ sortValues[doc.newID] = sortValue + 1
}
}
@@ -264,7 +264,7 @@ func buildImportedSYSortValues(importedDocs []*importedSYSortDoc, sourceSortIDs
orderedRootIDs = append(orderedRootIDs, rootIDs...)
}
for sortValue, id := range orderedRootIDs {
- sortValues[id] = sortValue
+ sortValues[id] = sortValue + 1
}
return sortValues
}
diff --git a/kernel/model/import_test.go b/kernel/model/import_test.go
index fe21c12a5c..49da56f1df 100644
--- a/kernel/model/import_test.go
+++ b/kernel/model/import_test.go
@@ -83,15 +83,15 @@ func TestBuildImportedSYSortValues(t *testing.T) {
name: "prepend batch",
createDocAtTop: true,
want: map[string]int{
- second.newID: 0, first.newID: 1, "existing-first": 2, "existing-second": 3,
- childNew.newID: 0, childOld.newID: 1,
+ second.newID: 1, first.newID: 2, "existing-first": 3, "existing-second": 4,
+ childNew.newID: 1, childOld.newID: 2,
},
},
{
name: "append batch",
want: map[string]int{
- "existing-first": 0, "existing-second": 1, second.newID: 2, first.newID: 3,
- childNew.newID: 0, childOld.newID: 1,
+ "existing-first": 1, "existing-second": 2, second.newID: 3, first.newID: 4,
+ childNew.newID: 1, childOld.newID: 2,
},
},
}
@@ -113,7 +113,7 @@ func TestBuildImportedSYSortValuesWithoutSourceSort(t *testing.T) {
oldID: "20260801000002-bbbbbbb", newID: "20260801000002-newbbbb", sourcePath: "/20260801000002-bbbbbbb.sy"}
got := buildImportedSYSortValues([]*importedSYSortDoc{older, newer}, nil, []string{"existing"}, true)
- assertImportedSYSortValues(t, got, map[string]int{newer.newID: 0, older.newID: 1, "existing": 2})
+ assertImportedSYSortValues(t, got, map[string]int{newer.newID: 1, older.newID: 2, "existing": 3})
}
func TestImportedSYRootIDs(t *testing.T) {