Skip to content

Commit

Permalink
prefer file over html when uploading
Browse files Browse the repository at this point in the history
- file should include the image data
- copying image from slack will include both, but image src is
  inaccessible without login
  • Loading branch information
jhchen committed Aug 26, 2021
1 parent 0c35e07 commit e164f12
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions modules/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,12 @@ class Clipboard extends Module {
e.preventDefault();
const range = this.quill.getSelection(true);
if (range == null) return;
const html = e.clipboardData.getData('text/html');
const text = e.clipboardData.getData('text/plain');
const files = Array.from(e.clipboardData.files || []);
if (!html && files.length > 0) {
if (files.length > 0) {
this.quill.uploader.upload(range, files);
} else {
const html = e.clipboardData.getData('text/html');
const text = e.clipboardData.getData('text/plain');
this.onPaste(range, { html, text });
}
}
Expand Down

0 comments on commit e164f12

Please sign in to comment.