Skip to content

📚 The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

feat(editor): add shortcuts for diagram, color, footnote and table (#619)

Dipak Chaudhari88478ce9e857
diff --git a/frontend/app/components/MarkdownEditor/Toolbar.vue b/frontend/app/components/MarkdownEditor/Toolbar.vue
index 1afd9bcf..fbc2866c 100644
--- a/frontend/app/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue
@@ -193,11 +193,11 @@ const extendedFormattingTools = computed<ToolItem[]>(() => [
const insertTools = computed<ToolItem[]>(() => [
{ name: t('markdown.toolbar.link'), icon: 'format/link', action: 'link', shortcut: 'Ctrl+K' },
{ name: t('markdown.toolbar.image'), icon: 'format/image', action: 'image', shortcut: 'Ctrl+Shift+I' },
- { name: t('markdown.toolbar.diagram'), icon: 'format/diagrams', action: 'diagram' },
+ { name: t('markdown.toolbar.diagram'), icon: 'format/diagrams', action: 'diagram', shortcut: 'Ctrl+Shift+D' },
{ name: t('markdown.toolbar.inlineCode'), icon: 'format/code', action: 'code', shortcut: 'Ctrl+E' },
{ name: t('markdown.toolbar.codeBlock'), icon: 'format/code-block', action: 'codeBlock', shortcut: 'Ctrl+Shift+C' },
- { name: t('markdown.toolbar.color'), icon: 'format/color', action: 'openColorPicker' },
- { name: t('markdown.toolbar.footnote'), icon: 'format/footnote', action: 'footnote' },
+ { name: t('markdown.toolbar.color'), icon: 'format/color', action: 'openColorPicker', shortcut: 'Ctrl+Shift+O' },
+ { name: t('markdown.toolbar.footnote'), icon: 'format/footnote', action: 'footnote', shortcut: 'Ctrl+Shift+F' },
]);
const structureTools = computed<ToolItem[]>(() => [
@@ -206,7 +206,7 @@ const structureTools = computed<ToolItem[]>(() => [
{ name: t('markdown.toolbar.bulletList'), icon: 'format/list-bulleted', action: 'list', shortcut: 'Ctrl+Shift+8' },
{ name: t('markdown.toolbar.numberedList'), icon: 'format/list-ordered', action: 'orderedList', shortcut: 'Ctrl+Shift+7' },
{ name: t('markdown.toolbar.taskList'), icon: 'format/task-list', action: 'taskList', shortcut: 'Ctrl+Shift+9' },
- { name: t('markdown.toolbar.table'), icon: 'format/table', action: 'gridOrganization' },
+ { name: t('markdown.toolbar.table'), icon: 'format/table', action: 'gridOrganization', shortcut: 'Ctrl+Alt+T' },
{ name: t('markdown.toolbar.horizontalRule'), icon: 'format/horizontal-rule', action: 'horizontalRule', shortcut: 'Ctrl+Shift+R' },
]);
diff --git a/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts b/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts
index a116365a..e73e8e74 100644
--- a/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts
+++ b/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts
@@ -85,6 +85,30 @@ export function createKeymaps(commands: { exec: (action: string, payload?: strin
return true;
},
},
+ {
+ key: 'Mod-Shift-d',
+ stopPropagation: true,
+ run: () => {
+ commands.exec('diagram');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-o',
+ stopPropagation: true,
+ run: () => {
+ commands.exec('openColorPicker');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-f',
+ stopPropagation: true,
+ run: () => {
+ commands.exec('footnote');
+ return true;
+ },
+ },
// Code
{
@@ -145,6 +169,16 @@ export function createKeymaps(commands: { exec: (action: string, payload?: strin
return true;
},
},
+ // Mod-Alt rather than Mod-Shift: Ctrl+Shift+T is the browser's reserved
+ // "reopen closed tab" shortcut, which pages cannot intercept.
+ {
+ key: 'Mod-Alt-t',
+ stopPropagation: true,
+ run: () => {
+ commands.exec('gridOrganization');
+ return true;
+ },
+ },
// Headers
{
diff --git a/frontend/app/pages/dashboard/settings/_views/shortcuts.vue b/frontend/app/pages/dashboard/settings/_views/shortcuts.vue
index e2fa49d2..c9bf066a 100644
--- a/frontend/app/pages/dashboard/settings/_views/shortcuts.vue
+++ b/frontend/app/pages/dashboard/settings/_views/shortcuts.vue
@@ -138,6 +138,18 @@
<span>{{ t('application.shortcuts.insertImage') }}</span>
<span><kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>I</kbd></span>
</div>
+ <div class="shortcut">
+ <span>{{ t('application.shortcuts.insertDiagram') }}</span>
+ <span><kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>D</kbd></span>
+ </div>
+ <div class="shortcut">
+ <span>{{ t('application.shortcuts.textColor') }}</span>
+ <span><kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>O</kbd></span>
+ </div>
+ <div class="shortcut">
+ <span>{{ t('application.shortcuts.insertFootnote') }}</span>
+ <span><kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>F</kbd></span>
+ </div>
<div class="shortcut">
<span>{{ t('application.shortcuts.inlineCode') }}</span>
<span><kbd>Ctrl</kbd> <kbd>E</kbd></span>
@@ -166,6 +178,10 @@
<span>{{ t('application.shortcuts.taskList') }}</span>
<span><kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>9</kbd></span>
</div>
+ <div class="shortcut">
+ <span>{{ t('application.shortcuts.insertTable') }}</span>
+ <span><kbd>Ctrl</kbd> <kbd>Alt</kbd> <kbd>T</kbd></span>
+ </div>
<div class="shortcut">
<span>{{ t('application.shortcuts.insertSeparator') }}</span>
<span><kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>R</kbd></span>
diff --git a/frontend/i18n/locales/de/application.ts b/frontend/i18n/locales/de/application.ts
index 5da61686..9963b617 100644
--- a/frontend/i18n/locales/de/application.ts
+++ b/frontend/i18n/locales/de/application.ts
@@ -14,10 +14,13 @@ export default {
highlightText: 'Text hervorheben',
inlineCode: 'Inline-Code',
insertCodeBlock: 'Codeblock einfügen',
+ insertDiagram: 'Diagramm einfügen',
+ insertFootnote: 'Fußnote einfügen',
insertImage: 'Bild einfügen',
insertLink: 'Link einfügen',
insertQuote: 'Zitat einfügen',
insertSeparator: 'Trennlinie einfügen',
+ insertTable: 'Tabelle einfügen',
italicText: 'Kursiver Text',
mathInline: 'Inline-Mathe',
nextDocument: 'Neues Dokument',
@@ -47,6 +50,7 @@ export default {
subscriptText: 'Tiefgestellt',
superscriptText: 'Hochgestellt',
taskList: 'Aufgabenliste',
+ textColor: 'Textfarbe',
toggleAdvancedView: 'Zur erweiterten Ansicht wechseln',
togglePreview: 'Vorschau ein-/ausblenden',
toggleQuickView: 'Zur Schnellansicht wechseln',
diff --git a/frontend/i18n/locales/en/application.ts b/frontend/i18n/locales/en/application.ts
index cfd0197d..7195661c 100644
--- a/frontend/i18n/locales/en/application.ts
+++ b/frontend/i18n/locales/en/application.ts
@@ -14,10 +14,13 @@ export default {
highlightText: 'Highlight text',
inlineCode: 'Inline code',
insertCodeBlock: 'Insert code block',
+ insertDiagram: 'Insert diagram',
+ insertFootnote: 'Insert footnote',
insertImage: 'Insert image',
insertLink: 'Insert link',
insertQuote: 'Insert quote block',
insertSeparator: 'Insert line separator',
+ insertTable: 'Insert table',
italicText: 'Italic text',
mathInline: 'Inline math',
nextDocument: 'Next document',
@@ -47,6 +50,7 @@ export default {
subscriptText: 'Subscript',
superscriptText: 'Superscript',
taskList: 'Task list',
+ textColor: 'Text color',
toggleAdvancedView: 'Switch to advanced view',
togglePreview: 'Toggle preview',
toggleQuickView: 'Switch to quick view',
diff --git a/frontend/i18n/locales/fr/application.ts b/frontend/i18n/locales/fr/application.ts
index 31f2c781..38d12ef6 100644
--- a/frontend/i18n/locales/fr/application.ts
+++ b/frontend/i18n/locales/fr/application.ts
@@ -14,10 +14,13 @@ export default {
highlightText: 'Surligner le texte',
inlineCode: 'Code en ligne',
insertCodeBlock: 'Insérer un bloc de code',
+ insertDiagram: 'Insérer un diagramme',
+ insertFootnote: 'Insérer une note de bas de page',
insertImage: 'Insérer une image',
insertLink: 'Insérer un lien',
insertQuote: 'Insérer une citation',
insertSeparator: 'Insérer un séparateur',
+ insertTable: 'Insérer un tableau',
italicText: 'Mettre le texte en italique',
mathInline: 'Math en ligne',
nextDocument: 'Aller au document suivant',
@@ -47,6 +50,7 @@ export default {
subscriptText: 'Indice',
superscriptText: 'Exposant',
taskList: 'Liste de tâches',
+ textColor: 'Couleur du texte',
toggleAdvancedView: 'Passer à la vue avancée',
togglePreview: "Basculer l'aperçu",
toggleQuickView: 'Passer à la vue rapide',
diff --git a/frontend/i18n/locales/it/application.ts b/frontend/i18n/locales/it/application.ts
index 68850d54..0bcfee54 100644
--- a/frontend/i18n/locales/it/application.ts
+++ b/frontend/i18n/locales/it/application.ts
@@ -14,10 +14,13 @@ export default {
highlightText: 'Evidenzia testo',
inlineCode: 'Codice inline',
insertCodeBlock: 'Inserisci blocco di codice',
+ insertDiagram: 'Inserisci diagramma',
+ insertFootnote: 'Inserisci nota a piè di pagina',
insertImage: 'Inserisci immagine',
insertLink: 'Inserisci link',
insertQuote: 'Inserisci citazione',
insertSeparator: 'Inserisci separatore',
+ insertTable: 'Inserisci tabella',
italicText: 'Testo in corsivo',
mathInline: 'Matematica inline',
nextDocument: 'Documento successivo',
@@ -47,6 +50,7 @@ export default {
subscriptText: 'Pedice',
superscriptText: 'Apice',
taskList: 'Elenco attività',
+ textColor: 'Colore del testo',
toggleAdvancedView: 'Passa alla vista avanzata',
togglePreview: 'Attiva/disattiva anteprima',
toggleQuickView: 'Passa alla vista rapida',
diff --git a/frontend/i18n/locales/ko/application.ts b/frontend/i18n/locales/ko/application.ts
index ae6eabfc..fd586ad4 100644
--- a/frontend/i18n/locales/ko/application.ts
+++ b/frontend/i18n/locales/ko/application.ts
@@ -14,10 +14,13 @@ export default {
highlightText: '형광펜',
inlineCode: '인라인 코드',
insertCodeBlock: '코드 블록 삽입',
+ insertDiagram: '다이어그램 삽입',
+ insertFootnote: '각주 삽입',
insertImage: '이미지 삽입',
insertLink: '링크 삽입',
insertQuote: '인용구 삽입',
insertSeparator: '구분선 삽입',
+ insertTable: '표 삽입',
italicText: '기울임꼴',
mathInline: '인라인 수식',
nextDocument: '다음 문서',
@@ -47,6 +50,7 @@ export default {
subscriptText: '아래 첨자',
superscriptText: '위 첨자',
taskList: '작업 목록',
+ textColor: '글자 색상',
toggleAdvancedView: '고급 보기로 전환',
togglePreview: '미리보기 전환',
toggleQuickView: '빠른 보기로 전환',
diff --git a/frontend/i18n/locales/uk/application.ts b/frontend/i18n/locales/uk/application.ts
index 440929dc..bcec3f65 100644
--- a/frontend/i18n/locales/uk/application.ts
+++ b/frontend/i18n/locales/uk/application.ts
@@ -14,10 +14,13 @@ export default {
highlightText: 'Виділити текст',
inlineCode: 'Вбудований код',
insertCodeBlock: 'Вставити блок коду',
+ insertDiagram: 'Вставити діаграму',
+ insertFootnote: 'Вставити виноску',
insertImage: 'Вставити зображення',
insertLink: 'Вставити посилання',
insertQuote: 'Вставити цитату',
insertSeparator: 'Вставити роздільник',
+ insertTable: 'Вставити таблицю',
italicText: 'Текст курсивом',
mathInline: 'Вбудована формула',
nextDocument: 'Наступний документ',
@@ -47,6 +50,7 @@ export default {
subscriptText: 'Нижній індекс',
superscriptText: 'Верхній індекс',
taskList: 'Список завдань',
+ textColor: 'Колір тексту',
toggleAdvancedView: 'Перейти до розширеного перегляду',
togglePreview: 'Увімкнути попередній перегляд',
toggleQuickView: 'Перейти до швидкого перегляду',