@writergate/quill-image-uploader-nextjs 0.1.11 → 0.1.13
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
CHANGED
package/src/blots/comment.js
CHANGED
@@ -1,24 +1,24 @@
|
|
1
1
|
import Quill from "quill";
|
2
2
|
|
3
|
-
const
|
3
|
+
const BlockBlot = Quill.import("blots/block");
|
4
4
|
|
5
|
-
class CommentBlot extends
|
5
|
+
class CommentBlot extends BlockBlot {
|
6
6
|
/**
|
7
|
-
*
|
8
|
-
* @param {{commentId:string}} value Object of commentId of the comment
|
9
|
-
* @returns
|
7
|
+
* @param {string} commentId The comment ID
|
10
8
|
*/
|
11
|
-
static create(
|
9
|
+
static create(commentId) {
|
12
10
|
const node = super.create();
|
13
11
|
node.setAttribute("class", "ql-wg-comment-wrapper");
|
14
|
-
|
12
|
+
if (commentId) {
|
13
|
+
node.setAttribute("data-comment", commentId);
|
14
|
+
}
|
15
15
|
return node;
|
16
16
|
}
|
17
17
|
}
|
18
18
|
|
19
|
-
CommentBlot.blotName = "
|
19
|
+
CommentBlot.blotName = "commentBlot";
|
20
20
|
CommentBlot.tagName = "div";
|
21
21
|
|
22
|
-
Quill.register(CommentBlot);
|
22
|
+
Quill.register({ "formats/commentBlot": CommentBlot });
|
23
23
|
|
24
24
|
export default CommentBlot;
|
package/src/blots/image.js
CHANGED
@@ -3,23 +3,23 @@ import Quill from "quill";
|
|
3
3
|
const InlineBlot = Quill.import("blots/block");
|
4
4
|
|
5
5
|
class LoadingImage extends InlineBlot {
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
static create(src) {
|
7
|
+
const node = super.create(src);
|
8
|
+
if (src === true) return node;
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
10
|
+
const image = document.createElement("img");
|
11
|
+
image.setAttribute("src", src);
|
12
|
+
node.appendChild(image);
|
13
|
+
return node;
|
14
|
+
}
|
15
|
+
deleteAt(index, length) {
|
16
|
+
super.deleteAt(index, length);
|
17
|
+
this.cache = {};
|
18
|
+
}
|
19
|
+
static value(domNode) {
|
20
|
+
const { src, custom } = domNode.dataset;
|
21
|
+
return { src, custom };
|
22
|
+
}
|
23
23
|
}
|
24
24
|
|
25
25
|
LoadingImage.blotName = "imageBlot";
|
@@ -27,4 +27,4 @@ LoadingImage.className = "image-uploading";
|
|
27
27
|
LoadingImage.tagName = "span";
|
28
28
|
Quill.register({ "formats/imageBlot": LoadingImage });
|
29
29
|
|
30
|
-
export default LoadingImage;
|
30
|
+
export default LoadingImage;
|
@@ -52,8 +52,7 @@ class ImageUploader {
|
|
52
52
|
this.quill.history.userOnly = true;
|
53
53
|
range.top = this.quill.getBounds(range.index, range.length).top;
|
54
54
|
const selectedText = this.quill.getText(range.index, range.length);
|
55
|
-
|
56
|
-
this.quill.formatText(range, CommentBlot.blotName, commentBlotValue);
|
55
|
+
this.quill.formatText(range, CommentBlot.blotName, commentId, "user");
|
57
56
|
this.options.newComment(range, selectedText, commentId);
|
58
57
|
}
|
59
58
|
this.quill.theme.tooltip.hide();
|
@@ -238,3 +237,4 @@ class ImageUploader {
|
|
238
237
|
|
239
238
|
window.ImageUploader = ImageUploader;
|
240
239
|
export default ImageUploader;
|
240
|
+
export { CommentBlot, LoadingImage };
|