An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:sparkles: Support configuring visibility and order for slash menu items https://github.com/siyuan-note/siyuan/issues/18790
Daniel28eda49e3ead
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.jsonindex 2f965d60fa..b4a8cf3f27 100644--- a/app/appearance/langs/ar.json+++ b/app/appearance/langs/ar.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "قائمة الشرطة المائلة","importNotebook": "استيراد دفتر ملاحظات","distributeSelectedColWidths": "توزيع عرض الأعمدة المحددة بالتساوي","useDefaultWidthForAllColumns": "استخدام العرض الافتراضي لجميع الأعمدة",@@ -171,7 +172,7 @@"entrySubmenu": "قائمة فرعية","splitMergedCellTip": "يجب تقسيم الخلايا المدمجة أولاً","entryVisibility": "القوائم وشريط الإرساء",- "entryVisibilityTip": "اختر عناصر القوائم المضمنة وأيقونات شريط الإرساء التي تظهر على سطح المكتب",+ "entryVisibilityTip": "اضبط إظهار وترتيب عناصر قوائم سطح المكتب المضمنة وعناصر قائمة الشرطة المائلة (بما فيها عناصر الإضافات)، واضبط إظهار أيقونات شريط الإرساء","entrySimple": "مبسّط","entryFull": "كامل","entrySimpleTip": "يعرض العناصر شائعة الاستخدام لمساعدة المستخدمين الجدد على البدء بسرعة",diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.jsonindex 3a11a2859c..fc3037a032 100644--- a/app/appearance/langs/de.json+++ b/app/appearance/langs/de.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Slash-Menü","importNotebook": "Notizbuch importieren","distributeSelectedColWidths": "Ausgewählte Spaltenbreiten gleichmäßig verteilen","useDefaultWidthForAllColumns": "Standardbreite für alle Spalten verwenden",@@ -171,7 +172,7 @@"entrySubmenu": "Untermenü","splitMergedCellTip": "Zusammengeführte Zellen müssen zuerst geteilt werden","entryVisibility": "Menüs und Dock",- "entryVisibilityTip": "Wählen Sie, welche integrierten Menüeinträge und Dock-Symbole auf dem Desktop angezeigt werden",+ "entryVisibilityTip": "Konfigurieren Sie Sichtbarkeit und Reihenfolge integrierter Desktop-Menüeinträge und der Einträge im Slash-Menü (einschließlich Plugin-Einträgen) sowie die Sichtbarkeit der Dock-Symbole","entrySimple": "Einfach","entryFull": "Vollständig","entrySimpleTip": "Zeigt häufig verwendete Einträge für einen schnellen Einstieg",diff --git a/app/appearance/langs/en.json b/app/appearance/langs/en.jsonindex 251bf34118..291e2cead8 100644--- a/app/appearance/langs/en.json+++ b/app/appearance/langs/en.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Slash menu","importNotebook": "Import Notebook","distributeSelectedColWidths": "Distribute selected column widths evenly","useDefaultWidthForAllColumns": "Use default width for all columns",@@ -171,7 +172,7 @@"entrySubmenu": "Submenu","splitMergedCellTip": "Split merged cells first","entryVisibility": "Menus and dock",- "entryVisibilityTip": "Choose which built-in menu items and dock icons are shown on desktop",+ "entryVisibilityTip": "Configure the visibility and order of built-in desktop menu items and slash menu items (including plugin items), and the visibility of dock icons","entrySimple": "Simple","entryFull": "Full","entrySimpleTip": "Shows commonly used entries for getting started quickly",diff --git a/app/appearance/langs/es.json b/app/appearance/langs/es.jsonindex 84dac6ba66..b37b48c011 100644--- a/app/appearance/langs/es.json+++ b/app/appearance/langs/es.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Menú slash","importNotebook": "Importar cuaderno","distributeSelectedColWidths": "Distribuir uniformemente el ancho de las columnas seleccionadas","useDefaultWidthForAllColumns": "Usar el ancho predeterminado para todas las columnas",@@ -171,7 +172,7 @@"entrySubmenu": "Submenú","splitMergedCellTip": "Primero hay que dividir las celdas combinadas","entryVisibility": "Menús y panel acoplable",- "entryVisibilityTip": "Elige qué elementos de menú e iconos del panel acoplable se muestran en el escritorio",+ "entryVisibilityTip": "Configura la visibilidad y el orden de los elementos integrados de los menús de escritorio y del menú slash (incluidos los elementos de complementos), así como la visibilidad de los iconos del panel acoplable","entrySimple": "Sencillo","entryFull": "Completo","entrySimpleTip": "Muestra las entradas más utilizadas para empezar rápidamente",diff --git a/app/appearance/langs/fr.json b/app/appearance/langs/fr.jsonindex fed645ab92..ce1490c787 100644--- a/app/appearance/langs/fr.json+++ b/app/appearance/langs/fr.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Menu de commandes slash","importNotebook": "Importer un carnet","distributeSelectedColWidths": "Répartir uniformément la largeur des colonnes sélectionnées","useDefaultWidthForAllColumns": "Utiliser la largeur par défaut pour toutes les colonnes",@@ -171,7 +172,7 @@"entrySubmenu": "Sous-menu","splitMergedCellTip": "Les cellules fusionnées doivent d'abord être fractionnées","entryVisibility": "Menus et barre d'ancrage",- "entryVisibilityTip": "Choisissez les éléments de menu et les icônes de la barre d'ancrage affichés sur ordinateur",+ "entryVisibilityTip": "Configurez la visibilité et l’ordre des éléments intégrés des menus de bureau et des éléments du menu de commandes slash (y compris les éléments de plugins), ainsi que la visibilité des icônes de la barre d’ancrage","entrySimple": "Simple","entryFull": "Complet","entrySimpleTip": "Affiche les entrées courantes pour démarrer rapidement",diff --git a/app/appearance/langs/he.json b/app/appearance/langs/he.jsonindex def8a22083..bc128d1b01 100644--- a/app/appearance/langs/he.json+++ b/app/appearance/langs/he.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "תפריט לוכסן","importNotebook": "ייבוא מחברת","distributeSelectedColWidths": "פזר את רוחב העמודות שנבחרו באופן שווה","useDefaultWidthForAllColumns": "השתמש ברוחב ברירת המחדל עבור כל העמודות",@@ -171,7 +172,7 @@"entrySubmenu": "תפריט משנה","splitMergedCellTip": "יש לפצל תחילה תאים ממוזגים","entryVisibility": "תפריטים וסרגל עגינה",- "entryVisibilityTip": "בחירת פריטי התפריט וסמלי סרגל העגינה המובנים שיוצגו במחשב",+ "entryVisibilityTip": "הגדרת הנראות והסדר של פריטי תפריט שולחן העבודה המובנים ושל פריטי תפריט הלוכסן (כולל פריטי תוספים), והנראות של סמלי סרגל העגינה","entrySimple": "פשוט","entryFull": "מלא","entrySimpleTip": "מציג פריטים נפוצים כדי לעזור למשתמשים חדשים להתחיל במהירות",diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.jsonindex 200ee51e0b..874144018e 100644--- a/app/appearance/langs/hi.json+++ b/app/appearance/langs/hi.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "स्लैश मेनू","importNotebook": "नोटबुक आयात करें","distributeSelectedColWidths": "चयनित स्तंभों की चौड़ाई समान रूप से बाँटें","useDefaultWidthForAllColumns": "सभी स्तंभों के लिए डिफ़ॉल्ट चौड़ाई का उपयोग करें",@@ -171,7 +172,7 @@"entrySubmenu": "उपमेनू","splitMergedCellTip": "पहले मर्ज किए गए सेल विभाजित करें","entryVisibility": "मेनू और डॉक",- "entryVisibilityTip": "डेस्कटॉप पर दिखाए जाने वाले अंतर्निहित मेनू आइटम और डॉक आइकन चुनें",+ "entryVisibilityTip": "डेस्कटॉप के अंतर्निहित मेनू आइटम और स्लैश मेनू आइटम (प्लगइन आइटम सहित) की दृश्यता व क्रम तथा डॉक आइकन की दृश्यता कॉन्फ़िगर करें","entrySimple": "सरल","entryFull": "पूर्ण","entrySimpleTip": "नए उपयोगकर्ताओं को जल्दी शुरू करने के लिए आम तौर पर उपयोग की जाने वाली प्रविष्टियाँ दिखाता है",diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.jsonindex 7f9ab8d407..0056663bc4 100644--- a/app/appearance/langs/id.json+++ b/app/appearance/langs/id.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Menu garis miring","importNotebook": "Impor buku catatan","distributeSelectedColWidths": "Distribusikan lebar kolom yang dipilih secara merata","useDefaultWidthForAllColumns": "Gunakan lebar default untuk semua kolom",@@ -171,7 +172,7 @@"entrySubmenu": "Submenu","splitMergedCellTip": "Pisahkan sel yang digabungkan terlebih dahulu","entryVisibility": "Menu dan dok",- "entryVisibilityTip": "Pilih item menu bawaan dan ikon dok yang ditampilkan di desktop",+ "entryVisibilityTip": "Atur visibilitas dan urutan item menu desktop bawaan dan item menu garis miring (termasuk item plugin), serta visibilitas ikon dok","entrySimple": "Sederhana","entryFull": "Lengkap","entrySimpleTip": "Menampilkan entri yang umum digunakan agar pengguna baru dapat memulai dengan cepat",diff --git a/app/appearance/langs/it.json b/app/appearance/langs/it.jsonindex 8ebe43aacb..42d49b3629 100644--- a/app/appearance/langs/it.json+++ b/app/appearance/langs/it.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Menu slash","importNotebook": "Importa taccuino","distributeSelectedColWidths": "Distribuisci uniformemente la larghezza delle colonne selezionate","useDefaultWidthForAllColumns": "Usa la larghezza predefinita per tutte le colonne",@@ -171,7 +172,7 @@"entrySubmenu": "Sottomenu","splitMergedCellTip": "Prima dividi le celle unite","entryVisibility": "Menu e barra di ancoraggio",- "entryVisibilityTip": "Scegli quali voci di menu e icone della barra di ancoraggio mostrare sul desktop",+ "entryVisibilityTip": "Configura la visibilità e l'ordine delle voci integrate dei menu desktop e delle voci del menu slash (incluse le voci dei plugin), nonché la visibilità delle icone della barra di ancoraggio","entrySimple": "Semplice","entryFull": "Completo","entrySimpleTip": "Mostra le voci usate più spesso per iniziare rapidamente",diff --git a/app/appearance/langs/ja.json b/app/appearance/langs/ja.jsonindex e007bebf3b..f40a2a8829 100644--- a/app/appearance/langs/ja.json+++ b/app/appearance/langs/ja.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "スラッシュメニュー","importNotebook": "ノートブックをインポート","distributeSelectedColWidths": "選択した列幅を均等にする","useDefaultWidthForAllColumns": "すべての列にデフォルト幅を使用",@@ -171,7 +172,7 @@"entrySubmenu": "サブメニュー","splitMergedCellTip": "先に結合セルを分割する必要があります","entryVisibility": "メニューとドック",- "entryVisibilityTip": "デスクトップで表示する組み込みメニュー項目とドックアイコンを選択します",+ "entryVisibilityTip": "デスクトップの組み込みメニュー項目とスラッシュメニュー項目(プラグイン項目を含む)の表示と順序、およびドックアイコンの表示を設定します","entrySimple": "シンプル","entryFull": "完全","entrySimpleTip": "よく使う項目を表示し、すぐに使い始められる構成",diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.jsonindex 96746564f6..ae38a76c64 100644--- a/app/appearance/langs/ko.json+++ b/app/appearance/langs/ko.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "슬래시 메뉴","importNotebook": "노트북 가져오기","distributeSelectedColWidths": "선택한 열 너비를 균등하게 분배","useDefaultWidthForAllColumns": "모든 열에 기본 너비 사용",@@ -171,7 +172,7 @@"entrySubmenu": "하위 메뉴","splitMergedCellTip": "먼저 병합된 셀을 분할해야 합니다","entryVisibility": "메뉴 및 도크",- "entryVisibilityTip": "데스크톱에 표시할 기본 메뉴 항목과 도크 아이콘을 선택합니다",+ "entryVisibilityTip": "데스크톱 기본 메뉴 항목과 슬래시 메뉴 항목(플러그인 항목 포함)의 표시 여부 및 순서와 도크 아이콘의 표시 여부를 설정합니다","entrySimple": "간단","entryFull": "전체","entrySimpleTip": "자주 사용하는 항목을 표시해 새 사용자가 빠르게 시작할 수 있도록 함",diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.jsonindex 013dbe715f..db69c6541d 100644--- a/app/appearance/langs/nl.json+++ b/app/appearance/langs/nl.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Slashmenu","importNotebook": "Notitieboek importeren","distributeSelectedColWidths": "Geselecteerde kolombreedtes gelijkmatig verdelen","useDefaultWidthForAllColumns": "Standaardbreedte voor alle kolommen gebruiken",@@ -171,7 +172,7 @@"entrySubmenu": "Submenu","splitMergedCellTip": "Splits eerst de samengevoegde cellen","entryVisibility": "Menu's en dock",- "entryVisibilityTip": "Kies welke ingebouwde menu-items en dockpictogrammen op het bureaublad worden getoond",+ "entryVisibilityTip": "Configureer de zichtbaarheid en volgorde van ingebouwde desktopmenu-items en slashmenu-items (inclusief plug-initems), en de zichtbaarheid van dockpictogrammen","entrySimple": "Eenvoudig","entryFull": "Volledig","entrySimpleTip": "Toont veelgebruikte items om snel aan de slag te gaan",diff --git a/app/appearance/langs/pl.json b/app/appearance/langs/pl.jsonindex 50a16f8c91..08fc745b93 100644--- a/app/appearance/langs/pl.json+++ b/app/appearance/langs/pl.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Menu poleceń z ukośnikiem","importNotebook": "Importuj notatnik","distributeSelectedColWidths": "Rozłóż równomiernie szerokość wybranych kolumn","useDefaultWidthForAllColumns": "Użyj domyślnej szerokości dla wszystkich kolumn",@@ -171,7 +172,7 @@"entrySubmenu": "Podmenu","splitMergedCellTip": "Najpierw podziel scalone komórki","entryVisibility": "Menu i dok",- "entryVisibilityTip": "Wybierz wbudowane pozycje menu i ikony doku wyświetlane na komputerze",+ "entryVisibilityTip": "Skonfiguruj widoczność i kolejność wbudowanych elementów menu pulpitu oraz elementów menu poleceń z ukośnikiem (w tym elementów wtyczek), a także widoczność ikon doku","entrySimple": "Prosty","entryFull": "Pełny","entrySimpleTip": "Wyświetla często używane pozycje, aby ułatwić szybki start",diff --git a/app/appearance/langs/pt-BR.json b/app/appearance/langs/pt-BR.jsonindex 482d1535ae..963c8e5e3d 100644--- a/app/appearance/langs/pt-BR.json+++ b/app/appearance/langs/pt-BR.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Menu slash","importNotebook": "Importar caderno","distributeSelectedColWidths": "Distribuir uniformemente a largura das colunas selecionadas","useDefaultWidthForAllColumns": "Usar a largura padrão para todas as colunas",@@ -171,7 +172,7 @@"entrySubmenu": "Submenu","splitMergedCellTip": "Divida primeiro as células mescladas","entryVisibility": "Menus e dock",- "entryVisibilityTip": "Escolha quais itens de menu e ícones do dock integrados são exibidos no computador",+ "entryVisibilityTip": "Configure a visibilidade e a ordem dos itens integrados dos menus da área de trabalho e do menu slash (incluindo itens de plugins), bem como a visibilidade dos ícones do dock","entrySimple": "Simples","entryFull": "Completo","entrySimpleTip": "Mostra os itens mais usados para começar rapidamente",diff --git a/app/appearance/langs/ru.json b/app/appearance/langs/ru.jsonindex ac0dd80056..c0bcd65cab 100644--- a/app/appearance/langs/ru.json+++ b/app/appearance/langs/ru.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Слэш-меню","importNotebook": "Импортировать блокнот","distributeSelectedColWidths": "Равномерно распределить ширину выбранных столбцов","useDefaultWidthForAllColumns": "Использовать ширину по умолчанию для всех столбцов",@@ -171,7 +172,7 @@"entrySubmenu": "Подменю","splitMergedCellTip": "Сначала разделите объединённые ячейки","entryVisibility": "Меню и док-панель",- "entryVisibilityTip": "Выберите встроенные пункты меню и значки док-панели, отображаемые на компьютере",+ "entryVisibilityTip": "Настройте видимость и порядок встроенных пунктов меню рабочего стола и пунктов слэш-меню (включая пункты плагинов), а также видимость значков док-панели","entrySimple": "Простой","entryFull": "Полный","entrySimpleTip": "Показывает часто используемые пункты, чтобы быстрее начать работу",diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.jsonindex 856d7e60f0..f3da7073f4 100644--- a/app/appearance/langs/sk.json+++ b/app/appearance/langs/sk.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Ponuka príkazov s lomkou","importNotebook": "Importovať zápisník","distributeSelectedColWidths": "Rovnomerne rozložiť šírku vybraných stĺpcov","useDefaultWidthForAllColumns": "Použiť predvolenú šírku pre všetky stĺpce",@@ -171,7 +172,7 @@"entrySubmenu": "Podponuka","splitMergedCellTip": "Najprv rozdeľte zlúčené bunky","entryVisibility": "Ponuky a dok",- "entryVisibilityTip": "Vyberte vstavané položky ponuky a ikony doku zobrazované na počítači",+ "entryVisibilityTip": "Nastavte viditeľnosť a poradie vstavaných položiek ponúk na pracovnej ploche a položiek ponuky príkazov s lomkou (vrátane položiek pluginov), ako aj viditeľnosť ikon doku","entrySimple": "Jednoduchý","entryFull": "Úplný","entrySimpleTip": "Zobrazuje často používané položky na rýchle začatie práce",diff --git a/app/appearance/langs/th.json b/app/appearance/langs/th.jsonindex fe609ba06d..ae71b9aa3c 100644--- a/app/appearance/langs/th.json+++ b/app/appearance/langs/th.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "เมนูสแลช","importNotebook": "นำเข้าสมุดบันทึก","distributeSelectedColWidths": "กระจายความกว้างของคอลัมน์ที่เลือกให้เท่ากัน","useDefaultWidthForAllColumns": "ใช้ความกว้างเริ่มต้นสำหรับทุกคอลัมน์",@@ -171,7 +172,7 @@"entrySubmenu": "เมนูย่อย","splitMergedCellTip": "ต้องแยกเซลล์ที่ผสานก่อน","entryVisibility": "เมนูและแถบเชื่อมต่อ",- "entryVisibilityTip": "เลือกรายการเมนูและไอคอนแถบเชื่อมต่อในตัวที่จะแสดงบนเดสก์ท็อป",+ "entryVisibilityTip": "กำหนดการแสดงผลและลำดับของรายการเมนูเดสก์ท็อปในตัวและรายการเมนูสแลช (รวมรายการปลั๊กอิน) ตลอดจนการแสดงผลของไอคอนแถบเชื่อมต่อ","entrySimple": "เรียบง่าย","entryFull": "ครบถ้วน","entrySimpleTip": "แสดงรายการที่ใช้บ่อยเพื่อช่วยให้ผู้ใช้ใหม่เริ่มต้นได้อย่างรวดเร็ว",diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.jsonindex dc3a963184..2011e5d0ac 100644--- a/app/appearance/langs/tr.json+++ b/app/appearance/langs/tr.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Eğik çizgi menüsü","importNotebook": "Not defteri içe aktar","distributeSelectedColWidths": "Seçili sütun genişliklerini eşit dağıt","useDefaultWidthForAllColumns": "Tüm sütunlar için varsayılan genişliği kullan",@@ -171,7 +172,7 @@"entrySubmenu": "Alt menü","splitMergedCellTip": "Önce birleştirilmiş hücreleri bölün","entryVisibility": "Menüler ve yuva",- "entryVisibilityTip": "Masaüstünde gösterilecek yerleşik menü öğelerini ve yuva simgelerini seçin",+ "entryVisibilityTip": "Yerleşik masaüstü menü öğeleri ile eğik çizgi menüsü öğelerinin (eklenti öğeleri dahil) görünürlüğünü ve sırasını, ayrıca yuva simgelerinin görünürlüğünü yapılandırın","entrySimple": "Basit","entryFull": "Tam","entrySimpleTip": "Yeni kullanıcıların hızlıca başlayabilmesi için sık kullanılan öğeleri gösterir",diff --git a/app/appearance/langs/uk.json b/app/appearance/langs/uk.jsonindex ef353e9705..809256a967 100644--- a/app/appearance/langs/uk.json+++ b/app/appearance/langs/uk.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "Слеш-меню","importNotebook": "Імпортувати блокнот","distributeSelectedColWidths": "Рівномірно розподілити ширину вибраних стовпців","useDefaultWidthForAllColumns": "Використовувати типову ширину для всіх стовпців",@@ -171,7 +172,7 @@"entrySubmenu": "Підменю","splitMergedCellTip": "Спочатку розділіть об’єднані комірки","entryVisibility": "Меню та док-панель",- "entryVisibilityTip": "Виберіть вбудовані пункти меню та піктограми док-панелі, що відображаються на комп'ютері",+ "entryVisibilityTip": "Налаштуйте видимість і порядок вбудованих пунктів меню робочого столу та пунктів слеш-меню (включно з пунктами плагінів), а також видимість піктограм док-панелі","entrySimple": "Простий","entryFull": "Повний","entrySimpleTip": "Показує часто використовувані пункти, щоб швидше почати роботу",diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.jsonindex a610ea27b4..e4b9361997 100644--- a/app/appearance/langs/zh-CN.json+++ b/app/appearance/langs/zh-CN.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "斜杠菜单","importNotebook": "导入笔记本","distributeSelectedColWidths": "均分所选列宽","useDefaultWidthForAllColumns": "所有列使用默认列宽",@@ -171,7 +172,7 @@"entrySubmenu": "子菜单","splitMergedCellTip": "需要先拆分合并的单元格","entryVisibility": "菜单与停靠栏",- "entryVisibilityTip": "配置桌面端内置菜单项和停靠栏图标是否显示",+ "entryVisibilityTip": "配置桌面端内置菜单项和斜杠菜单项(含插件项)的显隐与排序,以及停靠栏图标的显隐","entrySimple": "简洁方案","entryFull": "完整方案","entrySimpleTip": "显示常用入口,适合新用户快速上手",diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.jsonindex 5c696996b7..e42657a49b 100644--- a/app/appearance/langs/zh-TW.json+++ b/app/appearance/langs/zh-TW.json@@ -1,4 +1,5 @@{+ "entrySlashMenu": "斜線選單","importNotebook": "導入筆記本","distributeSelectedColWidths": "均分所選欄寬","useDefaultWidthForAllColumns": "所有欄使用預設欄寬",@@ -171,7 +172,7 @@"entrySubmenu": "子菜單","splitMergedCellTip": "需要先拆分合併的單元格","entryVisibility": "選單與停靠欄",- "entryVisibilityTip": "設定桌面端內建選單項目和停靠欄圖示是否顯示",+ "entryVisibilityTip": "設定桌面端內建選單項目和斜線選單項目(含插件項目)的顯示與排序,以及停靠欄圖示的顯示","entrySimple": "簡潔方案","entryFull": "完整方案","entrySimpleTip": "顯示常用入口,適合新使用者快速上手",diff --git a/app/src/assets/scss/business/_config.scss b/app/src/assets/scss/business/_config.scssindex de96215943..d95b908a8b 100644--- a/app/src/assets/scss/business/_config.scss+++ b/app/src/assets/scss/business/_config.scss@@ -946,6 +946,10 @@background-color: var(--b3-theme-primary-lightest);color: var(--b3-theme-primary);font-weight: 600;++ > .b3-list-item__text {+ color: inherit;+ }}}diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.tsindex 1b1cc8687d..3986609dcb 100644--- a/app/src/config/entryVisibility/catalog.test.ts+++ b/app/src/config/entryVisibility/catalog.test.ts@@ -1,4 +1,6 @@import * as assert from "node:assert/strict";+import {readFileSync} from "node:fs";+import {resolve} from "node:path";import test from "node:test";import {entryCatalog,@@ -9,8 +11,84 @@ import {getEntryParentPath,getEntryOrderParents,getEntryPaths,+ getPluginSlashEntryKey,+ getSlashMenuEntryPath,+ isEntryOrderSortable,+ refreshSlashMenuCatalog,+ SLASH_MENU_ROOT_PATH,} from "./catalog";+const slashMenuBuiltinOrder = [+ "template",+ "widget",+ "assets",+ "ref",+ "blockEmbed",+ "aiWriting",+ "database",+ "newFileRef",+ "newSubDocRef",+ "separator_1",+ "heading1",+ "heading2",+ "heading3",+ "heading4",+ "heading5",+ "heading6",+ "list",+ "orderedList",+ "check",+ "quote",+ "calloutNote",+ "calloutTip",+ "calloutImportant",+ "calloutWarning",+ "calloutCaution",+ "code",+ "table",+ "line",+ "math",+ "html",+ "databaseTableView",+ "databaseKanbanView",+ "databaseGalleryView",+ "separator_2",+ "emoji",+ "link",+ "bold",+ "italic",+ "underline",+ "strike",+ "mark",+ "sup",+ "sub",+ "inlineCode",+ "kbd",+ "tag",+ "inlineMath",+ "separator_3",+ "insertAsset",+ "insertHTMLFile",+ "insertIframeURL",+ "insertImgURL",+ "insertVideoURL",+ "insertAudioURL",+ "separator_4",+ "staff",+ "chart",+ "flowChart",+ "graph",+ "mermaid",+ "mindmap",+ "UML",+ "separator_5",+ "infoStyle",+ "successStyle",+ "warningStyle",+ "errorStyle",+ "clearFontStyle",+];+test("entry catalog paths are unique and indexed", () => {const paths: string[] = [];const visit = (prefix: string, nodes: typeof entryCatalog[number]["children"]) => {@@ -31,6 +109,161 @@ test("entry catalog paths are unique and indexed", () => {assert.deepEqual(new Set(getEntryPaths()), new Set(paths));});+test("slash menu catalog follows the built-in hint order", () => {+ const section = getEntryCatalogSection("editor.slash");+ assert.deepEqual(section?.children.map((item) => item.key), ["menu"]);+ const children = getEntryCatalogChildren(SLASH_MENU_ROOT_PATH);+ assert.deepEqual(children.map((item) => item.key), slashMenuBuiltinOrder);+ assert.equal(children.filter((item) => item.type === "entry").length, 63);+ assert.equal(children.filter((item) => item.type === "separator").length, 5);+ assert.equal(children.every((item) => item.simple), true);+});++test("slash menu catalog stays aligned with the built-in hint declarations", () => {+ const source = readFileSync(resolve(process.cwd(), "src/protyle/hint/extend.ts"), "utf8");+ const start = source.indexOf("export const getBuiltinSlashMenuItems");+ const end = source.indexOf("export const hintSlash", start);+ assert.notEqual(start, -1);+ assert.notEqual(end, -1);+ const hintOrder = Array.from(source.slice(start, end).matchAll(/\bid: "([^"]+)"/g), (match) => match[1]);+ assert.deepEqual(hintOrder, [...slashMenuBuiltinOrder, "separator_6"]);+});++test("slash menu entries are indexed below their total switch", () => {+ const templatePath = getSlashMenuEntryPath("template");+ assert.equal(SLASH_MENU_ROOT_PATH, "editor.slash.menu");+ assert.equal(templatePath, "editor.slash.menu.template");+ assert.equal(getEntryCatalogNode(templatePath)?.key, "template");+ assert.equal(getEntryParentPath(templatePath), SLASH_MENU_ROOT_PATH);+ assert.deepEqual(getEntryCatalogPathChain("editor.slash", templatePath), [+ SLASH_MENU_ROOT_PATH,+ templatePath,+ ]);+});++test("plugin slash keys encode dotted names and IDs without ambiguity", () => {+ const dottedPlugin = getPluginSlashEntryKey("plugin.name", "entry");+ const dottedEntry = getPluginSlashEntryKey("plugin", "name.entry");+ const pluginSeparator = getPluginSlashEntryKey("plugin.name", "entry", "separator");+ assert.equal(dottedPlugin, "plugin:plugin%2Ename:entry");+ assert.equal(dottedEntry, "plugin:plugin:name%2Eentry");+ assert.equal(pluginSeparator, "plugin-separator:plugin%2Ename:entry");+ assert.notEqual(dottedPlugin, dottedEntry);+ assert.notEqual(dottedPlugin, pluginSeparator);+ assert.equal(dottedPlugin.includes("."), false);+ assert.equal(dottedEntry.includes("."), false);+});++test("slash menu catalog refreshes unique plugin entries and its plugin separator", () => {+ const firstKey = getPluginSlashEntryKey("plugin.one", "shared.id");+ const secondKey = getPluginSlashEntryKey("plugin.two", "shared.id");+ const fallbackKey = getPluginSlashEntryKey("plugin.three", "fallback");+ try {+ refreshSlashMenuCatalog([{+ name: "plugin.one",+ displayName: "Plugin One",+ protyleSlash: [{+ id: "shared.id",+ html: '<span class="b3-list-item__text">HTML label</span>',+ filter: ["Filter label"],+ }, {+ id: "shared.id",+ html: '<span class="b3-list-item__text">Duplicate</span>',+ }],+ }, {+ name: "plugin.two",+ displayName: "Plugin Two",+ protyleSlash: [{+ id: "shared.id",+ html: "<span>Missing text class</span>",+ filter: ["Filter label"],+ }],+ }, {+ name: "plugin.three",+ displayName: "Plugin Three",+ protyleSlash: [{+ id: "fallback",+ html: "<span>Missing text class</span>",+ }],+ }]);++ const children = getEntryCatalogChildren(SLASH_MENU_ROOT_PATH);+ assert.deepEqual(children.slice(-4).map((item) => item.key), [+ "separator_6",+ firstKey,+ secondKey,+ fallbackKey,+ ]);+ assert.notEqual(firstKey, secondKey);+ assert.equal(children.filter((item) => item.key === firstKey).length, 1);+ assert.equal(getEntryCatalogNode(getSlashMenuEntryPath(firstKey))?.label(), "Plugin One - HTML label");+ assert.equal(getEntryCatalogNode(getSlashMenuEntryPath(secondKey))?.label(), "Plugin Two - Filter label");+ assert.equal(getEntryCatalogNode(getSlashMenuEntryPath(fallbackKey))?.label(), "Plugin Three - fallback");+ assert.equal(getEntryParentPath(getSlashMenuEntryPath(firstKey)), SLASH_MENU_ROOT_PATH);+ } finally {+ refreshSlashMenuCatalog([]);+ }+ assert.equal(getEntryCatalogChildren(SLASH_MENU_ROOT_PATH).some((item) => item.key === "separator_6"), false);+ assert.equal(getEntryCatalogNode(getSlashMenuEntryPath(firstKey)), undefined);+});++test("slash menu catalog keeps only renderable plugin separators", () => {+ const leadingKey = getPluginSlashEntryKey("plugin.separators", "leading", "separator");+ const firstKey = getPluginSlashEntryKey("plugin.separators", "first");+ const middleKey = getPluginSlashEntryKey("plugin.separators", "middle", "separator");+ const consecutiveKey = getPluginSlashEntryKey("plugin.separators", "consecutive", "separator");+ const secondKey = getPluginSlashEntryKey("plugin.separators", "second");+ const trailingKey = getPluginSlashEntryKey("plugin.separators", "trailing", "separator");+ try {+ refreshSlashMenuCatalog([{+ name: "plugin.separators",+ protyleSlash: [{+ id: "leading",+ html: "separator",+ }, {+ id: "first",+ html: "First",+ }, {+ id: "middle",+ html: "separator",+ }, {+ id: "consecutive",+ html: "separator",+ }, {+ id: "second",+ html: "Second",+ }, {+ id: "trailing",+ html: "separator",+ }],+ }]);+ const children = getEntryCatalogChildren(SLASH_MENU_ROOT_PATH);+ assert.deepEqual(children.slice(-4).map((item) => item.key), [+ "separator_6",+ firstKey,+ middleKey,+ secondKey,+ ]);+ assert.equal(getEntryCatalogNode(getSlashMenuEntryPath(middleKey))?.type, "separator");+ [leadingKey, consecutiveKey, trailingKey].forEach((key) => {+ assert.equal(getEntryCatalogNode(getSlashMenuEntryPath(key)), undefined);+ });+ } finally {+ refreshSlashMenuCatalog([]);+ }+});++test("entry order sortability follows its section and parent entry", () => {+ assert.equal(isEntryOrderSortable("editor.slash"), false);+ assert.equal(isEntryOrderSortable(SLASH_MENU_ROOT_PATH), true);+ assert.equal(isEntryOrderSortable("dock"), false);+ assert.equal(isEntryOrderSortable("document.more"), true);+ assert.equal(isEntryOrderSortable("gutter.single.turnInto"), true);+ assert.equal(isEntryOrderSortable("missing"), false);+ assert.equal(getEntryOrderParents().includes("editor.slash"), false);+ assert.equal(getEntryOrderParents().includes(SLASH_MENU_ROOT_PATH), true);+});+test("conditional block resource menus have distinct configuration labels", () => {const windowDescriptor = Object.getOwnPropertyDescriptor(globalThis, "window");Object.defineProperty(globalThis, "window", {diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.tsindex cd1f94fe65..5f9409bf37 100644--- a/app/src/config/entryVisibility/catalog.ts+++ b/app/src/config/entryVisibility/catalog.ts@@ -5,6 +5,7 @@ export interface IEntryCatalogNode {label: () => string;simple: boolean;type: "entry" | "separator";+ sortable?: boolean;children?: IEntryCatalogNode[];}@@ -18,12 +19,14 @@ export interface IEntryCatalogSection {const lang = (key: string) => () => window.siyuan.languages[key] || key;const literal = (value: string) => () => value;const location = (...labels: Array<() => string>) => () => labels.map((label) => label()).join(" - ");-const node = (key: string, label: () => string, simple = true, children?: IEntryCatalogNode[]): IEntryCatalogNode => ({+const node = (key: string, label: () => string, simple = true, children?: IEntryCatalogNode[],+ sortable?: boolean): IEntryCatalogNode => ({key,label,simple,type: "entry",children,+ sortable,});const separator = (key: string): IEntryCatalogNode => ({key,@@ -406,6 +409,81 @@ const gutterSingle = () => [node("updateAndCreatedAt", () => `${window.siyuan.languages.modifiedAt} / ${window.siyuan.languages.createdAt}`, false),];+export const SLASH_MENU_ROOT_PATH = "editor.slash.menu";++const slashMenuBuiltinChildren = [+ node("template", lang("template")),+ node("widget", lang("widget")),+ node("assets", lang("assets")),+ node("ref", lang("ref")),+ node("blockEmbed", lang("blockEmbed")),+ node("aiWriting", lang("aiWriting")),+ node("database", lang("database")),+ node("newFileRef", lang("newFileRef")),+ node("newSubDocRef", lang("newSubDocRef")),+ separator("separator_1"),+ node("heading1", lang("heading1")),+ node("heading2", lang("heading2")),+ node("heading3", lang("heading3")),+ node("heading4", lang("heading4")),+ node("heading5", lang("heading5")),+ node("heading6", lang("heading6")),+ node("list", lang("list")),+ node("orderedList", lang("ordered-list")),+ node("check", lang("check")),+ node("quote", lang("quote")),+ node("calloutNote", location(lang("callout"), literal("Note"))),+ node("calloutTip", location(lang("callout"), literal("Tip"))),+ node("calloutImportant", location(lang("callout"), literal("Important"))),+ node("calloutWarning", location(lang("callout"), literal("Warning"))),+ node("calloutCaution", location(lang("callout"), literal("Caution"))),+ node("code", lang("code")),+ node("table", lang("table")),+ node("line", lang("line")),+ node("math", lang("math")),+ node("html", literal("HTML")),+ node("databaseTableView", lang("databaseTableView")),+ node("databaseKanbanView", lang("databaseKanbanView")),+ node("databaseGalleryView", lang("databaseGalleryView")),+ separator("separator_2"),+ node("emoji", lang("emoji")),+ node("link", lang("link")),+ node("bold", lang("bold")),+ node("italic", lang("italic")),+ node("underline", lang("underline")),+ node("strike", lang("strike")),+ node("mark", lang("mark")),+ node("sup", lang("sup")),+ node("sub", lang("sub")),+ node("inlineCode", lang("inline-code")),+ node("kbd", lang("kbd")),+ node("tag", lang("tag")),+ node("inlineMath", lang("inline-math")),+ separator("separator_3"),+ node("insertAsset", lang("insertAsset")),+ node("insertHTMLFile", lang("insertHTMLFile")),+ node("insertIframeURL", lang("insertIframeURL")),+ node("insertImgURL", lang("insertImgURL")),+ node("insertVideoURL", lang("insertVideoURL")),+ node("insertAudioURL", lang("insertAudioURL")),+ separator("separator_4"),+ node("staff", literal("ABC")),+ node("chart", literal("Chart")),+ node("flowChart", literal("FlowChart")),+ node("graph", literal("Graphviz")),+ node("mermaid", literal("Mermaid")),+ node("mindmap", literal("Mind map")),+ node("UML", literal("PlantUML")),+ separator("separator_5"),+ node("infoStyle", lang("infoStyle")),+ node("successStyle", lang("successStyle")),+ node("warningStyle", lang("warningStyle")),+ node("errorStyle", lang("errorStyle")),+ node("clearFontStyle", lang("clearFontStyle")),+];++const slashMenuRoot = node("menu", lang("entrySlashMenu"), true, [...slashMenuBuiltinChildren], true);+export const entryCatalog: IEntryCatalogSection[] = [{key: "dock",@@ -560,6 +638,12 @@ export const entryCatalog: IEntryCatalogSection[] = [node("docInfo", lang("blockCount"), false),],},+ {+ key: "editor.slash",+ label: location(lang("editor"), lang("entrySlashMenu")),+ sortable: false,+ children: [slashMenuRoot],+ },{key: "gutter.single",label: location(lang("editor"), lang("entryGutterMenu"), lang("blockCount")),@@ -759,7 +843,7 @@ export const entryCatalog: IEntryCatalogSection[] = [const entryMap = new Map<string, IEntryCatalogNode>();const parentMap = new Map<string, string>();-const sectionMap = new Map(entryCatalog.map((section) => [section.key, section]));+const sectionMap = new Map<string, IEntryCatalogSection>();const childrenMap = new Map<string, IEntryCatalogNode[]>();const indexNodes = (prefix: string, nodes: IEntryCatalogNode[]) => {@@ -774,7 +858,18 @@ const indexNodes = (prefix: string, nodes: IEntryCatalogNode[]) => {});};-entryCatalog.forEach((section) => indexNodes(section.key, section.children));+const rebuildCatalogIndexes = () => {+ entryMap.clear();+ parentMap.clear();+ sectionMap.clear();+ childrenMap.clear();+ entryCatalog.forEach((section) => {+ sectionMap.set(section.key, section);+ indexNodes(section.key, section.children);+ });+};++rebuildCatalogIndexes();export const getEntryCatalogNode = (path: string) => entryMap.get(path);export const getEntryParentPath = (path: string) => parentMap.get(path);@@ -783,8 +878,16 @@ export const getEntryPaths = () => Array.from(entryMap.entries()).map(([path]) => path);export const getEntryCatalogSection = (key: string) => sectionMap.get(key);export const getEntryCatalogChildren = (path: string) => childrenMap.get(path);+export const isEntryOrderSortable = (parentPath: string) => {+ const section = getEntryCatalogSection(parentPath);+ if (section) {+ return section.sortable !== false;+ }+ const entry = getEntryCatalogNode(parentPath);+ return Boolean(entry && entry.sortable !== false);+};export const getEntryOrderParents = () => Array.from(childrenMap.keys())- .filter((path) => getEntryCatalogSection(path)?.sortable !== false);+ .filter(isEntryOrderSortable);export const getEntryCatalogPathChain = (sectionKey: string, path: string) => {const chain: string[] = [];let current: string | undefined = path;@@ -797,3 +900,88 @@ export const getEntryCatalogPathChain = (sectionKey: string, path: string) => {}return current === sectionKey ? chain : [];};++interface ISlashMenuCatalogPlugin {+ name: string;+ displayName?: string;+ protyleSlash: Array<{+ id: string;+ html: string;+ filter?: string[];+ }>;+}++const encodeSlashMenuEntryKeyPart = (value: string) => encodeURIComponent(value).replace(/\./g, "%2E");++export const getPluginSlashEntryKey = (pluginName: string, slashID: string,+ type: "entry" | "separator" = "entry") =>+ `${type === "separator" ? "plugin-separator" : "plugin"}:${encodeSlashMenuEntryKeyPart(pluginName)}:${encodeSlashMenuEntryKeyPart(slashID)}`;++export const getSlashMenuEntryPath = (entryKey: string) => `${SLASH_MENU_ROOT_PATH}.${entryKey}`;++const getPluginSlashEntryText = (slash: ISlashMenuCatalogPlugin["protyleSlash"][number]) => {+ if (typeof document !== "undefined") {+ const template = document.createElement("template");+ template.innerHTML = slash.html;+ const text = template.content.querySelector(".b3-list-item__text")?.textContent?.trim();+ if (text) {+ return text;+ }+ }+ const match = slash.html.match(/<[^>]*class\s*=\s*["'][^"']*\bb3-list-item__text\b[^"']*["'][^>]*>([\s\S]*?)<\/[^>]+>/i);+ const text = match?.[1].replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();+ return text || slash.filter?.[0]?.trim() || slash.id;+};++let slashMenuCatalogSignature = "[]";++const normalizeSlashMenuCatalogSeparators = (nodes: IEntryCatalogNode[]) => {+ const result: IEntryCatalogNode[] = [];+ nodes.forEach((item) => {+ if (item.type === "separator" && (result.length === 0 || result[result.length - 1].type === "separator")) {+ return;+ }+ result.push(item);+ });+ if (result[result.length - 1]?.type === "separator") {+ result.pop();+ }+ return result;+};++export const refreshSlashMenuCatalog = (plugins: ISlashMenuCatalogPlugin[]) => {+ const signature = JSON.stringify(plugins.map((plugin) => ({+ name: plugin.name,+ displayName: plugin.displayName,+ items: plugin.protyleSlash.map((slash) => ({+ id: slash.id,+ html: slash.html,+ filter: slash.filter,+ })),+ })));+ if (signature === slashMenuCatalogSignature) {+ return;+ }+ const pluginNodes: IEntryCatalogNode[] = [];+ const pluginKeys = new Set<string>();+ plugins.forEach((plugin) => {+ plugin.protyleSlash.forEach((slash) => {+ const identityKey = getPluginSlashEntryKey(plugin.name, slash.id);+ if (pluginKeys.has(identityKey)) {+ return;+ }+ pluginKeys.add(identityKey);+ if (slash.html === "separator") {+ pluginNodes.push(separator(getPluginSlashEntryKey(plugin.name, slash.id, "separator")));+ } else {+ const pluginName = plugin.displayName?.trim() || plugin.name;+ pluginNodes.push(node(identityKey, literal(`${pluginName} - ${getPluginSlashEntryText(slash)}`)));+ }+ });+ });+ slashMenuRoot.children = normalizeSlashMenuCatalogSeparators(pluginNodes.length > 0+ ? [...slashMenuBuiltinChildren, separator("separator_6"), ...pluginNodes]+ : [...slashMenuBuiltinChildren]);+ slashMenuCatalogSignature = signature;+ rebuildCatalogIndexes();+};diff --git a/app/src/config/entryVisibility/order.test.ts b/app/src/config/entryVisibility/order.test.tsindex 5d9d656bc5..65bd8e1b5a 100644--- a/app/src/config/entryVisibility/order.test.ts+++ b/app/src/config/entryVisibility/order.test.ts@@ -1,6 +1,12 @@import * as assert from "node:assert/strict";import test from "node:test";-import {mergeEntryOrder, moveEntryOrder, reorderEntrySlots, resolveEntryOrder} from "./order";+import {+ mergeEntryOrder,+ mergeEntryOrderPreservingUnknown,+ moveEntryOrder,+ reorderEntrySlots,+ resolveEntryOrder,+} from "./order";test("entry order keeps custom order and inserts new entries by their default neighbors", () => {assert.deepEqual(mergeEntryOrder(["a", "new", "b", "c"], ["c", "a", "b"]), ["c", "a", "new", "b"]);@@ -24,6 +30,74 @@ test("entry order ignores unknown and duplicate keys", () => {assert.deepEqual(mergeEntryOrder(["a", "b", "c"], ["missing", "c", "c", "a"]), ["c", "a", "b"]);});+test("entry order can preserve an unknown plugin key and its slot", () => {+ assert.deepEqual(mergeEntryOrderPreservingUnknown(+ ["a", "b", "c"],+ ["c", "plugin.disabled", "a", "b"],+ ), ["c", "plugin.disabled", "a", "b"]);+});++test("entry order preserves the first slot of a duplicate unknown key", () => {+ assert.deepEqual(mergeEntryOrderPreservingUnknown(+ ["a", "b"],+ ["a", "plugin.disabled", "plugin.disabled", "b"],+ ), ["a", "plugin.disabled", "b"]);+});++test("entry order inserts a new known key by default neighbors while preserving unknown slots", () => {+ assert.deepEqual(mergeEntryOrderPreservingUnknown(+ ["a", "new", "b", "c"],+ ["c", "plugin.disabled", "a", "b"],+ ), ["c", "plugin.disabled", "a", "new", "b"]);+});++test("entry order applies a known reorder while preserving unknown slots", () => {+ assert.deepEqual(mergeEntryOrderPreservingUnknown(+ ["a", "b", "c"],+ ["a", "plugin.disabled", "b", "c"],+ ["c", "a", "b"],+ ), ["c", "plugin.disabled", "a", "b"]);+});++test("entry order remains valid when a disabled plugin and its separator return", () => {+ const knownOrder = ["a", "separator_1", "b", "c"];+ const savedOrder = ["plugin:name:item", "a", "separator_6", "b", "separator_1", "c"];+ const separators = new Set(["separator_1", "separator_6"]);+ const merged = mergeEntryOrderPreservingUnknown(+ ["a", "b", "separator_1", "c"],+ savedOrder,+ knownOrder,+ separators,+ );+ assert.deepEqual(merged.filter((key) => knownOrder.includes(key)), knownOrder);+ assert.deepEqual(merged.filter((key) => !knownOrder.includes(key)), ["plugin:name:item", "separator_6"]);+ assert.deepEqual(resolveEntryOrder(+ ["a", "b", "separator_1", "c", "separator_6", "plugin:name:item"],+ merged,+ separators,+ ), merged);+});++test("entry order preserves a disabled plugin-provided separator", () => {+ const knownOrder = ["a", "separator_1", "b", "c"];+ const pluginSeparator = "plugin-separator:name:group";+ const savedOrder = ["plugin:name:item", "a", pluginSeparator, "b", "separator_1", "c"];+ const separators = new Set(["separator_1", pluginSeparator]);+ const merged = mergeEntryOrderPreservingUnknown(+ ["a", "b", "separator_1", "c"],+ savedOrder,+ knownOrder,+ separators,+ );+ assert.deepEqual(merged.filter((key) => knownOrder.includes(key)), knownOrder);+ assert.deepEqual(merged.filter((key) => !knownOrder.includes(key)), ["plugin:name:item", pluginSeparator]);+ assert.deepEqual(resolveEntryOrder(+ ["a", "b", "separator_1", "c", pluginSeparator, "plugin:name:item"],+ merged,+ separators,+ ), merged);+});+test("entry order falls back when separators are adjacent or at an edge", () => {const separators = new Set(["s1", "s2"]);const defaults = ["a", "s1", "b", "s2", "c"];diff --git a/app/src/config/entryVisibility/order.ts b/app/src/config/entryVisibility/order.tsindex f4588974fb..e10c6d943a 100644--- a/app/src/config/entryVisibility/order.ts+++ b/app/src/config/entryVisibility/order.ts@@ -17,6 +17,66 @@ export const mergeEntryOrder = (defaultOrder: string[], savedOrder?: string[]) =return result;};+const findValidEntryOrderInterleave = (knownOrder: string[], unknownOrder: string[], slotKinds: boolean[],+ separatorKeys: Set<string>) => {+ const memo = new Map<string, string[] | null>();+ const visit = (knownIndex: number, unknownIndex: number, previousSeparator: boolean): string[] | undefined => {+ if (knownIndex === knownOrder.length && unknownIndex === unknownOrder.length) {+ return previousSeparator ? undefined : [];+ }+ const state = `${knownIndex}:${unknownIndex}:${previousSeparator ? 1 : 0}`;+ if (memo.has(state)) {+ return memo.get(state) || undefined;+ }+ const preferUnknown = slotKinds[knownIndex + unknownIndex] === true;+ const sources: Array<"known" | "unknown"> = preferUnknown ? ["unknown", "known"] : ["known", "unknown"];+ for (const source of sources) {+ const item = source === "known" ? knownOrder[knownIndex] : unknownOrder[unknownIndex];+ if (typeof item !== "string") {+ continue;+ }+ const separator = separatorKeys.has(item);+ if (separator && (knownIndex + unknownIndex === 0 || previousSeparator)) {+ continue;+ }+ const tail = source === "known"+ ? visit(knownIndex + 1, unknownIndex, separator)+ : visit(knownIndex, unknownIndex + 1, separator);+ if (tail) {+ const result = [item, ...tail];+ memo.set(state, result);+ return result;+ }+ }+ memo.set(state, null);+ return undefined;+ };+ return visit(0, 0, false);+};++export const mergeEntryOrderPreservingUnknown = (defaultOrder: string[], savedOrder?: string[],+ knownOrder?: string[], separatorKeys?: Set<string>) => {+ const knownKeys = new Set(defaultOrder);+ const mergedKnownOrder = mergeEntryOrder(defaultOrder, knownOrder ?? savedOrder);+ let knownIndex = 0;+ const savedUniqueOrder = (savedOrder || []).filter((key, index, order) => order.indexOf(key) === index);+ const result = savedUniqueOrder+ .map((key) => {+ if (!knownKeys.has(key)) {+ return key;+ }+ return mergedKnownOrder[knownIndex++];+ })+ .filter((key): key is string => typeof key === "string");+ result.push(...mergedKnownOrder.slice(knownIndex));+ if (separatorKeys && !isValidEntryOrder(result, separatorKeys)) {+ const unknownOrder = savedUniqueOrder.filter((key) => !knownKeys.has(key));+ const slotKinds = savedUniqueOrder.map((key) => !knownKeys.has(key));+ return findValidEntryOrderInterleave(mergedKnownOrder, unknownOrder, slotKinds, separatorKeys) || result;+ }+ return result;+};+export const isValidEntryOrder = (order: string[], separatorKeys: Set<string>) => {if (order.length === 0 || separatorKeys.has(order[0]) || separatorKeys.has(order[order.length - 1])) {return false;diff --git a/app/src/config/entryVisibility/ui.ts b/app/src/config/entryVisibility/ui.tsindex 90fac0bcf4..90772399fa 100644--- a/app/src/config/entryVisibility/ui.ts+++ b/app/src/config/entryVisibility/ui.ts@@ -9,6 +9,8 @@ import {getEntryPaths,IEntryCatalogNode,IEntryCatalogSection,+ isEntryOrderSortable,+ refreshSlashMenuCatalog,} from "./catalog";import {createEntryProfileSnapshot,@@ -20,7 +22,7 @@ import {isEntryVisible,saveEntryVisibility,} from "./runtime";-import {moveEntryOrder, resolveEntryOrder} from "./order";+import {mergeEntryOrderPreservingUnknown, moveEntryOrder, resolveEntryOrder} from "./order";type TImportFile = {type: "siyuan-entry-profile" | "siyuan-entry-profile-bundle";@@ -274,7 +276,7 @@ const renderEntryColumns = (profile: Config.IEntryVisibilityProfile, sectionKey:break;}columns.push(renderEntryColumn(profile, title, prefix, columnNodes, depth, selectedPaths,- parentEnabled, readOnly, !visiblePaths && section.sortable !== false && !readOnly));+ parentEnabled, readOnly, !visiblePaths && isEntryOrderSortable(prefix) && !readOnly));const selectedPath = selectedPaths[depth];const selectedNode = selectedPath && columnNodes.find((item) => `${prefix}.${item.key}` === selectedPath);if (!selectedNode?.children?.length) {@@ -329,6 +331,7 @@ const getEntrySearchFilter = (query: string) => {};const openProfileEditor = (root: HTMLElement, profileID?: string) => {+ refreshSlashMenuCatalog(window.siyuan.ws?.app?.plugins || []);const builtin = profileID === ENTRY_PROFILE_SIMPLE || profileID === ENTRY_PROFILE_FULL;const existing = profileID? window.siyuan.config.appearance.entryVisibility.profiles.find((item) => item.id === profileID)@@ -390,7 +393,7 @@ const openProfileEditor = (root: HTMLElement, profileID?: string) => {let selectedSectionKey = entryCatalog[0].key;let selectedPaths: string[] = [];let previousQuery = "";- let dragging: {parentPath: string; sourceKey: string; order?: string[]} | undefined;+ let dragging: {parentPath: string; sourceKey: string; defaultOrder?: string[]; order?: string[]} | undefined;const clearDropTarget = () => {browser.querySelectorAll(".config-entry-visibility__row--drop-before, .config-entry-visibility__row--drop-after").forEach((item) => item.classList.remove("config-entry-visibility__row--drop-before",@@ -482,6 +485,7 @@ const openProfileEditor = (root: HTMLElement, profileID?: string) => {return;}const nodes = getEntryCatalogChildren(dragging.parentPath) || [];+ dragging.defaultOrder = nodes.map((item) => item.key);const order = getProfileEntryOrder(draft, dragging.parentPath, nodes);const after = event.clientY >= row.getBoundingClientRect().top + row.offsetHeight / 2;const movedOrder = moveEntryOrder(order, dragging.sourceKey, row.dataset.entryKey, after,@@ -496,12 +500,25 @@ const openProfileEditor = (root: HTMLElement, profileID?: string) => {row.classList.add(`config-entry-visibility__row--drop-${after ? "after" : "before"}`);});browser.addEventListener("drop", (event: DragEvent) => {- if (!dragging?.order) {+ if (!dragging?.defaultOrder || !dragging.order) {return;}event.preventDefault();draft.orders ||= {};- draft.orders[dragging.parentPath] = dragging.order;+ const savedOrder = draft.orders[dragging.parentPath];+ const separatorKeys = new Set([+ ...(getEntryCatalogChildren(dragging.parentPath) || [])+ .filter((item) => item.type === "separator")+ .map((item) => item.key),+ ...(savedOrder || []).filter((key) =>+ key.startsWith("separator_") || key.startsWith("plugin-separator:")),+ ]);+ draft.orders[dragging.parentPath] = mergeEntryOrderPreservingUnknown(+ dragging.defaultOrder,+ savedOrder,+ dragging.order,+ separatorKeys,+ );dragging = undefined;renderBrowser();});@@ -677,6 +694,7 @@ export const genEntryVisibilityHtml = () => `<div class="b3-label config-item" d</div>`;export const mountEntryVisibility = (root: HTMLElement) => {+ refreshSlashMenuCatalog(window.siyuan.ws?.app?.plugins || []);renderProfileCards(root);root.querySelector("[data-action='create']")?.addEventListener("click", () => openProfileEditor(root));root.querySelector("[data-action='export-all']")?.addEventListener("click", exportBundle);diff --git a/app/src/protyle/hint/extend.ts b/app/src/protyle/hint/extend.tsindex 76cc2b797d..0e5197b38a 100644--- a/app/src/protyle/hint/extend.ts+++ b/app/src/protyle/hint/extend.ts@@ -21,6 +21,15 @@ import {genAssetHTML} from "../../asset/renderAssets";import {unicode2Emoji} from "../../emoji";import {avRender} from "../render/av/render";import {addWidgetCacheVersion} from "../util/widgetCache";+import {+ getEntryCatalogNode,+ getPluginSlashEntryKey,+ getSlashMenuEntryPath,+ refreshSlashMenuCatalog,+ SLASH_MENU_ROOT_PATH,+} from "../../config/entryVisibility/catalog";+import {getEntryOrder, isEntryVisible} from "../../config/entryVisibility/runtime";+import {resolveSlashMenuItems, TSlashMenuItem} from "./slashMenu";const getHotkeyOrMarker = (hotkey: string, marker: string) => {if (hotkey) {@@ -31,9 +40,8 @@ const getHotkeyOrMarker = (hotkey: string, marker: string) => {return "";};-export const hintSlash = (key: string, protyle: IProtyle, sourceOrHideConfiguredCreate: THintSource | boolean = false) => {- const hideConfiguredCreate = typeof sourceOrHideConfiguredCreate === "boolean" && sourceOrHideConfiguredCreate;- const allList: IHintData[] = [{+export const getBuiltinSlashMenuItems = (protyle: IProtyle): IHintData[] => {+ return [{filter: [window.siyuan.languages.template, "template", "模板", "moban", "muban", "mb"],id: "template",value: Constants.ZWSP,@@ -375,12 +383,27 @@ export const hintSlash = (key: string, protyle: IProtyle, sourceOrHideConfiguredid: "separator_6",html: "separator",}];+};++export const hintSlash = (key: string, protyle: IProtyle, sourceOrHideConfiguredCreate: THintSource | boolean = false) => {+ const enabled = isEntryVisible(SLASH_MENU_ROOT_PATH);+ if (!enabled) {+ return [];+ }+ const hideConfiguredCreate = typeof sourceOrHideConfiguredCreate === "boolean" && sourceOrHideConfiguredCreate;+ const builtinList = getBuiltinSlashMenuItems(protyle);+ const allList = builtinList.map<TSlashMenuItem>((item) => ({+ ...item,+ entryKey: item.id || "",+ }));let hasPlugin = false;protyle.app.plugins.forEach((plugin) => {plugin.protyleSlash.forEach(slash => {allList.push({filter: slash.filter,id: slash.id,+ entryKey: getPluginSlashEntryKey(plugin.name, slash.id,+ slash.html === "separator" ? "separator" : "entry"),value: `plugin${Constants.ZWSP}${plugin.name}${Constants.ZWSP}${slash.id}`,html: slash.html});@@ -390,24 +413,14 @@ export const hintSlash = (key: string, protyle: IProtyle, sourceOrHideConfiguredif (!hasPlugin) {allList.pop();}- const visibleList = hideConfiguredCreate ? allList.filter((item) => item.id !== "newFileRef") : allList;- if (key === "") {- return visibleList;- }- return visibleList.filter((item) => {- if (!item.filter) {- return false;- }- const match = item.filter.find((filter) => {- if (filter.toLowerCase().indexOf(key.toLowerCase()) > -1) {- return true;- }- });- if (match) {- return true;- } else {- return false;- }+ refreshSlashMenuCatalog(protyle.app.plugins);+ return resolveSlashMenuItems(allList.filter((item) =>+ getEntryCatalogNode(getSlashMenuEntryPath(item.entryKey))), {+ enabled,+ hideConfiguredCreate,+ key,+ order: getEntryOrder(SLASH_MENU_ROOT_PATH),+ visible: (entryKey) => isEntryVisible(getSlashMenuEntryPath(entryKey)),});};diff --git a/app/src/protyle/hint/slashMenu.test.ts b/app/src/protyle/hint/slashMenu.test.tsnew file mode 100644index 0000000000..a963aba7d8--- /dev/null+++ b/app/src/protyle/hint/slashMenu.test.ts@@ -0,0 +1,78 @@+import * as assert from "node:assert/strict";+import test from "node:test";+import {normalizeSlashMenuSeparators, resolveSlashMenuItems, TSlashMenuItem} from "./slashMenu";++const entry = (entryKey: string, filter = [entryKey]): TSlashMenuItem => ({+ entryKey,+ id: entryKey,+ value: entryKey,+ html: entryKey,+ filter,+});++const separator = (entryKey: string): TSlashMenuItem => ({+ entryKey,+ id: entryKey,+ value: "",+ html: "separator",+});++const resolve = (items: TSlashMenuItem[], options: Partial<Parameters<typeof resolveSlashMenuItems>[1]> = {}) =>+ resolveSlashMenuItems(items, {+ enabled: true,+ hideConfiguredCreate: false,+ key: "",+ order: items.map((item) => item.entryKey),+ visible: () => true,+ ...options,+ });++test("slash menu returns no items when its total switch is disabled", () => {+ assert.deepEqual(resolve([entry("a")], {enabled: false}), []);+});++test("slash menu applies configured order to entries and separators", () => {+ const items = [entry("a"), separator("separator_1"), entry("b")];+ assert.deepEqual(resolve(items, {order: ["b", "separator_1", "a"]}).map((item) => item.entryKey),+ ["b", "separator_1", "a"]);+});++test("slash menu removes empty groups after visibility filtering", () => {+ const items = [separator("separator_1"), entry("a"), separator("separator_2"),+ separator("separator_3"), entry("b"), separator("separator_4")];+ assert.deepEqual(resolve(items, {visible: (entryKey) => entryKey === "b"}).map((item) => item.entryKey), ["b"]);+ assert.deepEqual(resolve(items, {visible: () => false}), []);+});++test("slash menu search and document-create conditions keep hidden entries out", () => {+ const items = [entry("newFileRef", ["document"]), separator("separator_1"),+ entry("visible", ["document"]), entry("other", ["other"])];+ assert.deepEqual(resolve(items, {hideConfiguredCreate: true, key: "doc"}).map((item) => item.entryKey),+ ["visible"]);+});++test("slash menu keeps the first item for a duplicate plugin entry key", () => {+ const first = entry("plugin:name:item", ["first"]);+ const duplicate = {...entry("plugin:name:item", ["duplicate"]), value: "duplicate"};+ assert.deepEqual(resolve([first, duplicate]), [first]);+});++test("slash menu keeps identical item IDs from different plugins independently configurable", () => {+ const first = {...entry("plugin:first:insert", ["first"]), id: "insert"};+ const second = {...entry("plugin:second:insert", ["second"]), id: "insert"};+ assert.deepEqual(resolve([first, second], {+ order: [second.entryKey, first.entryKey],+ visible: (entryKey) => entryKey !== first.entryKey,+ }), [second]);+});++test("slash menu keeps a plugin item whose ID matches the conditional built-in item", () => {+ const builtin = entry("newFileRef");+ const plugin = {...entry("plugin:name:newFileRef"), id: "newFileRef"};+ assert.deepEqual(resolve([builtin, plugin], {hideConfiguredCreate: true}), [plugin]);+});++test("slash menu separator normalization removes leading, trailing, and consecutive separators", () => {+ const items = [separator("s1"), entry("a"), separator("s2"), separator("s3"), entry("b"), separator("s4")];+ assert.deepEqual(normalizeSlashMenuSeparators(items).map((item) => item.entryKey), ["a", "s2", "b"]);+});diff --git a/app/src/protyle/hint/slashMenu.ts b/app/src/protyle/hint/slashMenu.tsnew file mode 100644index 0000000000..b96f46cddc--- /dev/null+++ b/app/src/protyle/hint/slashMenu.ts@@ -0,0 +1,52 @@+import {reorderEntrySlots} from "../../config/entryVisibility/order";++export type TSlashMenuItem = IHintData & {+ entryKey: string;+};++interface IResolveSlashMenuOptions {+ enabled: boolean;+ hideConfiguredCreate: boolean;+ key: string;+ order: string[];+ visible: (entryKey: string) => boolean;+}++const isSeparator = (item?: TSlashMenuItem) => item?.html === "separator";++export const normalizeSlashMenuSeparators = (items: TSlashMenuItem[]) => {+ const result: TSlashMenuItem[] = [];+ items.forEach((item) => {+ if (isSeparator(item)) {+ if (result.length > 0 && !isSeparator(result[result.length - 1])) {+ result.push(item);+ }+ return;+ }+ result.push(item);+ });+ if (isSeparator(result[result.length - 1])) {+ result.pop();+ }+ return result;+};++export const resolveSlashMenuItems = (items: TSlashMenuItem[], options: IResolveSlashMenuOptions) => {+ if (!options.enabled) {+ return [];+ }+ const entryKeys = new Set<string>();+ const uniqueItems = items.filter((item) => {+ if (entryKeys.has(item.entryKey)) {+ return false;+ }+ entryKeys.add(item.entryKey);+ return true;+ });+ const orderedItems = reorderEntrySlots(uniqueItems, options.order, (item) => item.entryKey);+ const visibleItems = orderedItems.filter((item) => isSeparator(item) ||+ (options.visible(item.entryKey) && !(options.hideConfiguredCreate && item.entryKey === "newFileRef")));+ const filteredItems = options.key === "" ? visibleItems : visibleItems.filter((item) => item.filter?.some((filter) =>+ filter.toLowerCase().includes(options.key.toLowerCase())));+ return normalizeSlashMenuSeparators(filteredItems);+};