@writergate/quill-image-uploader-nextjs 0.1.12 → 0.1.14
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
@@ -4,21 +4,21 @@ const InlineBlot = Quill.import("blots/inline");
|
|
4
4
|
|
5
5
|
class CommentBlot extends InlineBlot {
|
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,13 +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(
|
57
|
-
range,
|
58
|
-
CommentBlot.blotName,
|
59
|
-
commentBlotValue,
|
60
|
-
"user"
|
61
|
-
);
|
55
|
+
this.quill.formatText(range, CommentBlot.blotName, commentId, "user");
|
62
56
|
this.options.newComment(range, selectedText, commentId);
|
63
57
|
}
|
64
58
|
this.quill.theme.tooltip.hide();
|
@@ -243,3 +237,4 @@ class ImageUploader {
|
|
243
237
|
|
244
238
|
window.ImageUploader = ImageUploader;
|
245
239
|
export default ImageUploader;
|
240
|
+
export { CommentBlot, LoadingImage };
|