@adminforth/rich-editor 1.6.5 → 1.6.6
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/build.log +2 -2
- package/custom/quillEditor.vue +41 -6
- package/dist/custom/quillEditor.vue +41 -6
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -10,5 +10,5 @@ custom/package.json
|
|
|
10
10
|
custom/quillEditor.vue
|
|
11
11
|
custom/tsconfig.json
|
|
12
12
|
|
|
13
|
-
sent
|
|
14
|
-
total size is
|
|
13
|
+
sent 29,604 bytes received 115 bytes 59,438.00 bytes/sec
|
|
14
|
+
total size is 29,181 speedup is 0.98
|
package/custom/quillEditor.vue
CHANGED
|
@@ -87,10 +87,34 @@ class ImageBlot extends BlockEmbed {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
class ImageBlotEmbed extends Embed {
|
|
92
|
+
static blotName = 'image_embed';
|
|
93
|
+
static tagName = 'img';
|
|
94
|
+
|
|
95
|
+
static create(value) {
|
|
96
|
+
let node = super.create();
|
|
97
|
+
node.setAttribute('alt', value.alt);
|
|
98
|
+
node.setAttribute('src', value.url);
|
|
99
|
+
node.setAttribute('data-s3path', value['s3Path']);
|
|
100
|
+
return node;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static value(node) {
|
|
104
|
+
return {
|
|
105
|
+
alt: node.getAttribute('alt'),
|
|
106
|
+
url: node.getAttribute('src'),
|
|
107
|
+
s3Path: node.getAttribute('data-s3path'),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
90
112
|
// @ts-ignore
|
|
91
113
|
Quill.register(CompleteBlot);
|
|
92
114
|
// @ts-ignore
|
|
93
115
|
Quill.register(ImageBlot);
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
Quill.register(ImageBlotEmbed);
|
|
94
118
|
|
|
95
119
|
Quill.register({
|
|
96
120
|
'modules/table-better': QuillTableBetter
|
|
@@ -179,12 +203,23 @@ async function saveToServer(file: File) {
|
|
|
179
203
|
|
|
180
204
|
// here we have s3Path, call createResource to save the image
|
|
181
205
|
const range = quill.getSelection();
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
206
|
+
const formats = quill.getFormat(range.index);
|
|
207
|
+
|
|
208
|
+
// here we are checking if we are inside table cell
|
|
209
|
+
if (formats['table-cell']) {
|
|
210
|
+
// if so, we insert image_embed blot in order not to break table structure
|
|
211
|
+
quill.insertEmbed(range.index, 'image_embed', {
|
|
212
|
+
url: previewUrl,
|
|
213
|
+
s3Path: filePath,
|
|
214
|
+
alt: file.name
|
|
215
|
+
}, 'user');
|
|
216
|
+
} else {
|
|
217
|
+
quill.insertEmbed(range.index, 'image', {
|
|
218
|
+
url: previewUrl,
|
|
219
|
+
s3Path: filePath,
|
|
220
|
+
alt: file.name
|
|
221
|
+
}, 'user');
|
|
222
|
+
}
|
|
188
223
|
}
|
|
189
224
|
|
|
190
225
|
async function imageHandler() {
|
|
@@ -87,10 +87,34 @@ class ImageBlot extends BlockEmbed {
|
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
+
// @ts-ignore
|
|
91
|
+
class ImageBlotEmbed extends Embed {
|
|
92
|
+
static blotName = 'image_embed';
|
|
93
|
+
static tagName = 'img';
|
|
94
|
+
|
|
95
|
+
static create(value) {
|
|
96
|
+
let node = super.create();
|
|
97
|
+
node.setAttribute('alt', value.alt);
|
|
98
|
+
node.setAttribute('src', value.url);
|
|
99
|
+
node.setAttribute('data-s3path', value['s3Path']);
|
|
100
|
+
return node;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
static value(node) {
|
|
104
|
+
return {
|
|
105
|
+
alt: node.getAttribute('alt'),
|
|
106
|
+
url: node.getAttribute('src'),
|
|
107
|
+
s3Path: node.getAttribute('data-s3path'),
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
90
112
|
// @ts-ignore
|
|
91
113
|
Quill.register(CompleteBlot);
|
|
92
114
|
// @ts-ignore
|
|
93
115
|
Quill.register(ImageBlot);
|
|
116
|
+
// @ts-ignore
|
|
117
|
+
Quill.register(ImageBlotEmbed);
|
|
94
118
|
|
|
95
119
|
Quill.register({
|
|
96
120
|
'modules/table-better': QuillTableBetter
|
|
@@ -179,12 +203,23 @@ async function saveToServer(file: File) {
|
|
|
179
203
|
|
|
180
204
|
// here we have s3Path, call createResource to save the image
|
|
181
205
|
const range = quill.getSelection();
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
206
|
+
const formats = quill.getFormat(range.index);
|
|
207
|
+
|
|
208
|
+
// here we are checking if we are inside table cell
|
|
209
|
+
if (formats['table-cell']) {
|
|
210
|
+
// if so, we insert image_embed blot in order not to break table structure
|
|
211
|
+
quill.insertEmbed(range.index, 'image_embed', {
|
|
212
|
+
url: previewUrl,
|
|
213
|
+
s3Path: filePath,
|
|
214
|
+
alt: file.name
|
|
215
|
+
}, 'user');
|
|
216
|
+
} else {
|
|
217
|
+
quill.insertEmbed(range.index, 'image', {
|
|
218
|
+
url: previewUrl,
|
|
219
|
+
s3Path: filePath,
|
|
220
|
+
alt: file.name
|
|
221
|
+
}, 'user');
|
|
222
|
+
}
|
|
188
223
|
}
|
|
189
224
|
|
|
190
225
|
async function imageHandler() {
|