From 7202f47716e3efe673beb6cbe828ad276baa50bc Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 5 Aug 2025 20:35:53 +0300 Subject: [PATCH] feat(react/dialogs): port cheatsheet --- .../src/translations/cn/translation.json | 12 +- .../src/translations/de/translation.json | 13 +- .../src/translations/en/translation.json | 16 +- .../src/translations/es/translation.json | 15 +- .../src/translations/fr/translation.json | 13 +- .../src/translations/ro/translation.json | 15 +- .../src/translations/sr/translation.json | 10 +- .../src/translations/tw/translation.json | 13 +- apps/client/src/widgets/dialogs/help.ts | 160 ----------------- apps/client/src/widgets/dialogs/help.tsx | 167 ++++++++++++++++++ apps/client/src/widgets/react/Modal.tsx | 6 +- apps/client/src/widgets/react/RawHtml.tsx | 7 + 12 files changed, 230 insertions(+), 217 deletions(-) delete mode 100644 apps/client/src/widgets/dialogs/help.ts create mode 100644 apps/client/src/widgets/dialogs/help.tsx create mode 100644 apps/client/src/widgets/react/RawHtml.tsx diff --git a/apps/client/src/translations/cn/translation.json b/apps/client/src/translations/cn/translation.json index 1d59b2171..fc7d42fd6 100644 --- a/apps/client/src/translations/cn/translation.json +++ b/apps/client/src/translations/cn/translation.json @@ -116,17 +116,17 @@ "fullDocumentation": "帮助(完整在线文档)", "close": "关闭", "noteNavigation": "笔记导航", - "goUpDown": "UP, DOWN - 在笔记列表中向上/向下移动", - "collapseExpand": "LEFT, RIGHT - 折叠/展开节点", + "goUpDown": "在笔记列表中向上/向下移动", + "collapseExpand": "折叠/展开节点", "notSet": "未设置", "goBackForwards": "在历史记录中前后移动", "showJumpToNoteDialog": "显示\"跳转到\" 对话框", "scrollToActiveNote": "滚动到活跃笔记", - "jumpToParentNote": "Backspace - 跳转到父笔记", + "jumpToParentNote": "跳转到父笔记", "collapseWholeTree": "折叠整个笔记树", "collapseSubTree": "折叠子树", "tabShortcuts": "标签页快捷键", - "newTabNoteLink": "CTRL+click - 在笔记链接上使用CTRL+点击(或中键点击)在新标签页中打开笔记", + "newTabNoteLink": "", "onlyInDesktop": "仅在桌面版(电子构建)中", "openEmptyTab": "打开空白标签页", "closeActiveTab": "关闭活跃标签页", @@ -141,14 +141,14 @@ "moveNoteUpHierarchy": "在层级结构中向上移动笔记", "multiSelectNote": "多选上/下笔记", "selectAllNotes": "选择当前级别的所有笔记", - "selectNote": "Shift+click - 选择笔记", + "selectNote": "选择笔记", "copyNotes": "将活跃笔记(或当前选择)复制到剪贴板(用于克隆)", "cutNotes": "将当前笔记(或当前选择)剪切到剪贴板(用于移动笔记)", "pasteNotes": "将笔记粘贴为活跃笔记的子笔记(根据是复制还是剪切到剪贴板来决定是移动还是克隆)", "deleteNotes": "删除笔记/子树", "editingNotes": "编辑笔记", "editNoteTitle": "在树形笔记树中,焦点会从笔记树切换到笔记标题。按下 Enter 键会将焦点从笔记标题切换到文本编辑器。按下 Ctrl+. 会将焦点从编辑器切换回笔记树。", - "createEditLink": "Ctrl+K - 创建/编辑外部链接", + "createEditLink": "创建/编辑外部链接", "createInternalLink": "创建内部链接", "followLink": "跟随光标下的链接", "insertDateTime": "在插入点插入当前日期和时间", diff --git a/apps/client/src/translations/de/translation.json b/apps/client/src/translations/de/translation.json index 5a5f32649..3c569017a 100644 --- a/apps/client/src/translations/de/translation.json +++ b/apps/client/src/translations/de/translation.json @@ -113,20 +113,19 @@ "format_pdf": "PDF - für Ausdrucke oder Teilen." }, "help": { - "fullDocumentation": "Hilfe (gesamte Dokumentation ist online verfügbar)", "close": "Schließen", "noteNavigation": "Notiz Navigation", - "goUpDown": "Pfeil Hoch, Pfeil Runter - In der Liste der Notizen nach oben/unten gehen", - "collapseExpand": "LEFT, RIGHT - Knoten reduzieren/erweitern", + "goUpDown": "In der Liste der Notizen nach oben/unten gehen", + "collapseExpand": "Knoten reduzieren/erweitern", "notSet": "nicht eingestellt", "goBackForwards": "in der Historie zurück/vorwärts gehen", "showJumpToNoteDialog": "zeige \"Springe zu\" dialog", "scrollToActiveNote": "Scrolle zur aktiven Notiz", - "jumpToParentNote": "Backspace - Zur übergeordneten Notiz springen", + "jumpToParentNote": "Zur übergeordneten Notiz springen", "collapseWholeTree": "Reduziere den gesamten Notizbaum", "collapseSubTree": "Teilbaum einklappen", "tabShortcuts": "Tab-Tastenkürzel", - "newTabNoteLink": "Strg+Klick - (oder mittlerer Mausklick) auf den Notizlink öffnet die Notiz in einem neuen Tab", + "newTabNoteLink": "auf den Notizlink öffnet die Notiz in einem neuen Tab", "onlyInDesktop": "Nur im Desktop (Electron Build)", "openEmptyTab": "Leeren Tab öffnen", "closeActiveTab": "Aktiven Tab schließen", @@ -141,14 +140,14 @@ "moveNoteUpHierarchy": "Verschiebe die Notiz in der Hierarchie nach oben", "multiSelectNote": "Mehrfachauswahl von Notizen oben/unten", "selectAllNotes": "Wähle alle Notizen in der aktuellen Ebene aus", - "selectNote": "Umschalt+Klick - Notiz auswählen", + "selectNote": "Notiz auswählen", "copyNotes": "Kopiere aktive Notiz (oder aktuelle Auswahl) in den Zwischenspeicher (wird genutzt für Klonen)", "cutNotes": "Aktuelle Notiz (oder aktuelle Auswahl) in die Zwischenablage ausschneiden (wird zum Verschieben von Notizen verwendet)", "pasteNotes": "Notiz(en) als Unternotiz in die aktive Notiz einfügen (entweder verschieben oder klonen, je nachdem, ob sie kopiert oder in die Zwischenablag e ausgeschnitten wurde)", "deleteNotes": "Notiz / Unterbaum löschen", "editingNotes": "Notizen bearbeiten", "editNoteTitle": "Im Baumbereich wird vom Baumbereich zum Notiztitel gewechselt. Beim Druck auf Eingabe im Notiztitel, wechselt der Fokus zum Texteditor. Strg+. wechselt vom Editor zurück zum Baumbereich.", - "createEditLink": "Strg+K - Externen Link erstellen/bearbeiten", + "createEditLink": "Externen Link erstellen/bearbeiten", "createInternalLink": "Internen Link erstellen", "followLink": "Folge dem Link unter dem Cursor", "insertDateTime": "Gebe das aktuelle Datum und die aktuelle Uhrzeit an der Einfügemarke ein", diff --git a/apps/client/src/translations/en/translation.json b/apps/client/src/translations/en/translation.json index 0af2b16a9..c17badf3e 100644 --- a/apps/client/src/translations/en/translation.json +++ b/apps/client/src/translations/en/translation.json @@ -113,21 +113,21 @@ "format_pdf": "PDF - for printing or sharing purposes." }, "help": { - "fullDocumentation": "Help (full documentation is available online)", + "title": "Cheatsheet", "close": "Close", "noteNavigation": "Note navigation", - "goUpDown": "UP, DOWN - go up/down in the list of notes", - "collapseExpand": "LEFT, RIGHT - collapse/expand node", + "goUpDown": "go up/down in the list of notes", + "collapseExpand": "collapse/expand node", "notSet": "not set", "goBackForwards": "go back / forwards in the history", "showJumpToNoteDialog": "show \"Jump to\" dialog", "scrollToActiveNote": "scroll to active note", - "jumpToParentNote": "Backspace - jump to parent note", + "jumpToParentNote": "jump to parent note", "collapseWholeTree": "collapse whole note tree", "collapseSubTree": "collapse sub-tree", "tabShortcuts": "Tab shortcuts", - "newTabNoteLink": "Ctrl+click - (or middle mouse click) on note link opens note in a new tab", - "newTabWithActivationNoteLink": "Ctrl+Shift+click - (or Shift+middle mouse click) on note link opens and activates the note in a new tab", + "newTabNoteLink": "on note link opens note in a new tab", + "newTabWithActivationNoteLink": "on note link opens and activates the note in a new tab", "onlyInDesktop": "Only in desktop (Electron build)", "openEmptyTab": "open empty tab", "closeActiveTab": "close active tab", @@ -142,14 +142,14 @@ "moveNoteUpHierarchy": "move note up in the hierarchy", "multiSelectNote": "multi-select note above/below", "selectAllNotes": "select all notes in the current level", - "selectNote": "Shift+click - select note", + "selectNote": "select note", "copyNotes": "copy active note (or current selection) into clipboard (used for cloning)", "cutNotes": "cut current note (or current selection) into clipboard (used for moving notes)", "pasteNotes": "paste note(s) as sub-note into active note (which is either move or clone depending on whether it was copied or cut into clipboard)", "deleteNotes": "delete note / sub-tree", "editingNotes": "Editing notes", "editNoteTitle": "in tree pane will switch from tree pane into note title. Enter from note title will switch focus to text editor. Ctrl+. will switch back from editor to tree pane.", - "createEditLink": "Ctrl+K - create / edit external link", + "createEditLink": "create / edit external link", "createInternalLink": "create internal link", "followLink": "follow link under cursor", "insertDateTime": "insert current date and time at caret position", diff --git a/apps/client/src/translations/es/translation.json b/apps/client/src/translations/es/translation.json index 3f95e1886..1e1119e2f 100644 --- a/apps/client/src/translations/es/translation.json +++ b/apps/client/src/translations/es/translation.json @@ -113,21 +113,20 @@ "format_pdf": "PDF - para propósitos de impresión o compartición." }, "help": { - "fullDocumentation": "Ayuda (la documentación completa está disponible online)", "close": "Cerrar", "noteNavigation": "Navegación de notas", - "goUpDown": "UP, DOWN - subir/bajar en la lista de notas", - "collapseExpand": "LEFT, RIGHT - colapsar/expandir nodo", + "goUpDown": "subir/bajar en la lista de notas", + "collapseExpand": "colapsar/expandir nodo", "notSet": "no establecido", "goBackForwards": "retroceder / avanzar en la historia", "showJumpToNoteDialog": "mostrar \"Saltar a\" diálogo", "scrollToActiveNote": "desplazarse hasta la nota activa", - "jumpToParentNote": "Backspace - saltar a la nota padre", + "jumpToParentNote": "saltar a la nota padre", "collapseWholeTree": "colapsar todo el árbol de notas", "collapseSubTree": "colapsar subárbol", "tabShortcuts": "Atajos de pestañas", - "newTabNoteLink": "CTRL+clic - (o clic central del mouse) en el enlace de la nota abre la nota en una nueva pestaña", - "newTabWithActivationNoteLink": "Ctrl+Shift+clic - (o Shift+clic de rueda de ratón) en el enlace de la nota abre y activa la nota en una nueva pestaña", + "newTabNoteLink": "en el enlace de la nota abre la nota en una nueva pestaña", + "newTabWithActivationNoteLink": "en el enlace de la nota abre y activa la nota en una nueva pestaña", "onlyInDesktop": "Solo en escritorio (compilación con Electron)", "openEmptyTab": "abrir pestaña vacía", "closeActiveTab": "cerrar pestaña activa", @@ -142,14 +141,14 @@ "moveNoteUpHierarchy": "mover nota hacia arriba en la jerarquía", "multiSelectNote": "selección múltiple de nota hacia arriba/abajo", "selectAllNotes": "seleccionar todas las notas en el nivel actual", - "selectNote": "Shift+click - seleccionar nota", + "selectNote": "seleccionar nota", "copyNotes": "copiar nota activa (o selección actual) al portapapeles (usado para clonar)", "cutNotes": "cortar la nota actual (o la selección actual) en el portapapeles (usado para mover notas)", "pasteNotes": "pegar notas como subnotas en la nota activa (que se puede mover o clonar dependiendo de si se copió o cortó en el portapapeles)", "deleteNotes": "eliminar nota/subárbol", "editingNotes": "Editando notas", "editNoteTitle": "en el panel de árbol cambiará del panel de árbol al título de la nota. Ingresar desde el título de la nota cambiará el foco al editor de texto. Ctrl+. cambiará de nuevo del editor al panel de árbol.", - "createEditLink": "Ctrl+K - crear/editar enlace externo", + "createEditLink": "crear/editar enlace externo", "createInternalLink": "crear enlace interno", "followLink": "siga el enlace debajo del cursor", "insertDateTime": "insertar la fecha y hora actuales en la posición del cursor", diff --git a/apps/client/src/translations/fr/translation.json b/apps/client/src/translations/fr/translation.json index ec61a8acb..6921f1cf5 100644 --- a/apps/client/src/translations/fr/translation.json +++ b/apps/client/src/translations/fr/translation.json @@ -113,20 +113,19 @@ "format_pdf": "PDF - pour l'impression ou le partage de documents." }, "help": { - "fullDocumentation": "Aide (la documentation complète est disponible en ligne)", "close": "Fermer", "noteNavigation": "Navigation dans les notes", - "goUpDown": "HAUT, BAS - aller vers le haut/bas dans la liste des notes", - "collapseExpand": "GAUCHE, DROITE - réduire/développer le nœud", + "goUpDown": "aller vers le haut/bas dans la liste des notes", + "collapseExpand": "réduire/développer le nœud", "notSet": "non défini", "goBackForwards": "reculer/avancer dans l'historique", "showJumpToNoteDialog": "afficher la boîte de dialogue \"Aller à la note\"", "scrollToActiveNote": "faire défiler jusqu'à la note active", - "jumpToParentNote": "Retour arrière - aller à la note parent", + "jumpToParentNote": "aller à la note parent", "collapseWholeTree": "réduire tout l'arbre des notes", "collapseSubTree": "réduire le sous-arbre", "tabShortcuts": "Raccourcis des onglets", - "newTabNoteLink": "CTRL+clic - (ou clic central de la souris) sur le lien de la note ouvre la note dans un nouvel onglet", + "newTabNoteLink": "sur le lien de la note ouvre la note dans un nouvel onglet", "onlyInDesktop": "Uniquement sur ordinateur (version Electron)", "openEmptyTab": "ouvrir un onglet vide", "closeActiveTab": "fermer l'onglet actif", @@ -141,14 +140,14 @@ "moveNoteUpHierarchy": "déplacer la note vers le haut dans la hiérarchie", "multiSelectNote": "sélectionner plusieurs notes au-dessus/au-dessous", "selectAllNotes": "sélectionner toutes les notes du niveau actuel", - "selectNote": "Shift+clic - sélectionner une note", + "selectNote": "sélectionner une note", "copyNotes": "copier la note active (ou la sélection actuelle) dans le presse-papiers (utilisé pour le clonage)", "cutNotes": "couper la note actuelle (ou la sélection actuelle) dans le presse-papiers (utilisé pour déplacer les notes)", "pasteNotes": "coller la ou les notes en tant que sous-note dans la note active (qui est soit déplacée, soit clonée selon qu'elle a été copiée ou coupée dans le presse-papiers)", "deleteNotes": "supprimer une note / un sous-arbre", "editingNotes": "Édition des notes", "editNoteTitle": "dans le volet de l'arborescence, basculera du volet au titre de la note. Presser Entrer à partir du titre de la note basculera vers l’éditeur de texte. Ctrl+. bascule de l'éditeur au volet arborescent.", - "createEditLink": "Ctrl+K - créer/éditer un lien externe", + "createEditLink": "créer/éditer un lien externe", "createInternalLink": "créer un lien interne", "followLink": "suivre le lien sous le curseur", "insertDateTime": "insérer la date et l'heure courante à la position du curseur", diff --git a/apps/client/src/translations/ro/translation.json b/apps/client/src/translations/ro/translation.json index ac6b6f10b..8544428c5 100644 --- a/apps/client/src/translations/ro/translation.json +++ b/apps/client/src/translations/ro/translation.json @@ -617,11 +617,11 @@ "bulletList": "* sau - urmat de spațiu pentru o listă punctată", "close": "Închide", "closeActiveTab": "închide tabul activ", - "collapseExpand": "LEFT, RIGHT - minimizează/expandează nodul", + "collapseExpand": "minimizează/expandează nodul", "collapseSubTree": "minimizează subarborele", "collapseWholeTree": "minimizează întregul arbore de notițe", "copyNotes": "copiază notița activă (sau selecția curentă) în clipboard (utilizat pentru clonare)", - "createEditLink": "Ctrl+K - crează/editează legătură externă", + "createEditLink": "crează/editează legătură externă", "createInternalLink": "crează legătură internă", "createNoteAfter": "crează o nouă notiță după notița activă", "createNoteInto": "crează o subnotiță în notița activă", @@ -632,20 +632,19 @@ "editNoteTitle": "va sări de la arborele de notițe către titlul notiței. Enter de la titlul notiței va sări către editorul de text. Ctrl+. va sări înapoi de la editor către arborele de notițe.", "editingNotes": "Editarea notițelor", "followLink": "urmărește link-ul sub cursor", - "fullDocumentation": "Instrucțiuni (documentația completă se regăsește online)", "goBackForwards": "mergi înapoi/înainte în istoric", - "goUpDown": "UP, DOWN - mergi sus/jos în lista de notițe", + "goUpDown": "mergi sus/jos în lista de notițe", "headings": "##, ###, #### etc. urmat de spațiu pentru titluri", "inPageSearch": "caută în interiorul paginii", "insertDateTime": "inserează data și timpul curente la poziția cursorului", - "jumpToParentNote": "Backspace - sari la pagina părinte", + "jumpToParentNote": "sari la pagina părinte", "jumpToTreePane": "sari către arborele de notițe și scrolează către notița activă", "markdownAutoformat": "Formatare în stil Markdown", "moveNoteUpDown": "mută notița sus/jos în lista de notițe", "moveNoteUpHierarchy": "mută notița mai sus în ierarhie", "movingCloningNotes": "Mutarea/clonarea notițelor", "multiSelectNote": "selectează multiplu notița de sus/jos", - "newTabNoteLink": "CTRL+clic - (sau clic mijlociu) pe o legătură către o notiță va deschide notița într-un tab nou", + "newTabNoteLink": "pe o legătură către o notiță va deschide notița într-un tab nou", "notSet": "nesetat", "noteNavigation": "Navigarea printre notițe", "numberedList": "1. sau 1) urmat de spațiu pentru o listă numerotată", @@ -657,13 +656,13 @@ "reloadFrontend": "reîncarcă interfața Trilium", "scrollToActiveNote": "scrolează la notița activă", "selectAllNotes": "selectează toate notițele din nivelul curent", - "selectNote": "Shift+Click - selectează notița", + "selectNote": "selectează notița", "showDevTools": "afișează instrumentele de dezvoltatori", "showJumpToNoteDialog": "afișează ecranul „Sari la”", "showSQLConsole": "afișează consola SQL", "tabShortcuts": "Scurtături pentru tab-uri", "troubleshooting": "Unelte pentru depanare", - "newTabWithActivationNoteLink": "Ctrl+Shift+click - (sau Shift+click mouse mijlociu) pe o legătură către o notiță deschide și activează notița într-un tab nou" + "newTabWithActivationNoteLink": "pe o legătură către o notiță deschide și activează notița într-un tab nou" }, "hide_floating_buttons_button": { "button_title": "Ascunde butoanele" diff --git a/apps/client/src/translations/sr/translation.json b/apps/client/src/translations/sr/translation.json index b37bbd140..61ab6a8b2 100644 --- a/apps/client/src/translations/sr/translation.json +++ b/apps/client/src/translations/sr/translation.json @@ -122,12 +122,12 @@ "goBackForwards": "idi u nazad/napred kroz istoriju", "showJumpToNoteDialog": "prikaži \"Idi na\" dijalog", "scrollToActiveNote": "skroluj do aktivne beleške", - "jumpToParentNote": "Backspace - idi do nadređene beleške", + "jumpToParentNote": "idi do nadređene beleške", "collapseWholeTree": "sakupi celo drvo beleški", "collapseSubTree": "sakupi pod-drvo", "tabShortcuts": "Prečice na karticama", - "newTabNoteLink": "Ctrl+click - (ili middle mouse click) na link beleške otvara belešku u novoj kartici", - "newTabWithActivationNoteLink": "Ctrl+Shift+click - (ili Shift+middle mouse click) na link beleške otvara i aktivira belešku u novoj kartici", + "newTabNoteLink": "na link beleške otvara belešku u novoj kartici", + "newTabWithActivationNoteLink": "na link beleške otvara i aktivira belešku u novoj kartici", "onlyInDesktop": "Samo na dektop-u (Electron verzija)", "openEmptyTab": "otvori praznu karticu", "closeActiveTab": "zatvori aktivnu karticu", @@ -142,14 +142,14 @@ "moveNoteUpHierarchy": "pomeri belešku na gore u hijerarhiji", "multiSelectNote": "višestruki izbor beleški iznad/ispod", "selectAllNotes": "izaberi sve beleške u trenutnom nivou", - "selectNote": "Shift+click - izaberi belešku", + "selectNote": "izaberi belešku", "copyNotes": "kopiraj aktivnu belešku (ili trenutni izbor) u privremenu memoriju (koristi se za kloniranje)", "cutNotes": "iseci trenutnu belešku (ili trenutni izbor) u privremenu memoriju (koristi se za premeštanje beleški)", "pasteNotes": "nalepi belešku/e kao podbelešku u aktivnoj belešci (koja se ili premešta ili klonira u zavisnosti od toga da li je beleška kopirana ili isečena u privremenu memoriju)", "deleteNotes": "obriši belešku / podstablo", "editingNotes": "Izmena beleški", "editNoteTitle": "u ravni drveta će se prebaciti sa ravni drveta na naslov beleške. Ulaz sa naslova beleške će prebaciti fokus na uređivač teksta. Ctrl+. će se vratiti sa uređivača na ravan drveta.", - "createEditLink": "Ctrl+K - napravi / izmeni spoljašnji link", + "createEditLink": "napravi / izmeni spoljašnji link", "createInternalLink": "napravi unutrašnji link", "followLink": "prati link ispod kursora", "insertDateTime": "ubaci trenutan datum i vreme na poziciju kursora", diff --git a/apps/client/src/translations/tw/translation.json b/apps/client/src/translations/tw/translation.json index b258090d1..9e43e775a 100644 --- a/apps/client/src/translations/tw/translation.json +++ b/apps/client/src/translations/tw/translation.json @@ -107,20 +107,19 @@ "export_finished_successfully": "匯出成功完成。" }, "help": { - "fullDocumentation": "幫助(完整在線文檔)", "close": "關閉", "noteNavigation": "筆記導航", - "goUpDown": "UP, DOWN - 在筆記列表中向上/向下移動", - "collapseExpand": "LEFT, RIGHT - 折疊/展開節點", + "goUpDown": "在筆記列表中向上/向下移動", + "collapseExpand": "折疊/展開節點", "notSet": "未設定", "goBackForwards": "在歷史記錄中前後移動", "showJumpToNoteDialog": "顯示\"跳轉到\" 對話框", "scrollToActiveNote": "滾動到活動筆記", - "jumpToParentNote": "Backspace - 跳轉到上級筆記", + "jumpToParentNote": "跳轉到上級筆記", "collapseWholeTree": "折疊整個筆記樹", "collapseSubTree": "折疊子樹", "tabShortcuts": "標籤快捷鍵", - "newTabNoteLink": "CTRL+click - 在筆記鏈接上使用CTRL+點擊(或中鍵點擊)在新標籤中打開筆記", + "newTabNoteLink": "", "onlyInDesktop": "僅在桌面版(電子構建)中", "openEmptyTab": "打開空白標籤頁", "closeActiveTab": "關閉活動標籤頁", @@ -135,14 +134,14 @@ "moveNoteUpHierarchy": "在層級結構中向上移動筆記", "multiSelectNote": "多選上/下筆記", "selectAllNotes": "選擇當前級別的所有筆記", - "selectNote": "Shift+Click - 選擇筆記", + "selectNote": "選擇筆記", "copyNotes": "將活動筆記(或當前選擇)複製到剪貼簿(用於複製)", "cutNotes": "將當前筆記(或當前選擇)剪下到剪貼簿(用於移動筆記)", "pasteNotes": "將筆記貼上為活動筆記的子筆記(根據是複製還是剪下到剪貼簿來決定是移動還是複製)", "deleteNotes": "刪除筆記/子樹", "editingNotes": "編輯筆記", "editNoteTitle": "在樹形筆記樹中,焦點會從筆記樹切換到筆記標題。按下 Enter 鍵會將焦點從筆記標題切換到文字編輯器。按下 Ctrl+. 會將焦點從編輯器切換回筆記樹。", - "createEditLink": "Ctrl+K - 新增/編輯外部鏈接", + "createEditLink": "新增/編輯外部鏈接", "createInternalLink": "新增內部鏈接", "followLink": "跟隨遊標下的鏈接", "insertDateTime": "在插入點插入當前日期和時間", diff --git a/apps/client/src/widgets/dialogs/help.ts b/apps/client/src/widgets/dialogs/help.ts deleted file mode 100644 index ad8961d0c..000000000 --- a/apps/client/src/widgets/dialogs/help.ts +++ /dev/null @@ -1,160 +0,0 @@ -import BasicWidget from "../basic_widget.js"; -import { t } from "../../services/i18n.js"; -import { openDialog } from "../../services/dialog.js"; - -const TPL = /*html*/` -`; - -export default class HelpDialog extends BasicWidget { - doRender() { - this.$widget = $(TPL); - } - - showCheatsheetEvent() { - openDialog(this.$widget); - } -} diff --git a/apps/client/src/widgets/dialogs/help.tsx b/apps/client/src/widgets/dialogs/help.tsx new file mode 100644 index 000000000..95d2a56b9 --- /dev/null +++ b/apps/client/src/widgets/dialogs/help.tsx @@ -0,0 +1,167 @@ +import { openDialog } from "../../services/dialog.js"; +import ReactBasicWidget from "../react/ReactBasicWidget.js"; +import Modal from "../react/Modal.jsx"; +import { t } from "../../services/i18n.js"; +import { ComponentChildren } from "preact"; +import { CommandNames } from "../../components/app_context.js"; +import RawHtml from "../react/RawHtml.jsx"; +import { useEffect, useState } from "preact/hooks"; +import keyboard_actions from "../../services/keyboard_actions.js"; + +function HelpDialogComponent() { + return ( + +
+ +
    + + + + + + + + +
+
+ + +
    + + +
+ +
{t("help.onlyInDesktop")}
+
    + + + + +
+
+ + +
    + + + +
+
+ + +
    + + + + + + + + + +
+
+ + +
    + + + + + + +
+
+ + +
    +
  • +
  • +
  • +
  • +
+
+ + +
    + + + +
+
+ + +
    + + +
+
+
+
+ ); +} + +function KeyboardShortcut({ commands, description }: { commands: CommandNames | CommandNames[], description: string }) { + const [ shortcuts, setShortcuts ] = useState([]); + + useEffect(() => { + (async () => { + const shortcuts: string[] = []; + for (const command of Array.isArray(commands) ? commands : [commands]) { + const action = await keyboard_actions.getAction(command); + if (action) { + shortcuts.push(...(action.effectiveShortcuts ?? [])); + } + } + + if (shortcuts.length === 0) { + shortcuts.push(t("help.notSet")); + } + + setShortcuts(shortcuts); + })(); + }, [commands]); + + return FixedKeyboardShortcut({ + keys: shortcuts, + description + }); +} + +function FixedKeyboardShortcut({ keys, description }: { keys?: string[], description: string }) { + return ( +
  • + {keys && keys.map((key, index) => + <> + {key} + {index < keys.length - 1 ? ", " : "" } + + )} - +
  • + ); +} + +function Card({ title, children }: { title: string, children: ComponentChildren }) { + return ( +
    +
    +
    {title}
    + +

    + {children} +

    +
    +
    + ) +} + +export default class HelpDialog extends ReactBasicWidget { + + get component() { + return ; + } + + showCheatsheetEvent() { + openDialog(this.$widget); + } +} diff --git a/apps/client/src/widgets/react/Modal.tsx b/apps/client/src/widgets/react/Modal.tsx index 01c809b32..173915fec 100644 --- a/apps/client/src/widgets/react/Modal.tsx +++ b/apps/client/src/widgets/react/Modal.tsx @@ -10,6 +10,7 @@ interface ModalProps { children: ComponentChildren; footer?: ComponentChildren; footerAlignment?: "right" | "between"; + minWidth?: string; maxWidth?: number; zIndex?: number; /** @@ -40,7 +41,7 @@ interface ModalProps { formRef?: RefObject; } -export default function Modal({ children, className, size, title, footer, footerAlignment, onShown, onSubmit, helpPageId, maxWidth, zIndex, scrollable, onHidden: onHidden, modalRef: _modalRef, formRef: _formRef }: ModalProps) { +export default function Modal({ children, className, size, title, footer, footerAlignment, onShown, onSubmit, helpPageId, minWidth, maxWidth, zIndex, scrollable, onHidden: onHidden, modalRef: _modalRef, formRef: _formRef }: ModalProps) { const modalRef = _modalRef ?? useRef(null); const formRef = _formRef ?? useRef(null); @@ -76,6 +77,9 @@ export default function Modal({ children, className, size, title, footer, footer if (maxWidth) { documentStyle.maxWidth = `${maxWidth}px`; } + if (minWidth) { + documentStyle.minWidth = minWidth; + } return (
    diff --git a/apps/client/src/widgets/react/RawHtml.tsx b/apps/client/src/widgets/react/RawHtml.tsx new file mode 100644 index 000000000..8fc2ad60a --- /dev/null +++ b/apps/client/src/widgets/react/RawHtml.tsx @@ -0,0 +1,7 @@ +interface RawHtmlProps { + html: string; +} + +export default function RawHtml({ html }: RawHtmlProps) { + return ; +} \ No newline at end of file