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: new toolbar options and new syntax - New shortcuts - New toolbar with more options - Improve behavior of commands - New design - New "simplified view" option for mobiles (optional) - New syntax: Suppott footnote and sub/super script - New icons - Simplify view of table creation modal

Smaug6739bccd32a64c50
diff --git a/frontend/app/components/MarkdownEditor/EditorAppHeader.vue b/frontend/app/components/MarkdownEditor/EditorAppHeader.vue
index 0904dcbd..a43665b0 100644
--- a/frontend/app/components/MarkdownEditor/EditorAppHeader.vue
+++ b/frontend/app/components/MarkdownEditor/EditorAppHeader.vue
@@ -1,7 +1,7 @@
<template>
<div class="modal-header">
<div class="header-icon">
- <Icon :name="icon" style="width: 30px; height: 30px" fill="var(--bg-color)" />
+ <Icon :name="icon" display="xxl" fill="var(--bg-color)" />
</div>
<h3>{{ title }}</h3>
<p class="header-subtitle">{{ subtitle }}</p>
@@ -31,11 +31,6 @@ defineProps<{ icon: string; title: string; subtitle: string }>();
align-items: center;
justify-content: center;
margin-bottom: 16px;
-
- svg {
- width: 24px;
- height: 24px;
- }
}
h3 {
diff --git a/frontend/app/components/MarkdownEditor/EditorPreferences.vue b/frontend/app/components/MarkdownEditor/EditorPreferences.vue
index 5f510405..84ed77b6 100644
--- a/frontend/app/components/MarkdownEditor/EditorPreferences.vue
+++ b/frontend/app/components/MarkdownEditor/EditorPreferences.vue
@@ -19,6 +19,10 @@
<label for="category">Enable snippets</label>
<AppToggle v-model="store.get('editorSnippetsEnabled').value" />
</div>
+ <div class="row">
+ <label for="category">Simplified view on mobile</label>
+ <AppToggle v-model="store.get('editorSimplifiedViewOnMobile').value" />
+ </div>
</form>
</div>
</template>
diff --git a/frontend/app/components/MarkdownEditor/GridOrganizationModal.vue b/frontend/app/components/MarkdownEditor/GridOrganizationModal.vue
index 519f43bc..31f12425 100644
--- a/frontend/app/components/MarkdownEditor/GridOrganizationModal.vue
+++ b/frontend/app/components/MarkdownEditor/GridOrganizationModal.vue
@@ -25,19 +25,7 @@
<span v-else>Hover to see table size</span>
</div>
</div>
-
- <div class="quick-presets">
- <div class="presets-grid">
- <div v-for="preset in gridPresets" :key="preset.name" class="preset-item" @click="selectPreset(preset)">
- <div class="preset-visual" :style="getPresetStyle(preset)">
- <div v-for="cell in preset.cells" :key="cell.id" class="preset-cell" :style="getCellStyle(cell)"></div>
- </div>
- <span class="preset-name">{{ preset.name }}</span>
- </div>
- </div>
- </div>
</div>
-
<div class="modal-footer">
<button class="cancel-btn" @click="closeModal">Cancel</button>
</div>
@@ -57,111 +45,6 @@ const emit = defineEmits<{
const hoveredSize = ref<{ rows: number; columns: number } | null>(null);
const selectedSize = ref<{ rows: number; columns: number } | null>(null);
-interface GridCell {
- id: string;
- col: number;
- row: number;
- colspan?: number;
- rowspan?: number;
-}
-
-interface GridPreset {
- name: string;
- columns: number;
- rows: number;
- cells: GridCell[];
-}
-
-const gridPresets: GridPreset[] = [
- {
- name: '2x2 Grid',
- columns: 2,
- rows: 2,
- cells: [
- { id: '1', col: 1, row: 1 },
- { id: '2', col: 2, row: 1 },
- { id: '3', col: 1, row: 2 },
- { id: '4', col: 2, row: 2 },
- ],
- },
- {
- name: '3x2 Grid',
- columns: 3,
- rows: 2,
- cells: [
- { id: '1', col: 1, row: 1 },
- { id: '2', col: 2, row: 1 },
- { id: '3', col: 3, row: 1 },
- { id: '4', col: 1, row: 2 },
- { id: '5', col: 2, row: 2 },
- { id: '6', col: 3, row: 2 },
- ],
- },
- {
- name: '2x3 Grid',
- columns: 2,
- rows: 3,
- cells: [
- { id: '1', col: 1, row: 1 },
- { id: '2', col: 2, row: 1 },
- { id: '3', col: 1, row: 2 },
- { id: '4', col: 2, row: 2 },
- { id: '5', col: 1, row: 3 },
- { id: '6', col: 2, row: 3 },
- ],
- },
- {
- name: '3x3 Grid',
- columns: 3,
- rows: 3,
- cells: [
- { id: '1', col: 1, row: 1 },
- { id: '2', col: 2, row: 1 },
- { id: '3', col: 3, row: 1 },
- { id: '4', col: 1, row: 2 },
- { id: '5', col: 2, row: 2 },
- { id: '6', col: 3, row: 2 },
- { id: '7', col: 1, row: 3 },
- { id: '8', col: 2, row: 3 },
- { id: '9', col: 3, row: 3 },
- ],
- },
-
- {
- name: 'Two Column',
- columns: 2,
- rows: 3,
- cells: [
- { id: '1', col: 1, row: 1 },
- { id: '2', col: 2, row: 1 },
- { id: '3', col: 1, row: 2 },
- { id: '4', col: 2, row: 2 },
- { id: '5', col: 1, row: 3 },
- { id: '6', col: 2, row: 3 },
- ],
- },
-];
-
-const getPresetStyle = (preset: GridPreset) => {
- return {
- display: 'grid',
- gridTemplateColumns: `repeat(${preset.columns}, 1fr)`,
- gridTemplateRows: `repeat(${preset.rows}, 1fr)`,
- gap: '2px',
- width: '100%',
- height: '60px',
- };
-};
-
-const getCellStyle = (cell: GridCell) => {
- return {
- gridColumn: cell.colspan ? `span ${cell.colspan}` : `span 1`,
- gridRow: cell.rowspan ? `span ${cell.rowspan}` : `span 1`,
- backgroundColor: 'var(--primary)',
- borderRadius: '2px',
- };
-};
-
const isHovered = (row: number, col: number): boolean => {
if (!hoveredSize.value) return false;
return row <= hoveredSize.value.rows && col <= hoveredSize.value.columns;
@@ -187,12 +70,6 @@ const selectTableSize = (row: number, col: number) => {
emit('close');
};
-const selectPreset = (preset: GridPreset) => {
- const gridMarkdown = generateGridMarkdown(preset.columns, preset.rows);
- props.onGridSelect(gridMarkdown);
- emit('close');
-};
-
const generateGridMarkdown = (columns: number, rows: number): string => {
let markdown = '\n';
@@ -314,83 +191,6 @@ const closeModal = () => {
margin-right: auto;
}
-.presets-grid {
- display: grid;
- gap: 16px;
- grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
- margin-bottom: 16px;
-}
-
-.preset-item {
- position: relative;
- padding: 12px;
- border: 2px solid transparent;
- border-radius: 10px;
- text-align: center;
- background: var(--bg-color-secondary);
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
- cursor: pointer;
- overflow: hidden;
-
- &::before {
- position: absolute;
- top: 0;
- right: 0;
- left: 0;
- height: 3px;
- background: linear-gradient(90deg, var(--primary), var(--primary-light, var(--primary)));
- transition: transform 0.3s ease;
- content: '';
- transform: scaleX(0);
- }
-
- &:hover {
- border-color: var(--primary);
- background: var(--bg-color);
- box-shadow: 0 12px 32px rgb(0 0 0 / 15%);
- transform: translateY(-4px);
-
- &::before {
- transform: scaleX(1);
- }
-
- .preset-visual {
- border-color: var(--primary);
- box-shadow: 0 4px 16px rgb(var(--primary-rgb), 0.2);
- }
- }
-
- .preset-visual {
- position: relative;
- height: 50px;
- border: 2px solid var(--border-color);
- border-radius: 6px;
- background: var(--bg-color);
- transition: all 0.3s ease;
- margin-bottom: 8px;
-
- &::after {
- position: absolute;
- border-radius: 4px;
- background: linear-gradient(135deg, rgb(255 255 255 / 10%), rgb(255 255 255 / 5%));
- content: '';
- inset: 0;
- pointer-events: none;
- }
- }
-
- .preset-name {
- font-size: 13px;
- font-weight: 600;
- color: var(--font-color-dark);
- transition: color 0.3s ease;
- }
-
- &:hover .preset-name {
- color: var(--primary);
- }
-}
-
.modal-footer {
display: flex;
padding: 24px 0;
@@ -434,11 +234,6 @@ const closeModal = () => {
}
}
- .presets-grid {
- gap: 12px;
- grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
- }
-
.table-info {
max-width: 300px;
padding: 10px;
diff --git a/frontend/app/components/MarkdownEditor/MarkdownEditor.vue b/frontend/app/components/MarkdownEditor/MarkdownEditor.vue
index f6b4c5af..4bd11a0d 100644
--- a/frontend/app/components/MarkdownEditor/MarkdownEditor.vue
+++ b/frontend/app/components/MarkdownEditor/MarkdownEditor.vue
@@ -3,15 +3,15 @@
<div class="editor-wrapper">
<div class="editor-container">
<!-- Toolbar Section -->
- <Toolbar v-model="document" :minimal="minimal" @execute-action="commands.exec" />
+ <Toolbar v-model="document" @execute-action="commands.exec" />
<!-- Compact Document Metadata -->
- <div v-if="!minimal" class="document-meta">
+ <div class="document-meta">
<div class="line">
<input v-model="document.name" placeholder="Document title" class="meta-title" @input="autoSaveConditional" />
<input v-model="document.description" placeholder="Description" class="meta-description" @input="autoSaveConditional" />
</div>
- <AppTagInput v-model="document.tags" display="row" minimal @update:modelValue="autoSaveConditional" />
+ <AppTagInput v-model="document.tags" display="row" minimal @update:model-value="autoSaveConditional" />
</div>
<!-- Editor Content Section -->
@@ -47,7 +47,7 @@ import type { Node } from '~/stores';
const resourcesStore = useResourcesStore();
const preferences = usePreferences();
-const props = defineProps<{ doc?: Partial<Node>; minimal?: boolean }>();
+const props = defineProps<{ doc?: Partial<Node> }>();
const emit = defineEmits(['save', 'exit', 'autoSave']);
const editorContainer = ref<HTMLDivElement>();
@@ -157,7 +157,7 @@ const autoSave = debounceDelayed(() => {
width: 100%;
height: 100%;
flex-direction: column;
- gap: 8px;
+ gap: 4px;
}
// Compact Document Metadata - Single line
@@ -168,7 +168,7 @@ const autoSave = debounceDelayed(() => {
flex-wrap: wrap;
}
- padding: 6px 12px;
+ padding: 6px 10px;
border: 1px solid var(--border-color);
border-radius: 10px;
background: var(--bg-color);
@@ -223,11 +223,6 @@ const autoSave = debounceDelayed(() => {
}
}
-.meta-tags {
- min-width: 150px;
- flex: 0 1 auto;
-}
-
// Editor Content Section
.editor-content {
display: flex;
@@ -330,9 +325,5 @@ const autoSave = debounceDelayed(() => {
width: 100%;
max-width: 100%;
}
-
- .meta-tags {
- width: 100%;
- }
}
</style>
diff --git a/frontend/app/components/MarkdownEditor/Toolbar.vue b/frontend/app/components/MarkdownEditor/Toolbar.vue
index 26467381..e9d1f738 100644
--- a/frontend/app/components/MarkdownEditor/Toolbar.vue
+++ b/frontend/app/components/MarkdownEditor/Toolbar.vue
@@ -1,10 +1,9 @@
<template>
<div class="toolbar">
- <!-- Formatting Group -->
- <div class="toolbar-group no-mobile">
+ <!-- Text Formatting Group -->
+ <div :class="['toolbar-group', { 'no-mobile': mobileSimplifiedView }]">
<div class="group-buttons">
<button v-for="item in formattingTools" :key="item.name" class="toolbar-btn" :aria-label="item.name" @click="emitAction(item.action)">
- <!-- eslint-disable-next-line vue/no-v-html -->
<Icon :name="item.icon" />
<span class="tooltip"
>{{ item.name }}<kbd v-if="item.shortcut">{{ item.shortcut }}</kbd></span
@@ -13,13 +12,26 @@
</div>
</div>
- <div class="toolbar-divider" />
+ <div :class="['toolbar-divider', { 'no-mobile': mobileSimplifiedView }]" />
+
+ <!-- Extended Formatting Group -->
+ <div :class="['toolbar-group', { 'no-mobile': mobileSimplifiedView }]">
+ <div class="group-buttons">
+ <button v-for="item in extendedFormattingTools" :key="item.name" class="toolbar-btn" :aria-label="item.name" @click="emitAction(item.action)">
+ <Icon :name="item.icon" />
+ <span class="tooltip"
+ >{{ item.name }}<kbd v-if="item.shortcut">{{ item.shortcut }}</kbd></span
+ >
+ </button>
+ </div>
+ </div>
+
+ <div :class="['toolbar-divider', { 'no-mobile': mobileSimplifiedView }]" />
<!-- Insert Group -->
- <div class="toolbar-group no-mobile">
+ <div :class="['toolbar-group', { 'no-mobile': mobileSimplifiedView }]">
<div class="group-buttons">
<button v-for="item in insertTools" :key="item.name" class="toolbar-btn" :aria-label="item.name" @click="emitAction(item.action)">
- <!-- eslint-disable-next-line vue/no-v-html -->
<Icon :name="item.icon" />
<span class="tooltip"
>{{ item.name }}<kbd v-if="item.shortcut">{{ item.shortcut }}</kbd></span
@@ -28,13 +40,12 @@
</div>
</div>
- <div class="toolbar-divider" />
+ <div :class="['toolbar-divider', { 'no-mobile': mobileSimplifiedView }]" />
<!-- Structure Group -->
- <div class="toolbar-group no-mobile">
+ <div :class="['toolbar-group', { 'no-mobile': mobileSimplifiedView }]">
<div class="group-buttons">
<button v-for="item in structureTools" :key="item.name" class="toolbar-btn" :aria-label="item.name" @click="emitAction(item.action)">
- <!-- eslint-disable-next-line vue/no-v-html -->
<Icon :name="item.icon" />
<span class="tooltip"
>{{ item.name }}<kbd v-if="item.shortcut">{{ item.shortcut }}</kbd></span
@@ -43,12 +54,14 @@
</div>
</div>
- <div class="toolbar-divider" />
+ <div :class="['toolbar-divider', { 'no-mobile': mobileSimplifiedView }]" />
<!-- Voice & Category -->
- <div class="toolbar-group" style="flex: 1; flex-direction: row">
- <VoiceRecognition class="no-mobile" @transcription="handleTranscription" />
- <AppSelect v-if="!minimal" v-model="localValue.parent_id" :items="categories" placeholder="Category" class="category-select" />
+ <div class="toolbar-group" style="flex: 1; flex-direction: row; align-items: center; gap: 4px">
+ <div class="group-buttons">
+ <VoiceRecognition :class="{ 'no-mobile': mobileSimplifiedView }" @transcription="handleTranscription" />
+ </div>
+ <AppSelect v-model="localValue.parent_id" :items="categories" placeholder="Category" class="category-select" />
</div>
<!-- Right Section -->
@@ -71,8 +84,12 @@
</div>
</div>
- <!-- Actions Group -->
+ <!-- Actions & Settings Group -->
<div class="action-buttons">
+ <button class="toolbar-btn btn-ghost" aria-label="Clear Formatting" @click="emitAction('clearFormatting')">
+ <Icon name="format/clear-formatting" />
+ <span class="tooltip">Clear Formatting<kbd>Ctrl+Shift+X</kbd></span>
+ </button>
<button
v-for="item in actionTools"
:key="item.name"
@@ -81,16 +98,12 @@
:aria-label="item.name"
@click="emitAction(item.action)"
>
- <!-- eslint-disable-next-line vue/no-v-html -->
<Icon :name="item.icon" />
<span class="tooltip"
>{{ item.name }}<kbd v-if="item.shortcut">{{ item.shortcut }}</kbd></span
>
</button>
- </div>
-
- <!-- Settings -->
- <div class="settings-buttons">
+ <div class="action-divider" />
<button class="toolbar-btn btn-ghost" aria-label="Settings" @click="openSettings">
<Icon name="settings" display="lg" />
<span class="tooltip">Editor Settings</span>
@@ -112,20 +125,22 @@ import EditorPreferences from './EditorPreferences.vue';
const props = defineProps<{
modelValue: Partial<Node>;
- minimal?: boolean;
}>();
const preferences = usePreferences();
+const mobileSimplifiedView = preferences.get('editorSimplifiedViewOnMobile');
+
const stats = computed(() => {
const content = props.modelValue.content || '';
const words = content
.trim()
.split(/\s+/)
.filter(word => word.length > 0);
+ const wordCount = words.length;
return {
characters: content.length,
- words: words.length,
+ words: wordCount,
lines: content.split('\n').length,
};
});
@@ -150,35 +165,6 @@ const openSettings = () => useModal().add(new Modal(shallowRef(EditorPreferences
const categories = computed(() => new TreeStructure(useSidebarTree().nodes.value.filter(n => n.data.role <= 2)).generateTree());
-// Icons as SVG strings for inline rendering
-const icons = {
- bold: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>',
- italic:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>',
- underline:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120v-80h560v80H200Zm280-160q-101 0-157-63t-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63Z"/></svg>',
- strike:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"/></svg>',
- link: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>',
- image:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>',
- code: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>',
- quote:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>',
- list: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"/></svg>',
- orderedList:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M680-80v-60h100v-30h-60v-60h60v-30H680v-60h120q17 0 28.5 11.5T840-280v40q0 17-11.5 28.5T800-200q17 0 28.5 11.5T840-160v40q0 17-11.5 28.5T800-80H680Zm0-280v-110q0-17 11.5-28.5T720-510h60v-30H680v-60h120q17 0 28.5 11.5T840-560v70q0 17-11.5 28.5T800-450h-60v30h100v60H680Zm60-280v-180h-60v-60h120v240h-60ZM120-200v-80h480v80H120Zm0-240v-80h480v80H120Zm0-240v-80h480v80H120Z"/></svg>',
- table:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M120-120v-720h720v720H120Zm80-400h560v-240H200v240Zm213 160h134v-80H413v80Zm0 160h134v-80H413v80ZM200-360h133v-80H200v80Zm0 160h133v-80H200v80Zm427-160h133v-80H627v80Zm0 160h133v-80H627v80Z"/></svg>',
- color:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 32.5-156t88-127Q256-817 330-848.5T488-880q80 0 151 27.5t124.5 76q53.5 48.5 85 115T880-544q0 115-70 175.5T640-308h-74q-9 0-12.5 5t-3.5 11q0 12 15 34.5t15 51.5q0 50-27.5 74T480-80Zm0-400Zm-220 40q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120-160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm200 0q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120 160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17ZM480-160q9 0 14.5-5t5.5-13q0-14-15-33t-15-57q0-42 29-67t71-25h70q66 0 113-38.5T800-544q0-121-92.5-198.5T488-820q-136 0-232 93t-96 227q0 133 93.5 226.5T480-160Z"/></svg>',
- preview:
- '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-480H200v480Zm280-80q-82 0-146.5-44.5T240-440q29-71 93.5-115.5T480-600q82 0 146.5 44.5T720-440q-29 71-93.5 115.5T480-280Zm0-60q56 0 102-26.5t72-73.5q-26-47-72-73.5T480-540q-56 0-102 26.5T306-440q26 47 72 73.5T480-340Zm0-100Zm0 60q25 0 42.5-17.5T540-440q0-25-17.5-42.5T480-500q-25 0-42.5 17.5T420-440q0 25 17.5 42.5T480-380Z"/></svg>',
- save: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160Zm-80 34L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM240-560h360v-160H240v160Zm-40-86v446-560 114Z"/></svg>',
- goto: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>',
-};
-
-// Tool definitions organized by groups
// Tool type with optional shortcut
interface ToolItem {
name: string;
@@ -188,45 +174,58 @@ interface ToolItem {
}
const formattingTools: ToolItem[] = [
- { name: 'Bold', icon: icons.bold, action: 'bold', shortcut: 'Ctrl+B' },
- { name: 'Italic', icon: icons.italic, action: 'italic', shortcut: 'Ctrl+I' },
- { name: 'Underline', icon: icons.underline, action: 'underline', shortcut: 'Ctrl+U' },
- { name: 'Strikethrough', icon: icons.strike, action: 'strike' },
- { name: 'Color', icon: icons.color, action: 'openColorPicker' },
+ { name: 'Bold', icon: 'format/bold', action: 'bold', shortcut: 'Ctrl+B' },
+ { name: 'Italic', icon: 'format/italic', action: 'italic', shortcut: 'Ctrl+I' },
+ { name: 'Underline', icon: 'format/underline', action: 'underline', shortcut: 'Ctrl+U' },
+ { name: 'Strikethrough', icon: 'format/strikethrough', action: 'strike', shortcut: 'Ctrl+Shift+S' },
+ { name: 'Highlight', icon: 'format/highlight', action: 'mark', shortcut: 'Ctrl+Shift+H' },
+];
+
+const extendedFormattingTools: ToolItem[] = [
+ { name: 'Superscript', icon: 'format/superscript', action: 'superscript' },
+ { name: 'Subscript', icon: 'format/subscript', action: 'subscript' },
+ { name: 'Color', icon: 'format/color', action: 'openColorPicker' },
];
const insertTools: ToolItem[] = [
- { name: 'Link', icon: icons.link, action: 'link', shortcut: 'Ctrl+K' },
- { name: 'Image', icon: icons.image, action: 'image' },
- { name: 'Code', icon: icons.code, action: 'code' },
- { name: 'Quote', icon: icons.quote, action: 'quote' },
+ { name: 'Link', icon: 'format/link', action: 'link', shortcut: 'Ctrl+K' },
+ { name: 'Image', icon: 'format/image', action: 'image', shortcut: 'Ctrl+Shift+I' },
+ { name: 'Inline Code', icon: 'format/code', action: 'code', shortcut: 'Ctrl+E' },
+ { name: 'Code Block', icon: 'format/code-block', action: 'codeBlock', shortcut: 'Ctrl+Shift+C' },
+ { name: 'Math', icon: 'maths', action: 'mathInline', shortcut: 'Ctrl+M' },
+ { name: 'Footnote', icon: 'format/footnote', action: 'footnote' },
];
const structureTools: ToolItem[] = [
- { name: 'Bullet List', icon: icons.list, action: 'list' },
- { name: 'Numbered List', icon: icons.orderedList, action: 'orderedList' },
- { name: 'Table', icon: icons.table, action: 'gridOrganization' },
+ { name: 'Heading', icon: 'format/h1', action: 'h1', shortcut: 'Ctrl+[1-6]' },
+ { name: 'Quote', icon: 'format/quote', action: 'quote', shortcut: 'Ctrl+Shift+.' },
+ { name: 'Bullet List', icon: 'format/list-bulleted', action: 'list', shortcut: 'Ctrl+Shift+8' },
+ { name: 'Numbered List', icon: 'format/list-ordered', action: 'orderedList', shortcut: 'Ctrl+Shift+7' },
+ { name: 'Task List', icon: 'format/task-list', action: 'taskList', shortcut: 'Ctrl+Shift+9' },
+ { name: 'Table', icon: 'format/table', action: 'gridOrganization' },
+ { name: 'Horizontal Rule', icon: 'format/horizontal-rule', action: 'horizontalRule', shortcut: 'Ctrl+Shift+R' },
];
const actionTools: ToolItem[] = [
- { name: 'Preview', icon: icons.preview, action: 'preview', shortcut: 'Ctrl+P' },
- { name: 'Save', icon: icons.save, action: 'save', shortcut: 'Ctrl+S' },
- { name: 'Go to Document', icon: icons.goto, action: 'goto' },
+ { name: 'Preview', icon: 'preview', action: 'preview', shortcut: 'Ctrl+P' },
+ { name: 'Save', icon: 'save', action: 'save', shortcut: 'Ctrl+S' },
+ { name: 'Go to Document', icon: 'file_shortcut', action: 'goto' },
];
</script>
<style scoped lang="scss">
.toolbar {
display: flex;
width: 100%;
- padding: 8px 12px;
+ padding: 6px 10px;
+ margin-top: 8px;
border: 1px solid var(--border-color);
- border-radius: 12px;
+ border-radius: 10px;
background: var(--bg-color);
box-shadow: 0 2px 8px rgb(0 0 0 / 4%);
transition: box-shadow 0.2s ease;
align-items: center;
flex-wrap: wrap;
- gap: 6px;
+ gap: 4px 6px;
overflow-x: clip;
user-select: none;
@@ -243,48 +242,29 @@ const actionTools: ToolItem[] = [
.group-buttons {
display: flex;
- padding: 4px;
- border-radius: 8px;
+ padding: 3px;
+ border-radius: 6px;
background: var(--bg-ui);
- gap: 2px;
+ gap: 1px;
}
.toolbar-btn {
position: relative;
display: flex;
- width: 32px;
- height: 32px;
+ width: 28px;
+ height: 28px;
margin: 0;
padding: 0;
border: none;
- border-radius: 6px;
+ border-radius: 5px;
background: transparent;
transition: all 0.15s ease;
align-items: center;
cursor: pointer;
justify-content: center;
- .btn-icon {
- display: flex;
- width: 18px;
- height: 18px;
- align-items: center;
- justify-content: center;
-
- :deep(svg) {
- width: 18px;
- height: 18px;
- transition: fill 0.15s ease, transform 0.15s ease;
- fill: var(--font-color-light);
- }
- }
-
&:hover {
- background: var(--bg-contrast);
-
- .btn-icon :deep(svg) {
- transform: scale(1.1);
- }
+ background: var(--bg-contrast-2);
.tooltip {
opacity: 1;
@@ -292,10 +272,6 @@ const actionTools: ToolItem[] = [
visibility: visible;
}
}
-
- &:active {
- transform: scale(0.95);
- }
}
.btn-primary {
@@ -370,27 +346,27 @@ const actionTools: ToolItem[] = [
.toolbar-divider {
width: 1px;
- height: 32px;
- margin: 0 6px;
+ height: 24px;
+ margin: 0 2px;
background: var(--border-color);
- opacity: 0.5;
+ opacity: 0.4;
}
.toolbar-right {
display: flex;
align-items: center;
- gap: 12px;
+ gap: 8px;
margin-left: auto;
}
.stats-badge {
display: flex;
- padding: 4px 12px;
+ padding: 3px 10px;
border: 1px solid var(--border-color);
- border-radius: 8px;
+ border-radius: 6px;
background: linear-gradient(135deg, var(--bg-contrast) 0%, var(--bg-contrast-2) 100%);
align-items: center;
- gap: 8px;
+ gap: 6px;
}
.stat-item {
@@ -423,20 +399,25 @@ const actionTools: ToolItem[] = [
.action-buttons {
display: flex;
- padding: 4px;
- border-radius: 8px;
+ padding: 3px;
+ border-radius: 6px;
background: var(--bg-ui);
- gap: 4px;
+ gap: 3px;
}
-.settings-buttons {
- display: flex;
- gap: 2px;
+.action-divider {
+ width: 1px;
+ height: 18px;
+ margin: 0 2px;
+ background: var(--border-color);
+ opacity: 0.5;
+ align-self: center;
}
.category-select {
- border-radius: 8px;
+ border-radius: 6px;
background: var(--bg-color);
+ min-width: 110px;
}
// Responsive adjustments
diff --git a/frontend/app/components/MarkdownEditor/VoiceRecognition.vue b/frontend/app/components/MarkdownEditor/VoiceRecognition.vue
index 5b20f1cb..32597a1a 100644
--- a/frontend/app/components/MarkdownEditor/VoiceRecognition.vue
+++ b/frontend/app/components/MarkdownEditor/VoiceRecognition.vue
@@ -1,43 +1,8 @@
<template>
- <div class="voice-recognition">
- <button :class="['btn', { recording: isRecording }]" :title="isRecording ? 'Stop recording' : 'Start voice recognition'" @click="toggleRecording">
- <svg
- v-if="!isRecording"
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <rect x="9" y="2" width="6" height="12" rx="3" />
- <path d="M5 10v2a7 7 0 0 0 14 0v-2" />
- <path d="M12 19v3" />
- <path d="M8 22h8" />
- </svg>
- <svg
- v-else
- xmlns="http://www.w3.org/2000/svg"
- width="24"
- height="24"
- viewBox="0 0 24 24"
- fill="none"
- stroke="currentColor"
- stroke-width="2"
- stroke-linecap="round"
- stroke-linejoin="round"
- >
- <rect x="9" y="2" width="6" height="12" rx="3" />
- <path d="M5 10v2a7 7 0 0 0 14 0v-2" />
- <path d="M12 19v3" />
- <path d="M8 22h8" />
- <line x1="2" y1="2" x2="22" y2="22" />
- </svg>
- </button>
- </div>
+ <button :class="{ recording: isRecording }" :title="isRecording ? 'Stop recording' : 'Start voice recognition'" @click="toggleRecording">
+ <Icon v-if="!isRecording" name="voice/default" />
+ <Icon v-else name="voice/recording" />
+ </button>
</template>
<script setup lang="ts">
@@ -140,44 +105,26 @@ onUnmounted(() => {
</script>
<style scoped lang="scss">
-.voice-recognition {
- display: inline-block;
-}
-
-.btn {
+button {
display: flex;
- width: 32px;
- height: 32px;
+ width: 28px;
+ height: 28px;
margin: 0;
- padding: 4px;
+ padding: 0;
border: none;
- border-radius: 50%;
- background: none;
- transition: all 0.2s;
+ border-radius: 5px;
+ background: transparent;
align-items: center;
cursor: pointer;
justify-content: center;
- transform: none;
&:hover {
- background-color: var(--primary-bg);
+ background-color: var(--bg-contrast-2);
}
&.recording {
animation: pulse 2s infinite;
}
-
- svg {
- display: block;
- width: 24px;
- height: 24px;
- fill: none;
- stroke: var(--font-color-dark);
- }
-
- &.recording svg {
- stroke: var(--font-color);
- }
}
@keyframes pulse {
diff --git a/frontend/app/components/MarkdownEditor/modules/editorCommands.ts b/frontend/app/components/MarkdownEditor/modules/editorCommands.ts
index e4331930..876a4386 100644
--- a/frontend/app/components/MarkdownEditor/modules/editorCommands.ts
+++ b/frontend/app/components/MarkdownEditor/modules/editorCommands.ts
@@ -12,6 +12,490 @@ export interface CreateCommandsParams {
save: () => void;
}
+// ============================================================================
+// FORMATTING DETECTION & TOGGLE UTILITIES
+// ============================================================================
+
+interface FormatMarker {
+ prefix: string;
+ suffix: string;
+ pattern: RegExp;
+}
+
+const FORMAT_MARKERS: Record<string, FormatMarker> = {
+ bold: { prefix: '**', suffix: '**', pattern: /^\*\*(.+)\*\*$/ },
+ italic: { prefix: '*', suffix: '*', pattern: /^\*([^*]+)\*$/ },
+ underline: { prefix: '__', suffix: '__', pattern: /^__(.+)__$/ },
+ strike: { prefix: '~~', suffix: '~~', pattern: /^~~(.+)~~$/ },
+ code: { prefix: '`', suffix: '`', pattern: /^`([^`]+)`$/ },
+ superscript: { prefix: '^', suffix: '^', pattern: /^\^(.+)\^$/ },
+ subscript: { prefix: '~', suffix: '~', pattern: /^~([^~]+)~$/ },
+ mark: { prefix: '==', suffix: '==', pattern: /^==(.+)==$/ },
+};
+
+/**
+ * Checks if the text around selection is wrapped with specific markers
+ * Returns the extended range if found, or null if not formatted
+ */
+function detectWrappedFormat(doc: string, from: number, to: number, prefix: string, suffix: string): { from: number; to: number; innerText: string } | null {
+ const prefixLen = prefix.length;
+ const suffixLen = suffix.length;
+
+ // Check if we can extend selection to include markers
+ const extendedFrom = from - prefixLen;
+ const extendedTo = to + suffixLen;
+
+ if (extendedFrom < 0 || extendedTo > doc.length) return null;
+
+ const beforeText = doc.slice(extendedFrom, from);
+ const afterText = doc.slice(to, extendedTo);
+
+ if (beforeText === prefix && afterText === suffix) {
+ return {
+ from: extendedFrom,
+ to: extendedTo,
+ innerText: doc.slice(from, to),
+ };
+ }
+
+ return null;
+}
+
+/**
+ * Check if selected text itself contains the format markers
+ */
+function detectInnerFormat(selectedText: string, pattern: RegExp): string | null {
+ const match = selectedText.match(pattern);
+ return match && match[1] !== undefined ? match[1] : null;
+}
+
+function trimSelectionWhitespace(view: EditorView, from: number, to: number): { newFrom: number; newTo: number } {
+ const state = view.state;
+ let newFrom = from;
+ let newTo = to;
+
+ // Trim leading whitespace
+ while (newFrom < newTo && /\s/.test(state.doc.sliceString(newFrom, newFrom + 1))) {
+ newFrom++;
+ }
+
+ // Trim trailing whitespace
+ while (newTo > newFrom && /\s/.test(state.doc.sliceString(newTo - 1, newTo))) {
+ newTo--;
+ }
+
+ return { newFrom, newTo };
+}
+
+/**
+ * Toggle inline formatting (bold, italic, etc.)
+ * If text is already formatted, remove formatting
+ * If not, apply formatting
+ */
+function toggleInlineFormat(view: EditorView, formatKey: keyof typeof FORMAT_MARKERS): void {
+ const marker = FORMAT_MARKERS[formatKey];
+ if (!marker) return;
+
+ const state = view.state;
+ const { newFrom: from, newTo: to } = trimSelectionWhitespace(view, state.selection.main.from, state.selection.main.to);
+ const doc = state.doc.toString();
+ const selectedText = state.sliceDoc(from, to);
+
+ // Case 1: Check if surrounding text has the markers (cursor inside formatted text)
+ const wrappedFormat = detectWrappedFormat(doc, from, to, marker.prefix, marker.suffix);
+ if (wrappedFormat) {
+ // Remove formatting by replacing the whole wrapped section with inner text
+ view.dispatch({
+ changes: { from: wrappedFormat.from, to: wrappedFormat.to, insert: wrappedFormat.innerText },
+ selection: { anchor: wrappedFormat.from, head: wrappedFormat.from + wrappedFormat.innerText.length },
+ });
+ view.focus();
+ return;
+ }
+
+ // Case 2: Check if selection itself is wrapped (user selected including markers)
+ const innerText = detectInnerFormat(selectedText, marker.pattern);
+ if (innerText !== null) {
+ view.dispatch({
+ changes: { from, to, insert: innerText },
+ selection: { anchor: from, head: from + innerText.length },
+ });
+ view.focus();
+ return;
+ }
+
+ // Case 3: No formatting detected, apply it
+ const newText = `${marker.prefix}${selectedText}${marker.suffix}`;
+ const newFrom = from + marker.prefix.length;
+ const newTo = newFrom + selectedText.length;
+
+ view.dispatch({
+ changes: { from, to, insert: newText },
+ selection: { anchor: newFrom, head: newTo },
+ });
+ view.focus();
+}
+
+// ============================================================================
+// LINE-BASED OPERATIONS (Lists, Quotes, Headers)
+// ============================================================================
+
+interface LinePrefixConfig {
+ pattern: RegExp;
+ getPrefix: (lineIndex: number, match?: RegExpMatchArray) => string;
+ removePrefix: (line: string, match: RegExpMatchArray) => string;
+}
+
+const LINE_PREFIXES: Record<string, LinePrefixConfig> = {
+ quote: {
+ pattern: /^>\s?/,
+ getPrefix: () => '> ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ list: {
+ pattern: /^[-*+]\s/,
+ getPrefix: () => '- ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ orderedList: {
+ pattern: /^\d+\.\s/,
+ getPrefix: idx => `${idx + 1}. `,
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ taskList: {
+ pattern: /^-\s\[([ x])\]\s/,
+ getPrefix: () => '- [ ] ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ h1: {
+ pattern: /^#\s/,
+ getPrefix: () => '# ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ h2: {
+ pattern: /^##\s/,
+ getPrefix: () => '## ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ h3: {
+ pattern: /^###\s/,
+ getPrefix: () => '### ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ h4: {
+ pattern: /^####\s/,
+ getPrefix: () => '#### ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ h5: {
+ pattern: /^#####\s/,
+ getPrefix: () => '##### ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+ h6: {
+ pattern: /^######\s/,
+ getPrefix: () => '###### ',
+ removePrefix: (line, match) => line.slice(match[0].length),
+ },
+};
+
+/**
+ * Toggle line-based formatting (lists, quotes, headers)
+ * Works on multiple lines when selected
+ */
+function toggleLinePrefix(view: EditorView, prefixKey: string): void {
+ const config = LINE_PREFIXES[prefixKey];
+ if (!config) return;
+
+ const state = view.state;
+ const { from, to } = state.selection.main;
+
+ // Get line numbers for selection
+ const startLine = state.doc.lineAt(from);
+ const endLine = state.doc.lineAt(to);
+
+ const changes: { from: number; to: number; insert: string }[] = [];
+ let allHavePrefix = true;
+
+ // First pass: check if all lines have the prefix
+ for (let lineNum = startLine.number; lineNum <= endLine.number; lineNum++) {
+ const line = state.doc.line(lineNum);
+ const match = line.text.match(config.pattern);
+ if (!match) {
+ allHavePrefix = false;
+ break;
+ }
+ }
+
+ // Second pass: apply changes
+ let lineIndex = 0;
+ for (let lineNum = startLine.number; lineNum <= endLine.number; lineNum++) {
+ const line = state.doc.line(lineNum);
+ const match = line.text.match(config.pattern);
+
+ if (allHavePrefix && match) {
+ // Remove prefix
+ const newText = config.removePrefix(line.text, match);
+ changes.push({ from: line.from, to: line.to, insert: newText });
+ } else if (!allHavePrefix) {
+ // Add prefix (remove existing if different type for headers)
+ let textWithoutPrefix = line.text;
+
+ // For headers, remove any existing header prefix first
+ if (prefixKey.startsWith('h')) {
+ const headerMatch = line.text.match(/^#{1,6}\s/);
+ if (headerMatch) {
+ textWithoutPrefix = line.text.slice(headerMatch[0].length);
+ }
+ }
+
+ const prefix = config.getPrefix(lineIndex, match || undefined);
+ changes.push({ from: line.from, to: line.to, insert: prefix + textWithoutPrefix });
+ }
+ lineIndex++;
+ }
+
+ if (changes.length > 0) {
+ view.dispatch({ changes });
+ view.focus();
+ }
+}
+
+/**
+ * Toggle task item checkbox
+ */
+function toggleTaskCheckbox(view: EditorView): void {
+ const state = view.state;
+ const { from } = state.selection.main;
+ const line = state.doc.lineAt(from);
+
+ const uncheckedMatch = line.text.match(/^(-\s\[)\s(\].*)$/);
+ const checkedMatch = line.text.match(/^(-\s\[)x(\].*)$/);
+
+ if (uncheckedMatch) {
+ // Check the box
+ view.dispatch({
+ changes: { from: line.from, to: line.to, insert: `${uncheckedMatch[1]}x${uncheckedMatch[2]}` },
+ });
+ } else if (checkedMatch) {
+ // Uncheck the box
+ view.dispatch({
+ changes: { from: line.from, to: line.to, insert: `${checkedMatch[1]} ${checkedMatch[2]}` },
+ });
+ }
+ view.focus();
+}
+
+// ============================================================================
+// CODE BLOCK OPERATIONS
+// ============================================================================
+
+/**
+ * Insert or toggle code block (multi-line)
+ */
+function toggleCodeBlock(view: EditorView, language = ''): void {
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
+ const doc = state.doc.toString();
+
+ // Check if selection is inside a code block
+ const codeBlockPattern = /```(\w*)\n([\s\S]*?)```/g;
+ let match;
+ while ((match = codeBlockPattern.exec(doc)) !== null) {
+ const blockStart = match.index;
+ const blockEnd = blockStart + match[0].length;
+
+ if (from >= blockStart && to <= blockEnd) {
+ // Inside a code block, extract content and remove block
+ const content = match[2] ?? '';
+ view.dispatch({
+ changes: { from: blockStart, to: blockEnd, insert: content.trim() },
+ });
+ view.focus();
+ return;
+ }
+ }
+
+ // Not in a code block, create one
+ const isMultiLine = selectedText.includes('\n');
+
+ if (isMultiLine || selectedText.length > 50) {
+ // Use fenced code block for multi-line
+ const insert = `\`\`\`${language}\n${selectedText}\n\`\`\``;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + 4 + language.length, head: from + 4 + language.length + selectedText.length },
+ });
+ } else {
+ // Use inline code for short single-line
+ toggleInlineFormat(view, 'code');
+ return;
+ }
+ view.focus();
+}
+
+// ============================================================================
+// LINK & IMAGE OPERATIONS
+// ============================================================================
+
+/**
+ * Smart link insertion - detects if selection is a URL
+ */
+function insertLink(view: EditorView): void {
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
+ const doc = state.doc.toString();
+
+ // Check if already in a link
+ const linkPattern = /\[([^\]]*)\]\(([^)]*)\)/g;
+ let match;
+ while ((match = linkPattern.exec(doc)) !== null) {
+ const linkStart = match.index;
+ const linkEnd = linkStart + match[0].length;
+
+ if (from >= linkStart && to <= linkEnd) {
+ // Inside a link, extract text and remove link formatting
+ const linkText = match[1];
+ view.dispatch({
+ changes: { from: linkStart, to: linkEnd, insert: linkText },
+ });
+ view.focus();
+ return;
+ }
+ }
+
+ // Check if selection looks like a URL
+ const urlPattern = /^https?:\/\/[^\s]+$/;
+ const isUrl = urlPattern.test(selectedText);
+
+ if (isUrl) {
+ // Selected text is URL, create link with URL and place cursor in text part
+ const insert = `[](${selectedText})`;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + 1 },
+ });
+ } else {
+ // Selected text is link text, place cursor in URL part
+ const insert = `[${selectedText}]()`;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + selectedText.length + 3 },
+ });
+ }
+ view.focus();
+}
+
+// ============================================================================
+// SPECIAL INSERTIONS
+// ============================================================================
+
+/**
+ * Insert horizontal rule
+ */
+function insertHorizontalRule(view: EditorView): void {
+ const state = view.state;
+ const { from } = state.selection.main;
+ const line = state.doc.lineAt(from);
+
+ // Insert at the end of current line with newlines
+ const insert = line.text.length > 0 ? '\n\n---\n\n' : '---\n\n';
+ view.dispatch({
+ changes: { from: line.to, to: line.to, insert },
+ selection: { anchor: line.to + insert.length },
+ });
+ view.focus();
+}
+
+/**
+ * Insert math block (LaTeX)
+ */
+function insertMathBlock(view: EditorView, inline = true): void {
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
+
+ if (inline) {
+ const insert = `$${selectedText}$`;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + 1, head: from + 1 + selectedText.length },
+ });
+ } else {
+ const insert = `$$\n${selectedText}\n$$`;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: from + 3, head: from + 3 + selectedText.length },
+ });
+ }
+ view.focus();
+}
+
+/**
+ * Insert footnote
+ */
+function insertFootnote(view: EditorView): void {
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
+ const doc = state.doc.toString();
+
+ // Count existing footnotes to generate unique ID
+ const footnoteCount = (doc.match(/\[\^\d+\]/g) || []).length / 2 + 1;
+
+ const insert = `[^${footnoteCount}]`;
+ const footnoteDefinition = `\n\n[^${footnoteCount}]: ${selectedText}`;
+
+ // Insert reference at cursor
+ view.dispatch({
+ changes: [
+ { from, to, insert },
+ { from: doc.length, to: doc.length, insert: footnoteDefinition },
+ ],
+ selection: { anchor: from + insert.length },
+ });
+ view.focus();
+}
+
+/**
+ * Indent or outdent selected lines
+ */
+function indentLines(view: EditorView, outdent = false): void {
+ const state = view.state;
+ const { from, to } = state.selection.main;
+
+ const startLine = state.doc.lineAt(from);
+ const endLine = state.doc.lineAt(to);
+
+ const changes: { from: number; to: number; insert: string }[] = [];
+
+ for (let lineNum = startLine.number; lineNum <= endLine.number; lineNum++) {
+ const line = state.doc.line(lineNum);
+
+ if (outdent) {
+ // Remove leading tab or 2-4 spaces
+ const match = line.text.match(/^(\t| {1,2})/);
+ if (match) {
+ changes.push({ from: line.from, to: line.from + match[0].length, insert: '' });
+ }
+ } else {
+ // Add tab
+ changes.push({ from: line.from, to: line.from, insert: '\t' });
+ }
+ }
+
+ if (changes.length > 0) {
+ view.dispatch({ changes });
+ view.focus();
+ }
+}
+
+// ============================================================================
+// MAIN COMMANDS EXPORT
+// ============================================================================
+
export function createCommands(params: CreateCommandsParams) {
function insertText(text: string) {
const view = params.getView();
@@ -29,13 +513,16 @@ export function createCommands(params: CreateCommandsParams) {
const modalManager = useModal();
modalManager.add(new Modal(shallowRef(ColorPickerModal), { props: { onColorSelect: handleColorSelect } }));
}
+
function handleColorSelect(color: string) {
exec('color', color);
}
+
function openImageSelector() {
const modalManager = useModal();
modalManager.add(new Modal(shallowRef(ImageSelectorModal), { props: { onImageSelect: handleImageSelect }, size: 'large' }));
}
+
function openGridOrganization() {
const modalManager = useModal();
modalManager.add(new Modal(shallowRef(GridOrganizationModal), { props: { onGridSelect: handleGridSelect } }));
@@ -69,6 +556,7 @@ export function createCommands(params: CreateCommandsParams) {
}
function exec(action: string, payload?: string) {
+ // Non-editor actions
if (action === 'preview') return (params.showPreview.value = !params.showPreview.value);
if (action === 'openColorPicker') return openColorModal();
if (action === 'save') return params.save();
@@ -83,60 +571,86 @@ export function createCommands(params: CreateCommandsParams) {
const view = params.getView();
if (!view) return;
- const state = view.state;
- const { from, to } = state.selection.main;
- const selectedText = state.sliceDoc(from, to);
+ // Inline formatting toggles
+ if (['bold', 'italic', 'underline', 'strike', 'code', 'superscript', 'subscript', 'mark'].includes(action)) {
+ return toggleInlineFormat(view, action as keyof typeof FORMAT_MARKERS);
+ }
- let changes: { from: number; to: number; insert: string } | undefined;
- let select_from = from + 2;
- let select_to = to + 2;
+ // Line-based toggles
+ if (['quote', 'list', 'orderedList', 'taskList', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'].includes(action)) {
+ return toggleLinePrefix(view, action);
+ }
+ // Special actions
switch (action) {
- case 'bold':
- changes = { from, to, insert: `**${selectedText}**` };
- break;
- case 'italic':
- changes = { from, to, insert: `*${selectedText}*` };
- select_from = from + 1;
- select_to = select_from + selectedText.length;
- break;
- case 'underline':
- changes = { from, to, insert: `__${selectedText}__` };
- break;
- case 'strike':
- changes = { from, to, insert: `~~${selectedText}~~` };
- break;
case 'link':
- changes = { from, to, insert: `[](${selectedText})` };
- select_from = from + 3;
- select_to = select_from;
- break;
- case 'code':
- changes = { from, to, insert: `\`${selectedText}\`` };
- break;
- case 'quote':
- changes = { from, to, insert: `> ${selectedText}\n` };
- break;
- case 'list':
- changes = { from, to, insert: `- ${selectedText}\n` };
- break;
- case 'orderedList':
- changes = { from, to, insert: `1. ${selectedText}\n` };
- break;
+ return insertLink(view);
+
+ case 'codeBlock':
+ return toggleCodeBlock(view, payload || '');
+
+ case 'horizontalRule':
+ return insertHorizontalRule(view);
+
+ case 'mathInline':
+ return insertMathBlock(view, true);
+
+ case 'mathBlock':
+ return insertMathBlock(view, false);
+
+ case 'footnote':
+ return insertFootnote(view);
+
+ case 'indent':
+ return indentLines(view, false);
+
+ case 'outdent':
+ return indentLines(view, true);
+
+ case 'toggleCheckbox':
+ return toggleTaskCheckbox(view);
+
case 'color': {
const color = String(payload || '').trim();
if (!color) return;
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ const selectedText = state.sliceDoc(from, to);
const insert = `{color:${color}}(${selectedText})`;
- changes = { from, to, insert };
- select_from = insert.indexOf('(') + 1 + from;
- select_to = select_from + selectedText.length;
+ const selectFrom = insert.indexOf('(') + 1 + from;
+ const selectTo = selectFrom + selectedText.length;
+ view.dispatch({
+ changes: { from, to, insert },
+ selection: { anchor: selectFrom, head: selectTo },
+ });
+ view.focus();
break;
}
- }
- if (changes) {
- view.dispatch({ changes, selection: { anchor: select_from, head: select_to } });
- view.focus();
+ case 'clearFormatting': {
+ const state = view.state;
+ const { from, to } = state.selection.main;
+ let text = state.sliceDoc(from, to);
+
+ // Remove common markdown formatting
+ text = text
+ .replace(/\*\*(.+?)\*\*/g, '$1') // bold
+ .replace(/\*(.+?)\*/g, '$1') // italic
+ .replace(/__(.+?)__/g, '$1') // underline
+ .replace(/~~(.+?)~~/g, '$1') // strikethrough
+ .replace(/`(.+?)`/g, '$1') // code
+ .replace(/==(.+?)==/g, '$1') // mark
+ .replace(/\^(.+?)\^/g, '$1') // superscript
+ .replace(/~(.+?)~/g, '$1') // subscript
+ .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1'); // links
+
+ view.dispatch({
+ changes: { from, to, insert: text },
+ selection: { anchor: from, head: from + text.length },
+ });
+ view.focus();
+ break;
+ }
}
}
diff --git a/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts b/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts
index 70a36a59..a651160f 100644
--- a/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts
+++ b/frontend/app/components/MarkdownEditor/modules/editorKeymaps.ts
@@ -1,7 +1,8 @@
import type { KeyBinding } from '@codemirror/view';
-export function createKeymaps(commands: { exec: (action: string) => void }) {
+export function createKeymaps(commands: { exec: (action: string, payload?: string) => void }) {
const markdownKeysmap: readonly KeyBinding[] = [
+ // Text formatting
{
key: 'Mod-b',
run: () => {
@@ -24,19 +25,164 @@ export function createKeymaps(commands: { exec: (action: string) => void }) {
},
},
{
- key: 'Mod-e',
+ key: 'Mod-Shift-s',
run: () => {
- commands.exec('image');
+ commands.exec('strike');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-h',
+ run: () => {
+ commands.exec('mark');
return true;
},
},
+
+ // Links and media
{
- key: 'Mod-l',
+ key: 'Mod-k',
run: () => {
commands.exec('link');
return true;
},
},
+ {
+ key: 'Mod-Shift-i',
+ run: () => {
+ commands.exec('image');
+ return true;
+ },
+ },
+
+ // Code
+ {
+ key: 'Mod-e',
+ run: () => {
+ commands.exec('code');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-c',
+ run: () => {
+ commands.exec('codeBlock');
+ return true;
+ },
+ },
+
+ // Structure
+ {
+ key: 'Mod-Shift-.',
+ run: () => {
+ commands.exec('quote');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-7',
+ run: () => {
+ commands.exec('orderedList');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-8',
+ run: () => {
+ commands.exec('list');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-9',
+ run: () => {
+ commands.exec('taskList');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Enter',
+ run: () => {
+ commands.exec('toggleCheckbox');
+ return true;
+ },
+ },
+
+ // Headers
+ {
+ key: 'Mod-1',
+ run: () => {
+ commands.exec('h1');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-2',
+ run: () => {
+ commands.exec('h2');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-3',
+ run: () => {
+ commands.exec('h3');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-4',
+ run: () => {
+ commands.exec('h4');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-5',
+ run: () => {
+ commands.exec('h5');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-6',
+ run: () => {
+ commands.exec('h6');
+ return true;
+ },
+ },
+
+ // Math
+ {
+ key: 'Mod-m',
+ run: () => {
+ commands.exec('mathInline');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-m',
+ run: () => {
+ commands.exec('mathBlock');
+ return true;
+ },
+ },
+
+ // Other
+ {
+ key: 'Mod-Shift-x',
+ run: () => {
+ commands.exec('clearFormatting');
+ return true;
+ },
+ },
+ {
+ key: 'Mod-Shift-r',
+ run: () => {
+ commands.exec('horizontalRule');
+ return true;
+ },
+ },
];
return markdownKeysmap;
diff --git a/frontend/app/components/MarkdownSyntax.vue b/frontend/app/components/MarkdownSyntax.vue
index e23f0b9c..83f87497 100644
--- a/frontend/app/components/MarkdownSyntax.vue
+++ b/frontend/app/components/MarkdownSyntax.vue
@@ -12,6 +12,8 @@
<li><u>Underline</u>: <code>_underline_</code></li>
<li><del>Strikethrough</del>: <code>~~strikethrough~~</code></li>
<li><mark>Highlight</mark>: <code>==highlight==</code></li>
+ <li>Superscript: <sup>text</sup> <code>^text^</code></li>
+ <li>Subscript: <sub>text</sub> <code>~text~</code></li>
</ul>
<!-- TAGS -->
@@ -215,7 +217,7 @@ Useful for side content or notes.
<li><strong>Task lists:</strong> <code>- [ ] Todo</code>, <code>- [x] Done</code></li>
<li>
<strong>Tables:</strong><br />
- <pre style=" margin: 10px 0;padding: 0.75rem; border-radius: 6px; color: white; overflow-x: auto">
+ <pre style="margin: 10px 0; padding: 0.75rem; border-radius: 6px; color: white; overflow-x: auto">
| Column 1 | Column 2 |
|-----------|-----------|
| Cell 1 | Cell 2 |</pre
@@ -224,6 +226,31 @@ Useful for side content or notes.
<li><strong>Footnotes:</strong> <code>Text[^1]</code> with <code>[^1]: footnote text</code></li>
<li><strong>Inline HTML:</strong> <code>&lt;span style="color:red"&gt;text&lt;/span&gt;</code></li>
</ul>
+
+ <!-- FOOTNOTES -->
+ <h2><Icon name="format/footnote" fill="var(--primary)" /> Footnotes</h2>
+ <p>Add footnotes to your text for references or additional information.</p>
+ <div class="demo">
+ <pre>
+This is a text with a note[^1] and another[^ref].
+
+[^1]: First footnote
+[^ref]: Second footnote with text identifier</pre
+ >
+ <div>
+ <p>
+ This is a text with a note<sup class="footnote-ref"><a href="#fn-1" title="First footnote">[1]</a></sup> and another<sup class="footnote-ref"
+ ><a href="#fn-ref" title="Second footnote with text identifier">[ref]</a></sup
+ >.
+ </p>
+ <section class="footnotes" style="margin-top: 1rem; padding-top: 0.5rem; border-top: 1px solid var(--border-color); font-size: 0.9rem">
+ <ol style="margin: 0; padding-left: 1.5rem">
+ <li>First footnote <a href="#fnref-1" class="footnote-backref">↩</a></li>
+ <li>Second footnote with text identifier <a href="#fnref-ref" class="footnote-backref">↩</a></li>
+ </ol>
+ </section>
+ </div>
+ </div>
</div>
</div>
</template>
@@ -299,13 +326,6 @@ code {
grid-template-columns: repeat(3, 1fr);
}
-.external-link {
- display: inline-flex;
- color: var(--primary);
- align-items: center;
- gap: 4px;
-}
-
@media screen and (width <= 800px) {
.block-grid {
grid-template-columns: 1fr;
diff --git a/frontend/app/composables/Preferences.ts b/frontend/app/composables/Preferences.ts
index 6be9a90b..3207dc08 100644
--- a/frontend/app/composables/Preferences.ts
+++ b/frontend/app/composables/Preferences.ts
@@ -45,6 +45,7 @@ export const DEFAULT_PREFERENCES = {
editorSpellCheck: true as boolean,
editorDisplayStats: false as boolean,
editorSnippetsEnabled: true as boolean,
+ editorSimplifiedViewOnMobile: true as boolean,
developerMode: false as boolean,
};
diff --git a/frontend/app/helpers/markdown/checkbox.ts b/frontend/app/helpers/markdown/checkbox.ts
new file mode 100644
index 00000000..ec18811a
--- /dev/null
+++ b/frontend/app/helpers/markdown/checkbox.ts
@@ -0,0 +1,38 @@
+import type MarkdownIt from 'markdown-it';
+import type { StateCore } from 'markdown-it/dist/index.cjs.js';
+
+function markdownItCheckbox(md: MarkdownIt) {
+ let checkboxIdCounter = 0;
+ // Add a core rule to process checkboxes
+ md.core.ruler.after('inline', 'checkbox', (state: StateCore) => {
+ // Iterate through all tokens in the state
+ for (let i = 0; i < state.tokens.length; i++) {
+ const token = state.tokens[i];
+ if (!token) continue;
+ // Check if the token is an inline token and contains checkboxes
+ if (token.type === 'inline' && token.content.match(/^\[([ xX])\]/)) {
+ const match = token.content.match(/^\[([ xX])\]\s*(.*)/);
+
+ if (match) {
+ const isChecked = match[1]?.toLowerCase() === 'x';
+ const label = match[2];
+ const checkboxId = `check-${checkboxIdCounter++}`;
+
+ // Inject HTML tokens for rendering checkboxes
+ const checkboxToken = new state.Token('html_inline', '', 0);
+ checkboxToken.content = `
+ <label class="checkbox-container">
+ <input type="checkbox" ${isChecked ? 'checked' : ''} id="check-${checkboxId}">
+ <span>${label}</span>
+ </label>
+ `;
+
+ token.children = [checkboxToken]; // Replace children with the new HTML content
+ token.content = ''; // Clear the text content to avoid duplicate rendering
+ }
+ }
+ }
+ });
+}
+
+export { markdownItCheckbox };
diff --git a/frontend/app/helpers/markdown/index.ts b/frontend/app/helpers/markdown/index.ts
index 4b2605b8..1d818a13 100644
--- a/frontend/app/helpers/markdown/index.ts
+++ b/frontend/app/helpers/markdown/index.ts
@@ -1,4 +1,3 @@
-/* eslint-disable @typescript-eslint/no-explicit-any */
import MarkdownIt from 'markdown-it';
import { containerPlugin } from './container';
import { anchorPlugin } from './anchor';
@@ -10,10 +9,12 @@ import underline from 'markdown-it-underline';
import highlight from 'markdown-it-highlightjs';
// @ts-expect-error no types provided
import mark from 'markdown-it-mark';
-import katex from 'katex';
import colorPlugin from './colors';
+import { subscriptPlugin, superscriptPlugin, footNotePlugin } from './other';
+import { markdownItCheckbox } from './checkbox';
+import { markdownItKatexPlugin } from './katex';
-const md = new MarkdownIt({ html: true });
+const md = new MarkdownIt({ html: true, linkify: true });
md.use(containerPlugin);
md.use(anchorPlugin);
md.use(containerSvg);
@@ -24,104 +25,14 @@ md.use(mark);
md.use(markdownItKatexPlugin);
md.use(highlight);
md.use(markdownItCheckbox);
+md.use(subscriptPlugin);
+md.use(superscriptPlugin);
+md.use(footNotePlugin);
md.use(colorPlugin, {
enableBracketSyntax: true, // also parse [text]{color=value}
allowHex: true, // allow #rgb and #rrggbb
- allowedNamedColors: ['red', 'crimson', 'rebeccapurple'], // restrict named colors (null = all standard names)
});
-function markdownItKatexPlugin(md: any) {
- md.inline.ruler.after('escape', 'katex', (state: any, silent: any) => {
- if (silent) return false;
-
- const startMathPos = state.pos;
- if (state.src.charCodeAt(startMathPos) !== 0x24 /* $ */) return false;
-
- // Vérifie si c'est $$ (display) ou $ (inline)
- const isDisplay = state.src.charCodeAt(startMathPos + 1) === 0x24;
- const endMarker = isDisplay ? '$$' : '$';
-
- let found = false;
- let endMathPos = -1;
- const searchStart = startMathPos + (isDisplay ? 2 : 1);
-
- // Recherche du délimiteur de fin
- for (let i = searchStart; i < state.src.length; i++) {
- if (state.src.charCodeAt(i) === 0x24 /* $ */) {
- // Si on a $$ en fin
- if (isDisplay && state.src.charCodeAt(i + 1) === 0x24 && state.src.charCodeAt(i - 1) !== 0x5c) {
- found = true;
- endMathPos = i;
- break;
- }
- // Si on a $ en fin
- if (!isDisplay && state.src.charCodeAt(i - 1) !== 0x5c) {
- found = true;
- endMathPos = i;
- break;
- }
- }
- }
-
- if (!found) return false;
-
- const token = state.push(isDisplay ? 'katex_display' : 'katex_inline', '', 0);
- token.markup = endMarker;
- token.content = state.src.slice(startMathPos + endMarker.length, endMathPos);
-
- state.pos = endMathPos + endMarker.length;
- return true;
- });
-
- // Inline math ($...$)
- md.renderer.rules.katex_inline = (tokens: any, idx: any) => {
- return mdToKatex(tokens[idx].content, false);
- };
-
- // Display math ($$...$$)
- md.renderer.rules.katex_display = (tokens: any, idx: any) => {
- return mdToKatex(tokens[idx].content, true);
- };
-}
-
-// [ ] and [x] checkbox
-// Fonction markdownItCheckbox
-// Ajout d'une règle pour les listes
-function markdownItCheckbox(md: any) {
- let checkboxIdCounter = 0;
- // Ajout d'une règle pour transformer les cases à cocher
- md.core.ruler.after('inline', 'checkbox', (state: any) => {
- // Parcourt tous les tokens de l'état
- for (let i = 0; i < state.tokens.length; i++) {
- const token = state.tokens[i];
-
- // Vérifier si le token est une liste et s'il contient des cases à cocher
- if (token.type === 'inline' && token.content.match(/^\[([ xX])\]/)) {
- const match = token.content.match(/^\[([ xX])\]\s*(.*)/);
-
- if (match) {
- const isChecked = match[1].toLowerCase() === 'x';
- const label = match[2];
- const checkboxId = `check-${checkboxIdCounter++}`;
-
- // Injecte des tokens HTML pour le rendu des cases à cocher
- const checkboxToken = new state.Token('html_inline', '', 0);
- checkboxToken.content = `
- <label class="checkbox-container">
- <input type="checkbox" ${isChecked ? 'checked' : ''} id="check-${checkboxId}">
- <span>${label}</span>
- </label>
- `;
-
- token.children = [checkboxToken]; // Remplace les enfants par le nouveau contenu HTML
- token.content = ''; // Vide le contenu textuel pour éviter un rendu dupliqué
- }
- }
- }
- });
-}
-// Définir une règle de rendu pour injecter les cases à cocher
-
export default function compile(str: string = ''): string {
// Replace &lt; &gt; &amp; to < > & (to avoid markdown-it escape)
str = str.replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
@@ -129,12 +40,3 @@ export default function compile(str: string = ''): string {
html: true,
});
}
-function mdToKatex(text: string, centered: boolean): string {
- const expressionWithoutDollar = text;
- const render = katex.renderToString(expressionWithoutDollar, {
- throwOnError: false,
- displayMode: true,
- trust: true,
- });
- return `<span class="katex-container ${centered ? 'center' : ''}"><i>${render}</i></span>`;
-}
diff --git a/frontend/app/helpers/markdown/katex.ts b/frontend/app/helpers/markdown/katex.ts
new file mode 100644
index 00000000..54de3461
--- /dev/null
+++ b/frontend/app/helpers/markdown/katex.ts
@@ -0,0 +1,70 @@
+import { renderToString } from 'katex';
+import type MarkdownIt from 'markdown-it';
+import type { StateInline } from 'markdown-it/dist/index.cjs.js';
+
+function markdownItKatexPlugin(md: MarkdownIt) {
+ md.inline.ruler.after('escape', 'katex', (state: StateInline, silent: boolean) => {
+ if (silent) return false;
+
+ const startMathPos = state.pos;
+ if (state.src.charCodeAt(startMathPos) !== 0x24 /* $ */) return false;
+
+ // Check if it's display math ($$) or inline math ($)
+ const isDisplay = state.src.charCodeAt(startMathPos + 1) === 0x24;
+ const endMarker = isDisplay ? '$$' : '$';
+
+ let found = false;
+ let endMathPos = -1;
+ const searchStart = startMathPos + (isDisplay ? 2 : 1);
+
+ // Search for the end delimiter
+ for (let i = searchStart; i < state.src.length; i++) {
+ if (state.src.charCodeAt(i) === 0x24 /* $ */) {
+ // If we have $$ at the end
+ if (isDisplay && state.src.charCodeAt(i + 1) === 0x24 && state.src.charCodeAt(i - 1) !== 0x5c) {
+ found = true;
+ endMathPos = i;
+ break;
+ }
+ // Si on a $ en fin
+ if (!isDisplay && state.src.charCodeAt(i - 1) !== 0x5c) {
+ found = true;
+ endMathPos = i;
+ break;
+ }
+ }
+ }
+
+ if (!found) return false;
+
+ const token = state.push(isDisplay ? 'katex_display' : 'katex_inline', '', 0);
+ token.markup = endMarker;
+ token.content = state.src.slice(startMathPos + endMarker.length, endMathPos);
+
+ state.pos = endMathPos + endMarker.length;
+ return true;
+ });
+
+ // Inline math ($...$)
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ md.renderer.rules.katex_inline = (tokens: any, idx: any) => {
+ return mdToKatex(tokens[idx].content, false);
+ };
+
+ // Display math ($$...$$)
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ md.renderer.rules.katex_display = (tokens: any, idx: any) => {
+ return mdToKatex(tokens[idx].content, true);
+ };
+}
+
+function mdToKatex(text: string, centered: boolean): string {
+ const expressionWithoutDollar = text;
+ const render = renderToString(expressionWithoutDollar, {
+ throwOnError: false,
+ displayMode: true,
+ trust: true,
+ });
+ return `<span class="katex-container ${centered ? 'center' : ''}">${render}</span>`;
+}
+export { markdownItKatexPlugin };
diff --git a/frontend/app/helpers/markdown/other.ts b/frontend/app/helpers/markdown/other.ts
new file mode 100644
index 00000000..48e87d6e
--- /dev/null
+++ b/frontend/app/helpers/markdown/other.ts
@@ -0,0 +1,130 @@
+import type MarkdownIt from 'markdown-it';
+import type { StateInline } from 'markdown-it/dist/index.cjs.js';
+
+function superscriptPlugin(md: MarkdownIt) {
+ md.inline.ruler.after('emphasis', 'superscript', (state: StateInline, silent: boolean) => {
+ const start = state.pos;
+ if (state.src.charCodeAt(start) !== 0x5e /* ^ */) return false;
+
+ let end = start + 1;
+ while (end < state.src.length && state.src.charCodeAt(end) !== 0x5e /* ^ */) {
+ end++;
+ }
+
+ if (end === start + 1 || end >= state.src.length) return false;
+
+ if (!silent) {
+ state.push('sup_open', 'sup', 1);
+ state.push('text', '', 0).content = state.src.slice(start + 1, end);
+ state.push('sup_close', 'sup', -1);
+ }
+
+ state.pos = end + 1;
+ return true;
+ });
+
+ md.renderer.rules.sup_open = () => '<sup>';
+ md.renderer.rules.sup_close = () => '</sup>';
+}
+
+function subscriptPlugin(md: MarkdownIt) {
+ md.inline.ruler.after('emphasis', 'subscript', (state: StateInline, silent: boolean) => {
+ const start = state.pos;
+ if (state.src.charCodeAt(start) !== 0x7e /* ~ */) return false;
+
+ let end = start + 1;
+ while (end < state.src.length && state.src.charCodeAt(end) !== 0x7e /* ~ */) {
+ end++;
+ }
+
+ if (end === start + 1 || end >= state.src.length) return false;
+
+ if (!silent) {
+ state.push('sub_open', 'sub', 1);
+ state.push('text', '', 0).content = state.src.slice(start + 1, end);
+ state.push('sub_close', 'sub', -1);
+ }
+
+ state.pos = end + 1;
+ return true;
+ });
+
+ md.renderer.rules.sub_open = () => '<sub>';
+ md.renderer.rules.sub_close = () => '</sub>';
+}
+
+function footNotePlugin(md: MarkdownIt) {
+ const footnotes: Map<string, string> = new Map();
+
+ // Parse footnote definitions: [^id]: content
+ md.block.ruler.before('reference', 'footnote_def', (state, startLine, endLine, silent) => {
+ const start = state.bMarks[startLine]! + state.tShift[startLine]!;
+ const max = state.eMarks[startLine];
+ const line = state.src.slice(start, max);
+
+ const match = line.match(/^\[\^([^\]]+)\]:\s*(.*)$/);
+ if (!match) return false;
+
+ if (silent) return true;
+
+ const id = match[1]!;
+ const content = match[2]!;
+ footnotes.set(id, content);
+
+ state.line = startLine + 1;
+ return true;
+ });
+
+ // Parse footnote references: [^id]
+ md.inline.ruler.after('emphasis', 'footnote_ref', (state: StateInline, silent: boolean) => {
+ const start = state.pos;
+ const max = state.posMax;
+
+ if (start + 2 >= max) return false;
+ if (state.src.charCodeAt(start) !== 0x5b /* [ */) return false;
+ if (state.src.charCodeAt(start + 1) !== 0x5e /* ^ */) return false;
+
+ let end = start + 2;
+ while (end < max && state.src.charCodeAt(end) !== 0x5d /* ] */) {
+ end++;
+ }
+
+ if (end >= max) return false;
+
+ const id = state.src.slice(start + 2, end);
+ if (!id) return false;
+
+ if (!silent) {
+ const token = state.push('footnote_ref', '', 0);
+ token.meta = { id };
+ }
+
+ state.pos = end + 1;
+ return true;
+ });
+
+ md.renderer.rules.footnote_ref = (tokens, idx) => {
+ const id = tokens[idx]?.meta.id;
+ const content = footnotes.get(id) || '';
+ return `<sup class="footnote-ref"><a href="#fn-${id}" id="fnref-${id}" title="${md.utils.escapeHtml(content)}">[${id}]</a></sup>`;
+ };
+
+ // Add footnotes section at the end
+ const originalRender = md.render.bind(md);
+ md.render = (src: string, env?: object) => {
+ footnotes.clear();
+ let result = originalRender(src, env);
+
+ if (footnotes.size > 0) {
+ result += '<section class="footnotes"><hr><ol>';
+ footnotes.forEach((content, id) => {
+ result += `<li id="fn-${id}">${md.renderInline(content)} <a href="#fnref-${id}" class="footnote-backref">↩</a></li>`;
+ });
+ result += '</ol></section>';
+ }
+
+ return result;
+ };
+}
+
+export { superscriptPlugin, subscriptPlugin, footNotePlugin };
diff --git a/frontend/app/pages/dashboard/settings/_views/preferences.vue b/frontend/app/pages/dashboard/settings/_views/preferences.vue
index 4fe813b6..02f539c6 100644
--- a/frontend/app/pages/dashboard/settings/_views/preferences.vue
+++ b/frontend/app/pages/dashboard/settings/_views/preferences.vue
@@ -224,11 +224,17 @@ const options: Array<{ label: string; options: InterfaceOption[] }> = [
},
{
label: 'Enable Snippets',
- tag: 'New',
description: 'Enable or disable editor snippets functionality.',
type: 'toggle',
key: 'editorSnippetsEnabled',
},
+ {
+ label: 'Simplified view for mobile',
+ tag: 'New',
+ description: 'Enable a simplified editor view on mobile devices for better usability.',
+ type: 'toggle',
+ key: 'editorSimplifiedViewOnMobile',
+ },
],
},
{
diff --git a/frontend/public/app-icons/file_shortcut.svg b/frontend/public/app-icons/file_shortcut.svg
index df6e37d9..8e911527 100644
--- a/frontend/public/app-icons/file_shortcut.svg
+++ b/frontend/public/app-icons/file_shortcut.svg
@@ -1 +1 @@
-<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960" fill="var(--primary)"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>
\ No newline at end of file
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M400-280h160v-80H400v80Zm0-160h280v-80H400v80ZM280-600h400v-80H280v80Zm200 120ZM265-80q-79 0-134.5-55.5T75-270q0-57 29.5-102t77.5-68H80v-80h240v240h-80v-97q-37 8-61 38t-24 69q0 46 32.5 78t77.5 32v80Zm135-40v-80h360v-560H200v160h-80v-160q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H400Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/bold.svg b/frontend/public/app-icons/format/bold.svg
new file mode 100644
index 00000000..93cc44a3
--- /dev/null
+++ b/frontend/public/app-icons/format/bold.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M272-200v-560h221q65 0 120 40t55 111q0 51-23 78.5T602-491q25 11 55.5 41t30.5 90q0 89-65 124.5T501-200H272Zm121-112h104q48 0 58.5-24.5T566-372q0-11-10.5-35.5T494-432H393v120Zm0-228h93q33 0 48-17t15-38q0-24-17-39t-44-15h-95v109Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/clear-formatting.svg b/frontend/public/app-icons/format/clear-formatting.svg
new file mode 100644
index 00000000..d3f3a6a0
--- /dev/null
+++ b/frontend/public/app-icons/format/clear-formatting.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m486-160-62-62 84-84-150-150-84 84-62-62 84-84-138-138 50-50 512 512-50 50-84-84-84 84Zm-222-40v-80h200v80H264Zm358-358-56-56 142-142h-214v-80h394v74L642-558Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/code-block.svg b/frontend/public/app-icons/format/code-block.svg
new file mode 100644
index 00000000..308db53b
--- /dev/null
+++ b/frontend/public/app-icons/format/code-block.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m384-336 56-57-87-87 87-87-56-57-144 144 144 144Zm192 0 144-144-144-144-56 57 87 87-87 87 56 57ZM200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/code.svg b/frontend/public/app-icons/format/code.svg
new file mode 100644
index 00000000..d8434b76
--- /dev/null
+++ b/frontend/public/app-icons/format/code.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M320-240 80-480l240-240 57 57-184 184 183 183-56 56Zm320 0-57-57 184-184-183-183 56-56 240 240-240 240Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/color.svg b/frontend/public/app-icons/format/color.svg
new file mode 100644
index 00000000..64a6cf92
--- /dev/null
+++ b/frontend/public/app-icons/format/color.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M480-80q-82 0-155-31.5t-127.5-86Q143-252 111.5-325T80-480q0-83 32.5-156t88-127Q256-817 330-848.5T488-880q80 0 151 27.5t124.5 76q53.5 48.5 85 115T880-544q0 115-70 175.5T640-308h-74q-9 0-12.5 5t-3.5 11q0 12 15 34.5t15 51.5q0 50-27.5 74T480-80Zm0-400Zm-220 40q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120-160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm200 0q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17Zm120 160q26 0 43-17t17-43q0-26-17-43t-43-17q-26 0-43 17t-17 43q0 26 17 43t43 17ZM480-160q9 0 14.5-5t5.5-13q0-14-15-33t-15-57q0-42 29-67t71-25h70q66 0 113-38.5T800-544q0-121-92.5-198.5T488-820q-136 0-232 93t-96 227q0 133 93.5 226.5T480-160Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/footnote.svg b/frontend/public/app-icons/format/footnote.svg
new file mode 100644
index 00000000..648bf4f9
--- /dev/null
+++ b/frontend/public/app-icons/format/footnote.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-280h280v-80H280v80Zm0-160h400v-80H280v80Zm0-160h400v-80H280v80Zm-80 480q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm0-560v560-560Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/h1.svg b/frontend/public/app-icons/format/h1.svg
new file mode 100644
index 00000000..17b3b216
--- /dev/null
+++ b/frontend/public/app-icons/format/h1.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-280v-400h80v160h160v-160h80v400h-80v-160H280v160h-80Zm480 0v-320h-80v-80h160v400h-80Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/highlight.svg b/frontend/public/app-icons/format/highlight.svg
new file mode 100644
index 00000000..8acddb70
--- /dev/null
+++ b/frontend/public/app-icons/format/highlight.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-320v-440q0-33 23.5-56.5T360-840q9 0 18 2t17 6l240 119q20 10 32.5 29.5T680-641v321H280Zm80-80h240v-241L360-760v360ZM160-120l22-65q8-25 29-40t47-15h444q26 0 47 15t29 40l22 65H160Zm200-280h240-240Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/horizontal-rule.svg b/frontend/public/app-icons/format/horizontal-rule.svg
new file mode 100644
index 00000000..c70df0d6
--- /dev/null
+++ b/frontend/public/app-icons/format/horizontal-rule.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M160-440v-80h640v80H160Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/image.svg b/frontend/public/app-icons/format/image.svg
new file mode 100644
index 00000000..df634e1c
--- /dev/null
+++ b/frontend/public/app-icons/format/image.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-560H200v560Zm40-80h480L570-480 450-320l-90-120-120 160Zm-40 80v-560 560Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/italic.svg b/frontend/public/app-icons/format/italic.svg
new file mode 100644
index 00000000..a9881942
--- /dev/null
+++ b/frontend/public/app-icons/format/italic.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-200v-100h160l120-360H320v-100h400v100H580L460-300h140v100H200Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/link.svg b/frontend/public/app-icons/format/link.svg
new file mode 100644
index 00000000..3fa9cc2d
--- /dev/null
+++ b/frontend/public/app-icons/format/link.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M440-280H280q-83 0-141.5-58.5T80-480q0-83 58.5-141.5T280-680h160v80H280q-50 0-85 35t-35 85q0 50 35 85t85 35h160v80ZM320-440v-80h320v80H320Zm200 160v-80h160q50 0 85-35t35-85q0-50-35-85t-85-35H520v-80h160q83 0 141.5 58.5T880-480q0 83-58.5 141.5T680-280H520Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/list-bulleted.svg b/frontend/public/app-icons/format/list-bulleted.svg
new file mode 100644
index 00000000..798feb24
--- /dev/null
+++ b/frontend/public/app-icons/format/list-bulleted.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M280-600v-80h560v80H280Zm0 160v-80h560v80H280Zm0 160v-80h560v80H280ZM160-600q-17 0-28.5-11.5T120-640q0-17 11.5-28.5T160-680q17 0 28.5 11.5T200-640q0 17-11.5 28.5T160-600Zm0 160q-17 0-28.5-11.5T120-480q0-17 11.5-28.5T160-520q17 0 28.5 11.5T200-480q0 17-11.5 28.5T160-440Zm0 160q-17 0-28.5-11.5T120-320q0-17 11.5-28.5T160-360q17 0 28.5 11.5T200-320q0 17-11.5 28.5T160-280Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/list-ordered.svg b/frontend/public/app-icons/format/list-ordered.svg
new file mode 100644
index 00000000..fb8d7e27
--- /dev/null
+++ b/frontend/public/app-icons/format/list-ordered.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M680-80v-60h100v-30h-60v-60h60v-30H680v-60h120q17 0 28.5 11.5T840-280v40q0 17-11.5 28.5T800-200q17 0 28.5 11.5T840-160v40q0 17-11.5 28.5T800-80H680Zm0-280v-110q0-17 11.5-28.5T720-510h60v-30H680v-60h120q17 0 28.5 11.5T840-560v70q0 17-11.5 28.5T800-450h-60v30h100v60H680Zm60-280v-180h-60v-60h120v240h-60ZM120-200v-80h480v80H120Zm0-240v-80h480v80H120Zm0-240v-80h480v80H120Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/quote.svg b/frontend/public/app-icons/format/quote.svg
new file mode 100644
index 00000000..b1893735
--- /dev/null
+++ b/frontend/public/app-icons/format/quote.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="m228-240 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T458-480L320-240h-92Zm360 0 92-160q-66 0-113-47t-47-113q0-66 47-113t113-47q66 0 113 47t47 113q0 23-5.5 42.5T818-480L680-240h-92ZM320-500q25 0 42.5-17.5T380-560q0-25-17.5-42.5T320-620q-25 0-42.5 17.5T260-560q0 25 17.5 42.5T320-500Zm360 0q25 0 42.5-17.5T740-560q0-25-17.5-42.5T680-620q-25 0-42.5 17.5T620-560q0 25 17.5 42.5T680-500Zm0-60Zm-360 0Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/strikethrough.svg b/frontend/public/app-icons/format/strikethrough.svg
new file mode 100644
index 00000000..11b72f17
--- /dev/null
+++ b/frontend/public/app-icons/format/strikethrough.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M486-160q-76 0-135-45t-85-123l88-38q14 48 48.5 79t85.5 31q42 0 76-20t34-64q0-18-7-33t-19-27h112q5 14 7.5 28.5T694-340q0 86-61.5 133T486-160ZM80-480v-80h800v80H80Zm402-326q66 0 115.5 32.5T674-674l-88 39q-9-29-33.5-52T484-710q-41 0-68 18.5T386-640h-96q2-69 54.5-117.5T482-806Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/subscript.svg b/frontend/public/app-icons/format/subscript.svg
new file mode 100644
index 00000000..ad7cb4ea
--- /dev/null
+++ b/frontend/public/app-icons/format/subscript.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M760-160v-50q0-17 11.5-28.5T800-250h80v-30H760v-40h130q17 0 28.5 11.5T930-280v40q0 17-11.5 28.5T890-200h-80v30h120v40H760ZM235-280l185-291-172-269h106l124 200h4l123-200h107L540-573l186 293H620L482-508h-4L340-280H235Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/superscript.svg b/frontend/public/app-icons/format/superscript.svg
new file mode 100644
index 00000000..27c0a37f
--- /dev/null
+++ b/frontend/public/app-icons/format/superscript.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M760-600v-50q0-17 11.5-28.5T800-690h80v-30h-120v-40h130q17 0 28.5 11.5T930-720v40q0 17-11.5 28.5T890-640h-80v30h120v40H760ZM235-160l185-291-172-269h106l124 200h4l123-200h107L540-453l186 293H620L482-388h-4L340-160H235Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/table.svg b/frontend/public/app-icons/format/table.svg
new file mode 100644
index 00000000..b848cc59
--- /dev/null
+++ b/frontend/public/app-icons/format/table.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm240-240H200v160h240v-160Zm80 0v160h240v-160H520Zm-80-80v-160H200v160h240Zm80 0h240v-160H520v160ZM200-680h560v-80H200v80Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/task-list.svg b/frontend/public/app-icons/format/task-list.svg
new file mode 100644
index 00000000..4517d0d5
--- /dev/null
+++ b/frontend/public/app-icons/format/task-list.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M222-200 80-342l56-56 85 85 170-170 56 57-225 226Zm0-320L80-662l56-56 85 85 170-170 56 57-225 226Zm298 240v-80h360v80H520Zm0-320v-80h360v80H520Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/format/underline.svg b/frontend/public/app-icons/format/underline.svg
new file mode 100644
index 00000000..5d17ef6e
--- /dev/null
+++ b/frontend/public/app-icons/format/underline.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120v-80h560v80H200Zm280-160q-101 0-157-63t-56-167v-330h103v336q0 56 28 91t82 35q54 0 82-35t28-91v-336h103v330q0 104-56 167t-157 63Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/preview.svg b/frontend/public/app-icons/preview.svg
new file mode 100644
index 00000000..a628a8bc
--- /dev/null
+++ b/frontend/public/app-icons/preview.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M200-120q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h560q33 0 56.5 23.5T840-760v560q0 33-23.5 56.5T760-120H200Zm0-80h560v-480H200v480Zm280-80q-82 0-146.5-44.5T240-440q29-71 93.5-115.5T480-600q82 0 146.5 44.5T720-440q-29 71-93.5 115.5T480-280Zm0-60q56 0 102-26.5t72-73.5q-26-47-72-73.5T480-540q-56 0-102 26.5T306-440q26 47 72 73.5T480-340Zm0-100Zm0 60q25 0 42.5-17.5T540-440q0-25-17.5-42.5T480-500q-25 0-42.5 17.5T420-440q0 25 17.5 42.5T480-380Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/save.svg b/frontend/public/app-icons/save.svg
new file mode 100644
index 00000000..daee2e8a
--- /dev/null
+++ b/frontend/public/app-icons/save.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -960 960 960"><path d="M840-680v480q0 33-23.5 56.5T760-120H200q-33 0-56.5-23.5T120-200v-560q0-33 23.5-56.5T200-840h480l160 160Zm-80 34L646-760H200v560h560v-446ZM480-240q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35ZM240-560h360v-160H240v160Zm-40-86v446-560 114Z"/></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/voice/default.svg b/frontend/public/app-icons/voice/default.svg
new file mode 100644
index 00000000..71a8db2e
--- /dev/null
+++ b/frontend/public/app-icons/voice/default.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> <rect x="9" y="2" width="6" height="12" rx="3" /><path d="M5 10v2a7 7 0 0 0 14 0v-2" /> <path d="M12 19v3" /> <path d="M8 22h8" /></svg>
\ No newline at end of file
diff --git a/frontend/public/app-icons/voice/recording.svg b/frontend/public/app-icons/voice/recording.svg
new file mode 100644
index 00000000..b622af07
--- /dev/null
+++ b/frontend/public/app-icons/voice/recording.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="2" width="6" height="12" rx="3" /> <path d="M5 10v2a7 7 0 0 0 14 0v-2" /><path d="M12 19v3" /><path d="M8 22h8" /><line x1="2" y1="2" x2="22" y2="22" /></svg>
\ No newline at end of file