Skip to content

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

:sparkles: Support database automation subdocument depth limits https://github.com/siyuan-note/siyuan/issues/20753

Danieled1845d9b7ce
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index dd3d17d5b4..3718ec7133 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "عمق المستندات الفرعية",
+ "automationCollectionDepthUnlimited": "بلا حدود",
+ "automationCollectionDepthCurrent": "المستند الحالي فقط",
+ "automationCollectionDepthLimited": "العمق الأقصى",
+ "automationCollectionDepthTip": "يشمل كل مستند محدد نفسه؛ يقتصر تطبيق العمق على نطاقات المستندات. يتم دمج نطاقات دفاتر الملاحظات والمستندات",
"mindmapPasteChild": "لصق كعقدة فرعية",
"mindmapPasteSibling": "لصق كعقدة شقيقة",
"embedBlockBreadcrumbParentPath": "إظهار المسار الأصل في مسار التنقل",
@@ -114,7 +119,7 @@
"copyOCRText": "نسخ نص OCR",
"exportTitleImage": "تصدير صورة العنوان",
"automationCollectBlocks": "الكتلة تطابق الشروط",
- "automationCollectionScope": "نطاق المراقبة (يشمل المستندات الفرعية)",
+ "automationCollectionScope": "نطاق المراقبة",
"automationCollectionPreview": "معاينة الكتل المطابقة",
"automationCollectPage": "جمع المطابقات في هذه الصفحة",
"automationCollectionTip": "يضيف الجمع التلقائي الكتل المطابقة. تحتفظ تغييرات المصدر أو القواعد بالإدخالات والحقول الحالية؛ استخدم مراجعة الجمع للتنظيف الصريح",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index 314a414df0..cdde6e095d 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Tiefe der Unterdokumente",
+ "automationCollectionDepthUnlimited": "Unbegrenzt",
+ "automationCollectionDepthCurrent": "Nur aktuelles Dokument",
+ "automationCollectionDepthLimited": "Maximale Tiefe",
+ "automationCollectionDepthTip": "Schließt jedes ausgewählte Dokument selbst ein; die Tiefe gilt nur für Dokumentbereiche. Notizbuch- und Dokumentbereiche werden vereinigt",
"mindmapPasteChild": "Als untergeordneten Knoten einfügen",
"mindmapPasteSibling": "Als gleichgeordneten Knoten einfügen",
"embedBlockBreadcrumbParentPath": "Übergeordneten Pfad in der Brotkrumennavigation anzeigen",
@@ -114,7 +119,7 @@
"copyOCRText": "OCR-Text kopieren",
"exportTitleImage": "Titelbild exportieren",
"automationCollectBlocks": "Block erfüllt Bedingungen",
- "automationCollectionScope": "Überwachungsbereich (mit Unterdokumenten)",
+ "automationCollectionScope": "Überwachungsbereich",
"automationCollectionPreview": "Passende Blöcke anzeigen",
"automationCollectPage": "Treffer dieser Seite erfassen",
"automationCollectionTip": "Die automatische Sammlung fügt passende Blöcke hinzu. Änderungen an Quelle oder Regeln erhalten vorhandene Einträge und Felder; bereinigen Sie ausdrücklich über die Sammlungsprüfung",
diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.json
index a56a7bdac2..111eb86f91 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Subdocument depth",
+ "automationCollectionDepthUnlimited": "Unlimited",
+ "automationCollectionDepthCurrent": "Current document only",
+ "automationCollectionDepthLimited": "Limit depth",
+ "automationCollectionDepthTip": "Includes each selected document itself; depth applies only to document scopes. Notebook and document scopes are combined",
"mindmapPasteChild": "Paste as child node",
"mindmapPasteSibling": "Paste as sibling node",
"embedBlockBreadcrumbParentPath": "Show parent path in breadcrumbs",
@@ -114,7 +119,7 @@
"copyOCRText": "Copy OCR text",
"exportTitleImage": "Export title image",
"automationCollectBlocks": "Block matches conditions",
- "automationCollectionScope": "Watch scope (includes subdocuments)",
+ "automationCollectionScope": "Watch scope",
"automationCollectionPreview": "Preview matching blocks",
"automationCollectPage": "Collect matches on this page",
"automationCollectionTip": "Automatic collection adds matching blocks. Source or rule changes keep existing entries and fields; use the collection review to clean up explicitly",
diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.json
index 4849592dbc..875dbe5fee 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Profundidad de subdocumentos",
+ "automationCollectionDepthUnlimited": "Sin límite",
+ "automationCollectionDepthCurrent": "Solo el documento actual",
+ "automationCollectionDepthLimited": "Profundidad máxima",
+ "automationCollectionDepthTip": "Incluye cada documento seleccionado; la profundidad solo limita los ámbitos de documentos. Los ámbitos de cuadernos y documentos se unen",
"mindmapPasteChild": "Pegar como nodo hijo",
"mindmapPasteSibling": "Pegar como nodo hermano",
"embedBlockBreadcrumbParentPath": "Mostrar la ruta superior en la ruta de navegación",
@@ -114,7 +119,7 @@
"copyOCRText": "Copiar texto OCR",
"exportTitleImage": "Exportar imagen de título",
"automationCollectBlocks": "Un bloque cumple las condiciones",
- "automationCollectionScope": "Ámbito de seguimiento (incluye subdocumentos)",
+ "automationCollectionScope": "Ámbito de supervisión",
"automationCollectionPreview": "Vista previa de bloques coincidentes",
"automationCollectPage": "Recopilar coincidencias de esta página",
"automationCollectionTip": "La recopilación automática añade bloques coincidentes. Los cambios en el origen o las reglas conservan las entradas y los campos existentes; use la revisión para limpiarlos explícitamente",
diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.json
index cd703b1126..3dd6737016 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Profondeur des sous-documents",
+ "automationCollectionDepthUnlimited": "Illimitée",
+ "automationCollectionDepthCurrent": "Document actuel uniquement",
+ "automationCollectionDepthLimited": "Profondeur maximale",
+ "automationCollectionDepthTip": "Inclut chaque document sélectionné ; la profondeur limite uniquement les périmètres de documents. Les périmètres des carnets et des documents sont réunis",
"mindmapPasteChild": "Coller comme nœud enfant",
"mindmapPasteSibling": "Coller comme nœud de même niveau",
"embedBlockBreadcrumbParentPath": "Afficher le chemin parent dans le fil d'Ariane",
@@ -114,7 +119,7 @@
"copyOCRText": "Copier le texte OCR",
"exportTitleImage": "Exporter l’image de titre",
"automationCollectBlocks": "Un bloc remplit les conditions",
- "automationCollectionScope": "Portée de surveillance (sous-documents inclus)",
+ "automationCollectionScope": "Périmètre de surveillance",
"automationCollectionPreview": "Aperçu des blocs correspondants",
"automationCollectPage": "Collecter les résultats de cette page",
"automationCollectionTip": "La collecte automatique ajoute les blocs correspondants. Les changements de source ou de règles conservent les entrées et champs existants ; utilisez la vérification pour les nettoyer explicitement",
diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.json
index de55e6fed8..a7a7fe4942 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "עומק מסמכי המשנה",
+ "automationCollectionDepthUnlimited": "ללא הגבלה",
+ "automationCollectionDepthCurrent": "המסמך הנוכחי בלבד",
+ "automationCollectionDepthLimited": "עומק מרבי",
+ "automationCollectionDepthTip": "כולל כל מסמך שנבחר עצמו; העומק מגביל רק טווחי מסמכים. טווחי מחברות ומסמכים משולבים יחד",
"mindmapPasteChild": "הדבקה כצומת ילד",
"mindmapPasteSibling": "הדבקה כצומת אח",
"embedBlockBreadcrumbParentPath": "הצגת נתיב האב בנתיב הניווט",
@@ -114,7 +119,7 @@
"copyOCRText": "העתקת טקסט OCR",
"exportTitleImage": "ייצוא תמונת כותרת",
"automationCollectBlocks": "בלוק תואם לתנאים",
- "automationCollectionScope": "טווח מעקב (כולל מסמכי משנה)",
+ "automationCollectionScope": "טווח המעקב",
"automationCollectionPreview": "תצוגה מקדימה של בלוקים תואמים",
"automationCollectPage": "איסוף התאמות בעמוד זה",
"automationCollectionTip": "איסוף אוטומטי מוסיף בלוקים תואמים. שינויים במקור או בכללים שומרים על הרשומות והשדות הקיימים; ניתן לנקות במפורש דרך בדיקת האיסוף",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index c2defd2ec2..b7d273b10d 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "उपदस्तावेज़ों की गहराई",
+ "automationCollectionDepthUnlimited": "असीमित",
+ "automationCollectionDepthCurrent": "केवल वर्तमान दस्तावेज़",
+ "automationCollectionDepthLimited": "अधिकतम गहराई",
+ "automationCollectionDepthTip": "प्रत्येक चयनित दस्तावेज़ स्वयं भी शामिल है; गहराई केवल दस्तावेज़ों के दायरे को सीमित करती है। नोटबुक और दस्तावेज़ों के दायरे संयुक्त होते हैं",
"mindmapPasteChild": "चाइल्ड नोड के रूप में पेस्ट करें",
"mindmapPasteSibling": "समान स्तर के नोड के रूप में पेस्ट करें",
"embedBlockBreadcrumbParentPath": "ब्रेडक्रंब में मूल पथ दिखाएँ",
@@ -114,7 +119,7 @@
"copyOCRText": "OCR टेक्स्ट कॉपी करें",
"exportTitleImage": "शीर्षक चित्र निर्यात करें",
"automationCollectBlocks": "ब्लॉक शर्तों से मेल खाता है",
- "automationCollectionScope": "निगरानी का दायरा (उपदस्तावेज़ सहित)",
+ "automationCollectionScope": "निगरानी का दायरा",
"automationCollectionPreview": "मेल खाने वाले ब्लॉक का पूर्वावलोकन",
"automationCollectPage": "इस पृष्ठ के मेल खाते ब्लॉक एकत्र करें",
"automationCollectionTip": "स्वचालित संग्रह मेल खाने वाले ब्लॉक जोड़ता है। स्रोत या नियम बदलने पर मौजूदा प्रविष्टियाँ और फ़ील्ड सुरक्षित रहते हैं; स्पष्ट सफ़ाई के लिए संग्रह समीक्षा का उपयोग करें",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index a683efe99e..516e589b53 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Kedalaman subdokumen",
+ "automationCollectionDepthUnlimited": "Tanpa batas",
+ "automationCollectionDepthCurrent": "Hanya dokumen saat ini",
+ "automationCollectionDepthLimited": "Kedalaman maksimum",
+ "automationCollectionDepthTip": "Mencakup setiap dokumen yang dipilih; kedalaman hanya membatasi cakupan dokumen. Cakupan buku catatan dan dokumen digabungkan",
"mindmapPasteChild": "Tempel sebagai simpul anak",
"mindmapPasteSibling": "Tempel sebagai simpul sejajar",
"embedBlockBreadcrumbParentPath": "Tampilkan jalur induk di remah roti",
@@ -114,7 +119,7 @@
"copyOCRText": "Salin teks OCR",
"exportTitleImage": "Ekspor gambar judul",
"automationCollectBlocks": "Blok memenuhi kondisi",
- "automationCollectionScope": "Cakupan pemantauan (termasuk subdokumen)",
+ "automationCollectionScope": "Cakupan pemantauan",
"automationCollectionPreview": "Pratinjau blok yang cocok",
"automationCollectPage": "Kumpulkan kecocokan di halaman ini",
"automationCollectionTip": "Pengumpulan otomatis menambahkan blok yang cocok. Perubahan sumber atau aturan mempertahankan entri dan kolom yang ada; gunakan pemeriksaan pengumpulan untuk membersihkan secara eksplisit",
diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.json
index 404d522de6..98f06955cd 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Profondità dei sottodocumenti",
+ "automationCollectionDepthUnlimited": "Illimitata",
+ "automationCollectionDepthCurrent": "Solo il documento corrente",
+ "automationCollectionDepthLimited": "Profondità massima",
+ "automationCollectionDepthTip": "Include ogni documento selezionato; la profondità limita solo gli ambiti dei documenti. Gli ambiti dei taccuini e dei documenti vengono uniti",
"mindmapPasteChild": "Incolla come nodo figlio",
"mindmapPasteSibling": "Incolla come nodo allo stesso livello",
"embedBlockBreadcrumbParentPath": "Mostra il percorso superiore nelle briciole di pane",
@@ -114,7 +119,7 @@
"copyOCRText": "Copia testo OCR",
"exportTitleImage": "Esporta immagine del titolo",
"automationCollectBlocks": "Un blocco soddisfa le condizioni",
- "automationCollectionScope": "Ambito di monitoraggio (include i sottodocumenti)",
+ "automationCollectionScope": "Ambito di monitoraggio",
"automationCollectionPreview": "Anteprima dei blocchi corrispondenti",
"automationCollectPage": "Raccogli le corrispondenze di questa pagina",
"automationCollectionTip": "La raccolta automatica aggiunge i blocchi corrispondenti. Le modifiche all’origine o alle regole conservano voci e campi esistenti; usa il controllo della raccolta per pulirli esplicitamente",
diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.json
index 0bdc1d38d7..0b46dcca5b 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "子文書の深さ",
+ "automationCollectionDepthUnlimited": "無制限",
+ "automationCollectionDepthCurrent": "現在の文書のみ",
+ "automationCollectionDepthLimited": "最大階層数",
+ "automationCollectionDepthTip": "選択した各文書自体を含み、深さは文書の範囲にのみ適用されます。ノートブックと文書の範囲は和集合です",
"mindmapPasteChild": "子ノードとして貼り付け",
"mindmapPasteSibling": "同階層のノードとして貼り付け",
"embedBlockBreadcrumbParentPath": "パンくずリストに文書の上位パスを表示",
@@ -114,7 +119,7 @@
"copyOCRText": "OCR テキストをコピー",
"exportTitleImage": "題頭画像をエクスポート",
"automationCollectBlocks": "通常ブロックが条件に一致",
- "automationCollectionScope": "監視範囲(子文書を含む)",
+ "automationCollectionScope": "監視範囲",
"automationCollectionPreview": "一致するブロックをプレビュー",
"automationCollectPage": "このページの一致ブロックを収集",
"automationCollectionTip": "自動収集は一致する内容を追加します。元の内容やルールが変わっても既存項目とフィールドは保持され、収集結果の確認から明示的に整理できます",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 94a8e8bc76..30eb994949 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "하위 문서 깊이",
+ "automationCollectionDepthUnlimited": "제한 없음",
+ "automationCollectionDepthCurrent": "현재 문서만",
+ "automationCollectionDepthLimited": "최대 깊이",
+ "automationCollectionDepthTip": "선택한 각 문서 자체를 포함하며 깊이는 문서 범위에만 적용됩니다. 노트북과 문서 범위는 합집합으로 결합됩니다",
"mindmapPasteChild": "하위 노드로 붙여넣기",
"mindmapPasteSibling": "같은 수준의 노드로 붙여넣기",
"embedBlockBreadcrumbParentPath": "탐색 경로에 문서의 상위 경로 표시",
@@ -114,7 +119,7 @@
"copyOCRText": "OCR 텍스트 복사",
"exportTitleImage": "제목 이미지 내보내기",
"automationCollectBlocks": "일반 블록이 조건과 일치",
- "automationCollectionScope": "감시 범위(하위 문서 포함)",
+ "automationCollectionScope": "감시 범위",
"automationCollectionPreview": "일치하는 블록 미리 보기",
"automationCollectPage": "이 페이지의 일치 블록 수집",
"automationCollectionTip": "자동 수집은 일치하는 블록을 추가합니다. 원본이나 규칙이 변경되어도 기존 항목과 필드는 유지됩니다. 수집 결과 확인에서 직접 정리할 수 있습니다",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index c36bbdc9d9..134dc777a0 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Diepte van subdocumenten",
+ "automationCollectionDepthUnlimited": "Onbeperkt",
+ "automationCollectionDepthCurrent": "Alleen huidig document",
+ "automationCollectionDepthLimited": "Maximale diepte",
+ "automationCollectionDepthTip": "Omvat elk geselecteerd document zelf; de diepte geldt alleen voor documentbereiken. Notitieboek- en documentbereiken worden samengevoegd",
"mindmapPasteChild": "Plakken als onderliggend knooppunt",
"mindmapPasteSibling": "Plakken als knooppunt op hetzelfde niveau",
"embedBlockBreadcrumbParentPath": "Bovenliggend pad in het kruimelpad tonen",
@@ -114,7 +119,7 @@
"copyOCRText": "OCR-tekst kopiëren",
"exportTitleImage": "Titelafbeelding exporteren",
"automationCollectBlocks": "Blok voldoet aan voorwaarden",
- "automationCollectionScope": "Volgbereik (inclusief subdocumenten)",
+ "automationCollectionScope": "Bewakingsbereik",
"automationCollectionPreview": "Voorbeeld van overeenkomende blokken",
"automationCollectPage": "Overeenkomsten op deze pagina verzamelen",
"automationCollectionTip": "Automatisch verzamelen voegt passende blokken toe. Wijzigingen in bron of regels behouden bestaande items en velden; gebruik de controle om expliciet op te ruimen",
diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.json
index 8a794d7c85..c551de3ebc 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Głębokość dokumentów podrzędnych",
+ "automationCollectionDepthUnlimited": "Bez ograniczeń",
+ "automationCollectionDepthCurrent": "Tylko bieżący dokument",
+ "automationCollectionDepthLimited": "Maksymalna głębokość",
+ "automationCollectionDepthTip": "Obejmuje każdy wybrany dokument; głębokość ogranicza tylko zakresy dokumentów. Zakresy notatników i dokumentów są łączone",
"mindmapPasteChild": "Wklej jako węzeł podrzędny",
"mindmapPasteSibling": "Wklej jako węzeł równorzędny",
"embedBlockBreadcrumbParentPath": "Pokaż ścieżkę nadrzędną w nawigacji okruszkowej",
@@ -114,7 +119,7 @@
"copyOCRText": "Kopiuj tekst OCR",
"exportTitleImage": "Eksportuj obraz tytułowy",
"automationCollectBlocks": "Blok spełnia warunki",
- "automationCollectionScope": "Zakres obserwacji (z dokumentami podrzędnymi)",
+ "automationCollectionScope": "Zakres monitorowania",
"automationCollectionPreview": "Podgląd pasujących bloków",
"automationCollectPage": "Zbierz dopasowania z tej strony",
"automationCollectionTip": "Automatyczne zbieranie dodaje pasujące bloki. Zmiany źródła lub reguł zachowują istniejące wpisy i pola; do jawnego porządkowania służy przegląd zbierania",
diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.json
index 4111d9d02d..3b4185063a 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Profundidade dos subdocumentos",
+ "automationCollectionDepthUnlimited": "Sem limite",
+ "automationCollectionDepthCurrent": "Somente o documento atual",
+ "automationCollectionDepthLimited": "Profundidade máxima",
+ "automationCollectionDepthTip": "Inclui cada documento selecionado; a profundidade limita apenas os escopos de documentos. Os escopos de cadernos e documentos são unidos",
"mindmapPasteChild": "Colar como nó filho",
"mindmapPasteSibling": "Colar como nó irmão",
"embedBlockBreadcrumbParentPath": "Mostrar o caminho superior na trilha de navegação",
@@ -114,7 +119,7 @@
"copyOCRText": "Copiar texto OCR",
"exportTitleImage": "Exportar imagem de título",
"automationCollectBlocks": "Bloco atende às condições",
- "automationCollectionScope": "Escopo de monitoramento (inclui subdocumentos)",
+ "automationCollectionScope": "Escopo de monitoramento",
"automationCollectionPreview": "Visualizar blocos correspondentes",
"automationCollectPage": "Coletar correspondências desta página",
"automationCollectionTip": "A coleta automática adiciona blocos correspondentes. Alterações na origem ou nas regras mantêm as entradas e campos existentes; use a verificação para limpar explicitamente",
diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.json
index 65f7c52641..ef8189eb64 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Глубина вложенных документов",
+ "automationCollectionDepthUnlimited": "Без ограничений",
+ "automationCollectionDepthCurrent": "Только текущий документ",
+ "automationCollectionDepthLimited": "Максимальная глубина",
+ "automationCollectionDepthTip": "Включает каждый выбранный документ; глубина ограничивает только области документов. Области блокнотов и документов объединяются",
"mindmapPasteChild": "Вставить как дочерний узел",
"mindmapPasteSibling": "Вставить как узел того же уровня",
"embedBlockBreadcrumbParentPath": "Показывать родительский путь в навигационной цепочке",
@@ -114,7 +119,7 @@
"copyOCRText": "Копировать текст OCR",
"exportTitleImage": "Экспортировать заглавное изображение",
"automationCollectBlocks": "Блок соответствует условиям",
- "automationCollectionScope": "Область отслеживания (с дочерними документами)",
+ "automationCollectionScope": "Область отслеживания",
"automationCollectionPreview": "Просмотр подходящих блоков",
"automationCollectPage": "Собрать совпадения на этой странице",
"automationCollectionTip": "Автоматический сбор добавляет подходящие блоки. Изменения источника или правил сохраняют существующие записи и поля; используйте проверку сбора для явной очистки",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index 5ffcf423f9..b4221dd66e 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Hĺbka poddokumentov",
+ "automationCollectionDepthUnlimited": "Bez obmedzenia",
+ "automationCollectionDepthCurrent": "Iba aktuálny dokument",
+ "automationCollectionDepthLimited": "Maximálna hĺbka",
+ "automationCollectionDepthTip": "Zahŕňa každý vybraný dokument; hĺbka obmedzuje iba rozsahy dokumentov. Rozsahy zápisníkov a dokumentov sa zjednocujú",
"mindmapPasteChild": "Prilepiť ako podradený uzol",
"mindmapPasteSibling": "Prilepiť ako uzol rovnakej úrovne",
"embedBlockBreadcrumbParentPath": "Zobraziť nadradenú cestu v navigačnej ceste",
@@ -114,7 +119,7 @@
"copyOCRText": "Kopírovať text OCR",
"exportTitleImage": "Exportovať titulný obrázok",
"automationCollectBlocks": "Blok spĺňa podmienky",
- "automationCollectionScope": "Rozsah sledovania (vrátane poddokumentov)",
+ "automationCollectionScope": "Rozsah sledovania",
"automationCollectionPreview": "Náhľad zodpovedajúcich blokov",
"automationCollectPage": "Zhromaždiť zhody na tejto stránke",
"automationCollectionTip": "Automatické zbieranie pridáva vyhovujúce bloky. Zmeny zdroja alebo pravidiel zachovajú existujúce položky a polia; na výslovné čistenie použite kontrolu zbierania",
diff --git a/app/appearance/langs/sr.json b/app/appearance/langs/sr.json
index 404f71e668..0c38de2dd7 100644
--- a/app/appearance/langs/sr.json
+++ b/app/appearance/langs/sr.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Дубина поддокумената",
+ "automationCollectionDepthUnlimited": "Неограничено",
+ "automationCollectionDepthCurrent": "Само тренутни документ",
+ "automationCollectionDepthLimited": "Највећа дубина",
+ "automationCollectionDepthTip": "Укључује сваки изабрани документ; дубина ограничава само опсеге докумената. Опсези бележница и докумената се обједињују",
"mindmapPasteChild": "Налепи као подређени чвор",
"mindmapPasteSibling": "Налепи као чвор истог нивоа",
"embedBlockBreadcrumbParentPath": "Прикажи надређену путању у навигационој путањи",
@@ -114,7 +119,7 @@
"copyOCRText": "Копирај OCR текст",
"exportTitleImage": "Извези насловну слику",
"automationCollectBlocks": "Блок испуњава услове",
- "automationCollectionScope": "Опсег праћења (укључује поддокументе)",
+ "automationCollectionScope": "Опсег праћења",
"automationCollectionPreview": "Преглед одговарајућих блокова",
"automationCollectPage": "Прикупи поклапања са ове странице",
"automationCollectionTip": "Аутоматско прикупљање додаје одговарајуће блокове. Промене извора или правила чувају постојеће ставке и поља; за изричито чишћење користите проверу прикупљања",
diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.json
index 3cbaca6995..2fb0340659 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "ความลึกของเอกสารย่อย",
+ "automationCollectionDepthUnlimited": "ไม่จำกัด",
+ "automationCollectionDepthCurrent": "เฉพาะเอกสารปัจจุบัน",
+ "automationCollectionDepthLimited": "ความลึกสูงสุด",
+ "automationCollectionDepthTip": "รวมตัวเอกสารแต่ละฉบับที่เลือกด้วย ความลึกจำกัดเฉพาะขอบเขตเอกสาร โดยรวมขอบเขตสมุดบันทึกและเอกสารเข้าด้วยกัน",
"mindmapPasteChild": "วางเป็นโหนดลูก",
"mindmapPasteSibling": "วางเป็นโหนดระดับเดียวกัน",
"embedBlockBreadcrumbParentPath": "แสดงเส้นทางหลักในเส้นทางนำทาง",
@@ -114,7 +119,7 @@
"copyOCRText": "คัดลอกข้อความ OCR",
"exportTitleImage": "ส่งออกรูปภาพส่วนหัว",
"automationCollectBlocks": "บล็อกตรงตามเงื่อนไข",
- "automationCollectionScope": "ขอบเขตการติดตาม (รวมเอกสารย่อย)",
+ "automationCollectionScope": "ขอบเขตการติดตาม",
"automationCollectionPreview": "ดูตัวอย่างบล็อกที่ตรงกัน",
"automationCollectPage": "รวบรวมบล็อกที่ตรงกันในหน้านี้",
"automationCollectionTip": "การรวบรวมอัตโนมัติเพิ่มบล็อกที่ตรงเงื่อนไข การเปลี่ยนต้นฉบับหรือกฎจะคงรายการและเขตข้อมูลเดิมไว้ ใช้การตรวจสอบผลการรวบรวมเพื่อล้างข้อมูลด้วยตนเอง",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index 21537e614a..2a43b92ee9 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Alt belge derinliği",
+ "automationCollectionDepthUnlimited": "Sınırsız",
+ "automationCollectionDepthCurrent": "Yalnızca mevcut belge",
+ "automationCollectionDepthLimited": "En fazla derinlik",
+ "automationCollectionDepthTip": "Seçilen her belgenin kendisini içerir; derinlik yalnızca belge kapsamlarını sınırlar. Not defteri ve belge kapsamları birleştirilir",
"mindmapPasteChild": "Alt düğüm olarak yapıştır",
"mindmapPasteSibling": "Aynı düzeyde düğüm olarak yapıştır",
"embedBlockBreadcrumbParentPath": "Gezinti yolunda üst yolu göster",
@@ -114,7 +119,7 @@
"copyOCRText": "OCR metnini kopyala",
"exportTitleImage": "Başlık görselini dışa aktar",
"automationCollectBlocks": "Blok koşulları karşılıyor",
- "automationCollectionScope": "İzleme kapsamı (alt belgeler dahil)",
+ "automationCollectionScope": "İzleme kapsamı",
"automationCollectionPreview": "Eşleşen blokları önizle",
"automationCollectPage": "Bu sayfadaki eşleşmeleri topla",
"automationCollectionTip": "Otomatik toplama eşleşen blokları ekler. Kaynak veya kural değişiklikleri mevcut kayıt ve alanları korur; açıkça temizlemek için toplama incelemesini kullanın",
diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.json
index 3c411a6912..bf8b0988f4 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "Глибина вкладених документів",
+ "automationCollectionDepthUnlimited": "Без обмежень",
+ "automationCollectionDepthCurrent": "Лише поточний документ",
+ "automationCollectionDepthLimited": "Максимальна глибина",
+ "automationCollectionDepthTip": "Включає кожен вибраний документ; глибина обмежує лише області документів. Області записників і документів об’єднуються",
"mindmapPasteChild": "Вставити як дочірній вузол",
"mindmapPasteSibling": "Вставити як вузол того самого рівня",
"embedBlockBreadcrumbParentPath": "Показувати батьківський шлях у навігаційному ланцюжку",
@@ -114,7 +119,7 @@
"copyOCRText": "Копіювати текст OCR",
"exportTitleImage": "Експортувати заголовне зображення",
"automationCollectBlocks": "Блок відповідає умовам",
- "automationCollectionScope": "Область відстеження (з дочірніми документами)",
+ "automationCollectionScope": "Область відстеження",
"automationCollectionPreview": "Перегляд відповідних блоків",
"automationCollectPage": "Зібрати збіги на цій сторінці",
"automationCollectionTip": "Автоматичне збирання додає відповідні блоки. Зміни джерела або правил зберігають наявні записи й поля; для явного очищення скористайтеся перевіркою збирання",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index ed3ee6c441..9aaae60b60 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "子文档深度",
+ "automationCollectionDepthUnlimited": "不限",
+ "automationCollectionDepthCurrent": "仅当前文档",
+ "automationCollectionDepthLimited": "最多层数",
+ "automationCollectionDepthTip": "包含每个选中文档本身,深度仅限制文档范围;笔记本与文档范围取并集",
"mindmapPasteChild": "粘贴为子节点",
"mindmapPasteSibling": "粘贴为同级节点",
"embedBlockBreadcrumbParentPath": "面包屑显示文档上层路径",
@@ -114,7 +119,7 @@
"copyOCRText": "复制 OCR 文本",
"exportTitleImage": "导出题头图",
"automationCollectBlocks": "普通块符合条件",
- "automationCollectionScope": "监听范围(包含子文档)",
+ "automationCollectionScope": "监听范围",
"automationCollectionPreview": "预览匹配块",
"automationCollectPage": "收集本页匹配块",
"automationCollectionTip": "自动收集只添加匹配内容,原文或规则变化均保留已有条目及字段;可通过检查收集结果主动清理",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index 924377df6a..d911f92162 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,9 @@
{
+ "automationCollectionDepth": "子文件深度",
+ "automationCollectionDepthUnlimited": "不限",
+ "automationCollectionDepthCurrent": "僅目前文件",
+ "automationCollectionDepthLimited": "最多層數",
+ "automationCollectionDepthTip": "包含每個所選文件本身,深度僅限制文件範圍;筆記本與文件範圍取聯集",
"mindmapPasteChild": "貼上為子節點",
"mindmapPasteSibling": "貼上為同層級節點",
"embedBlockBreadcrumbParentPath": "麵包屑顯示文件上層路徑",
@@ -114,7 +119,7 @@
"copyOCRText": "複製 OCR 文字",
"exportTitleImage": "匯出題頭圖",
"automationCollectBlocks": "一般區塊符合條件",
- "automationCollectionScope": "監聽範圍(包含子文件)",
+ "automationCollectionScope": "監聽範圍",
"automationCollectionPreview": "預覽符合的區塊",
"automationCollectPage": "收集本頁符合的區塊",
"automationCollectionTip": "自動收集只新增相符內容,原文或規則變更均保留既有項目與欄位;可透過檢查收集結果主動清理",
diff --git a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
index 76f0fef9ad..4bfac99159 100644
--- a/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
+++ b/app/guide/20210808180117-6v0mkxr/20200923234011-ieuun1p/20210808180303-xaduj2o/20240208172514-9dsv6na.sy
@@ -7,7 +7,7 @@
"id": "20240208172514-9dsv6na",
"title": "Database",
"type": "doc",
- "updated": "20261018144949"
+ "updated": "20261020211145"
},
"Children": [
{
@@ -4540,12 +4540,26 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261015141042-nrq3k5z",
- "updated": "20261018120429"
+ "updated": "20261020211145"
},
"Children": [
{
"Type": "NodeText",
- "Data": "Choose the Block matches conditions trigger, then use the add button under Watch scope (includes subdocuments) to select notebooks or documents. Click a document title to preview it in a floating window while keeping automation settings open; its icon also supports hover preview. Notebook and document scopes are combined. Block types, tags, and custom attributes use separate Chip groups; add conditions with each group's add button, and remove them with the Chip's close button. The block type picker supports search and repeated selections. Click a tag or attribute Chip to edit it; Enter confirms tags, while attribute changes remain drafts until confirmed, and Escape or Cancel discards them. Tags are trimmed and deduplicated. Block types use OR. Tags and custom attributes each default to Match all; choose Match any separately when needed. The three groups still use AND, and an empty group adds no restriction. Custom attributes support equality, contains, exists, and does not exist; the last two do not need a value. Match any requires automation format 3, while existing rules keep their Match all behavior."
+ "Data": "Choose the Block matches conditions trigger, then use the add button under Watch scope to select notebooks or documents. Click a document title to preview it in a floating window while keeping automation settings open; its icon also supports hover preview. Notebook and document scopes are combined. Block types, tags, and custom attributes use separate Chip groups; add conditions with each group's add button, and remove them with the Chip's close button. The block type picker supports search and repeated selections. Click a tag or attribute Chip to edit it; Enter confirms tags, while attribute changes remain drafts until confirmed, and Escape or Cancel discards them. Tags are trimmed and deduplicated. Block types use OR. Tags and custom attributes each default to Match all; choose Match any separately when needed. The three groups still use AND, and an empty group adds no restriction. Custom attributes support equality, contains, exists, and does not exist; the last two do not need a value. Match any requires automation format 3, while existing rules keep their Match all behavior."
+ }
+ ]
+ },
+ {
+ "ID": "20261020211145-1vqtmd6",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261020211145-1vqtmd6",
+ "updated": "20261020211145"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "When document scopes are selected, Subdocument depth appears below Watch scope. Unlimited is the default and includes all descendant documents. Current document only includes each selected document itself. With Limit depth, enter a positive integer: 1 includes the selected document and its direct children, 2 also includes grandchildren, and so on. This setting is shared by all document scopes in the rule and does not limit notebook scopes; overlapping scopes are combined. Changing depth preserves existing entries and fields and does not collect existing content automatically. Use collection management to preview and collect matches or review and remove unmatched entries. Limited depth requires automation format 5; older clients reject it without rewriting the database."
}
]
},
diff --git a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
index 763b061de4..1eb3a7423d 100644
--- a/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
+++ b/app/guide/20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180321-hbvl5c2/20240208113259-nykkvaq.sy
@@ -7,7 +7,7 @@
"id": "20240208113259-nykkvaq",
"title": "数据库",
"type": "doc",
- "updated": "20261018144949"
+ "updated": "20261020211145"
},
"Children": [
{
@@ -4540,12 +4540,26 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261015141042-ux38r6d",
- "updated": "20261018120429"
+ "updated": "20261020211145"
},
"Children": [
{
"Type": "NodeText",
- "Data": "选择「普通块符合条件」触发器,通过「监听范围(包含子文档)」下的添加按钮选择笔记本或文档,范围取并集。点击文档标题可在浮窗中预览,保留自动化设置;也可将鼠标悬停在图标上预览。块类型、标签和自定义属性分别使用 Chip 分组,通过各组的添加按钮配置,点击 Chip 的关闭图标移除。块类型列表支持搜索和连续多选;点击标签或属性 Chip 可编辑,标签按回车确认,属性先作为草稿编辑,确认后才保存,按 Esc 或取消不影响现有条件。标签会去除首尾空格并自动去重。块类型取任一匹配;标签和属性分别默认为「全部满足」,可独立改为「任一满足」。三个分组之间仍须全部满足,空分组不限制。属性支持等于、包含、存在和不存在,后两者不需要属性值。「任一满足」需要自动化格式 3,已有规则保留全部满足的行为。"
+ "Data": "选择「普通块符合条件」触发器,通过「监听范围」下的添加按钮选择笔记本或文档,范围取并集。点击文档标题可在浮窗中预览,保留自动化设置;也可将鼠标悬停在图标上预览。块类型、标签和自定义属性分别使用 Chip 分组,通过各组的添加按钮配置,点击 Chip 的关闭图标移除。块类型列表支持搜索和连续多选;点击标签或属性 Chip 可编辑,标签按回车确认,属性先作为草稿编辑,确认后才保存,按 Esc 或取消不影响现有条件。标签会去除首尾空格并自动去重。块类型取任一匹配;标签和属性分别默认为「全部满足」,可独立改为「任一满足」。三个分组之间仍须全部满足,空分组不限制。属性支持等于、包含、存在和不存在,后两者不需要属性值。「任一满足」需要自动化格式 3,已有规则保留全部满足的行为。"
+ }
+ ]
+ },
+ {
+ "ID": "20261020211145-i92h6in",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261020211145-i92h6in",
+ "updated": "20261020211145"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "选择文档范围后,「监听范围」下方显示「子文档深度」。默认「不限」,包含全部后代文档;「仅当前文档」只包含每个选中文档本身;选择「最多层数」后输入正整数,1 表示选中文档及一级子文档,2 再包含二级子文档,以此类推。同一规则的所有文档范围共用此设置,笔记本范围不受限制,重叠范围仍取并集。修改深度保留已有条目和字段,不自动补收存量内容;可通过收集管理预览并收集匹配内容,或检查并移出不匹配条目。有限深度需要自动化格式 5,旧客户端会拒绝读取且不改写数据库。"
}
]
},
diff --git a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
index b1f5bbb63c..939a73cfe2 100644
--- a/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
+++ b/app/guide/20211226090932-5lcq56f/20211226115423-d5z1joq/20211226121203-rjjngpz/20240208171522-y7dxcno.sy
@@ -7,7 +7,7 @@
"id": "20240208171522-y7dxcno",
"title": "資料庫",
"type": "doc",
- "updated": "20261018144949"
+ "updated": "20261020211145"
},
"Children": [
{
@@ -4540,12 +4540,26 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261015141042-155k3zl",
- "updated": "20261018120429"
+ "updated": "20261020211145"
},
"Children": [
{
"Type": "NodeText",
- "Data": "選擇「普通區塊符合條件」觸發器,透過「監聽範圍(包含子文件)」下的新增按鈕選擇筆記本或文件,範圍取聯集。點擊文件標題可在浮動視窗中預覽,保留自動化設定;也可將滑鼠移到圖示上預覽。區塊類型、標籤和自訂屬性分別使用 Chip 分組,透過各組的新增按鈕設定,點擊 Chip 的關閉圖示移除。區塊類型列表支援搜尋和連續多選;點擊標籤或屬性 Chip 可編輯,標籤按 Enter 確認,屬性先作為草稿編輯,確認後才儲存,按 Esc 或取消不影響既有條件。標籤會去除首尾空白並自動去重。區塊類型取任一匹配;標籤和屬性分別預設為「全部滿足」,可獨立改為「任一滿足」。三個分組之間仍須全部滿足,空分組不限制。屬性支援等於、包含、存在和不存在,後兩者不需要屬性值。「任一滿足」需要自動化格式 3,既有規則保留全部滿足的行為。"
+ "Data": "選擇「普通區塊符合條件」觸發器,透過「監聽範圍」下的新增按鈕選擇筆記本或文件,範圍取聯集。點擊文件標題可在浮動視窗中預覽,保留自動化設定;也可將滑鼠移到圖示上預覽。區塊類型、標籤和自訂屬性分別使用 Chip 分組,透過各組的新增按鈕設定,點擊 Chip 的關閉圖示移除。區塊類型列表支援搜尋和連續多選;點擊標籤或屬性 Chip 可編輯,標籤按 Enter 確認,屬性先作為草稿編輯,確認後才儲存,按 Esc 或取消不影響既有條件。標籤會去除首尾空白並自動去重。區塊類型取任一匹配;標籤和屬性分別預設為「全部滿足」,可獨立改為「任一滿足」。三個分組之間仍須全部滿足,空分組不限制。屬性支援等於、包含、存在和不存在,後兩者不需要屬性值。「任一滿足」需要自動化格式 3,既有規則保留全部滿足的行為。"
+ }
+ ]
+ },
+ {
+ "ID": "20261020211145-9wvol2h",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261020211145-9wvol2h",
+ "updated": "20261020211145"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "選擇文件範圍後,「監聽範圍」下方顯示「子文件深度」。預設「不限」,包含全部後代文件;「僅目前文件」只包含每個所選文件本身;選擇「最多層數」後輸入正整數,1 表示所選文件及一級子文件,2 再包含二級子文件,依此類推。同一規則的所有文件範圍共用此設定,筆記本範圍不受限制,重疊範圍仍取聯集。修改深度保留既有項目和欄位,不自動補收既有內容;可透過收集管理預覽並收集符合條件的內容,或檢查並移出不符合條件的項目。有限深度需要自動化格式 5,舊用戶端會拒絕讀取且不改寫資料庫。"
}
]
},
diff --git a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
index a1db95f32d..31b0bc1ca6 100644
--- a/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
+++ b/app/guide/20240530133126-axarxgx/20240530101000-4qitucx/20240530101000-g3ugxml/20240530101000-3eaevtp.sy
@@ -8,7 +8,7 @@
"id": "20240530101000-3eaevtp",
"title": "データベース",
"type": "doc",
- "updated": "20261018144949"
+ "updated": "20261020211145"
},
"Children": [
{
@@ -4550,12 +4550,26 @@
"Type": "NodeParagraph",
"Properties": {
"id": "20261015141042-qt2jps9",
- "updated": "20261018120429"
+ "updated": "20261020211145"
},
"Children": [
{
"Type": "NodeText",
- "Data": "「通常ブロックが条件に一致」トリガーを選び、「監視範囲(子文書を含む)」の下にある追加ボタンでノートブックや文書を指定します。文書名を押すと、自動化設定を開いたままフローティングウィンドウでプレビューできます。アイコンへのマウスオーバーでもプレビューできます。範囲は和集合です。ブロック種類・タグ・カスタム属性はそれぞれ Chip で管理し、各組の追加ボタンで条件を加え、閉じるボタンで削除します。種類の一覧は検索と連続した複数選択に対応します。タグや属性の Chip を押すと編集でき、タグは Enter で確定します。属性は確定するまで下書きとして保持し、Esc またはキャンセルで既存条件を変えずに取り消せます。タグの前後の空白と重複は除去します。種類は OR、タグと属性はそれぞれ既定で「すべてに一致」で、「いずれかに一致」に個別に変更できます。三つの組の間は AND のままで、空の組は制限しません。属性は等しい・含む・存在する・存在しないを使え、後二者は値が不要です。「いずれかに一致」には自動化形式 3 が必要で、既存ルールの AND 動作は維持します。"
+ "Data": "「通常ブロックが条件に一致」トリガーを選び、「監視範囲」の下にある追加ボタンでノートブックや文書を指定します。文書名を押すと、自動化設定を開いたままフローティングウィンドウでプレビューできます。アイコンへのマウスオーバーでもプレビューできます。範囲は和集合です。ブロック種類・タグ・カスタム属性はそれぞれ Chip で管理し、各組の追加ボタンで条件を加え、閉じるボタンで削除します。種類の一覧は検索と連続した複数選択に対応します。タグや属性の Chip を押すと編集でき、タグは Enter で確定します。属性は確定するまで下書きとして保持し、Esc またはキャンセルで既存条件を変えずに取り消せます。タグの前後の空白と重複は除去します。種類は OR、タグと属性はそれぞれ既定で「すべてに一致」で、「いずれかに一致」に個別に変更できます。三つの組の間は AND のままで、空の組は制限しません。属性は等しい・含む・存在する・存在しないを使え、後二者は値が不要です。「いずれかに一致」には自動化形式 3 が必要で、既存ルールの AND 動作は維持します。"
+ }
+ ]
+ },
+ {
+ "ID": "20261020211145-mwlwm6k",
+ "Type": "NodeParagraph",
+ "Properties": {
+ "id": "20261020211145-mwlwm6k",
+ "updated": "20261020211145"
+ },
+ "Children": [
+ {
+ "Type": "NodeText",
+ "Data": "文書の範囲を選ぶと、「監視範囲」の下に「子文書の深さ」が表示されます。既定の「無制限」はすべての子孫文書を含み、「現在の文書のみ」は選択した各文書自体だけを含みます。「最大階層数」では正の整数を入力します。1 は選択した文書と直接の子文書、2 はさらに孫文書までを含みます。同じルールの文書範囲すべてに共通し、ノートブックの範囲は制限しません。重なる範囲は和集合です。深さを変更しても既存の項目とフィールドを保持し、既存の内容を自動で追加収集しません。収集管理で一致する内容をプレビューして収集するか、不一致の項目を確認して除去できます。深さの制限には自動化形式 5 が必要で、古いクライアントはデータベースを書き換えずに読み取りを拒否します。"
}
]
},
diff --git a/app/src/protyle/render/av/automation.test.ts b/app/src/protyle/render/av/automation.test.ts
index f7823057bf..6a88148771 100644
--- a/app/src/protyle/render/av/automation.test.ts
+++ b/app/src/protyle/render/av/automation.test.ts
@@ -5,12 +5,61 @@ import {readFileSync} from "node:fs";
import {test} from "node:test";
import {runInNewContext} from "node:vm";
import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
-import type {AVAttributeViewData} from "../../../types/api";
+import type {AVAttributeViewData, AVAutomationBlockSourceInput} from "../../../types/api";
const compiled = transpileModule(readFileSync("src/protyle/render/av/automation.ts", "utf8"), {
compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
}).outputText;
+test("document depth autosave upgrades format including zero and preserves undo snapshots", async () => {
+ const transactions: Array<{perform: IOperation[], undo: IOperation[]}> = [];
+ let source: AVAutomationBlockSourceInput;
+ let save: () => void;
+ const child = {innerHTML: "", textContent: "", checked: true, classList: {toggle() {}},
+ querySelectorAll: (): HTMLElement[] => [], addEventListener() {}};
+ const body = {...child, isConnected: true, querySelector: () => child};
+ const panel = {isConnected: true, addEventListener() {}, querySelector: () => body};
+ const menu = {innerHTML: "", classList: {add() {}, remove() {}}, addEventListener() {}, querySelector: () => panel};
+ const database: Pick<AVAttributeViewData, "id" | "keyValues" | "automations"> = {id: "database", keyValues: [], automations: {spec: 1, rules: [{
+ id: "rule", name: "Collect", enabled: true, trigger: "block", blockSource: {documentIDs: ["doc"]},
+ actions: [{type: "collect", target: "current", fields: {}}],
+ }]}};
+ const methods = {} as typeof import("./automation");
+ runInNewContext(compiled, {
+ exports: methods, window: {siyuan: {config: {}, languages: {}}},
+ require: (name: string) => name === "./capabilities" ? capabilities : (({
+ "./blockCollection": {collectionSourceIncomplete: () => false,
+ mountBlockCollectionSource: (_host: HTMLElement, value: AVAutomationBlockSourceInput, _protyle: IProtyle, persist: () => void) => {
+ source = value; save = persist;
+ }},
+ "../../../util/escape": {escapeAttr: String, escapeHtml: String},
+ "../../../util/fetch": {fetchSyncPost: async () => ({code: 0, data: {av: database}})},
+ "../../wysiwyg/transaction": {transaction: (_protyle: IProtyle, perform: IOperation[], undo: IOperation[]) => transactions.push({perform, undo})},
+ })[name] || {}),
+ });
+ await methods.openAutomationMenu({protyle: {options: {}} as IProtyle,
+ blockElement: {dataset: {nodeId: "carrier"}} as unknown as HTMLElement,
+ avID: "database", menuElement: menu as unknown as HTMLElement, onResize() {}});
+ assert.equal(transactions.length, 0);
+ source.documentDepth = 0;
+ save();
+ const first = JSON.parse(JSON.stringify(transactions[0]));
+ assert.equal(first.perform[0].data.spec, 5);
+ assert.equal(first.perform[0].data.rules[0].blockSource.documentDepth, 0);
+ assert.equal(first.undo[0].data.spec, 1);
+ assert.equal(first.undo[0].data.rules[0].blockSource.documentDepth, undefined);
+ source.documentDepth = 2;
+ save();
+ assert.deepEqual(JSON.parse(JSON.stringify(transactions[1].undo)), first.perform);
+ delete source.documentDepth;
+ save();
+ const last = JSON.parse(JSON.stringify(transactions[2].perform[0].data));
+ assert.equal(last.spec, 5);
+ assert.equal(last.rules[0].blockSource.documentDepth, undefined);
+ assert.equal(last.rules[0].enabled, true);
+ assert.equal(database.automations.spec, 1);
+});
+
test("automation settings reject readonly, publishing and historical editors before fetching data", async () => {
for (const mode of ["disabled", "readonly", "publish", "created", "snapshot"]) {
const methods = {} as typeof import("./automation");
diff --git a/app/src/protyle/render/av/automation.ts b/app/src/protyle/render/av/automation.ts
index c13104aef9..4c83ac3cbd 100644
--- a/app/src/protyle/render/av/automation.ts
+++ b/app/src/protyle/render/av/automation.ts
@@ -210,7 +210,8 @@ export const openAutomationMenu = async (options: {
const usesSourceOptions = rules.some(rule => rule.blockSource?.types?.some(type => type.includes(":")) ||
rule.blockSource?.tagMatch === "or" || rule.blockSource?.attributeMatch === "or");
const usesTagTarget = rules.some(rule => !!rule.blockSource?.tagTarget);
- const next = {spec: Math.max(previous.spec, usesTagTarget ? 4 : usesSourceOptions ? 3 : usesTemplates ? 2 : 1), rules: clone(rules)};
+ const usesDocumentDepth = rules.some(rule => rule.blockSource?.documentDepth != null);
+ const next = {spec: Math.max(previous.spec, usesDocumentDepth ? 5 : usesTagTarget ? 4 : usesSourceOptions ? 3 : usesTemplates ? 2 : 1), rules: clone(rules)};
if (JSON.stringify(next) === JSON.stringify(previous)) {
return;
}
diff --git a/app/src/protyle/render/av/blockCollection.test.ts b/app/src/protyle/render/av/blockCollection.test.ts
index 8f45dc327d..f33dbc3c27 100644
--- a/app/src/protyle/render/av/blockCollection.test.ts
+++ b/app/src/protyle/render/av/blockCollection.test.ts
@@ -3,6 +3,12 @@ import {readFileSync} from "node:fs";
import {test} from "node:test";
import {runInNewContext} from "node:vm";
import {ModuleKind, ScriptTarget, transpileModule} from "typescript";
+import {execFile} from "node:child_process";
+import {mkdtempSync, rmSync, writeFileSync} from "node:fs";
+import {tmpdir} from "node:os";
+import * as path from "node:path";
+import {promisify} from "node:util";
+import type {AVAutomationBlockSourceInput} from "../../../types/api";
const compiled = transpileModule(readFileSync("src/protyle/render/av/blockCollection.ts", "utf8"), {
compilerOptions: {module: ModuleKind.CommonJS, target: ScriptTarget.ES2022},
@@ -15,6 +21,132 @@ test("collection scope requires a notebook or document and complete attribute na
assert.equal(methods.collectionSourceIncomplete({documentIDs: ["doc"]}), false);
assert.equal(methods.collectionSourceIncomplete({notebookIDs: ["notebook"], attributes: [{name: "custom-", operator: "exists"}]}), true);
assert.equal(methods.collectionSourceIncomplete({documentIDs: ["doc"], attributes: [{name: "custom-state", operator: "equals", value: "open"}]}), false);
+ for (const documentDepth of [undefined, null, 0, 1, 12]) {
+ assert.equal(methods.collectionSourceIncomplete({documentIDs: ["doc"], documentDepth}), false);
+ }
+ for (const documentDepth of [-1, 1.5, NaN, Infinity]) {
+ assert.equal(methods.collectionSourceIncomplete({documentIDs: ["doc"], documentDepth}), true);
+ }
+});
+
+const browserCases = async (sourceCode: string, languages: Record<string, string>) => {
+ const check: typeof assert = require("node:assert/strict");
+ const api = {} as typeof import("./blockCollection");
+ const menu = document.createElement("div");
+ document.body.append(menu);
+ let addScope: (paths: string[], boxes: string[]) => void;
+ Object.assign(window, {siyuan: {languages, notebooks: [{id: "box", name: "Notebook"}]}});
+ new Function("exports", "require", sourceCode)(api, (name: string) => ({
+ "../../../util/escape": {escapeAttr: String, escapeHtml: String},
+ "../../../util/fetch": {fetchSyncPost: async () => ({code: 0, data: "/Selected document"})},
+ "./collectionConditions": {mountCollectionConditions() {}},
+ "../../../util/pathName": {movePathTo: (options: {cb: typeof addScope}) => { addScope = options.cb; }},
+ "../../../menus/menuToggle": {toggleMenu: (options: {build: () => void, show: () => void}) => { options.build(); options.show(); }},
+ "../../../plugin/Menu": {Menu: class {
+ constructor() { menu.replaceChildren(); }
+ addItem(item: {label: string, checked: boolean, click: () => void}) {
+ const button = document.createElement("button");
+ button.textContent = item.label;
+ button.setAttribute("aria-checked", String(item.checked));
+ button.addEventListener("click", item.click);
+ menu.append(button);
+ }
+ open() {}
+ }},
+ })[name] || {});
+ const tick = () => new Promise(resolve => setTimeout(resolve, 0));
+ for (const width of [1000, 320]) {
+ const host = document.createElement("div");
+ host.style.width = `${width}px`;
+ document.body.append(host);
+ const source: AVAutomationBlockSourceInput = {notebookIDs: ["box"]};
+ const saves: AVAutomationBlockSourceInput[] = [];
+ const save = () => {
+ check.ok(Array.from(host.querySelectorAll("input")).every(input => input.checkValidity()));
+ saves.push(JSON.parse(JSON.stringify(source)));
+ };
+ api.mountBlockCollectionSource(host, source, {notebookId: "box"} as IProtyle, save, () => {});
+ await tick();
+ check.equal(host.querySelector("[data-depth-mode]"), null);
+ host.querySelector<HTMLButtonElement>("[data-scope]").click();
+ addScope(["/doc.sy"], ["box"]);
+ await tick();
+ const choose = async (label: string) => {
+ host.querySelector<HTMLButtonElement>("[data-depth-mode]").click();
+ const button = Array.from(menu.querySelectorAll("button")).find(item => item.textContent === label);
+ check.ok(button);
+ button.click();
+ await tick();
+ };
+ check.match(host.querySelector("[data-depth-mode]").textContent, /Unlimited/);
+ check.equal(source.documentDepth, undefined);
+ await choose(languages.automationCollectionDepthCurrent);
+ check.equal(source.documentDepth, 0);
+ check.equal(host.querySelector("[data-document-depth]"), null);
+ await choose(languages.automationCollectionDepthLimited);
+ check.equal(source.documentDepth, 1);
+ const input = host.querySelector<HTMLInputElement>("[data-document-depth]");
+ check.equal(input.value, "1");
+ const before = saves.length;
+ for (const value of ["", "-1", "0", "1.5"]) {
+ input.value = value;
+ input.dispatchEvent(new Event("change", {bubbles: true}));
+ check.equal(source.documentDepth, 1);
+ check.equal(saves.length, before);
+ }
+ input.value = "12";
+ input.dispatchEvent(new KeyboardEvent("keydown", {key: "Enter", bubbles: true}));
+ check.equal(source.documentDepth, 12);
+ check.equal(saves.length, before + 1);
+ input.value = "";
+ input.dispatchEvent(new Event("change", {bubbles: true}));
+ await choose(languages.automationCollectionDepthUnlimited);
+ check.equal(source.documentDepth, undefined);
+ check.equal(host.querySelector("[data-document-depth]"), null);
+ await choose(languages.automationCollectionDepthCurrent);
+ host.querySelector<SVGElement>('[data-remove="document"]').dispatchEvent(new MouseEvent("click", {bubbles: true}));
+ await tick();
+ check.equal(host.querySelector("[data-depth-mode]"), null);
+ host.querySelector<HTMLButtonElement>("[data-scope]").click();
+ addScope(["/doc.sy"], ["box"]);
+ await tick();
+ check.match(host.querySelector("[data-depth-mode]").textContent, /Current document only/);
+ check.equal(source.documentDepth, 0);
+ check.deepEqual(source.notebookIDs, ["box"]);
+ host.remove();
+ }
+ menu.remove();
+ return "Collection depth DOM cases passed";
+};
+
+test("collection depth controls preserve zero, validate edits and support narrow layouts", {
+ skip: process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY,
+ timeout: 45000,
+}, async () => {
+ const temporary = mkdtempSync(path.join(tmpdir(), "siyuan-collection-depth-"));
+ const script = path.join(temporary, "run.cjs");
+ const languages = JSON.parse(readFileSync("appearance/langs/en.json", "utf8"));
+ writeFileSync(script, `const {app, BrowserWindow} = require("electron");
+app.setPath("userData", ${JSON.stringify(path.join(temporary, "profile"))});
+app.commandLine.appendSwitch("disable-gpu");
+app.whenReady().then(async () => {
+ const win = new BrowserWindow({show: false, webPreferences: {nodeIntegration: true, contextIsolation: false}});
+ try {
+ await win.loadURL("about:blank");
+ console.log(await win.webContents.executeJavaScript(${JSON.stringify(`const __name = value => value; (${browserCases.toString()})(${JSON.stringify(compiled)}, ${JSON.stringify(languages)})`)}));
+ win.destroy(); app.exit(0);
+ } catch (error) { console.error(error); win.destroy(); app.exit(1); }
+});`, "utf8");
+ const env = {...process.env};
+ delete env.ELECTRON_RUN_AS_NODE;
+ try {
+ const {stdout} = await promisify(execFile)(require("electron") as unknown as string, [script], {env, timeout: 40000, windowsHide: true});
+ assert.match(stdout, /Collection depth DOM cases passed/);
+ } finally {
+ assert.equal(path.dirname(path.resolve(temporary)), path.resolve(tmpdir()));
+ assert.ok(path.basename(temporary).startsWith("siyuan-collection-depth-"));
+ rmSync(temporary, {recursive: true, force: true});
+ }
});
test("collection type selection replaces overlapping parents and preserves independent types", () => {
diff --git a/app/src/protyle/render/av/blockCollection.ts b/app/src/protyle/render/av/blockCollection.ts
index 56d44a8808..dbb95e0cf3 100644
--- a/app/src/protyle/render/av/blockCollection.ts
+++ b/app/src/protyle/render/av/blockCollection.ts
@@ -4,9 +4,12 @@ import {escapeAttr, escapeHtml} from "../../../util/escape";
import {movePathTo} from "../../../util/pathName";
import {mountCollectionConditions} from "./collectionConditions";
import {BlockPanel} from "../../../block/Panel";
+import {Menu} from "../../../plugin/Menu";
+import {toggleMenu} from "../../../menus/menuToggle";
export const collectionSourceIncomplete = (source: AVAutomationBlockSourceInput) => !source ||
!(source.notebookIDs?.length || source.documentIDs?.length) ||
+ (source.documentDepth != null && (!Number.isSafeInteger(source.documentDepth) || source.documentDepth < 0)) ||
(source.attributes || []).some(attr => !attr || !/^custom-[\w-]+$/.test(attr.name));
export const mountBlockCollectionSource = (host: HTMLElement, source: AVAutomationBlockSourceInput,
@@ -16,6 +19,9 @@ export const mountBlockCollectionSource = (host: HTMLElement, source: AVAutomati
mountCollectionConditions(conditions, source, save, onResize);
const names = new Map<string, string>();
let revision = 0;
+ const depthMode = () => source.documentDepth == null ? "unlimited" : source.documentDepth === 0 ? "current" : "limited";
+ const depthLabels = {unlimited: lang.automationCollectionDepthUnlimited, current: lang.automationCollectionDepthCurrent,
+ limited: lang.automationCollectionDepthLimited};
const removeButton = (kind: string, index: number) => `<svg class="b3-menu__action b3-menu__action--show b3-menu__action--warning fn__pointer ariaLabel" data-remove="${kind}" data-index="${index}" role="button" tabindex="0" data-position="north" aria-label="${escapeAttr(lang.delete)}"><use xlink:href="#iconClose"></use></svg>`;
const render = async () => {
const version = ++revision;
@@ -33,6 +39,7 @@ export const mountBlockCollectionSource = (host: HTMLElement, source: AVAutomati
<div class="av__automation-control" data-scope-control><span class="av__automation-control-label">${lang.automationCollectionScope}</span>
${notebooks.length || documents.length ? `<div class="av__automation-source-list">${notebooks.map((id, i) => `<div class="av__automation-row av__automation-source-row"><svg class="block__logoicon ft__on-surface"><use xlink:href="#iconNotebook"></use></svg><span class="fn__flex-1 ft__breakword av__automation-notebook-name">${escapeHtml(window.siyuan.notebooks.find(box => box.id === id)?.name || id)}</span>${removeButton("notebook", i)}</div>`).join("")}${documents.map((id, i) => `<div class="av__automation-row av__automation-source-row"><span class="b3-list-item__icon fn__pointer popover__block" data-id="${escapeAttr(id)}"><svg><use xlink:href="#iconFile"></use></svg></span><button type="button" class="b3-button b3-button--cancel b3-button--wrap fn__flex-1 av__automation-source-action av__automation-document-name" data-preview-document="${escapeAttr(id)}">${escapeHtml(names.get(id) || id)}</button>${removeButton("document", i)}</div>`).join("")}</div>` : ""}
<button type="button" class="b3-button b3-button--cancel b3-button--wrap av__automation-source-action" data-scope><svg><use xlink:href="#iconAdd"></use></svg><span>${escapeHtml(`${lang.addAttr} - ${lang.automationCollectionScope}`)}</span></button></div>
+${documents.length ? `<div class="av__automation-control"><div class="av__automation-row"><span class="av__automation-control-label fn__flex-1">${lang.automationCollectionDepth}</span><button type="button" class="b3-button b3-button--cancel b3-button--wrap av__automation-source-action" data-depth-mode aria-label="${escapeAttr(lang.automationCollectionDepth)}"><span>${depthLabels[depthMode()]}</span><svg><use xlink:href="#iconDown"></use></svg></button></div>${depthMode() === "limited" ? `<input type="number" class="b3-text-field fn__block" min="1" step="1" required data-document-depth value="${source.documentDepth}" aria-label="${escapeAttr(lang.automationCollectionDepth)}">` : ""}<div class="ft__on-surface ft__smaller av__automation-tip">${lang.automationCollectionDepthTip}</div></div>` : ""}
</div>`;
host.firstElementChild.append(conditions);
onResize();
@@ -48,6 +55,25 @@ ${notebooks.length || documents.length ? `<div class="av__automation-source-list
}
const target = (event.target as Element).closest<HTMLElement>("button, [data-remove]");
if (!target) { return; }
+ if (target.hasAttribute("data-depth-mode")) {
+ let menu: Menu;
+ toggleMenu({target, build: () => {
+ menu = new Menu();
+ Object.entries(depthLabels).forEach(([mode, label]) => menu.addItem({iconHTML: "", label,
+ checked: mode === depthMode(), click: () => {
+ if (mode === depthMode()) { return; }
+ if (mode === "unlimited") { delete source.documentDepth; }
+ else { source.documentDepth = mode === "current" ? 0 : 1; }
+ host.querySelector("[data-document-depth]")?.remove();
+ save();
+ void render();
+ }}));
+ }, show: () => {
+ const rect = target.getBoundingClientRect();
+ menu.open({x: rect.left, y: rect.bottom, h: rect.height, target});
+ }});
+ return;
+ }
if (target.hasAttribute("data-scope")) {
movePathTo({title: lang.automationCollectionScope, flashcard: false, sourceNotebookIds: [protyle.notebookId],
cb: (paths, boxes) => {
@@ -72,7 +98,23 @@ ${notebooks.length || documents.length ? `<div class="av__automation-source-list
save();
void render();
});
+ host.addEventListener("change", event => {
+ const input = event.target as HTMLInputElement;
+ if (!input.matches("[data-document-depth]")) { return; }
+ const value = Number(input.value);
+ input.setCustomValidity(input.value.trim() && Number.isSafeInteger(value) && value >= 1 ? "" : lang.invalid);
+ if (!input.reportValidity()) { return; }
+ if (source.documentDepth !== value) {
+ source.documentDepth = value;
+ save();
+ }
+ });
host.addEventListener("keydown", event => {
+ if (event.key === "Enter" && (event.target as HTMLElement).matches("[data-document-depth]")) {
+ event.preventDefault();
+ (event.target as HTMLElement).dispatchEvent(new Event("change", {bubbles: true}));
+ return;
+ }
const target = (event.target as Element).closest<SVGElement>("[data-remove]");
if (target && (event.key === "Enter" || event.key === " ")) {
event.preventDefault();
diff --git a/app/src/types/api/index.d.ts b/app/src/types/api/index.d.ts
index 1ff757570b..97990f0faa 100644
--- a/app/src/types/api/index.d.ts
+++ b/app/src/types/api/index.d.ts
@@ -260,9 +260,9 @@ export type AVAutomationBlockAttribute = { "name": string; "operator": "equals"
export type AVAutomationBlockAttributeInput = { "name": string; "operator": "equals" | "contains" | "exists" | "notExists"; "value"?: string; };
-export type AVAutomationBlockSource = { "attributeMatch"?: "" | "and" | "or"; "attributes"?: Array<AVAutomationBlockAttribute | null>; "documentIDs"?: Array<string>; "notebookIDs"?: Array<string>; "tagMatch"?: "" | "and" | "or"; "tagTarget"?: "" | "block" | "container"; "tags"?: Array<string>; "types"?: Array<string>; };
+export type AVAutomationBlockSource = { "attributeMatch"?: "" | "and" | "or"; "attributes"?: Array<AVAutomationBlockAttribute | null>; "documentDepth"?: number; "documentIDs"?: Array<string>; "notebookIDs"?: Array<string>; "tagMatch"?: "" | "and" | "or"; "tagTarget"?: "" | "block" | "container"; "tags"?: Array<string>; "types"?: Array<string>; };
-export type AVAutomationBlockSourceInput = { "attributeMatch"?: "" | "and" | "or"; "attributes"?: Array<AVAutomationBlockAttributeInput | null>; "documentIDs"?: Array<string>; "notebookIDs"?: Array<string>; "tagMatch"?: "" | "and" | "or"; "tagTarget"?: "" | "block" | "container"; "tags"?: Array<string>; "types"?: Array<string>; };
+export type AVAutomationBlockSourceInput = { "attributeMatch"?: "" | "and" | "or"; "attributes"?: Array<AVAutomationBlockAttributeInput | null>; "documentDepth"?: number | null; "documentIDs"?: Array<string>; "notebookIDs"?: Array<string>; "tagMatch"?: "" | "and" | "or"; "tagTarget"?: "" | "block" | "container"; "tags"?: Array<string>; "types"?: Array<string>; };
export type AVAutomationConfig = { "rules": Array<AVAutomationRule | null> | null; "spec": number; };
@@ -8032,10 +8032,12 @@ export interface APIPOSTRoutes {
/**
* move 操作支持 nextID,将块移到该同级锚点之前,优先于 previousID 和 parentID。
* 移动保留折叠标题下辖块顺序及源块身份,不将整列表自动拆成列表项;moveBlock 接口不接受 nextID。
- * 数据库自动化通过 setAttrViewAutomations 操作整体保存,配置 spec 为 1 至 4,所有视图共享数据库级规则。
+ * 数据库自动化通过 setAttrViewAutomations 操作整体保存,配置 spec 为 1 至 5,所有视图共享数据库级规则。
* blockSource.types 主类型包含全部子类型;spec 3 可指定 h:h1 至 h:h6、l:u/o/t、i:u/o/t、callout:类型名。
* blockSource 的 tagMatch、attributeMatch 缺省为 and;spec 3 支持各组独立设置 or,空组不限制,组间仍为 and。
* spec 4 的 blockSource.tagTarget 支持 block(标签所在块)和 container(最近合格容器),缺省保持原行为。
+ * spec 5 的 blockSource.documentDepth 限制各文档范围的子文档深度,0 仅自身,1 包含自身及一级子文档。
+ * 深度缺省或 null 不限,不影响笔记本范围,各范围仍取并集;修改不自动清理或补收已有内容。
* 容器按类型及属性条件选择并去重;全部标签须在同一个来源块中,文档容器须显式选择 d。
* 类型和属性始终筛选最终对象;默认首个内容块优先归属合格列表项,每次标签命中只选择一个对象。
* 无标签时收集对象不影响筛选;变更收集对象不转换已有条目,预览与实际收集使用相同规则。
diff --git a/docs/API.ja.md b/docs/API.ja.md
index 92350c1ea1..01e8cc94a0 100644
--- a/docs/API.ja.md
+++ b/docs/API.ja.md
@@ -2213,7 +2213,7 @@ if (response.code === 0 && response.data) {
* `data.av`: 完全な `AttributeView` 定義——フィールド(`keyValues`)、フィールド順序(`keyIDs`、`null` の場合あり)、および全ビューの生のレイアウト設定(`table`/`gallery`/`kanban`)とアイテム順序(`itemIds`)。互換性フィールド `viewID` は最初に利用可能なビューから算出され、永続化されません。レンダリング後の行やページングは含まれないため、計算後の行データが必要な場合は [レンダリング](#レンダリング) を使用してください
- * `data.av.automations` は省略可能で、データベース全体のルール(`spec: 1`~`4`)を保持します。`block` トリガーの `blockSource` はノートブック/文書の範囲、ブロックの種類、タグ、カスタム属性を指定し、`collect` アクションは一致する元のブロックを現在のデータベースにバインドします。主種類はすべてのサブタイプを含みます。形式 3 は `h:h1`~`h:h6`、`l:u/o/t`、`i:u/o/t`、`callout:TYPE`(大文字小文字を区別し、独自種類も指定可能)をサポートします。種類の未選択は制限なし、複数選択は OR です。自動作成された主キー値には、カーネルが管理する `block.collectionRuleID` が含まれる場合があります。自動収集は追加だけを行います。原文やルールの条件・範囲・対象・有効状態が変わっても既存の項目とフィールドを保持し、再び一致しても同じ項目を使います。明示的な整理ではすべての有効な収集ルールを使い、手動・自動でバインドした項目を同じ基準で確認します。一致する項目や判定できない項目は保持し、実行前の再確認で不一致が確定した項目だけを除去します。元に戻す操作で元の項目と全フィールドを復元します。 `blockSource.tagMatch` と `attributeMatch` は既定で `and`、形式 3 では各組を個別に `or` にできます。組の間は AND のままで、空の組は制限しません。 各ルールの省略可能な `notifyOnSuccess` は既定(`null` を含む)で `true` です。実際の変更をトランザクション確定後に一つの通知にまとめます。無効にしてもエラーは通知します。変更なし・明示的な収集・元に戻す・やり直し・ロールバックでは成功通知を送信しません。 形式 4 では省略可能な `blockSource.tagTarget` を追加しています。省略・空文字列は既定の選択で、最初の内容ブロックより条件に合うリスト項目を優先、`block` はタグを含むブロック、`container` は種類と属性の条件に一致する最も近いコンテナを収集し、ブロック ID で重複を除きます。文書には明示的な `d` の選択が必要です。AND のタグは同じ元ブロックに必要で、タグ条件がなければこの設定は影響しません。プレビューと実際の収集対象は一致し、切り替えても既存項目とフィールドは維持されます。
+ * `data.av.automations` は省略可能で、データベース全体のルール(`spec: 1`~`5`)を保持します。`block` トリガーの `blockSource` はノートブック/文書の範囲、ブロックの種類、タグ、カスタム属性を指定し、`collect` アクションは一致する元のブロックを現在のデータベースにバインドします。主種類はすべてのサブタイプを含みます。形式 3 は `h:h1`~`h:h6`、`l:u/o/t`、`i:u/o/t`、`callout:TYPE`(大文字小文字を区別し、独自種類も指定可能)をサポートします。種類の未選択は制限なし、複数選択は OR です。自動作成された主キー値には、カーネルが管理する `block.collectionRuleID` が含まれる場合があります。自動収集は追加だけを行います。原文やルールの条件・範囲・対象・有効状態が変わっても既存の項目とフィールドを保持し、再び一致しても同じ項目を使います。明示的な整理ではすべての有効な収集ルールを使い、手動・自動でバインドした項目を同じ基準で確認します。一致する項目や判定できない項目は保持し、実行前の再確認で不一致が確定した項目だけを除去します。元に戻す操作で元の項目と全フィールドを復元します。 `blockSource.tagMatch` と `attributeMatch` は既定で `and`、形式 3 では各組を個別に `or` にできます。組の間は AND のままで、空の組は制限しません。 各ルールの省略可能な `notifyOnSuccess` は既定(`null` を含む)で `true` です。実際の変更をトランザクション確定後に一つの通知にまとめます。無効にしてもエラーは通知します。変更なし・明示的な収集・元に戻す・やり直し・ロールバックでは成功通知を送信しません。 形式 4 では省略可能な `blockSource.tagTarget` を追加しています。省略・空文字列は既定の選択で、最初の内容ブロックより条件に合うリスト項目を優先、`block` はタグを含むブロック、`container` は種類と属性の条件に一致する最も近いコンテナを収集し、ブロック ID で重複を除きます。文書には明示的な `d` の選択が必要です。AND のタグは同じ元ブロックに必要で、タグ条件がなければこの設定は影響しません。プレビューと実際の収集対象は一致し、切り替えても既存項目とフィールドは維持されます。 形式 5 では省略可能な `blockSource.documentDepth` を追加しています。省略または `null` は無制限、`0` は選択した各文書自体のみ、`1` は直接の子文書も含み、他の非負整数は相対的な最大階層数を指定します。文書の範囲すべてに共通し、ノートブックの範囲は制限せず、範囲は和集合のままです。深さを変更しても既存の項目とフィールドを保持し、既存の内容を自動で追加収集しません。
### 主キー値を取得
diff --git a/docs/API.md b/docs/API.md
index 350e4621e7..d4f8ccebea 100644
--- a/docs/API.md
+++ b/docs/API.md
@@ -2223,7 +2223,7 @@ The field types (`keyType`) are:
* `data.av`: The full `AttributeView` definition — fields (`keyValues`), field ordering (`keyIDs`, may be `null`), and all views with their raw layout config (`table`/`list`/`gallery`/`kanban`) and item ordering (`itemIds`). The compatibility `viewID` is computed as the first available view and is not persisted. Returns no rendered rows or pagination; therefore, use [Render](#Render) for computed rows
- * `data.av.automations` optionally contains database-wide rules (`spec: 1` through `4`). A `block` trigger uses `blockSource` to select notebooks/documents, block types, tags, and custom attributes; its `collect` action binds matching source blocks to this database. Main types include every subtype; format 3 supports `h:h1` through `h:h6`, `l:u/o/t`, `i:u/o/t`, and `callout:TYPE` (case-sensitive, including custom types). Empty types impose no restriction, and multiple types use OR. Automatically created primary values may include `block.collectionRuleID`, which is maintained by the kernel. Automatic collection only adds entries. Source changes and changes to rule conditions, scope, target, or activation preserve existing rows and fields; matching again keeps the same row. Explicit cleanup checks all enabled collection rules for manual and automatic bound entries alike, preserves matches and indeterminate entries, and rechecks before removing unmatched entries; undo restores the original row and all fields. `blockSource.tagMatch` and `attributeMatch` default to `and`; format 3 also supports `or` independently within each group. Groups remain ANDed, and empty groups add no restriction. Each rule's optional `notifyOnSuccess` defaults to `true` (including `null`); successful changes are summarized once after the transaction commits. Disabled notifications do not suppress errors. No-op actions, explicit collection, undo, redo, and rolled-back transactions do not generate success messages. Format 4 adds optional `blockSource.tagTarget`: omitted/empty uses default selection, preferring an eligible list item over its first content block, `block` collects the tagged block itself, and `container` collects the nearest container meeting type and attribute conditions, deduplicated by block ID. Documents require an explicit `d` type. AND tags must occur in one source block; without tag conditions this option has no effect. Preview and actual collection share the same targets; changing this option preserves existing rows and fields.
+ * `data.av.automations` optionally contains database-wide rules (`spec: 1` through `5`). A `block` trigger uses `blockSource` to select notebooks/documents, block types, tags, and custom attributes; its `collect` action binds matching source blocks to this database. Main types include every subtype; format 3 supports `h:h1` through `h:h6`, `l:u/o/t`, `i:u/o/t`, and `callout:TYPE` (case-sensitive, including custom types). Empty types impose no restriction, and multiple types use OR. Automatically created primary values may include `block.collectionRuleID`, which is maintained by the kernel. Automatic collection only adds entries. Source changes and changes to rule conditions, scope, target, or activation preserve existing rows and fields; matching again keeps the same row. Explicit cleanup checks all enabled collection rules for manual and automatic bound entries alike, preserves matches and indeterminate entries, and rechecks before removing unmatched entries; undo restores the original row and all fields. `blockSource.tagMatch` and `attributeMatch` default to `and`; format 3 also supports `or` independently within each group. Groups remain ANDed, and empty groups add no restriction. Each rule's optional `notifyOnSuccess` defaults to `true` (including `null`); successful changes are summarized once after the transaction commits. Disabled notifications do not suppress errors. No-op actions, explicit collection, undo, redo, and rolled-back transactions do not generate success messages. Format 4 adds optional `blockSource.tagTarget`: omitted/empty uses default selection, preferring an eligible list item over its first content block, `block` collects the tagged block itself, and `container` collects the nearest container meeting type and attribute conditions, deduplicated by block ID. Documents require an explicit `d` type. AND tags must occur in one source block; without tag conditions this option has no effect. Preview and actual collection share the same targets; changing this option preserves existing rows and fields. Format 5 adds optional `blockSource.documentDepth`: omitted or `null` means unlimited, `0` includes only each selected document itself, and `1` also includes its direct children. Other nonnegative integers set the maximum relative descendant depth. It applies uniformly to document scopes, not notebook scopes; scopes remain combined by union. Changing depth preserves existing rows and fields and does not backfill existing content.
### Get primary key values
diff --git a/docs/API.zh-CN.md b/docs/API.zh-CN.md
index a62cbcae12..c8ad236f27 100644
--- a/docs/API.zh-CN.md
+++ b/docs/API.zh-CN.md
@@ -2219,7 +2219,7 @@ if (response.code === 0 && response.data) {
* `data.av`: 完整的 `AttributeView` 定义——字段(`keyValues`)、字段顺序(`keyIDs`,可能为 `null`),以及所有视图的原始布局配置(`table`/`list`/`gallery`/`kanban`)和条目顺序(`itemIds`)。兼容字段 `viewID` 动态取第一个可用视图,不会持久化。返回值不含渲染后的行或分页;需要计算后的行数据请使用 [渲染](#渲染)
- * `data.av.automations` 可选,保存数据库共享的规则(`spec: 1` 至 `4`)。`block` 触发器通过 `blockSource` 指定笔记本/文档范围、块类型、标签和自定义属性,`collect` 动作将符合条件的原块绑定到当前数据库。主类型包含全部子类型;格式 3 支持 `h:h1` 至 `h:h6`、`l:u/o/t`、`i:u/o/t` 和 `callout:TYPE`(区分大小写,允许自定义提示类型)。类型为空不限制,多个类型取任一匹配。自动创建的主键值可能包含由内核维护的 `block.collectionRuleID`。自动收集只添加条目,原文变化及规则条件、范围、对象或启用状态变化均保留已有条目和字段,再次匹配仍使用原条目。主动清理按全部启用的收集规则统一检查手动和自动绑定条目,保留匹配或无法判断的条目,执行前复查后仅移出确认不匹配的条目;撤销恢复原条目及全部字段。 `blockSource.tagMatch` 和 `attributeMatch` 缺省为 `and`,格式 3 支持各组独立设置 `or`;组间仍取与关系,空组不限制。 每条规则的可选 `notifyOnSuccess` 缺省或 `null` 为 `true`,实际变更在事务提交成功后合并通知;关闭不影响错误提示。无变化、手动收集、撤销重做及回滚事务不发送成功通知。 格式 4 增加可选的 `blockSource.tagTarget`:缺省或空字符串使用默认选择,优先收集合格列表项而非其首个内容块,`block` 收集标签所在块,`container` 选择最近的符合类型和属性条件的容器并按块 ID 去重;文档需显式选择 `d`。全部标签须在同一个来源块中,无标签条件时此选项不影响筛选。预览与实际收集对象一致,切换保留已有条目及字段。
+ * `data.av.automations` 可选,保存数据库共享的规则(`spec: 1` 至 `5`)。`block` 触发器通过 `blockSource` 指定笔记本/文档范围、块类型、标签和自定义属性,`collect` 动作将符合条件的原块绑定到当前数据库。主类型包含全部子类型;格式 3 支持 `h:h1` 至 `h:h6`、`l:u/o/t`、`i:u/o/t` 和 `callout:TYPE`(区分大小写,允许自定义提示类型)。类型为空不限制,多个类型取任一匹配。自动创建的主键值可能包含由内核维护的 `block.collectionRuleID`。自动收集只添加条目,原文变化及规则条件、范围、对象或启用状态变化均保留已有条目和字段,再次匹配仍使用原条目。主动清理按全部启用的收集规则统一检查手动和自动绑定条目,保留匹配或无法判断的条目,执行前复查后仅移出确认不匹配的条目;撤销恢复原条目及全部字段。 `blockSource.tagMatch` 和 `attributeMatch` 缺省为 `and`,格式 3 支持各组独立设置 `or`;组间仍取与关系,空组不限制。 每条规则的可选 `notifyOnSuccess` 缺省或 `null` 为 `true`,实际变更在事务提交成功后合并通知;关闭不影响错误提示。无变化、手动收集、撤销重做及回滚事务不发送成功通知。 格式 4 增加可选的 `blockSource.tagTarget`:缺省或空字符串使用默认选择,优先收集合格列表项而非其首个内容块,`block` 收集标签所在块,`container` 选择最近的符合类型和属性条件的容器并按块 ID 去重;文档需显式选择 `d`。全部标签须在同一个来源块中,无标签条件时此选项不影响筛选。预览与实际收集对象一致,切换保留已有条目及字段。 格式 5 增加可选的 `blockSource.documentDepth`:缺省或 `null` 表示不限,`0` 仅包含每个选中文档本身,`1` 还包含一级子文档,其他非负整数指定最大相对后代深度。该设置统一限制文档范围,不影响笔记本范围,各范围仍取并集。修改深度保留已有条目和字段,不自动补收存量内容。
### 获取主键值
diff --git a/kernel/api/av_contract_automation.go b/kernel/api/av_contract_automation.go
index 28bfdd1227..282359496a 100644
--- a/kernel/api/av_contract_automation.go
+++ b/kernel/api/av_contract_automation.go
@@ -76,7 +76,8 @@ func toContractAVAutomationBlockSource(source *av.AutomationBlockSource) *apicon
return nil
}
return &apicontract.AVAutomationBlockSource{NotebookIDs: source.NotebookIDs, DocumentIDs: source.DocumentIDs,
- TagMatch: source.TagMatch, TagTarget: source.TagTarget, AttributeMatch: source.AttributeMatch,
+ DocumentDepth: source.DocumentDepth,
+ TagMatch: source.TagMatch, TagTarget: source.TagTarget, AttributeMatch: source.AttributeMatch,
Types: source.Types, Tags: source.Tags, Attributes: avContractSlice(source.Attributes, func(attr *av.AutomationBlockAttribute) *apicontract.AVAutomationBlockAttribute {
if attr == nil {
return nil
diff --git a/kernel/api/contract_av_automation_test.go b/kernel/api/contract_av_automation_test.go
index 21f3e6c229..61a5ed0303 100644
--- a/kernel/api/contract_av_automation_test.go
+++ b/kernel/api/contract_av_automation_test.go
@@ -272,6 +272,23 @@ func TestAVContractAutomationWrites(t *testing.T) {
readBack.Data.AV.Automations.Rules[0].BlockSource.TagTarget != "container" {
t.Fatalf("tag target contract round trip: %s %v", response.Body.String(), err)
}
+ for _, depth := range []*int{new(0), new(1), nil} {
+ collection.BlockSource.DocumentDepth = depth
+ if err = model.PerformAttributeViewOperations([]*model.Operation{{Action: "setAttrViewAutomations", AvID: database.ID,
+ Data: &av.AutomationConfig{Spec: 5, Rules: []*av.AutomationRule{collection}}}}); err != nil {
+ t.Fatal(err)
+ }
+ response = callAttributeViewContextFilterAPI(t, "/api/av/getAttributeView", map[string]any{"id": database.ID}, getAttributeView)
+ requireAPIContract(t, http.MethodPost, "/api/av/getAttributeView", response)
+ readBack.Data.AV.Automations = av.AutomationConfig{}
+ if err = json.Unmarshal(response.Body.Bytes(), &readBack); err != nil {
+ t.Fatal(err)
+ }
+ got := readBack.Data.AV.Automations.Rules[0].BlockSource.DocumentDepth
+ if readBack.Data.AV.Automations.Spec != 5 || (got == nil) != (depth == nil) || got != nil && *got != *depth {
+ t.Fatalf("document depth contract round trip: %s", response.Body.String())
+ }
+ }
call("/api/block/appendBlock", map[string]any{"parentID": tree.ID, "dataType": "markdown", "data": "> First #collect#\n>\n> Second #collect#"}, appendBlock)
stored, _ = av.ParseAttributeView(database.ID)
preview, err = model.PreviewAttributeViewCollection(database.ID, collection.ID, 1)
diff --git a/kernel/apicontract/av_automation.go b/kernel/apicontract/av_automation.go
index 4fad44a1a9..c26681eec7 100644
--- a/kernel/apicontract/av_automation.go
+++ b/kernel/apicontract/av_automation.go
@@ -1,7 +1,7 @@
package apicontract
// AVAutomationConfig 通过 setAttrViewAutomations 事务操作整体保存,所有镜像和视图共享。
-// spec 为 1 至 4;模板赋值至少使用 2,块子类型至少使用 3,标签收集对象至少使用 4。
+// spec 为 1 至 5;模板赋值至少使用 2,块子类型至少使用 3,标签收集对象至少使用 4,有限文档深度至少使用 5。
// 旧读取器拒绝新版本,防止配置静默丢失。
// 缺省配置不会触发自动化,既有版本的主类型匹配含义不变。
// 普通条目新增、字段编辑及对应 API 会触发启用的规则,
@@ -30,6 +30,9 @@ type AVAutomationRule struct {
}
// AVAutomationBlockSource 监听范围取笔记本与文档的并集,文档包含子文档;范围至少选择一项。
+// documentDepth 缺省或 null 表示不限;非负整数限制每个所选文档的最大子文档深度,0 仅自身,1 包含自身及一级子文档。
+// 深度按文档 ID 路径相对计算,不限制文档内部块层级;不影响笔记本范围,重叠范围仍取并集;有限深度要求 spec 5。
+// 修改深度保留已有条目及字段,不自动补收存量;预览、显式收集和清理检查使用相同范围判断。
// 类型组取或关系;标签和属性组各自通过 tagMatch、attributeMatch 选择 and(缺省)或 or(至少 spec 3)。
// 各条件组之间取与关系,空组不限制;标签精确匹配,全部标签必须出现在同一个来源块中。
// types 为空不限制类型;主类型匹配其全部子类型,类型之间取或关系。
@@ -47,6 +50,7 @@ type AVAutomationRule struct {
type AVAutomationBlockSource struct {
NotebookIDs []string `json:"notebookIDs,omitempty" api:"optional"`
DocumentIDs []string `json:"documentIDs,omitempty" api:"optional"`
+ DocumentDepth *int `json:"documentDepth,omitempty" api:"optional"`
Types []string `json:"types,omitempty" api:"optional"`
Tags []string `json:"tags,omitempty" api:"optional"`
Attributes []*AVAutomationBlockAttribute `json:"attributes,omitempty" api:"optional"`
diff --git a/kernel/apicontract/av_test.go b/kernel/apicontract/av_test.go
index f4bdccb2f4..9b98b725fd 100644
--- a/kernel/apicontract/av_test.go
+++ b/kernel/apicontract/av_test.go
@@ -7,6 +7,39 @@ import (
"testing"
)
+func TestAVAutomationDocumentDepthContract(t *testing.T) {
+ endpoint := Endpoint[AVAutomationBlockSource, Null]{definition: Definition{Path: "/test", Body: JSONBody}}
+ for _, test := range []struct {
+ body string
+ depth *int
+ }{
+ {`{}`, nil}, {`{"documentDepth":null}`, nil}, {`{"documentDepth":0}`, new(0)},
+ {`{"documentDepth":1}`, new(1)}, {`{"documentDepth":12}`, new(12)},
+ } {
+ value, err := endpoint.Decode(strings.NewReader(test.body))
+ if err != nil || (value.DocumentDepth == nil) != (test.depth == nil) ||
+ value.DocumentDepth != nil && *value.DocumentDepth != *test.depth {
+ t.Fatalf("depth input %s: %+v %v", test.body, value, err)
+ }
+ raw, err := json.Marshal(value)
+ if err != nil {
+ t.Fatal(err)
+ }
+ var output map[string]json.RawMessage
+ if err = json.Unmarshal(raw, &output); err != nil {
+ t.Fatal(err)
+ }
+ if (output["documentDepth"] != nil) != (test.depth != nil) {
+ t.Fatalf("depth presence lost: %s", raw)
+ }
+ }
+ for _, body := range []string{`{"documentDepth":1.5}`, `{"documentDepth":"1"}`, `{"documentDepth":true}`} {
+ if _, err := endpoint.Decode(strings.NewReader(body)); err == nil {
+ t.Fatalf("invalid depth type accepted: %s", body)
+ }
+ }
+}
+
func TestAVRequestCompatibility(t *testing.T) {
group, err := SetAttrViewGroup.Decode(strings.NewReader(`{"avID":" av ","blockID":" block ","group":{"FIELD":"key","method":2,"unknown":true},"ignoreRows":"ignored"}`))
if err != nil || group.AvID != " av " || group.BlockID != " block " || group.Group.Field != "key" || group.Group.Method != 2 || group.IgnoreRows {
diff --git a/kernel/apicontract/contracts.go b/kernel/apicontract/contracts.go
index 31730dd6cb..a6c7343b1e 100644
--- a/kernel/apicontract/contracts.go
+++ b/kernel/apicontract/contracts.go
@@ -1518,10 +1518,12 @@ var SystemAddUIProcess = define[EmptyRequest, Null]("addUIProcess", "/api/system
// move 操作支持 nextID,将块移到该同级锚点之前,优先于 previousID 和 parentID。
// 移动保留折叠标题下辖块顺序及源块身份,不将整列表自动拆成列表项;moveBlock 接口不接受 nextID。
-// 数据库自动化通过 setAttrViewAutomations 操作整体保存,配置 spec 为 1 至 4,所有视图共享数据库级规则。
+// 数据库自动化通过 setAttrViewAutomations 操作整体保存,配置 spec 为 1 至 5,所有视图共享数据库级规则。
// blockSource.types 主类型包含全部子类型;spec 3 可指定 h:h1 至 h:h6、l:u/o/t、i:u/o/t、callout:类型名。
// blockSource 的 tagMatch、attributeMatch 缺省为 and;spec 3 支持各组独立设置 or,空组不限制,组间仍为 and。
// spec 4 的 blockSource.tagTarget 支持 block(标签所在块)和 container(最近合格容器),缺省保持原行为。
+// spec 5 的 blockSource.documentDepth 限制各文档范围的子文档深度,0 仅自身,1 包含自身及一级子文档。
+// 深度缺省或 null 不限,不影响笔记本范围,各范围仍取并集;修改不自动清理或补收已有内容。
// 容器按类型及属性条件选择并去重;全部标签须在同一个来源块中,文档容器须显式选择 d。
// 类型和属性始终筛选最终对象;默认首个内容块优先归属合格列表项,每次标签命中只选择一个对象。
// 无标签时收集对象不影响筛选;变更收集对象不转换已有条目,预览与实际收集使用相同规则。
diff --git a/kernel/apicontract/schema.json b/kernel/apicontract/schema.json
index b6a7dc3b13..fd86e27692 100644
--- a/kernel/apicontract/schema.json
+++ b/kernel/apicontract/schema.json
@@ -6740,6 +6740,9 @@
]
}
},
+ "documentDepth": {
+ "type": "integer"
+ },
"documentIDs": {
"type": "array",
"items": {
@@ -6807,6 +6810,16 @@
]
}
},
+ "documentDepth": {
+ "anyOf": [
+ {
+ "type": "integer"
+ },
+ {
+ "type": "null"
+ }
+ ]
+ },
"documentIDs": {
"type": "array",
"items": {
diff --git a/kernel/av/automation.go b/kernel/av/automation.go
index 207bba75dc..91a44e7e7e 100644
--- a/kernel/av/automation.go
+++ b/kernel/av/automation.go
@@ -27,10 +27,11 @@ type AutomationRule struct {
NotifyOnSuccess *bool `json:"notifyOnSuccess,omitempty"`
}
-// AutomationBlockSource 的范围取并集,各类条件取交集;文档范围包含其子文档。
+// AutomationBlockSource 的范围取并集,各类条件取交集;文档深度缺省不限,0 仅包含文档本身。
type AutomationBlockSource struct {
NotebookIDs []string `json:"notebookIDs,omitempty"`
DocumentIDs []string `json:"documentIDs,omitempty"`
+ DocumentDepth *int `json:"documentDepth,omitempty"`
Types []string `json:"types,omitempty"`
Tags []string `json:"tags,omitempty"`
Attributes []*AutomationBlockAttribute `json:"attributes,omitempty"`
@@ -68,6 +69,9 @@ func IsAutomationBlockType(value string) bool {
func (rule *AutomationRule) RequiredSpec() int {
ret := 1
if rule.BlockSource != nil {
+ if rule.BlockSource.DocumentDepth != nil {
+ return 5
+ }
if rule.BlockSource.TagTarget != "" {
return 4
}
@@ -97,7 +101,7 @@ func (config *AutomationConfig) ValidateSpec() error {
if config == nil {
return nil
}
- if config.Spec < 1 || config.Spec > 4 {
+ if config.Spec < 1 || config.Spec > 5 {
return fmt.Errorf("unsupported database automation specification [%d]", config.Spec)
}
for _, rule := range config.Rules {
diff --git a/kernel/av/automation_test.go b/kernel/av/automation_test.go
index db7d261809..4bd299a2ed 100644
--- a/kernel/av/automation_test.go
+++ b/kernel/av/automation_test.go
@@ -134,7 +134,7 @@ func TestAutomationBlockTypeAndSpecCompatibility(t *testing.T) {
if err != nil {
t.Fatal(err)
}
- for _, spec := range []int{1, 2, 3, 4} {
+ for _, spec := range []int{1, 2, 3, 4, 5} {
view, err := ParseAttributeViewData("20260921000000-layouts", data)
if err != nil {
t.Fatal(err)
@@ -162,10 +162,21 @@ func TestAutomationBlockTypeAndSpecCompatibility(t *testing.T) {
rule.BlockSource.TagTarget = target
raw, _ = json.Marshal(view)
_, err = ParseAttributeViewData(view.ID, raw)
- if (err == nil) != (spec == 4) {
+ if (err == nil) != (spec >= 4) {
t.Fatalf("tag target %s spec %d: %v", target, spec, err)
}
}
+ for _, depth := range []int{0, 1, 12} {
+ rule.BlockSource.DocumentDepth = &depth
+ raw, _ = json.Marshal(view)
+ parsed, parseErr := ParseAttributeViewData(view.ID, raw)
+ if (parseErr == nil) != (spec >= 5) {
+ t.Fatalf("document depth %d spec %d: %v", depth, spec, parseErr)
+ }
+ if parseErr == nil && *parsed.Automations.Rules[0].BlockSource.DocumentDepth != depth {
+ t.Fatal("document depth was not preserved")
+ }
+ }
}
}
diff --git a/kernel/model/attribute_view_collection.go b/kernel/model/attribute_view_collection.go
index 9d395ad6ce..ec20664af7 100644
--- a/kernel/model/attribute_view_collection.go
+++ b/kernel/model/attribute_view_collection.go
@@ -40,7 +40,11 @@ func collectionScopeMatches(source *av.AutomationBlockSource, tree *parse.Tree)
return true
}
for _, id := range source.DocumentIDs {
- if tree.ID == id || strings.Contains(tree.Path, "/"+id+"/") {
+ if tree.ID == id {
+ return true
+ }
+ if _, suffix, found := strings.Cut(tree.Path, "/"+id+"/"); found &&
+ (source.DocumentDepth == nil || strings.Count(suffix, "/")+1 <= *source.DocumentDepth) {
return true
}
}
@@ -190,6 +194,9 @@ func (tx *Transaction) validateBlockCollectionRule(view *av.AttributeView, rule
len(rule.Conditions) != 0 || rule.KeyID != "" || len(rule.Actions) != 1 {
return fmt.Errorf("invalid block collection source")
}
+ if source.DocumentDepth != nil && *source.DocumentDepth < 0 {
+ return fmt.Errorf("invalid block collection document depth")
+ }
if !slices.Contains([]string{"", "and", "or"}, source.TagMatch) ||
!slices.Contains([]string{"", "and", "or"}, source.AttributeMatch) ||
!slices.Contains([]string{"", "block", "container"}, source.TagTarget) {
diff --git a/kernel/model/attribute_view_collection_depth_fts5_test.go b/kernel/model/attribute_view_collection_depth_fts5_test.go
new file mode 100644
index 0000000000..d2af2407f0
--- /dev/null
+++ b/kernel/model/attribute_view_collection_depth_fts5_test.go
@@ -0,0 +1,219 @@
+//go:build fts5
+
+package model
+
+import (
+ "strings"
+ "testing"
+
+ "github.com/88250/lute/ast"
+ "github.com/88250/lute/parse"
+ "github.com/siyuan-note/siyuan/kernel/av"
+ "github.com/siyuan-note/siyuan/kernel/treenode"
+)
+
+func TestBlockCollectionDocumentDepthScope(t *testing.T) {
+ for _, test := range []struct {
+ name string
+ depth *int
+ ids []string
+ box string
+ tree *parse.Tree
+ want bool
+ }{
+ {"legacy descendants", nil, []string{"parent"}, "", &parse.Tree{ID: "grand", Path: "/parent/child/grand.sy"}, true},
+ {"self", new(0), []string{"parent"}, "", &parse.Tree{ID: "parent", Path: "/ancestor/parent.sy"}, true},
+ {"no children", new(0), []string{"parent"}, "", &parse.Tree{ID: "child", Path: "/parent/child.sy"}, false},
+ {"direct child", new(1), []string{"parent"}, "", &parse.Tree{ID: "child", Path: "/ancestor/parent/child.sy"}, true},
+ {"grandchild excluded", new(1), []string{"parent"}, "", &parse.Tree{ID: "grand", Path: "/parent/child/grand.sy"}, false},
+ {"grandchild included", new(2), []string{"parent"}, "", &parse.Tree{ID: "grand", Path: "/parent/child/grand.sy"}, true},
+ {"nested scope union", new(1), []string{"parent", "child"}, "", &parse.Tree{ID: "grand", Path: "/parent/child/grand.sy"}, true},
+ {"explicit document union", new(0), []string{"parent", "grand"}, "", &parse.Tree{ID: "grand", Path: "/parent/child/grand.sy"}, true},
+ {"notebook union", new(0), []string{"parent"}, "box", &parse.Tree{ID: "grand", Box: "box", Path: "/parent/child/grand.sy"}, true},
+ {"unrelated", nil, []string{"parent"}, "", &parse.Tree{ID: "child", Path: "/other/child.sy"}, false},
+ {"partial id", nil, []string{"parent"}, "", &parse.Tree{ID: "child", Path: "/prefix-parent/child.sy"}, false},
+ } {
+ t.Run(test.name, func(t *testing.T) {
+ source := &av.AutomationBlockSource{DocumentIDs: test.ids, DocumentDepth: test.depth}
+ if test.box != "" {
+ source.NotebookIDs = []string{test.box}
+ }
+ if got := collectionScopeMatches(source, test.tree); got != test.want {
+ t.Fatalf("scope matches = %v, want %v", got, test.want)
+ }
+ })
+ }
+ // 文档层级不限制文档内部的容器嵌套。
+ root := &ast.Node{ID: "parent", Type: ast.NodeDocument}
+ quote := &ast.Node{ID: ast.NewNodeID(), Type: ast.NodeBlockquote}
+ paragraph := treenode.NewParagraph("")
+ root.AppendChild(quote)
+ quote.AppendChild(paragraph)
+ source := &av.AutomationBlockSource{DocumentIDs: []string{"parent"}, DocumentDepth: new(0), Types: []string{"p"}}
+ if !collectionMatches(source, &parse.Tree{ID: "parent", Root: root})[paragraph.ID] {
+ t.Fatal("document depth limited block nesting")
+ }
+}
+
+func TestBlockCollectionDocumentDepthTransitionsPreviewAndCleanup(t *testing.T) {
+ fixture, view, keyID := setupBlockCollectionTest(t)
+ parent, err := LoadTreeByBlockID(fixture.sourceID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ child, err := CreateDocByMdSync(fixture.box.ID, strings.TrimSuffix(parent.Path, ".sy")+"/"+ast.NewNodeID()+".sy", "Child", "Child content", nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ grand, err := CreateDocByMdSync(fixture.box.ID, strings.TrimSuffix(child.Path, ".sy")+"/"+ast.NewNodeID()+".sy", "Grandchild", "Grandchild content", nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ setDepth := func(depth *int) {
+ t.Helper()
+ view = readAttributeViewItemsTest(t, view.ID)
+ view.Automations.Spec = 5
+ view.Automations.Rules[0].BlockSource.DocumentDepth = depth
+ if err := PerformAttributeViewOperations([]*Operation{{Action: "setAttrViewAutomations", AvID: view.ID, Data: view.Automations}}); err != nil {
+ t.Fatal(err)
+ }
+ }
+ setDepth(new(1))
+ for _, id := range []string{parent.ID, child.ID, grand.ID} {
+ if err = PerformTxSync(blockCollectionTags(t, id, "todo")); err != nil {
+ t.Fatal(err)
+ }
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ if view.GetBlockValueByBoundID(parent.ID) == nil || view.GetBlockValueByBoundID(child.ID) == nil || view.GetBlockValueByBoundID(grand.ID) != nil {
+ t.Fatal("depth 1 must collect self and direct children only")
+ }
+ childItem := view.GetBlockValueByBoundID(child.ID).BlockID
+ view.GetValue(keyID, childItem).Text.Content = "Edited"
+ if err = av.SaveAttributeView(view); err != nil {
+ t.Fatal(err)
+ }
+ preview, err := PreviewAttributeViewCollection(view.ID, view.Automations.Rules[0].ID, 1)
+ if err != nil || len(preview.Blocks) != 2 {
+ t.Fatalf("depth 1 preview: %+v %v", preview, err)
+ }
+ setDepth(new(0))
+ review, err := ReviewAttributeViewCollection(view.ID, 1, "")
+ if err != nil || review.Matched != 1 || review.Unmatched != 1 {
+ t.Fatalf("depth 0 review: %+v %v", review, err)
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ if view.GetValue(keyID, childItem).Text.Content != "Edited" {
+ t.Fatal("shrinking depth reset existing fields")
+ }
+ preview, err = PreviewAttributeViewCollection(view.ID, view.Automations.Rules[0].ID, 1)
+ if err != nil || len(preview.Blocks) != 1 || preview.Blocks[0].ID != parent.ID {
+ t.Fatalf("depth 0 preview: %+v %v", preview, err)
+ }
+ cleanup := collectionCleanupOperation(view.ID, review)
+ setDepth(new(2))
+ if err = PerformAttributeViewOperations([]*Operation{cleanup}); err == nil {
+ t.Fatal("depth change accepted stale cleanup")
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ if view.GetBlockValueByBoundID(grand.ID) != nil {
+ t.Fatal("changing depth backfilled existing content")
+ }
+ preview, err = PreviewAttributeViewCollection(view.ID, view.Automations.Rules[0].ID, 1)
+ if err != nil || len(preview.Blocks) != 3 {
+ t.Fatalf("depth 2 preview: %+v %v", preview, err)
+ }
+ if err = PerformAttributeViewOperations([]*Operation{{Action: "collectAttrViewBlocks", AvID: view.ID,
+ Data: map[string]any{"ruleID": view.Automations.Rules[0].ID, "blockIDs": []string{grand.ID}}}}); err != nil {
+ t.Fatal(err)
+ }
+ if readAttributeViewItemsTest(t, view.ID).GetBlockValueByBoundID(grand.ID) == nil {
+ t.Fatal("explicit depth match not collected")
+ }
+ setDepth(new(0))
+ review, err = ReviewAttributeViewCollection(view.ID, 1, "")
+ if err != nil || review.Matched != 1 || review.Unmatched != 2 {
+ t.Fatalf("cleanup review: %+v %v", review, err)
+ }
+ op := collectionCleanupOperation(view.ID, review)
+ tx := &Transaction{fromAPI: true, DoOperations: []*Operation{op}, UndoOperations: []*Operation{op}}
+ if err = PerformTxSync(tx); err != nil {
+ t.Fatal(err)
+ }
+ if readAttributeViewItemsTest(t, view.ID).GetBlockValue(childItem) != nil {
+ t.Fatal("confirmed depth mismatch was not removed")
+ }
+ if err = PerformTxSync(&Transaction{isReplay: true, DoOperations: cloneOperations(tx.UndoOperations)}); err != nil {
+ t.Fatal(err)
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ if view.GetValue(keyID, childItem).Text.Content != "Edited" {
+ t.Fatal("undo did not restore original fields")
+ }
+ if err = PerformTxSync(&Transaction{isReplay: true, DoOperations: cloneOperations(tx.DoOperations)}); err != nil {
+ t.Fatal(err)
+ }
+ if readAttributeViewItemsTest(t, view.ID).GetBlockValue(childItem) != nil {
+ t.Fatal("redo did not restore cleanup")
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ view.Automations.Rules[0].BlockSource.DocumentDepth = new(-1)
+ if err = PerformAttributeViewOperations([]*Operation{{Action: "setAttrViewAutomations", AvID: view.ID, Data: view.Automations}}); err == nil {
+ t.Fatal("negative document depth accepted")
+ }
+ if *readAttributeViewItemsTest(t, view.ID).Automations.Rules[0].BlockSource.DocumentDepth != 0 {
+ t.Fatal("invalid depth overwrote saved configuration")
+ }
+}
+
+func TestBlockCollectionDocumentDepthBlockMoves(t *testing.T) {
+ fixture, view, _ := setupBlockCollectionTest(t)
+ parent, err := LoadTreeByBlockID(fixture.sourceID)
+ if err != nil {
+ t.Fatal(err)
+ }
+ child, err := CreateDocByMdSync(fixture.box.ID, strings.TrimSuffix(parent.Path, ".sy")+"/"+ast.NewNodeID()+".sy", "Child", "Child content", nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ grand, err := CreateDocByMdSync(fixture.box.ID, strings.TrimSuffix(child.Path, ".sy")+"/"+ast.NewNodeID()+".sy", "Grandchild", "Moved content", nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ view.Automations.Spec = 5
+ source := view.Automations.Rules[0].BlockSource
+ source.DocumentDepth, source.Tags, source.Types = new(1), nil, []string{"p"}
+ if err = av.SaveAttributeView(view); err != nil {
+ t.Fatal(err)
+ }
+ blockID := grand.Root.FirstChild.ID
+ if err = PerformTxSync(&Transaction{fromAPI: true, DoOperations: []*Operation{{Action: "move", ID: blockID, ParentID: child.ID}}}); err != nil {
+ t.Fatal(err)
+ }
+ if readAttributeViewItemsTest(t, view.ID).GetBlockValueByBoundID(blockID) == nil {
+ t.Fatal("move into allowed depth did not collect")
+ }
+ if err = PerformTxSync(&Transaction{fromAPI: true, DoOperations: []*Operation{{Action: "move", ID: blockID, ParentID: grand.ID}}}); err != nil {
+ t.Fatal(err)
+ }
+ if readAttributeViewItemsTest(t, view.ID).GetBlockValueByBoundID(blockID) == nil {
+ t.Fatal("move out of allowed depth removed existing entry")
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ view.Automations.Rules[0].BlockSource.Types = []string{"d"}
+ if err = av.SaveAttributeView(view); err != nil {
+ t.Fatal(err)
+ }
+ created, err := CreateDocByMdSync(fixture.box.ID, strings.TrimSuffix(parent.Path, ".sy")+"/"+ast.NewNodeID()+".sy", "New child", "", nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ excluded, err := CreateDocByMdSync(fixture.box.ID, strings.TrimSuffix(created.Path, ".sy")+"/"+ast.NewNodeID()+".sy", "New grandchild", "", nil, nil)
+ if err != nil {
+ t.Fatal(err)
+ }
+ view = readAttributeViewItemsTest(t, view.ID)
+ if view.GetBlockValueByBoundID(created.ID) == nil || view.GetBlockValueByBoundID(excluded.ID) != nil {
+ t.Fatal("new documents did not respect relative depth")
+ }
+}
diff --git a/kernel/model/attribute_view_collection_sqlcipher_test.go b/kernel/model/attribute_view_collection_sqlcipher_test.go
index 458c336038..c257c8db6c 100644
--- a/kernel/model/attribute_view_collection_sqlcipher_test.go
+++ b/kernel/model/attribute_view_collection_sqlcipher_test.go
@@ -24,11 +24,14 @@ func TestBlockCollectionEncryptedSourceAndRecovery(t *testing.T) {
if name == "" {
name = "default"
}
- t.Run(name, func(t *testing.T) { testBlockCollectionEncryptedSourceAndRecovery(t, target) })
+ t.Run(name, func(t *testing.T) {
+ t.Run("unlimited", func(t *testing.T) { testBlockCollectionEncryptedSourceAndRecovery(t, target, nil) })
+ t.Run("current", func(t *testing.T) { testBlockCollectionEncryptedSourceAndRecovery(t, target, new(0)) })
+ })
}
}
-func testBlockCollectionEncryptedSourceAndRecovery(t *testing.T, target string) {
+func testBlockCollectionEncryptedSourceAndRecovery(t *testing.T, target string, depth *int) {
fixture, view, keyID := setupBlockCollectionTest(t)
boxID := fixture.box.ID
tree, err := LoadTreeByBlockID(fixture.sourceID)
@@ -93,6 +96,10 @@ func testBlockCollectionEncryptedSourceAndRecovery(t *testing.T, target string)
view.Automations.Rules[0].BlockSource.Tags = nil
}
view.Automations.Rules[0].BlockSource.Attributes = []*av.AutomationBlockAttribute{{Name: "custom-state", Operator: "equals", Value: "active"}}
+ if depth != nil {
+ view.Automations.Spec = 5
+ view.Automations.Rules[0].BlockSource.DocumentDepth = depth
+ }
if err = av.SaveAttributeView(view); err != nil {
t.Fatal(err)
}