forked from farhoodlabs/paperclip
Support dropping non-image files onto markdown editor as attachments
When dragging files like .zip onto the issue description editor, non-image files are now uploaded as attachments instead of being silently ignored. Images continue to be handled inline by MDXEditor's image plugin. Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
@@ -11,6 +11,8 @@ interface InlineEditorProps {
|
||||
placeholder?: string;
|
||||
multiline?: boolean;
|
||||
imageUploadHandler?: (file: File) => Promise<string>;
|
||||
/** Called when a non-image file is dropped onto the editor. */
|
||||
onDropFile?: (file: File) => Promise<void>;
|
||||
mentions?: MentionOption[];
|
||||
nullable?: boolean;
|
||||
}
|
||||
@@ -46,6 +48,7 @@ export function InlineEditor({
|
||||
multiline = false,
|
||||
nullable = false,
|
||||
imageUploadHandler,
|
||||
onDropFile,
|
||||
mentions,
|
||||
}: InlineEditorProps) {
|
||||
const [editing, setEditing] = useState(false);
|
||||
@@ -228,6 +231,7 @@ export function InlineEditor({
|
||||
className="bg-transparent"
|
||||
contentClassName={cn("paperclip-edit-in-place-content", className)}
|
||||
imageUploadHandler={imageUploadHandler}
|
||||
onDropFile={onDropFile}
|
||||
mentions={mentions}
|
||||
onSubmit={() => {
|
||||
finalizeMultilineBlurOrSubmit();
|
||||
|
||||
Reference in New Issue
Block a user