0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

🐛 Fixed overly small file drop area in beta editor (#17682)

closes https://github.com/TryGhost/Product/issues/3449

- added drop handler to the whole editor pane area (to match previous editor) that uses the external API plugin to pass files through to the editor when dropped
- allows images/files to be dropped outside of the main editor canvas which is especially helpful when creating images in a new post
This commit is contained in:
Kevin Ansfield 2023-08-10 17:36:06 +01:00 committed by GitHub
parent 05a4d2cc79
commit f983e93090
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View file

@ -5,6 +5,8 @@
class="gh-koenig-editor-pane flex flex-column mih-100"
{{on "mousedown" this.trackMousedown}}
{{on "mouseup" this.focusEditor}}
{{on "dragover" this.editorPaneDragover}}
{{on "drop" this.editorPaneDrop}}
>
<GhEditorFeatureImage
@image={{@featureImage}}

View file

@ -40,6 +40,19 @@ export default class GhKoenigEditorReactComponent extends Component {
this.mousedownY = event.clientY;
}
@action
editorPaneDragover(event) {
event.preventDefault();
}
@action
editorPaneDrop(event) {
if (event.dataTransfer.files.length > 0) {
event.preventDefault();
this.editorAPI?.insertFiles(Array.from(event.dataTransfer.files));
}
}
// Title actions -----------------------------------------------------------
@action