Skip to content

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

:sparkles: Support customizing the editor toolbar https://github.com/siyuan-note/siyuan/issues/12731

Danieldf7ce71a80d5
diff --git a/app/appearance/langs/ar.json b/app/appearance/langs/ar.json
index 46ff4b25fc..a292daa415 100644
--- a/app/appearance/langs/ar.json
+++ b/app/appearance/langs/ar.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "شريط الأدوات",
"appMenuAbout": "حول SiYuan",
"appMenuServices": "الخدمات",
"appMenuHide": "إخفاء SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "قائمة العناصر السطرية",
"entrySubmenu": "قائمة فرعية",
"splitMergedCellTip": "يجب تقسيم الخلايا المدمجة أولاً",
- "entryVisibility": "القوائم وشريط الإرساء",
- "entryVisibilityTip": "اضبط إظهار وترتيب عناصر قوائم سطح المكتب المضمنة، واضبط إظهار أيقونات شريط الإرساء",
+ "entryVisibility": "القوائم وشريط الأدوات وشريط الإرساء",
+ "entryVisibilityTip": "اضبط إظهار وترتيب عناصر قوائم سطح المكتب وشريط الأدوات المضمنة، واضبط إظهار أيقونات شريط الإرساء",
"entrySimple": "مبسّط",
"entryFull": "كامل",
"entrySimpleTip": "يعرض العناصر شائعة الاستخدام لمساعدة المستخدمين الجدد على البدء بسرعة",
diff --git a/app/appearance/langs/de.json b/app/appearance/langs/de.json
index f51b1a7519..7731929450 100644
--- a/app/appearance/langs/de.json
+++ b/app/appearance/langs/de.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Symbolleiste",
"appMenuAbout": "Über SiYuan",
"appMenuServices": "Dienste",
"appMenuHide": "SiYuan ausblenden",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Inline-Element-Menü",
"entrySubmenu": "Untermenü",
"splitMergedCellTip": "Zusammengeführte Zellen müssen zuerst geteilt werden",
- "entryVisibility": "Menüs und Dock",
- "entryVisibilityTip": "Konfigurieren Sie die Sichtbarkeit und Reihenfolge integrierter Desktop-Menüeinträge sowie die Sichtbarkeit der Dock-Symbole",
+ "entryVisibility": "Menüs, Symbolleiste und Dock",
+ "entryVisibilityTip": "Konfigurieren Sie die Sichtbarkeit und Reihenfolge integrierter Desktop-Menü- und Symbolleisteneinträge 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.json
index 528f9fbf42..cbe565cb4c 100644
--- a/app/appearance/langs/en.json
+++ b/app/appearance/langs/en.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Toolbar",
"appMenuAbout": "About SiYuan",
"appMenuServices": "Services",
"appMenuHide": "Hide SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Inline element menu",
"entrySubmenu": "Submenu",
"splitMergedCellTip": "Split merged cells first",
- "entryVisibility": "Menus and dock",
- "entryVisibilityTip": "Configure the visibility and order of built-in desktop menu items, and the visibility of dock icons",
+ "entryVisibility": "Menus, toolbar and dock",
+ "entryVisibilityTip": "Configure the visibility and order of built-in desktop menu and toolbar 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.json
index 4ed75fa9af..18b7479cdb 100644
--- a/app/appearance/langs/es.json
+++ b/app/appearance/langs/es.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Barra de herramientas",
"appMenuAbout": "Acerca de SiYuan",
"appMenuServices": "Servicios",
"appMenuHide": "Ocultar SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menú de elementos en línea",
"entrySubmenu": "Submenú",
"splitMergedCellTip": "Primero hay que dividir las celdas combinadas",
- "entryVisibility": "Menús y panel acoplable",
- "entryVisibilityTip": "Configura la visibilidad y el orden de los elementos integrados de los menús de escritorio, así como la visibilidad de los iconos del panel acoplable",
+ "entryVisibility": "Menús, barra de herramientas y panel acoplable",
+ "entryVisibilityTip": "Configura la visibilidad y el orden de los elementos integrados de los menús y la barra de herramientas del escritorio, 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.json
index c903cc1ee3..bc41bdc3c1 100644
--- a/app/appearance/langs/fr.json
+++ b/app/appearance/langs/fr.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Barre d’outils",
"appMenuAbout": "À propos de SiYuan",
"appMenuServices": "Services",
"appMenuHide": "Masquer SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menu des éléments en ligne",
"entrySubmenu": "Sous-menu",
"splitMergedCellTip": "Les cellules fusionnées doivent d'abord être fractionnées",
- "entryVisibility": "Menus et barre d'ancrage",
- "entryVisibilityTip": "Configurez la visibilité et l’ordre des éléments intégrés des menus de bureau, ainsi que la visibilité des icônes de la barre d’ancrage",
+ "entryVisibility": "Menus, barre d’outils et barre d’ancrage",
+ "entryVisibilityTip": "Configurez la visibilité et l’ordre des éléments intégrés des menus et de la barre d’outils du bureau, 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.json
index f8897ee968..88c30d0a25 100644
--- a/app/appearance/langs/he.json
+++ b/app/appearance/langs/he.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "סרגל כלים",
"appMenuAbout": "אודות SiYuan",
"appMenuServices": "שירותים",
"appMenuHide": "הסתר את SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "תפריט רכיבים בשורה",
"entrySubmenu": "תפריט משנה",
"splitMergedCellTip": "יש לפצל תחילה תאים ממוזגים",
- "entryVisibility": "תפריטים וסרגל עגינה",
- "entryVisibilityTip": "הגדרת הנראות והסדר של פריטי תפריט שולחן העבודה המובנים והנראות של סמלי סרגל העגינה",
+ "entryVisibility": "תפריטים, סרגל כלים וסרגל עגינה",
+ "entryVisibilityTip": "הגדרת הנראות והסדר של פריטי התפריט וסרגל הכלים המובנים בשולחן העבודה, והנראות של סמלי סרגל העגינה",
"entrySimple": "פשוט",
"entryFull": "מלא",
"entrySimpleTip": "מציג פריטים נפוצים כדי לעזור למשתמשים חדשים להתחיל במהירות",
diff --git a/app/appearance/langs/hi.json b/app/appearance/langs/hi.json
index c9015ee951..6c02897f07 100644
--- a/app/appearance/langs/hi.json
+++ b/app/appearance/langs/hi.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "टूलबार",
"appMenuAbout": "SiYuan के बारे में",
"appMenuServices": "सेवाएँ",
"appMenuHide": "SiYuan छिपाएँ",
@@ -194,8 +195,8 @@
"entryInlineMenu": "इनलाइन तत्व मेनू",
"entrySubmenu": "उपमेनू",
"splitMergedCellTip": "पहले मर्ज किए गए सेल विभाजित करें",
- "entryVisibility": "मेनू और डॉक",
- "entryVisibilityTip": "डेस्कटॉप के अंतर्निहित मेनू आइटम की दृश्यता व क्रम तथा डॉक आइकन की दृश्यता कॉन्फ़िगर करें",
+ "entryVisibility": "मेनू, टूलबार और डॉक",
+ "entryVisibilityTip": "डेस्कटॉप के अंतर्निहित मेनू और टूलबार आइटम की दृश्यता व क्रम तथा डॉक आइकन की दृश्यता कॉन्फ़िगर करें",
"entrySimple": "सरल",
"entryFull": "पूर्ण",
"entrySimpleTip": "नए उपयोगकर्ताओं को जल्दी शुरू करने के लिए आम तौर पर उपयोग की जाने वाली प्रविष्टियाँ दिखाता है",
diff --git a/app/appearance/langs/id.json b/app/appearance/langs/id.json
index f187d2ba5c..5c42746394 100644
--- a/app/appearance/langs/id.json
+++ b/app/appearance/langs/id.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Bilah alat",
"appMenuAbout": "Tentang SiYuan",
"appMenuServices": "Layanan",
"appMenuHide": "Sembunyikan SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menu elemen sebaris",
"entrySubmenu": "Submenu",
"splitMergedCellTip": "Pisahkan sel yang digabungkan terlebih dahulu",
- "entryVisibility": "Menu dan dok",
- "entryVisibilityTip": "Atur visibilitas dan urutan item menu desktop bawaan, serta visibilitas ikon dok",
+ "entryVisibility": "Menu, bilah alat, dan dok",
+ "entryVisibilityTip": "Atur visibilitas dan urutan item menu dan bilah alat desktop bawaan, 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.json
index 6b573fea44..cb9b9de614 100644
--- a/app/appearance/langs/it.json
+++ b/app/appearance/langs/it.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Barra degli strumenti",
"appMenuAbout": "Informazioni su SiYuan",
"appMenuServices": "Servizi",
"appMenuHide": "Nascondi SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menu degli elementi in linea",
"entrySubmenu": "Sottomenu",
"splitMergedCellTip": "Prima dividi le celle unite",
- "entryVisibility": "Menu e barra di ancoraggio",
- "entryVisibilityTip": "Configura la visibilità e l'ordine delle voci integrate dei menu desktop, nonché la visibilità delle icone della barra di ancoraggio",
+ "entryVisibility": "Menu, barra degli strumenti e barra di ancoraggio",
+ "entryVisibilityTip": "Configura la visibilità e l'ordine delle voci integrate dei menu e della barra degli strumenti desktop, 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.json
index 398cc487e0..0806298cd7 100644
--- a/app/appearance/langs/ja.json
+++ b/app/appearance/langs/ja.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "ツールバー",
"appMenuAbout": "SiYuan について",
"appMenuServices": "サービス",
"appMenuHide": "SiYuan を隠す",
@@ -194,8 +195,8 @@
"entryInlineMenu": "インライン要素メニュー",
"entrySubmenu": "サブメニュー",
"splitMergedCellTip": "先に結合セルを分割する必要があります",
- "entryVisibility": "メニューとドック",
- "entryVisibilityTip": "デスクトップの組み込みメニュー項目の表示と順序、およびドックアイコンの表示を設定します",
+ "entryVisibility": "メニュー、ツールバー、ドック",
+ "entryVisibilityTip": "デスクトップの組み込みメニュー項目とツールバー項目の表示と順序、およびドックアイコンの表示を設定します",
"entrySimple": "シンプル",
"entryFull": "完全",
"entrySimpleTip": "よく使う項目を表示し、すぐに使い始められる構成",
diff --git a/app/appearance/langs/ko.json b/app/appearance/langs/ko.json
index 421e08c233..0206d82513 100644
--- a/app/appearance/langs/ko.json
+++ b/app/appearance/langs/ko.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "도구 모음",
"appMenuAbout": "SiYuan 정보",
"appMenuServices": "서비스",
"appMenuHide": "SiYuan 숨기기",
@@ -194,8 +195,8 @@
"entryInlineMenu": "인라인 요소 메뉴",
"entrySubmenu": "하위 메뉴",
"splitMergedCellTip": "먼저 병합된 셀을 분할해야 합니다",
- "entryVisibility": "메뉴 및 도크",
- "entryVisibilityTip": "데스크톱 기본 메뉴 항목의 표시 여부 및 순서와 도크 아이콘의 표시 여부를 설정합니다",
+ "entryVisibility": "메뉴, 도구 모음 및 도크",
+ "entryVisibilityTip": "데스크톱 기본 메뉴 및 도구 모음 항목의 표시 여부와 순서, 도크 아이콘의 표시 여부를 설정합니다",
"entrySimple": "간단",
"entryFull": "전체",
"entrySimpleTip": "자주 사용하는 항목을 표시해 새 사용자가 빠르게 시작할 수 있도록 함",
diff --git a/app/appearance/langs/nl.json b/app/appearance/langs/nl.json
index f0cb008e38..da531001dc 100644
--- a/app/appearance/langs/nl.json
+++ b/app/appearance/langs/nl.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Werkbalk",
"appMenuAbout": "Over SiYuan",
"appMenuServices": "Voorzieningen",
"appMenuHide": "Verberg SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menu voor inline-elementen",
"entrySubmenu": "Submenu",
"splitMergedCellTip": "Splits eerst de samengevoegde cellen",
- "entryVisibility": "Menu's en dock",
- "entryVisibilityTip": "Configureer de zichtbaarheid en volgorde van ingebouwde desktopmenu-items en de zichtbaarheid van dockpictogrammen",
+ "entryVisibility": "Menu's, werkbalk en dock",
+ "entryVisibilityTip": "Configureer de zichtbaarheid en volgorde van ingebouwde desktopmenu- en werkbalkitems 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.json
index dd90a996bd..9e1370afb7 100644
--- a/app/appearance/langs/pl.json
+++ b/app/appearance/langs/pl.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Pasek narzędzi",
"appMenuAbout": "O programie SiYuan",
"appMenuServices": "Usługi",
"appMenuHide": "Ukryj SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menu elementów wbudowanych",
"entrySubmenu": "Podmenu",
"splitMergedCellTip": "Najpierw podziel scalone komórki",
- "entryVisibility": "Menu i dok",
- "entryVisibilityTip": "Skonfiguruj widoczność i kolejność wbudowanych elementów menu pulpitu, a także widoczność ikon doku",
+ "entryVisibility": "Menu, pasek narzędzi i dok",
+ "entryVisibilityTip": "Skonfiguruj widoczność i kolejność wbudowanych elementów menu i paska narzędzi pulpitu, 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.json
index 56862ba210..b8109b872c 100644
--- a/app/appearance/langs/pt-BR.json
+++ b/app/appearance/langs/pt-BR.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Barra de ferramentas",
"appMenuAbout": "Sobre o SiYuan",
"appMenuServices": "Serviços",
"appMenuHide": "Ocultar SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Menu de elementos em linha",
"entrySubmenu": "Submenu",
"splitMergedCellTip": "Divida primeiro as células mescladas",
- "entryVisibility": "Menus e dock",
- "entryVisibilityTip": "Configure a visibilidade e a ordem dos itens integrados dos menus da área de trabalho, bem como a visibilidade dos ícones do dock",
+ "entryVisibility": "Menus, barra de ferramentas e dock",
+ "entryVisibilityTip": "Configure a visibilidade e a ordem dos itens integrados dos menus e da barra de ferramentas da área de trabalho, 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.json
index 84c71a6dfa..e06a7292e9 100644
--- a/app/appearance/langs/ru.json
+++ b/app/appearance/langs/ru.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Панель инструментов",
"appMenuAbout": "О программе SiYuan",
"appMenuServices": "Службы",
"appMenuHide": "Скрыть SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Меню строчных элементов",
"entrySubmenu": "Подменю",
"splitMergedCellTip": "Сначала разделите объединённые ячейки",
- "entryVisibility": "Меню и док-панель",
- "entryVisibilityTip": "Настройте видимость и порядок встроенных пунктов меню рабочего стола, а также видимость значков док-панели",
+ "entryVisibility": "Меню, панель инструментов и док-панель",
+ "entryVisibilityTip": "Настройте видимость и порядок встроенных пунктов меню и панели инструментов рабочего стола, а также видимость значков док-панели",
"entrySimple": "Простой",
"entryFull": "Полный",
"entrySimpleTip": "Показывает часто используемые пункты, чтобы быстрее начать работу",
diff --git a/app/appearance/langs/sk.json b/app/appearance/langs/sk.json
index e609c8ce19..1f0ad02c96 100644
--- a/app/appearance/langs/sk.json
+++ b/app/appearance/langs/sk.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Panel s nástrojmi",
"appMenuAbout": "O aplikácii SiYuan",
"appMenuServices": "Služby",
"appMenuHide": "Skryť SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Ponuka vnorených prvkov",
"entrySubmenu": "Podponuka",
"splitMergedCellTip": "Najprv rozdeľte zlúčené bunky",
- "entryVisibility": "Ponuky a dok",
- "entryVisibilityTip": "Nastavte viditeľnosť a poradie vstavaných položiek ponúk na pracovnej ploche, ako aj viditeľnosť ikon doku",
+ "entryVisibility": "Ponuky, panel s nástrojmi a dok",
+ "entryVisibilityTip": "Nastavte viditeľnosť a poradie vstavaných položiek ponúk a panela s nástrojmi na pracovnej ploche, 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.json
index 2bea2741be..41d3249029 100644
--- a/app/appearance/langs/th.json
+++ b/app/appearance/langs/th.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "แถบเครื่องมือ",
"appMenuAbout": "เกี่ยวกับ SiYuan",
"appMenuServices": "บริการ",
"appMenuHide": "ซ่อน SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "เมนูองค์ประกอบอินไลน์",
"entrySubmenu": "เมนูย่อย",
"splitMergedCellTip": "ต้องแยกเซลล์ที่ผสานก่อน",
- "entryVisibility": "เมนูและแถบเชื่อมต่อ",
- "entryVisibilityTip": "กำหนดการแสดงผลและลำดับของรายการเมนูเดสก์ท็อปในตัว ตลอดจนการแสดงผลของไอคอนแถบเชื่อมต่อ",
+ "entryVisibility": "เมนู แถบเครื่องมือ และแถบเชื่อมต่อ",
+ "entryVisibilityTip": "กำหนดการแสดงผลและลำดับของรายการเมนูและแถบเครื่องมือเดสก์ท็อปในตัว ตลอดจนการแสดงผลของไอคอนแถบเชื่อมต่อ",
"entrySimple": "เรียบง่าย",
"entryFull": "ครบถ้วน",
"entrySimpleTip": "แสดงรายการที่ใช้บ่อยเพื่อช่วยให้ผู้ใช้ใหม่เริ่มต้นได้อย่างรวดเร็ว",
diff --git a/app/appearance/langs/tr.json b/app/appearance/langs/tr.json
index d1f103d94a..be5a7affdd 100644
--- a/app/appearance/langs/tr.json
+++ b/app/appearance/langs/tr.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Araç çubuğu",
"appMenuAbout": "SiYuan Hakkında",
"appMenuServices": "Hizmetler",
"appMenuHide": "SiYuan'ı Gizle",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Satır içi öğe menüsü",
"entrySubmenu": "Alt menü",
"splitMergedCellTip": "Önce birleştirilmiş hücreleri bölün",
- "entryVisibility": "Menüler ve yuva",
- "entryVisibilityTip": "Yerleşik masaüstü menü öğelerinin görünürlüğünü ve sırasını, ayrıca yuva simgelerinin görünürlüğünü yapılandırın",
+ "entryVisibility": "Menüler, araç çubuğu ve yuva",
+ "entryVisibilityTip": "Yerleşik masaüstü menü ve araç çubuğu öğelerinin 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.json
index db6786fc4c..9ff4ea8f82 100644
--- a/app/appearance/langs/uk.json
+++ b/app/appearance/langs/uk.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "Панель інструментів",
"appMenuAbout": "Про SiYuan",
"appMenuServices": "Служби",
"appMenuHide": "Сховати SiYuan",
@@ -194,8 +195,8 @@
"entryInlineMenu": "Меню рядкових елементів",
"entrySubmenu": "Підменю",
"splitMergedCellTip": "Спочатку розділіть об’єднані комірки",
- "entryVisibility": "Меню та док-панель",
- "entryVisibilityTip": "Налаштуйте видимість і порядок вбудованих пунктів меню робочого столу, а також видимість піктограм док-панелі",
+ "entryVisibility": "Меню, панель інструментів і док-панель",
+ "entryVisibilityTip": "Налаштуйте видимість і порядок вбудованих пунктів меню та панелі інструментів робочого столу, а також видимість піктограм док-панелі",
"entrySimple": "Простий",
"entryFull": "Повний",
"entrySimpleTip": "Показує часто використовувані пункти, щоб швидше почати роботу",
diff --git a/app/appearance/langs/zh-CN.json b/app/appearance/langs/zh-CN.json
index e7bdd238d5..c4298488af 100644
--- a/app/appearance/langs/zh-CN.json
+++ b/app/appearance/langs/zh-CN.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "工具栏",
"appMenuAbout": "关于思源笔记",
"appMenuServices": "服务",
"appMenuHide": "隐藏思源笔记",
@@ -194,8 +195,8 @@
"entryInlineMenu": "行级元素菜单",
"entrySubmenu": "子菜单",
"splitMergedCellTip": "需要先拆分合并的单元格",
- "entryVisibility": "菜单与停靠栏",
- "entryVisibilityTip": "配置桌面端内置菜单项的显隐与排序,以及停靠栏图标的显隐",
+ "entryVisibility": "菜单、工具栏与停靠栏",
+ "entryVisibilityTip": "配置桌面端内置菜单项与工具栏项的显隐与排序,以及停靠栏图标的显隐",
"entrySimple": "简洁方案",
"entryFull": "完整方案",
"entrySimpleTip": "显示常用入口,适合新用户快速上手",
diff --git a/app/appearance/langs/zh-TW.json b/app/appearance/langs/zh-TW.json
index c08159baa1..9574d8cffa 100644
--- a/app/appearance/langs/zh-TW.json
+++ b/app/appearance/langs/zh-TW.json
@@ -1,4 +1,5 @@
{
+ "entryToolbar": "工具列",
"appMenuAbout": "關於思源筆記",
"appMenuServices": "服務",
"appMenuHide": "隱藏思源筆記",
@@ -194,8 +195,8 @@
"entryInlineMenu": "行級元素菜單",
"entrySubmenu": "子菜單",
"splitMergedCellTip": "需要先拆分合併的單元格",
- "entryVisibility": "選單與停靠欄",
- "entryVisibilityTip": "設定桌面端內建選單項目的顯示與排序,以及停靠欄圖示的顯示",
+ "entryVisibility": "選單、工具列與停靠欄",
+ "entryVisibilityTip": "設定桌面端內建選單項目與工具列項目的顯示與排序,以及停靠欄圖示的顯示",
"entrySimple": "簡潔方案",
"entryFull": "完整方案",
"entrySimpleTip": "顯示常用入口,適合新使用者快速上手",
diff --git a/app/src/assets/scss/business/_config.scss b/app/src/assets/scss/business/_config.scss
index b6399e9cf0..7d4e6e8b77 100644
--- a/app/src/assets/scss/business/_config.scss
+++ b/app/src/assets/scss/business/_config.scss
@@ -1004,7 +1004,7 @@
&--toggleable {
cursor: pointer;
- &:has([data-entry-readonly]),
+ &.config-entry-visibility__row--readonly,
&.config-entry-visibility__row--disabled {
cursor: not-allowed;
}
diff --git a/app/src/config/entryVisibility/catalog.test.ts b/app/src/config/entryVisibility/catalog.test.ts
index 7bc46b40f0..a33e865a8d 100644
--- a/app/src/config/entryVisibility/catalog.test.ts
+++ b/app/src/config/entryVisibility/catalog.test.ts
@@ -2,6 +2,7 @@ import * as assert from "node:assert/strict";
import {readFileSync} from "node:fs";
import {resolve} from "node:path";
import test from "node:test";
+import {DESKTOP_TOOLBAR_ENTRIES, TOOLBAR_ENTRY_ROOT_PATH} from "../../protyle/toolbar/defaults";
import {
entryCatalog,
getEntryCatalogChildren,
@@ -94,9 +95,7 @@ test("entry catalog paths are unique and indexed", () => {
const visit = (prefix: string, nodes: typeof entryCatalog[number]["children"]) => {
nodes.forEach((item) => {
const path = `${prefix}.${item.key}`;
- if (item.type === "entry") {
- paths.push(path);
- }
+ paths.push(path);
assert.equal(getEntryCatalogNode(path), item);
assert.equal(getEntryParentPath(path), prefix);
if (item.children) {
@@ -109,6 +108,13 @@ test("entry catalog paths are unique and indexed", () => {
assert.deepEqual(new Set(getEntryPaths()), new Set(paths));
});
+test("toolbar catalog follows the default toolbar declaration", () => {
+ const children = getEntryCatalogChildren(TOOLBAR_ENTRY_ROOT_PATH);
+ assert.deepEqual(children.map((item) => item.key), DESKTOP_TOOLBAR_ENTRIES.map((item) => item.key));
+ assert.equal(children.filter((item) => item.type === "separator").length, 2);
+ assert.equal(children.every((item) => item.simple), true);
+});
+
test("slash menu catalog follows the built-in hint order", () => {
const section = getEntryCatalogSection("editor.slash");
assert.deepEqual(section?.children.map((item) => item.key), ["menu"]);
@@ -263,6 +269,7 @@ test("entry order sortability follows its section and parent entry", () => {
assert.equal(isEntryOrderSortable("missing"), false);
assert.equal(getEntryOrderParents().includes("editor.slash"), false);
assert.equal(getEntryOrderParents().includes(SLASH_MENU_ROOT_PATH), true);
+ assert.equal(getEntryOrderParents().includes(TOOLBAR_ENTRY_ROOT_PATH), true);
});
test("conditional block resource menus have distinct configuration labels", () => {
diff --git a/app/src/config/entryVisibility/catalog.ts b/app/src/config/entryVisibility/catalog.ts
index 6f4510731f..1e104bfdc8 100644
--- a/app/src/config/entryVisibility/catalog.ts
+++ b/app/src/config/entryVisibility/catalog.ts
@@ -1,4 +1,5 @@
import {CODE_TAB_SPACE_VALUES} from "../../protyle/wysiwyg/codeBlockUtil";
+import {DESKTOP_TOOLBAR_ENTRIES, TOOLBAR_ENTRY_ROOT_PATH} from "../../protyle/toolbar/defaults";
export interface IEntryCatalogNode {
key: string;
@@ -412,6 +413,10 @@ const gutterSingle = () => [
export const SLASH_MENU_ROOT_PATH = "editor.slash.menu";
+const toolbarBuiltinChildren = DESKTOP_TOOLBAR_ENTRIES.map((item) => item.separator
+ ? separator(item.key)
+ : node(item.key, lang(item.lang)));
+
const slashMenuBuiltinChildren = [
node("template", lang("template")),
node("widget", lang("widget")),
@@ -667,6 +672,11 @@ export const entryCatalog: IEntryCatalogSection[] = [
node("docInfo", lang("entryDocumentStatistics"), false),
],
},
+ {
+ key: TOOLBAR_ENTRY_ROOT_PATH,
+ label: location(lang("editor"), lang("entryToolbar")),
+ children: toolbarBuiltinChildren,
+ },
{
key: "editor.slash",
label: location(lang("editor"), lang("entrySlashMenu")),
@@ -902,9 +912,7 @@ rebuildCatalogIndexes();
export const getEntryCatalogNode = (path: string) => entryMap.get(path);
export const getEntryParentPath = (path: string) => parentMap.get(path);
-export const getEntryPaths = () => Array.from(entryMap.entries())
- .filter(([, item]) => item.type === "entry")
- .map(([path]) => path);
+export const getEntryPaths = () => Array.from(entryMap.keys());
export const getEntryCatalogSection = (key: string) => sectionMap.get(key);
export const getEntryCatalogChildren = (path: string) => childrenMap.get(path);
export const isEntryOrderSortable = (parentPath: string) => {
diff --git a/app/src/config/entryVisibility/runtime.ts b/app/src/config/entryVisibility/runtime.ts
index bfd9c21a3b..1335d87dd5 100644
--- a/app/src/config/entryVisibility/runtime.ts
+++ b/app/src/config/entryVisibility/runtime.ts
@@ -10,6 +10,8 @@ import {
import {reorderEntrySlots, resolveEntryOrder} from "./order";
import {getDocTreeEntryScope} from "./docTreeScope";
import {getProfileEntryVisibility} from "./profile";
+import {TOOLBAR_ENTRY_ROOT_PATH} from "../../protyle/toolbar/defaults";
+import {resolveToolbarItems} from "../../protyle/toolbar/entryVisibility";
export const ENTRY_VISIBILITY_VERSION = 3;
export const ENTRY_PROFILE_SIMPLE = "simple";
@@ -189,11 +191,17 @@ const sortMenuItems = (itemsElement: Element, prefix: string) => {
const filterMenuItems = (itemsElement: Element, prefix: string) => {
Array.from(itemsElement.children).forEach((item) => {
+ const id = item.getAttribute("data-id");
+ const path = id ? `${prefix}.${id}` : "";
+ if (item.classList.contains("b3-menu__separator")) {
+ if (path && getEntryCatalogNode(path) && !isEntryVisible(path)) {
+ item.remove();
+ }
+ return;
+ }
if (!item.classList.contains("b3-menu__item")) {
return;
}
- const id = item.getAttribute("data-id");
- const path = id ? `${prefix}.${id}` : "";
if (path && getEntryCatalogNode(path) && !isEntryVisible(path)) {
item.remove();
return;
@@ -240,11 +248,36 @@ export const applyDockEntryVisibility = () => {
/// #endif
};
+export const applyToolbarEntryVisibility = (toolbarElement: HTMLElement) => {
+ /// #if !MOBILE
+ const children = Array.from(toolbarElement.children) as HTMLElement[];
+ const resolveKey = (item: HTMLElement) => {
+ const id = item.dataset.id;
+ return id && getEntryCatalogNode(`${TOOLBAR_ENTRY_ROOT_PATH}.${id}`) ? id : undefined;
+ };
+ const result = resolveToolbarItems(children, {
+ getKey: resolveKey,
+ isSeparator: (item) => item.classList.contains("protyle-toolbar__divider"),
+ isVisible: (key) => isEntryVisible(`${TOOLBAR_ENTRY_ROOT_PATH}.${key}`),
+ order: getEntryOrder(TOOLBAR_ENTRY_ROOT_PATH),
+ });
+ result.ordered.forEach((item) => toolbarElement.append(item));
+ const visibleItems = new Set(result.visible);
+ result.ordered.forEach((item) => item.classList.toggle("fn__none", !visibleItems.has(item)));
+ const empty = !result.visible.some((item) => item.classList.contains("protyle-toolbar__item"));
+ toolbarElement.toggleAttribute("data-entry-empty", empty);
+ if (empty) {
+ toolbarElement.classList.add("fn__none");
+ }
+ /// #endif
+};
+
const applyEntryVisibilityLocal = (config: Config.IEntryVisibility) => {
window.siyuan.config.appearance.entryVisibility = config;
/// #if !MOBILE
window.siyuan.menus?.menu?.remove();
applyDockEntryVisibility();
+ document.querySelectorAll<HTMLElement>(".protyle-toolbar").forEach(applyToolbarEntryVisibility);
window.dispatchEvent(new CustomEvent("siyuan-entry-visibility"));
/// #endif
};
diff --git a/app/src/config/entryVisibility/ui.ts b/app/src/config/entryVisibility/ui.ts
index 300ff7fb60..5ea7bdaf66 100644
--- a/app/src/config/entryVisibility/ui.ts
+++ b/app/src/config/entryVisibility/ui.ts
@@ -194,9 +194,12 @@ const orderEntryNodes = (profile: Config.IEntryVisibilityProfile, parentPath: st
};
const renderEntrySwitch = (profile: Config.IEntryVisibilityProfile, path: string, item: IEntryCatalogNode,
- parentEnabled: boolean, readOnly: boolean) => `<input class="b3-switch" type="checkbox"
- aria-label="${escapeAttr(item.label())}" data-entry-path="${escapeAttr(path)}"${readOnly ? ' data-entry-readonly aria-disabled="true"' : ""}
+ parentEnabled: boolean, readOnly: boolean) => {
+ const label = item.type === "separator" ? window.siyuan.languages.entrySeparator : item.label();
+ return `<input class="b3-switch" type="checkbox"
+ aria-label="${escapeAttr(label)}" data-entry-path="${escapeAttr(path)}"${readOnly ? ' data-entry-readonly aria-disabled="true"' : ""}
${!parentEnabled && !readOnly ? " disabled" : ""}${getProfileEntryVisibility(profile, path) ? " checked" : ""}>`;
+};
const renderEntryColumn = (profile: Config.IEntryVisibilityProfile, title: string, prefix: string,
nodes: IEntryCatalogNode[], depth: number, selectedPaths: string[],
@@ -210,17 +213,19 @@ const renderEntryColumn = (profile: Config.IEntryVisibilityProfile, title: strin
const path = `${prefix}.${item.key}`;
const draggable = sortable && parentEnabled;
if (item.type === "separator") {
- return `<div class="config-entry-visibility__row config-entry-visibility__row--separator"
+ return `<div class="config-entry-visibility__row config-entry-visibility__row--separator${parentEnabled ? "" : " config-entry-visibility__row--disabled"}${readOnly ? " config-entry-visibility__row--readonly" : ""}"
data-entry-row data-entry-key="${escapeAttr(item.key)}" data-entry-parent="${escapeAttr(prefix)}">
${draggable ? '<span class="config-entry-visibility__drag" draggable="true"><svg><use xlink:href="#iconDrag"></use></svg></span>' : ""}
<span class="config-entry-visibility__label">${window.siyuan.languages.entrySeparator}</span>
+ ${renderEntrySwitch(profile, path, item, parentEnabled, readOnly)}
+ <span class="config-entry-visibility__arrow-space"></span>
</div>`;
}
const label = item.label();
const hasChildren = Boolean(item.children?.length);
const selected = selectedPaths[depth] === path;
const rowTag = hasChildren ? "div" : "label";
- return `<${rowTag} class="config-entry-visibility__row config-entry-visibility__row--${hasChildren ? "navigable" : "toggleable"}${selected ? " config-entry-visibility__row--current" : ""}${parentEnabled ? "" : " config-entry-visibility__row--disabled"}"
+ return `<${rowTag} class="config-entry-visibility__row config-entry-visibility__row--${hasChildren ? "navigable" : "toggleable"}${selected ? " config-entry-visibility__row--current" : ""}${parentEnabled ? "" : " config-entry-visibility__row--disabled"}${readOnly ? " config-entry-visibility__row--readonly" : ""}"
data-entry-row data-entry-key="${escapeAttr(item.key)}" data-entry-parent="${escapeAttr(prefix)}" data-entry-path-row="${escapeAttr(path)}"${hasChildren ? ` data-action="navigate-entry" data-entry-path="${escapeAttr(path)}" data-entry-depth="${depth}"` : ""}>
${draggable ? '<span class="config-entry-visibility__drag" draggable="true"><svg><use xlink:href="#iconDrag"></use></svg></span>' : ""}
${hasChildren ? `<button class="config-entry-visibility__navigate" data-action="navigate-entry"
diff --git a/app/src/protyle/hint/slashMenu.test.ts b/app/src/protyle/hint/slashMenu.test.ts
index a963aba7d8..2477b23344 100644
--- a/app/src/protyle/hint/slashMenu.test.ts
+++ b/app/src/protyle/hint/slashMenu.test.ts
@@ -44,6 +44,12 @@ test("slash menu removes empty groups after visibility filtering", () => {
assert.deepEqual(resolve(items, {visible: () => false}), []);
});
+test("slash menu applies configured visibility to separators", () => {
+ const items = [entry("a"), separator("separator_1"), entry("b")];
+ assert.deepEqual(resolve(items, {visible: (entryKey) => entryKey !== "separator_1"})
+ .map((item) => item.entryKey), ["a", "b"]);
+});
+
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"])];
diff --git a/app/src/protyle/hint/slashMenu.ts b/app/src/protyle/hint/slashMenu.ts
index b96f46cddc..46f74be141 100644
--- a/app/src/protyle/hint/slashMenu.ts
+++ b/app/src/protyle/hint/slashMenu.ts
@@ -44,8 +44,8 @@ export const resolveSlashMenuItems = (items: TSlashMenuItem[], options: IResolve
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 visibleItems = orderedItems.filter((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);
diff --git a/app/src/protyle/toolbar/defaults.ts b/app/src/protyle/toolbar/defaults.ts
new file mode 100644
index 0000000000..30faa3aebb
--- /dev/null
+++ b/app/src/protyle/toolbar/defaults.ts
@@ -0,0 +1,142 @@
+const toolbarEntryId = Symbol("toolbarEntryId");
+
+interface IToolbarEntry {
+ key: string;
+ name: string;
+ lang?: string;
+ icon?: string;
+ separator?: boolean;
+}
+
+type TConfigurableToolbarItem = IMenuItem & {
+ [toolbarEntryId]?: string;
+};
+
+export const TOOLBAR_ENTRY_ROOT_PATH = "editor.toolbar";
+
+export const DESKTOP_TOOLBAR_ENTRIES: IToolbarEntry[] = [{
+ key: "block-ref",
+ name: "block-ref",
+ lang: "ref",
+}, {
+ key: "a",
+ name: "a",
+ lang: "link",
+}, {
+ key: "ai",
+ name: "ai",
+ lang: "aiEdit",
+}, {
+ key: "separator_1",
+ name: "|",
+ separator: true,
+}, {
+ key: "text",
+ name: "text",
+ lang: "appearance",
+}, {
+ key: "strong",
+ name: "strong",
+ lang: "bold",
+}, {
+ key: "em",
+ name: "em",
+ lang: "italic",
+}, {
+ key: "u",
+ name: "u",
+ lang: "underline",
+}, {
+ key: "s",
+ name: "s",
+ lang: "strike",
+}, {
+ key: "mark",
+ name: "mark",
+ lang: "mark",
+}, {
+ key: "sup",
+ name: "sup",
+ lang: "sup",
+}, {
+ key: "sub",
+ name: "sub",
+ lang: "sub",
+}, {
+ key: "code",
+ name: "code",
+ lang: "inline-code",
+}, {
+ key: "kbd",
+ name: "kbd",
+ lang: "kbd",
+}, {
+ key: "tag",
+ name: "tag",
+ lang: "tag",
+}, {
+ key: "inline-math",
+ name: "inline-math",
+ lang: "inline-math",
+}, {
+ key: "inline-memo",
+ name: "inline-memo",
+ lang: "memo",
+}, {
+ key: "separator_2",
+ name: "|",
+ separator: true,
+}, {
+ key: "format-painter",
+ name: "format-painter",
+ lang: "formatPainter",
+}, {
+ key: "clear",
+ name: "clear",
+ lang: "clearInline",
+ icon: "iconEraser",
+}];
+
+const desktopToolbarEntryKeys = new Map(DESKTOP_TOOLBAR_ENTRIES
+ .filter((item) => !item.separator)
+ .map((item) => [item.name, item.key]));
+
+const toolbarSeparator = (entryId: string): IMenuItem => {
+ const item: TConfigurableToolbarItem = {name: "|"};
+ item[toolbarEntryId] = entryId;
+ return item;
+};
+
+export const getDefaultToolbar = (mobile: boolean): Array<string | IMenuItem> => {
+ if (mobile) {
+ return [
+ "block-ref",
+ "a",
+ "ai",
+ "|",
+ "text",
+ "strong",
+ "em",
+ "u",
+ "clear",
+ "|",
+ "code",
+ "tag",
+ "inline-math",
+ "inline-memo",
+ ];
+ }
+ return DESKTOP_TOOLBAR_ENTRIES.map((item) => {
+ if (item.separator) {
+ return toolbarSeparator(item.key);
+ }
+ if (item.icon) {
+ return {name: item.name, icon: item.icon};
+ }
+ return item.name;
+ });
+};
+
+export const getToolbarEntryId = (item: IMenuItem) => item.name === "|"
+ ? (item as TConfigurableToolbarItem)[toolbarEntryId]
+ : desktopToolbarEntryKeys.get(item.name);
diff --git a/app/src/protyle/toolbar/entryVisibility.test.ts b/app/src/protyle/toolbar/entryVisibility.test.ts
new file mode 100644
index 0000000000..0ade0c75d7
--- /dev/null
+++ b/app/src/protyle/toolbar/entryVisibility.test.ts
@@ -0,0 +1,67 @@
+import * as assert from "node:assert/strict";
+import test from "node:test";
+import {DESKTOP_TOOLBAR_ENTRIES, getDefaultToolbar, getToolbarEntryId} from "./defaults";
+import {normalizeToolbarSeparators, resolveToolbarItems} from "./entryVisibility";
+
+interface IToolbarTestItem {
+ key?: string;
+ separator?: boolean;
+}
+
+const resolve = (items: IToolbarTestItem[], options: {
+ hidden?: string[];
+ order?: string[];
+} = {}) => resolveToolbarItems(items, {
+ getKey: (item) => item.key,
+ isSeparator: (item) => item.separator === true,
+ isVisible: (key) => !(options.hidden || []).includes(key),
+ order: options.order || items.flatMap((item) => item.key || []),
+});
+
+test("desktop toolbar defaults expose stable configuration identifiers", () => {
+ const entries = getDefaultToolbar(false).map((item) => typeof item === "string" ? {name: item} : item);
+ assert.deepEqual(entries.map(getToolbarEntryId), DESKTOP_TOOLBAR_ENTRIES.map((item) => item.key));
+ assert.equal(getToolbarEntryId({name: "plugin-item"}), undefined);
+});
+
+test("toolbar applies configured order while preserving plugin slots", () => {
+ const plugin = {};
+ const result = resolve([{key: "a"}, plugin, {key: "b"}, {key: "c"}], {
+ order: ["c", "b", "a"],
+ });
+ assert.deepEqual(result.ordered, [{key: "c"}, plugin, {key: "b"}, {key: "a"}]);
+});
+
+test("toolbar hides configured entries without hiding plugin entries", () => {
+ const plugin = {};
+ const result = resolve([{key: "a"}, plugin, {key: "b"}], {hidden: ["a", "b"]});
+ assert.deepEqual(result.visible, [plugin]);
+});
+
+test("toolbar removes empty groups after visibility filtering", () => {
+ const result = resolve([
+ {key: "separator_1", separator: true},
+ {key: "a"},
+ {key: "separator_2", separator: true},
+ {key: "separator_3", separator: true},
+ {key: "b"},
+ {key: "separator_4", separator: true},
+ ], {hidden: ["a"]});
+ assert.deepEqual(result.visible, [{key: "b"}]);
+});
+
+test("toolbar separator normalization removes leading, trailing, and consecutive separators", () => {
+ const items = [
+ {separator: true},
+ {key: "a"},
+ {separator: true},
+ {separator: true},
+ {key: "b"},
+ {separator: true},
+ ];
+ assert.deepEqual(normalizeToolbarSeparators(items, (item) => item.separator === true), [
+ {key: "a"},
+ {separator: true},
+ {key: "b"},
+ ]);
+});
diff --git a/app/src/protyle/toolbar/entryVisibility.ts b/app/src/protyle/toolbar/entryVisibility.ts
new file mode 100644
index 0000000000..c1ae8caef4
--- /dev/null
+++ b/app/src/protyle/toolbar/entryVisibility.ts
@@ -0,0 +1,37 @@
+import {reorderEntrySlots} from "../../config/entryVisibility/order";
+
+interface IResolveToolbarItemsOptions<T> {
+ getKey: (item: T) => string | undefined;
+ isSeparator: (item: T) => boolean;
+ isVisible: (key: string) => boolean;
+ order: string[];
+}
+
+export const normalizeToolbarSeparators = <T>(items: T[], isSeparator: (item: T) => boolean) => {
+ const result: T[] = [];
+ 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 resolveToolbarItems = <T>(items: T[], options: IResolveToolbarItemsOptions<T>) => {
+ const ordered = reorderEntrySlots(items, options.order, options.getKey);
+ const configured = ordered.filter((item) => {
+ const key = options.getKey(item);
+ return !key || options.isVisible(key);
+ });
+ return {
+ ordered,
+ visible: normalizeToolbarSeparators(configured, options.isSeparator),
+ };
+};
diff --git a/app/src/protyle/toolbar/index.ts b/app/src/protyle/toolbar/index.ts
index 81d6dea61c..33121f2246 100644
--- a/app/src/protyle/toolbar/index.ts
+++ b/app/src/protyle/toolbar/index.ts
@@ -60,6 +60,8 @@ import {FormatPainter} from "./FormatPainter";
import {IFormatPainterSnapshot} from "./formatPainterCore";
import {clearDisallowedTextInputHotkey} from "../../util/hotKeyPolicy";
import {closeSubElement} from "./subElementLifecycle";
+import {getDefaultToolbar, getToolbarEntryId} from "./defaults";
+import {applyToolbarEntryVisibility} from "../../config/entryVisibility/runtime";
const filterPluginToolbar = (toolbar: Array<string | IMenuItem>, lite: boolean) => {
if (!lite) {
@@ -128,6 +130,7 @@ export class Toolbar {
const itemElement = this.genItem(protyle, menuItem);
this.element.appendChild(itemElement);
});
+ applyToolbarEntryVisibility(this.element);
/// #if MOBILE
updateMobilePluginToolbar(protyle);
/// #endif
@@ -135,43 +138,7 @@ export class Toolbar {
public update(protyle: IProtyle) {
this.element.innerHTML = "";
- protyle.options.toolbar = toolbarKeyToMenu(isMobile() ? [
- "block-ref",
- "a",
- "ai",
- "|",
- "text",
- "strong",
- "em",
- "u",
- "clear",
- "|",
- "code",
- "tag",
- "inline-math",
- "inline-memo",
- ] : [
- "block-ref",
- "a",
- "ai",
- "|",
- "text",
- "strong",
- "em",
- "u",
- "s",
- "mark",
- "sup",
- "sub",
- "code",
- "kbd",
- "tag",
- "inline-math",
- "inline-memo",
- "|",
- "format-painter",
- {name: "clear", icon: "iconEraser"},
- ]);
+ protyle.options.toolbar = toolbarKeyToMenu(getDefaultToolbar(isMobile()));
protyle.app.plugins.forEach(item => {
const pluginToolbar = filterPluginToolbar(item.updateProtyleToolbar(protyle.options.toolbar), protyle.lite);
pluginToolbar.forEach(toolbarItem => {
@@ -192,6 +159,7 @@ export class Toolbar {
const itemElement = this.genItem(protyle, menuItem);
this.element.appendChild(itemElement);
});
+ applyToolbarEntryVisibility(this.element);
/// #if MOBILE
updateMobilePluginToolbar(protyle);
/// #endif
@@ -250,7 +218,7 @@ export class Toolbar {
const endCellElement = hasClosestByTag(range.endContainer, "TD") ||
hasClosestByTag(range.endContainer, "TH");
const isCrossCell = !!startCellElement && !!endCellElement && startCellElement !== endCellElement;
- if (isMobile() || !nodeElement || protyle.disabled || (!isCrossBlock && (
+ if (this.element.hasAttribute("data-entry-empty") || isMobile() || !nodeElement || protyle.disabled || (!isCrossBlock && (
nodeElement.getAttribute("data-type") === "NodeCodeBlock" ||
nodeElement.classList.contains("av") ||
hasClosestByTag(range.startContainer, "CAPTION")
@@ -2286,6 +2254,10 @@ export class Toolbar {
if (!menuItemObj) {
return;
}
+ const entryId = getToolbarEntryId(menuItem);
+ if (entryId) {
+ menuItemObj.element.dataset.id = entryId;
+ }
return menuItemObj.element;
}
diff --git a/app/src/protyle/util/Options.ts b/app/src/protyle/util/Options.ts
index 6e8ae27082..d5dd992886 100644
--- a/app/src/protyle/util/Options.ts
+++ b/app/src/protyle/util/Options.ts
@@ -3,6 +3,7 @@ import {merge} from "./merge";
import {hintEmbed, hintRef, hintSlash, hintTag} from "../hint/extend";
import {toolbarKeyToMenu} from "../toolbar/util";
import {isMobile} from "../../util/functions";
+import {getDefaultToolbar} from "../toolbar/defaults";
export class Options {
public options: IProtyleOptions;
@@ -90,43 +91,7 @@ export class Options {
},
mode: "both",
},
- toolbar: isMobile() ? [
- "block-ref",
- "a",
- "ai",
- "|",
- "text",
- "strong",
- "em",
- "u",
- "clear",
- "|",
- "code",
- "tag",
- "inline-math",
- "inline-memo",
- ] : [
- "block-ref",
- "a",
- "ai",
- "|",
- "text",
- "strong",
- "em",
- "u",
- "s",
- "mark",
- "sup",
- "sub",
- "code",
- "kbd",
- "tag",
- "inline-math",
- "inline-memo",
- "|",
- "format-painter",
- {name: "clear", icon: "iconEraser"},
- ],
+ toolbar: getDefaultToolbar(isMobile()),
typewriterMode: false,
upload: {
max: 1024 * 1024 * 1024 * 16,