π The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.
Vue dockergolangkanbanknowledge-baseknowledge-managementmarkdownnote-takingnotesnotes-appnotionnuxtnuxtjsoffline-firstoidcpwaselfhostedssovuevuejswiki
File upload on past or drop in the editor :tada:
Smaug67393793d68ad2e0
diff --git a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vueindex e924d06f..7b0b00ed 100644--- a/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue+++ b/frontend/app/components/MarkdownEditor/LazyMarkdownEditor.vue@@ -37,11 +37,12 @@ import GridOrganizationModal from './GridOrganizationModal.vue';import ColorPickerModal from './ColorPickerModal.vue';import compile from '~/helpers/markdown';-import type { Document } from '~/stores';+import type { Document, Ressource } from '~/stores';import { useModal, Modal } from '~/composables/ModalBus';-const props = defineProps<{ doc?: Partial<Document>; minimal?: boolean }>();+const resourcesStore = useRessourcesStore();+const props = defineProps<{ doc?: Partial<Document>; minimal?: boolean }>();const emit = defineEmits(['save', 'exit']);const editorContainer = ref<HTMLDivElement>();@@ -234,6 +235,43 @@ const snippetListener = EditorView.updateListener.of(update => {},});});++const fileUploadHandler = EditorView.domEventHandlers({+ paste: event => {+ // Handle file upload and format as Markdown (e.g., )+ const items = event.clipboardData?.items;+ if (!items) return;+ for (const item of items) {+ if (item.kind === 'file') {+ const file = item.getAsFile();+ if (!file) return;+ const body = new FormData();+ body.append('file', file);+ resourcesStore.post(body).then(result => {+ const url = `${CDN}/${(result as Ressource).author_id}/${(result as Ressource).transformed_path}`;+ exec('insertText', `\n`);+ });+ }+ }+ },+ drop: event => {+ const items = event.dataTransfer?.items;+ if (!items) return;+ for (const item of items) {+ if (item.kind === 'file') {+ const file = item.getAsFile();+ if (!file) return;+ const body = new FormData();+ body.append('file', file);+ resourcesStore.post(body).then(result => {+ const url = `${CDN}/${(result as Ressource).author_id}/${(result as Ressource).transformed_path}`;+ exec('insertText', `\n`);+ });+ }+ }+ },+});+const markdownKeysmap: readonly KeyBinding[] = [{key: 'Mod-b',@@ -300,6 +338,7 @@ const state = EditorState.create({markdown({ base: markdownLanguage }),updateListener,snippetListener,+ fileUploadHandler,themeCompartment.of(useColorMode().value === 'dark' ? materialDark : materialLight),highlightSelectionMatches({}),EditorView.lineWrapping,