@writergate/quill-image-uploader-nextjs 0.0.11 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/quill.imageUploader.js +13 -20
package/package.json
CHANGED
@@ -14,6 +14,7 @@ class ImageUploader {
|
|
14
14
|
var toolbar = this.quill.getModule("toolbar");
|
15
15
|
toolbar.addHandler("image", this.selectLocalImage.bind(this));
|
16
16
|
toolbar.addHandler("code-block", this.fixHighlighter.bind(this));
|
17
|
+
toolbar.addHandler("clean", this.clean.bind(this));
|
17
18
|
|
18
19
|
this.handleDrop = this.handleDrop.bind(this);
|
19
20
|
this.handlePaste = this.handlePaste.bind(this);
|
@@ -28,29 +29,21 @@ class ImageUploader {
|
|
28
29
|
const formats = this.quill.getFormat(range);
|
29
30
|
// if its not a code-block yet, turn it into one.
|
30
31
|
if (!formats['code-block']) {
|
31
|
-
return this.quill.
|
32
|
+
return this.quill.formatLine(range.index, range.length, 'code-block', 'user');
|
32
33
|
};
|
33
34
|
|
34
35
|
// if it was a code-block, and the user meant to remove it
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
for (let i = 0; i < node.classList.length; i++) {
|
47
|
-
const c = node.classList[i];
|
48
|
-
if (c.indexOf('hljs') >= 0) {
|
49
|
-
node.classList.remove(c);
|
50
|
-
i--;
|
51
|
-
}
|
52
|
-
}
|
53
|
-
}
|
36
|
+
this.quill.removeFormat(range.index, range.length, 'user');
|
37
|
+
// running it twise to remove colors
|
38
|
+
this.quill.removeFormat(range.index, range.length, 'user');
|
39
|
+
}
|
40
|
+
|
41
|
+
clean() {
|
42
|
+
const range = this.quill.getSelection(true);
|
43
|
+
const formats = this.quill.getFormat(range);
|
44
|
+
// running it twise to remove colors
|
45
|
+
this.quill.removeFormat(range.index, range.length, 'user');
|
46
|
+
this.quill.removeFormat(range.index, range.length, 'user');
|
54
47
|
}
|
55
48
|
|
56
49
|
selectLocalImage() {
|