@writergate/quill-image-uploader-nextjs 0.2.2 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@writergate/quill-image-uploader-nextjs",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/enlear/quill-image-uploader-nextjs.git"
@@ -7,8 +7,14 @@ const ATTRIBUTES = ["class", "data-comment"];
7
7
  class CommentBlot extends InlineBlot {
8
8
  static create(value) {
9
9
  const node = super.create();
10
- node.setAttribute("class", value.class || "ql-wg-comment-wrapper");
11
- node.setAttribute("data-comment", value["data-comment"] || value.commentId);
10
+ const commentId = value["data-comment"] || value.commentId;
11
+ if (commentId) {
12
+ node.setAttribute("class", value.class || "ql-wg-comment-wrapper");
13
+ node.setAttribute(
14
+ "data-comment",
15
+ value["data-comment"] || value.commentId
16
+ );
17
+ }
12
18
  return node;
13
19
  }
14
20
 
@@ -12,11 +12,6 @@ class ImageUploader {
12
12
  "[Missing config] upload function that returns a promise is required"
13
13
  );
14
14
 
15
- if (typeof this.options.renderComment !== "function")
16
- console.warn(
17
- "[Missing config] renderComment function that returns a promise is required"
18
- );
19
-
20
15
  if (typeof this.options.newComment !== "function")
21
16
  console.warn(
22
17
  "[Missing config] newComment function that returns a promise is required"
@@ -36,7 +31,6 @@ class ImageUploader {
36
31
 
37
32
  this.handleDrop = this.handleDrop.bind(this);
38
33
  this.handlePaste = this.handlePaste.bind(this);
39
- this.renderComment = this.renderComment.bind(this);
40
34
 
41
35
  this.quill.root.addEventListener("drop", this.handleDrop, false);
42
36
  this.quill.root.addEventListener("paste", this.handlePaste, false);
@@ -50,22 +44,6 @@ class ImageUploader {
50
44
  }
51
45
  }
52
46
 
53
- renderComment(comment) {
54
- const { id, range } = comment;
55
- const { index, length } = range;
56
- const formattedRange = {
57
- length,
58
- index,
59
- };
60
-
61
- this.quill.formatText(
62
- formattedRange,
63
- CommentBlot.blotName,
64
- { commentId: id },
65
- "user"
66
- );
67
- }
68
-
69
47
  addComment() {
70
48
  let range = this.quill.getSelection();
71
49
  if (range && range.length > 0 && this.options.newComment) {