A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: always give preference to text over files when pasting (#1869)
Muhammad Ali289ef2a3245b
diff --git a/apps/web/src/components/editor/tiptap.tsx b/apps/web/src/components/editor/tiptap.tsxindex e381914bb..db7a80eb3 100644--- a/apps/web/src/components/editor/tiptap.tsx+++ b/apps/web/src/components/editor/tiptap.tsx@@ -137,7 +137,15 @@ function TipTap(props: TipTapProps) {{editorProps: {handlePaste: (view, event) => {- if (event.clipboardData?.files?.length && onAttachFile) {+ const hasText = event.clipboardData?.types?.some((type) =>+ type.startsWith("text/")+ );++ // we always give preference to text over files & skip any attached+ // files if there is text.+ // TODO: give user an actionable hint to allow them to select what they+ // want to do in such cases.+ if (!hasText && event.clipboardData?.files?.length && onAttachFile) {event.preventDefault();event.stopPropagation();for (const file of event.clipboardData.files) {