mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge pull request #13169 from overleaf/dk-dropimg-handler
[cm6] added drop handler to rich text GitOrigin-RevId: 9972b788d680645ee83c3bc9376b9446a2b068e9
This commit is contained in:
parent
80a5f4594e
commit
1336ff8196
1 changed files with 18 additions and 0 deletions
|
@ -179,6 +179,24 @@ export const figureModalPasteHandler = (): Extension => {
|
|||
return []
|
||||
}
|
||||
return EditorView.domEventHandlers({
|
||||
drop: evt => {
|
||||
if (!evt.dataTransfer || evt.dataTransfer.files.length === 0) {
|
||||
return
|
||||
}
|
||||
const file = evt.dataTransfer.files[0]
|
||||
if (!ALLOWED_MIME_TYPES.has(file.type)) {
|
||||
return
|
||||
}
|
||||
window.dispatchEvent(
|
||||
new CustomEvent<PastedImageData>('figure-modal:paste-image', {
|
||||
detail: {
|
||||
name: file.name,
|
||||
type: file.type,
|
||||
data: file,
|
||||
},
|
||||
})
|
||||
)
|
||||
},
|
||||
paste: evt => {
|
||||
if (!evt.clipboardData || evt.clipboardData.files.length === 0) {
|
||||
return
|
||||
|
|
Loading…
Reference in a new issue