fix(Quill): Remove image drop module

Quill 2.0 already has it
This commit is contained in:
Faris Ansari 2018-10-24 17:01:08 +05:30
parent a8f2798b82
commit fd2725bb2c
3 changed files with 0 additions and 59 deletions

View file

@ -1,8 +1,4 @@
import Quill from 'quill';
import { ImageDrop } from 'quill-image-drop-module';
Quill.register('modules/imageDrop', ImageDrop);
// replace <p> tag with <div>
const Block = Quill.import('blots/block');
@ -66,30 +62,6 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
e.stopPropagation();
});
// paste images
$(this.quill.root).on('paste', (e) => {
const clipboardData = e.originalEvent.clipboardData;
const files = clipboardData.files;
if (files.length > 0) {
Array.from(files).forEach(file => {
if (!file.type.match(/^image\/(gif|jpe?g|a?png|svg|webp|bmp|vnd\.microsoft\.icon)/i)) {
// file is not an image
// Note that some file formats such as psd start with image/* but are not readable
return;
}
frappe.dom.file_to_base64(file)
.then(data_url => {
setTimeout(() => {
const index = (this.quill.getSelection() || {}).index || this.quill.getLength();
this.quill.insertEmbed(index, 'image', data_url, 'user');
});
})
});
}
});
// table commands
this.$wrapper.on('click', '.ql-table .ql-picker-item', (e) => {
const $target = $(e.currentTarget);
@ -133,7 +105,6 @@ frappe.ui.form.ControlTextEditor = frappe.ui.form.ControlCode.extend({
return {
modules: {
toolbar: this.get_toolbar_options(),
imageDrop: true,
table: true
},
theme: 'snow'

View file

@ -27,7 +27,6 @@
"moment": "^2.20.1",
"moment-timezone": "^0.5.21",
"quill": "2.0.0-dev.2",
"quill-image-drop-module": "^1.0.3",
"redis": "^2.8.0",
"showdown": "^1.8.6",
"socket.io": "^2.0.4",

View file

@ -1001,11 +1001,6 @@ etag@~1.8.1:
resolved "https://registry.yarnpkg.com/etag/-/etag-1.8.1.tgz#41ae2eeb65efa62268aebfea83ac7d79299b0887"
integrity sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=
eventemitter3@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-2.0.3.tgz#b5e1079b59fb5e1ba2771c0a993be060a58c99ba"
integrity sha1-teEHm1n7XhuidxwKmTvgYKWMmbo=
eventemitter3@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.0.tgz#090b4d6cdbd645ed10bf750d4b5407942d7ba163"
@ -2459,11 +2454,6 @@ p-try@^1.0.0:
resolved "https://registry.yarnpkg.com/p-try/-/p-try-1.0.0.tgz#cbc79cdbaf8fd4228e13f621f2b1a237c1b207b3"
integrity sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=
parchment@^1.1.4:
version "1.1.4"
resolved "https://registry.yarnpkg.com/parchment/-/parchment-1.1.4.tgz#aeded7ab938fe921d4c34bc339ce1168bc2ffde5"
integrity sha512-J5FBQt/pM2inLzg4hEWmzQx/8h8D0CiDxaG3vyp9rKrQRSDgBlhjdP5jQGgosEajXPSQouXGHOmVdgo7QmJuOg==
parchment@quilljs/parchment#487850f7eb030a6c4e750ba809e58b09444e0bdb:
version "2.0.0-dev"
resolved "https://codeload.github.com/quilljs/parchment/tar.gz/487850f7eb030a6c4e750ba809e58b09444e0bdb"
@ -3029,13 +3019,6 @@ quill-delta@^3.6.2:
extend "^3.0.2"
fast-diff "1.1.2"
quill-image-drop-module@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/quill-image-drop-module/-/quill-image-drop-module-1.0.3.tgz#0e5ec8329dd67a12126f166b191bf64d2057a7d3"
integrity sha1-Dl7IMp3WehISbxZrGRv2TSBXp9M=
dependencies:
quill "^1.2.2"
quill@2.0.0-dev.2:
version "2.0.0-dev.2"
resolved "https://registry.yarnpkg.com/quill/-/quill-2.0.0-dev.2.tgz#0f8bc962da28e3ebbb856f246200e7d32e39fc9f"
@ -3048,18 +3031,6 @@ quill@2.0.0-dev.2:
parchment quilljs/parchment#487850f7eb030a6c4e750ba809e58b09444e0bdb
quill-delta "^3.6.2"
quill@^1.2.2:
version "1.3.6"
resolved "https://registry.yarnpkg.com/quill/-/quill-1.3.6.tgz#99f4de1fee85925a0d7d4163b6d8328f23317a4d"
integrity sha512-K0mvhimWZN6s+9OQ249CH2IEPZ9JmkFuCQeHAOQax3EZ2nDJ3wfGh59mnlQaZV2i7u8eFarx6wAtvQKgShojug==
dependencies:
clone "^2.1.1"
deep-equal "^1.0.1"
eventemitter3 "^2.0.3"
extend "^3.0.1"
parchment "^1.1.4"
quill-delta "^3.6.2"
randomatic@^1.1.3:
version "1.1.7"
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.7.tgz#c7abe9cc8b87c0baa876b19fde83fd464797e38c"