Memos is an open-source, self-hosted note-taking app that brings your everyday thoughts together in a personal timeline. Your data stays yours, and you choose what to keep private or share.
Go dockerfossgomarkdownmemomicroblognote-takingnotesopen-sourceown-your-datareactself-hostedsqlitetimeline
fix: handle pasted files in memo editor
Steven2db57b139a68
diff --git a/web/src/components/MemoEditor/components/EditorContent.tsx b/web/src/components/MemoEditor/components/EditorContent.tsxindex 6abd22ab8..5cc14f784 100644--- a/web/src/components/MemoEditor/components/EditorContent.tsx+++ b/web/src/components/MemoEditor/components/EditorContent.tsx@@ -29,8 +29,29 @@ export const EditorContent = forwardRef<EditorRefActions, EditorContentProps>(({dispatch(actions.updateContent(content));};- const handlePaste = () => {- // Paste handling is managed by the Editor component internally+ const handlePaste = (event: React.ClipboardEvent<Element>) => {+ const clipboard = event.clipboardData;+ if (!clipboard) return;++ const files: File[] = [];+ if (clipboard.items && clipboard.items.length > 0) {+ for (const item of Array.from(clipboard.items)) {+ if (item.kind !== "file") continue;+ const file = item.getAsFile();+ if (file) files.push(file);+ }+ } else if (clipboard.files && clipboard.files.length > 0) {+ files.push(...Array.from(clipboard.files));+ }++ if (files.length === 0) return;++ const localFiles: LocalFile[] = files.map((file) => ({+ file,+ previewUrl: createBlobUrl(file),+ }));+ localFiles.forEach((localFile) => dispatch(actions.addLocalFile(localFile)));+ event.preventDefault();};return (