Web: support pasting images to PublishDialog

This commit is contained in:
Cao Mingjun
2023-11-25 07:39:20 +00:00
committed by GitHub
parent 00fe639a95
commit 4b1468cfd8
2 changed files with 24 additions and 9 deletions

View File

@@ -241,6 +241,13 @@ const PublishDialog = (props) => {
}
}, [props.attachFile]);
const handlePaste = (ev) => {
const blob = props.getPastedImage(ev);
if (blob) {
updateAttachFile(blob);
}
};
const handleAttachFileChanged = async (ev) => {
await updateAttachFile(ev.target.files[0]);
};
@@ -363,6 +370,7 @@ const PublishDialog = (props) => {
inputProps={{
"aria-label": t("publish_dialog_message_label"),
}}
onPaste={handlePaste}
/>
<FormControlLabel
label={t("publish_dialog_checkbox_markdown")}