@adminforth/rich-editor 1.4.0 → 1.4.1
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 +17 -2
- package/dist/custom/quillEditor.vue +17 -2
- 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 21,
|
|
14
|
-
total size is
|
|
13
|
+
sent 21,457 bytes received 115 bytes 43,144.00 bytes/sec
|
|
14
|
+
total size is 21,034 speedup is 0.98
|
package/custom/quillEditor.vue
CHANGED
|
@@ -289,6 +289,21 @@ onMounted(() => {
|
|
|
289
289
|
|
|
290
290
|
});
|
|
291
291
|
|
|
292
|
+
function isQuillContentEmpty(html: string): boolean {
|
|
293
|
+
const div = document.createElement('div');
|
|
294
|
+
div.innerHTML = html;
|
|
295
|
+
|
|
296
|
+
div.querySelectorAll('br').forEach(br => br.remove());
|
|
297
|
+
|
|
298
|
+
div.querySelectorAll('p').forEach(p => {
|
|
299
|
+
if (!p.textContent?.trim()) {
|
|
300
|
+
p.remove();
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const text = div.textContent?.trim();
|
|
305
|
+
return !text;
|
|
306
|
+
}
|
|
292
307
|
|
|
293
308
|
async function emitTextUpdate() {
|
|
294
309
|
const editorHtml = quill.root.innerHTML;
|
|
@@ -311,9 +326,9 @@ async function emitTextUpdate() {
|
|
|
311
326
|
lastText = html;
|
|
312
327
|
|
|
313
328
|
await (new Promise((resolve) => setTimeout(resolve, 0)));
|
|
314
|
-
|
|
329
|
+
const isEmpty = isQuillContentEmpty(html);
|
|
315
330
|
dbg('⬆️ emit value suggestion-input', html);
|
|
316
|
-
emit('update:value', html);
|
|
331
|
+
emit('update:value', isEmpty ? '' : html);
|
|
317
332
|
}
|
|
318
333
|
|
|
319
334
|
// Auto-Completion functions
|
|
@@ -289,6 +289,21 @@ onMounted(() => {
|
|
|
289
289
|
|
|
290
290
|
});
|
|
291
291
|
|
|
292
|
+
function isQuillContentEmpty(html: string): boolean {
|
|
293
|
+
const div = document.createElement('div');
|
|
294
|
+
div.innerHTML = html;
|
|
295
|
+
|
|
296
|
+
div.querySelectorAll('br').forEach(br => br.remove());
|
|
297
|
+
|
|
298
|
+
div.querySelectorAll('p').forEach(p => {
|
|
299
|
+
if (!p.textContent?.trim()) {
|
|
300
|
+
p.remove();
|
|
301
|
+
}
|
|
302
|
+
});
|
|
303
|
+
|
|
304
|
+
const text = div.textContent?.trim();
|
|
305
|
+
return !text;
|
|
306
|
+
}
|
|
292
307
|
|
|
293
308
|
async function emitTextUpdate() {
|
|
294
309
|
const editorHtml = quill.root.innerHTML;
|
|
@@ -311,9 +326,9 @@ async function emitTextUpdate() {
|
|
|
311
326
|
lastText = html;
|
|
312
327
|
|
|
313
328
|
await (new Promise((resolve) => setTimeout(resolve, 0)));
|
|
314
|
-
|
|
329
|
+
const isEmpty = isQuillContentEmpty(html);
|
|
315
330
|
dbg('⬆️ emit value suggestion-input', html);
|
|
316
|
-
emit('update:value', html);
|
|
331
|
+
emit('update:value', isEmpty ? '' : html);
|
|
317
332
|
}
|
|
318
333
|
|
|
319
334
|
// Auto-Completion functions
|