Skip to content

TaskView is a self-hosted project and task management platform focused on clarity, ownership, and control. TaskView is built for teams that want a transparent, self-hosted alternative to SaaS task managers.

fix: note toolbar and fullscreen mode

Nikolai Gimand0bb20e56d12
diff --git a/web/src/components/features/tasks/TvTaskDetailOverlay.vue b/web/src/components/features/tasks/TvTaskDetailOverlay.vue
index 80eb749..e9bb1e1 100644
--- a/web/src/components/features/tasks/TvTaskDetailOverlay.vue
+++ b/web/src/components/features/tasks/TvTaskDetailOverlay.vue
@@ -4,6 +4,7 @@
<USlideover
v-if="displayMode === 'slideover'"
v-model:open="isOpen"
+ :ui="{ body: 'p-4!' }"
>
<template #header>
<div class="flex items-center justify-between w-full">
diff --git a/web/src/components/features/tasks/parts/NoteEditor.vue b/web/src/components/features/tasks/parts/NoteEditor.vue
index 5db336a..8324bb0 100644
--- a/web/src/components/features/tasks/parts/NoteEditor.vue
+++ b/web/src/components/features/tasks/parts/NoteEditor.vue
@@ -1,39 +1,76 @@
<template>
- <div
- class="note-editor border border-default rounded-2xl overflow-hidden dark:bg-tv-ui-bg-elevated!"
- data-testid="task-note-editor"
- >
- <UEditor
- v-if="canViewTaskNote"
- #default="{ editor }"
- v-model="initialContent"
- :content-type="contentType"
- :placeholder="placeholder"
- :extensions="extensions"
- :editable="canEditTaskNote"
- class="min-h-32"
- @update:model-value="handleUpdate"
+ <div>
+ <Teleport
+ :to="fullscreenTarget"
+ :disabled="!isTeleported"
>
- <UEditorToolbar
- :editor="editor"
- :items="toolbarItems"
- class="border-b border-default overflow-x-auto"
- :ui="{base: 'p-2'}"
- />
- <!-- <UEditorDragHandle :editor="editor" /> -->
- </UEditor>
+ <div
+ class="note-editor overflow-clip dark:bg-tv-ui-bg-elevated!"
+ :class="isFullscreen ? 'flex flex-col flex-1 min-h-0' : 'border border-default rounded-2xl'"
+ data-testid="task-note-editor"
+ >
+ <UEditor
+ v-if="canViewTaskNote"
+ ref="editorRef"
+ #default="{ editor }"
+ v-model="initialContent"
+ :content-type="contentType"
+ :placeholder="placeholder"
+ :extensions="extensions"
+ :editable="canEditTaskNote"
+ :class="isFullscreen ? 'flex flex-col flex-1 min-h-0' : 'min-h-32'"
+ :ui="{ content: contentClass }"
+ @update:model-value="handleUpdate"
+ >
+ <UEditorToolbar
+ :editor="editor"
+ :items="toolbarItems"
+ class="sticky -top-4 z-10 border-b border-default overflow-x-auto shrink-0 bg-default dark:bg-tv-ui-bg-elevated"
+ :ui="{base: 'p-2'}"
+ />
+ </UEditor>
+ <NoteEditorFooter
+ v-if="isOverflowing"
+ :expanded="isExpanded"
+ @toggle-expand="toggleExpanded"
+ @fullscreen="toggleFullscreen"
+ />
+ </div>
+ </Teleport>
+
+ <UModal
+ v-model:open="isFullscreen"
+ fullscreen
+ :title="t('tasks.note')"
+ :ui="{ body: 'p-0! flex flex-col min-h-0' }"
+ data-testid="task-note-fullscreen"
+ @after:leave="focusEditor"
+ >
+ <template #body>
+ <div
+ ref="fullscreenTarget"
+ class="flex flex-col flex-1 min-h-0"
+ />
+ </template>
+ </UModal>
</div>
</template>
<script setup lang="ts">
-import type { EditorToolbarItem } from '@nuxt/ui'
+import { computed, nextTick, ref, useTemplateRef, watch } from 'vue'
+import { useI18n } from 'vue-i18n'
import { useDebounceFn } from '@vueuse/core'
import TextAlign from '@tiptap/extension-text-align'
import { useGoalPermissions } from '@/composables/useGoalPermissions'
+import { useNoteEditorToolbar } from '@/composables/useNoteEditorToolbar'
+import { useNoteEditorCollapse } from '@/composables/useNoteEditorCollapse'
+import NoteEditorFooter from '@/components/features/tasks/parts/NoteEditorFooter.vue'
+
+const { t } = useI18n()
-const {
- canEditTaskNote,
- canViewTaskNote,
+const {
+ canEditTaskNote,
+ canViewTaskNote,
} = useGoalPermissions()
const extensions = [
@@ -65,161 +102,42 @@ function handleUpdate(value: string) {
debouncedSave(value)
}
-const toolbarItemUi = {
- leadingIcon: 'size-5',
+const editorRef = useTemplateRef('editorRef')
+const fullscreenTarget = useTemplateRef<HTMLElement>('fullscreenTarget')
+
+const isFullscreen = ref(false)
+const isTeleported = computed(() => isFullscreen.value && !!fullscreenTarget.value)
+
+function toggleFullscreen() {
+ isFullscreen.value = !isFullscreen.value
}
-const toolbarItems: EditorToolbarItem[][] = [
- // History controls
- [{
- kind: 'undo',
- icon: 'i-lucide-undo',
- tooltip: { text: 'Undo' },
- ui: toolbarItemUi,
- }, {
- kind: 'redo',
- icon: 'i-lucide-redo',
- tooltip: { text: 'Redo' },
- ui: toolbarItemUi,
- }],
- // Block types
- [{
- icon: 'i-lucide-heading',
- tooltip: { text: 'Headings' },
- content: {
- align: 'start',
- },
- items: [{
- kind: 'heading',
- level: 1,
- icon: 'i-lucide-heading-1',
- label: 'Heading 1',
- ui: toolbarItemUi,
- }, {
- kind: 'heading',
- level: 2,
- icon: 'i-lucide-heading-2',
- label: 'Heading 2',
- ui: toolbarItemUi,
- }, {
- kind: 'heading',
- level: 3,
- icon: 'i-lucide-heading-3',
- label: 'Heading 3',
- ui: toolbarItemUi,
- }, {
- kind: 'heading',
- level: 4,
- icon: 'i-lucide-heading-4',
- label: 'Heading 4',
- ui: toolbarItemUi,
- }],
- }, {
- icon: 'i-lucide-list',
- tooltip: { text: 'Lists' },
- content: {
- align: 'start',
- },
- items: [{
- kind: 'bulletList',
- icon: 'i-lucide-list',
- label: 'Bullet List',
- ui: toolbarItemUi,
- }, {
- kind: 'orderedList',
- icon: 'i-lucide-list-ordered',
- label: 'Ordered List',
- ui: toolbarItemUi,
- }],
- }, {
- kind: 'blockquote',
- icon: 'i-lucide-text-quote',
- tooltip: { text: 'Blockquote' },
- ui: toolbarItemUi,
- }, {
- kind: 'codeBlock',
- icon: 'i-lucide-square-code',
- tooltip: { text: 'Code Block' },
- ui: toolbarItemUi,
- }, {
- kind: 'horizontalRule',
- icon: 'i-lucide-separator-horizontal',
- tooltip: { text: 'Horizontal Rule' },
- ui: toolbarItemUi,
- }],
- // Text formatting
- [{
- kind: 'mark',
- mark: 'bold',
- icon: 'i-lucide-bold',
- tooltip: { text: 'Bold' },
- ui: toolbarItemUi,
- }, {
- kind: 'mark',
- mark: 'italic',
- icon: 'i-lucide-italic',
- tooltip: { text: 'Italic' },
- ui: toolbarItemUi,
- }, {
- kind: 'mark',
- mark: 'underline',
- icon: 'i-lucide-underline',
- tooltip: { text: 'Underline' },
- ui: toolbarItemUi,
- }, {
- kind: 'mark',
- mark: 'strike',
- icon: 'i-lucide-strikethrough',
- tooltip: { text: 'Strikethrough' },
- ui: toolbarItemUi,
- }, {
- kind: 'mark',
- mark: 'code',
- icon: 'i-lucide-code',
- tooltip: { text: 'Code' },
- ui: toolbarItemUi,
- }],
- // Link
- [{
- kind: 'link',
- icon: 'i-lucide-link',
- tooltip: { text: 'Link' },
- ui: toolbarItemUi,
- }],
- // Text alignment
- [{
- icon: 'i-lucide-align-justify',
- tooltip: { text: 'Text Align' },
- content: {
- align: 'end',
- },
- items: [{
- kind: 'textAlign',
- align: 'left',
- icon: 'i-lucide-align-left',
- label: 'Align Left',
- ui: toolbarItemUi,
- }, {
- kind: 'textAlign',
- align: 'center',
- icon: 'i-lucide-align-center',
- label: 'Align Center',
- ui: toolbarItemUi,
- }, {
- kind: 'textAlign',
- align: 'right',
- icon: 'i-lucide-align-right',
- label: 'Align Right',
- ui: toolbarItemUi,
- }, {
- kind: 'textAlign',
- align: 'justify',
- icon: 'i-lucide-align-justify',
- label: 'Align Justify',
- ui: toolbarItemUi,
- }],
- }],
-]
+const { toolbarItems } = useNoteEditorToolbar({
+ isFullscreen,
+ onToggleFullscreen: toggleFullscreen,
+})
+
+const contentElement = computed(() => editorRef.value?.editor?.view.dom ?? null)
+
+const { isOverflowing, isCollapsed, isExpanded, toggleExpanded } = useNoteEditorCollapse({
+ contentElement,
+ isFullscreen,
+})
+
+const contentClass = computed(() => {
+ if (isFullscreen.value) return 'flex-1 min-h-0 overflow-y-auto'
+ if (isCollapsed.value) return 'max-h-80 overflow-y-auto'
+ return ''
+})
+
+async function focusEditor() {
+ await nextTick()
+ editorRef.value?.editor?.commands.focus()
+}
+
+watch(isTeleported, (teleported) => {
+ if (teleported) focusEditor()
+})
</script>
<style scoped>
diff --git a/web/src/components/features/tasks/parts/NoteEditorFooter.vue b/web/src/components/features/tasks/parts/NoteEditorFooter.vue
new file mode 100644
index 0000000..2f320bc
--- /dev/null
+++ b/web/src/components/features/tasks/parts/NoteEditorFooter.vue
@@ -0,0 +1,37 @@
+<template>
+ <div class="flex items-center justify-end gap-1 border-t border-default p-2">
+ <UButton
+ :label="expanded ? t('tasks.noteCollapse') : t('tasks.noteExpand')"
+ :icon="expanded ? 'i-lucide-chevron-up' : 'i-lucide-chevron-down'"
+ color="neutral"
+ variant="soft"
+ size="sm"
+ data-testid="task-note-toggle-expand"
+ @click="emit('toggleExpand')"
+ />
+ <UButton
+ :label="t('tasks.noteFullscreen')"
+ icon="i-lucide-maximize-2"
+ color="neutral"
+ variant="soft"
+ size="sm"
+ data-testid="task-note-open-fullscreen"
+ @click="emit('fullscreen')"
+ />
+ </div>
+</template>
+
+<script setup lang="ts">
+import { useI18n } from 'vue-i18n'
+
+const { t } = useI18n()
+
+defineProps<{
+ expanded: boolean
+}>()
+
+const emit = defineEmits<{
+ toggleExpand: []
+ fullscreen: []
+}>()
+</script>
diff --git a/web/src/composables/useNoteEditorCollapse.ts b/web/src/composables/useNoteEditorCollapse.ts
new file mode 100644
index 0000000..9d551af
--- /dev/null
+++ b/web/src/composables/useNoteEditorCollapse.ts
@@ -0,0 +1,19 @@
+import { computed, ref } from 'vue'
+import { useElementSize } from '@vueuse/core'
+import type { UseNoteEditorCollapseArgs } from '@/composables/useNoteEditorCollapse.types'
+
+export const NOTE_COLLAPSED_MAX_HEIGHT = 320
+
+export function useNoteEditorCollapse({ contentElement, isFullscreen }: UseNoteEditorCollapseArgs) {
+ const { height } = useElementSize(contentElement)
+ const isExpanded = ref(false)
+
+ const isOverflowing = computed(() => !isFullscreen.value && height.value > NOTE_COLLAPSED_MAX_HEIGHT)
+ const isCollapsed = computed(() => isOverflowing.value && !isExpanded.value)
+
+ function toggleExpanded() {
+ isExpanded.value = !isExpanded.value
+ }
+
+ return { isOverflowing, isCollapsed, isExpanded, toggleExpanded }
+}
diff --git a/web/src/composables/useNoteEditorCollapse.types.ts b/web/src/composables/useNoteEditorCollapse.types.ts
new file mode 100644
index 0000000..a563339
--- /dev/null
+++ b/web/src/composables/useNoteEditorCollapse.types.ts
@@ -0,0 +1,7 @@
+import type { Ref } from 'vue'
+import type { MaybeComputedElementRef } from '@vueuse/core'
+
+export type UseNoteEditorCollapseArgs = {
+ contentElement: MaybeComputedElementRef
+ isFullscreen: Ref<boolean>
+}
diff --git a/web/src/composables/useNoteEditorToolbar.ts b/web/src/composables/useNoteEditorToolbar.ts
new file mode 100644
index 0000000..e7c573a
--- /dev/null
+++ b/web/src/composables/useNoteEditorToolbar.ts
@@ -0,0 +1,180 @@
+import { computed } from 'vue'
+import { useI18n } from 'vue-i18n'
+import type { EditorToolbarItem } from '@nuxt/ui'
+import type { UseNoteEditorToolbarArgs } from '@/composables/useNoteEditorToolbar.types'
+
+const itemUi = {
+ leadingIcon: 'size-5',
+}
+
+const historyItems: EditorToolbarItem[] = [{
+ kind: 'undo',
+ icon: 'i-lucide-undo',
+ tooltip: { text: 'Undo' },
+ ui: itemUi,
+}, {
+ kind: 'redo',
+ icon: 'i-lucide-redo',
+ tooltip: { text: 'Redo' },
+ ui: itemUi,
+}]
+
+const blockItems: EditorToolbarItem[] = [{
+ icon: 'i-lucide-heading',
+ tooltip: { text: 'Headings' },
+ content: {
+ align: 'start',
+ },
+ items: [{
+ kind: 'heading',
+ level: 1,
+ icon: 'i-lucide-heading-1',
+ label: 'Heading 1',
+ ui: itemUi,
+ }, {
+ kind: 'heading',
+ level: 2,
+ icon: 'i-lucide-heading-2',
+ label: 'Heading 2',
+ ui: itemUi,
+ }, {
+ kind: 'heading',
+ level: 3,
+ icon: 'i-lucide-heading-3',
+ label: 'Heading 3',
+ ui: itemUi,
+ }, {
+ kind: 'heading',
+ level: 4,
+ icon: 'i-lucide-heading-4',
+ label: 'Heading 4',
+ ui: itemUi,
+ }],
+}, {
+ icon: 'i-lucide-list',
+ tooltip: { text: 'Lists' },
+ content: {
+ align: 'start',
+ },
+ items: [{
+ kind: 'bulletList',
+ icon: 'i-lucide-list',
+ label: 'Bullet List',
+ ui: itemUi,
+ }, {
+ kind: 'orderedList',
+ icon: 'i-lucide-list-ordered',
+ label: 'Ordered List',
+ ui: itemUi,
+ }],
+}, {
+ kind: 'blockquote',
+ icon: 'i-lucide-text-quote',
+ tooltip: { text: 'Blockquote' },
+ ui: itemUi,
+}, {
+ kind: 'codeBlock',
+ icon: 'i-lucide-square-code',
+ tooltip: { text: 'Code Block' },
+ ui: itemUi,
+}, {
+ kind: 'horizontalRule',
+ icon: 'i-lucide-separator-horizontal',
+ tooltip: { text: 'Horizontal Rule' },
+ ui: itemUi,
+}]
+
+const markItems: EditorToolbarItem[] = [{
+ kind: 'mark',
+ mark: 'bold',
+ icon: 'i-lucide-bold',
+ tooltip: { text: 'Bold' },
+ ui: itemUi,
+}, {
+ kind: 'mark',
+ mark: 'italic',
+ icon: 'i-lucide-italic',
+ tooltip: { text: 'Italic' },
+ ui: itemUi,
+}, {
+ kind: 'mark',
+ mark: 'underline',
+ icon: 'i-lucide-underline',
+ tooltip: { text: 'Underline' },
+ ui: itemUi,
+}, {
+ kind: 'mark',
+ mark: 'strike',
+ icon: 'i-lucide-strikethrough',
+ tooltip: { text: 'Strikethrough' },
+ ui: itemUi,
+}, {
+ kind: 'mark',
+ mark: 'code',
+ icon: 'i-lucide-code',
+ tooltip: { text: 'Code' },
+ ui: itemUi,
+}]
+
+const linkItems: EditorToolbarItem[] = [{
+ kind: 'link',
+ icon: 'i-lucide-link',
+ tooltip: { text: 'Link' },
+ ui: itemUi,
+}]
+
+const alignItems: EditorToolbarItem[] = [{
+ icon: 'i-lucide-align-justify',
+ tooltip: { text: 'Text Align' },
+ content: {
+ align: 'end',
+ },
+ items: [{
+ kind: 'textAlign',
+ align: 'left',
+ icon: 'i-lucide-align-left',
+ label: 'Align Left',
+ ui: itemUi,
+ }, {
+ kind: 'textAlign',
+ align: 'center',
+ icon: 'i-lucide-align-center',
+ label: 'Align Center',
+ ui: itemUi,
+ }, {
+ kind: 'textAlign',
+ align: 'right',
+ icon: 'i-lucide-align-right',
+ label: 'Align Right',
+ ui: itemUi,
+ }, {
+ kind: 'textAlign',
+ align: 'justify',
+ icon: 'i-lucide-align-justify',
+ label: 'Align Justify',
+ ui: itemUi,
+ }],
+}]
+
+export function useNoteEditorToolbar({ isFullscreen, onToggleFullscreen }: UseNoteEditorToolbarArgs) {
+ const { t } = useI18n()
+
+ const fullscreenItems = computed<EditorToolbarItem[]>(() => [{
+ icon: isFullscreen.value ? 'i-lucide-minimize-2' : 'i-lucide-maximize-2',
+ tooltip: { text: isFullscreen.value ? t('tasks.noteExitFullscreen') : t('tasks.noteFullscreen') },
+ 'aria-label': isFullscreen.value ? t('tasks.noteExitFullscreen') : t('tasks.noteFullscreen'),
+ ui: itemUi,
+ onClick: onToggleFullscreen,
+ }])
+
+ const toolbarItems = computed<EditorToolbarItem[][]>(() => [
+ historyItems,
+ blockItems,
+ markItems,
+ linkItems,
+ alignItems,
+ fullscreenItems.value,
+ ])
+
+ return { toolbarItems }
+}
diff --git a/web/src/composables/useNoteEditorToolbar.types.ts b/web/src/composables/useNoteEditorToolbar.types.ts
new file mode 100644
index 0000000..0727f1f
--- /dev/null
+++ b/web/src/composables/useNoteEditorToolbar.types.ts
@@ -0,0 +1,6 @@
+import type { Ref } from 'vue'
+
+export type UseNoteEditorToolbarArgs = {
+ isFullscreen: Ref<boolean>
+ onToggleFullscreen: () => void
+}
diff --git a/web/src/locales/de.ts b/web/src/locales/de.ts
index f2bcff8..f966175 100644
--- a/web/src/locales/de.ts
+++ b/web/src/locales/de.ts
@@ -507,6 +507,10 @@ export default {
addDescription: 'Beschreibung hinzufügen...',
note: 'Notiz',
addNote: 'Notiz hinzufügen...',
+ noteFullscreen: 'Vollbild',
+ noteExitFullscreen: 'Vollbild beenden',
+ noteExpand: 'Aufklappen',
+ noteCollapse: 'Zuklappen',
sourceOfTruthTitle: '{provider} ist die Datenquelle',
sourceOfTruthDescription: 'Diese Aufgabe ist mit einem Issue in {provider} verknüpft. Werden dort Titel oder Beschreibung geändert, wird die Aufgabe automatisch aktualisiert.',
priority: 'Priorität',
diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts
index 4f54df4..9f43b2d 100644
--- a/web/src/locales/en.ts
+++ b/web/src/locales/en.ts
@@ -521,6 +521,10 @@ export default {
addDescription: 'Add a description...',
note: 'Note',
addNote: 'Add a note...',
+ noteFullscreen: 'Full screen',
+ noteExitFullscreen: 'Exit full screen',
+ noteExpand: 'Expand',
+ noteCollapse: 'Collapse',
sourceOfTruthTitle: '{provider} is the source of truth',
sourceOfTruthDescription: 'This task is linked to an issue in {provider}. If the title or description is edited there, the task is updated automatically.',
priority: 'Priority',
diff --git a/web/src/locales/es.ts b/web/src/locales/es.ts
index 6d40f22..f6b36a8 100644
--- a/web/src/locales/es.ts
+++ b/web/src/locales/es.ts
@@ -507,6 +507,10 @@ export default {
addDescription: 'Añade una descripción...',
note: 'Nota',
addNote: 'Añade una nota...',
+ noteFullscreen: 'Pantalla completa',
+ noteExitFullscreen: 'Salir de pantalla completa',
+ noteExpand: 'Expandir',
+ noteCollapse: 'Contraer',
sourceOfTruthTitle: '{provider} es la fuente de verdad',
sourceOfTruthDescription: 'Esta tarea está vinculada a una issue en {provider}. Si allí se edita el título o la descripción, la tarea se actualiza automáticamente.',
priority: 'Prioridad',
diff --git a/web/src/locales/pt-br.ts b/web/src/locales/pt-br.ts
index 9bebd83..8a90f02 100644
--- a/web/src/locales/pt-br.ts
+++ b/web/src/locales/pt-br.ts
@@ -520,6 +520,10 @@ export default {
addDescription: 'Adicione uma descrição...',
note: 'Observação',
addNote: 'Adicione uma observação...',
+ noteFullscreen: 'Tela cheia',
+ noteExitFullscreen: 'Sair da tela cheia',
+ noteExpand: 'Expandir',
+ noteCollapse: 'Recolher',
sourceOfTruthTitle: '{provider} é a fonte da verdade',
sourceOfTruthDescription: 'Esta tarefa está vinculada a um problema em {provider}. Se o título ou a descrição forem editados ali, a tarefa será atualizada automaticamente.',
priority: 'Prioridade',
diff --git a/web/src/locales/ru.ts b/web/src/locales/ru.ts
index 7a7cd49..64fff3b 100644
--- a/web/src/locales/ru.ts
+++ b/web/src/locales/ru.ts
@@ -494,6 +494,10 @@ export default {
addDescription: 'Добавить описание...',
note: 'Заметка',
addNote: 'Добавить заметку...',
+ noteFullscreen: 'На весь экран',
+ noteExitFullscreen: 'Выйти из полноэкранного режима',
+ noteExpand: 'Развернуть',
+ noteCollapse: 'Свернуть',
sourceOfTruthTitle: 'Источник истины — {provider}',
sourceOfTruthDescription: 'Задача связана с issue в {provider}. Если там изменят название или описание, задача обновится автоматически.',
priority: 'Приоритет',