@adminforth/rich-editor 1.4.0 → 1.5.0
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 +18 -2
- package/dist/custom/quillEditor.vue +18 -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,698 bytes received 115 bytes 43,626.00 bytes/sec
|
|
14
|
+
total size is 21,281 speedup is 0.98
|
package/custom/quillEditor.vue
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500
|
|
4
4
|
focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400
|
|
5
5
|
dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 whitespace-normal af-quill-editor"
|
|
6
|
+
:class="'bg-lightInputBackground placeholder-lightInputPlaceholderText text-lightInputText border-lightInputBorder dark:!bg-darkInputBackground dark:!placeholder-darkInputPlaceholderText dark:!text-darkInputText dark:!border-darkInputBorder'"
|
|
6
7
|
>
|
|
7
8
|
<div
|
|
8
9
|
ref="editor"
|
|
@@ -289,6 +290,21 @@ onMounted(() => {
|
|
|
289
290
|
|
|
290
291
|
});
|
|
291
292
|
|
|
293
|
+
function isQuillContentEmpty(html: string): boolean {
|
|
294
|
+
const div = document.createElement('div');
|
|
295
|
+
div.innerHTML = html;
|
|
296
|
+
|
|
297
|
+
div.querySelectorAll('br').forEach(br => br.remove());
|
|
298
|
+
|
|
299
|
+
div.querySelectorAll('p').forEach(p => {
|
|
300
|
+
if (!p.textContent?.trim()) {
|
|
301
|
+
p.remove();
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
const text = div.textContent?.trim();
|
|
306
|
+
return !text;
|
|
307
|
+
}
|
|
292
308
|
|
|
293
309
|
async function emitTextUpdate() {
|
|
294
310
|
const editorHtml = quill.root.innerHTML;
|
|
@@ -311,9 +327,9 @@ async function emitTextUpdate() {
|
|
|
311
327
|
lastText = html;
|
|
312
328
|
|
|
313
329
|
await (new Promise((resolve) => setTimeout(resolve, 0)));
|
|
314
|
-
|
|
330
|
+
const isEmpty = isQuillContentEmpty(html);
|
|
315
331
|
dbg('⬆️ emit value suggestion-input', html);
|
|
316
|
-
emit('update:value', html);
|
|
332
|
+
emit('update:value', isEmpty ? '' : html);
|
|
317
333
|
}
|
|
318
334
|
|
|
319
335
|
// Auto-Completion functions
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500
|
|
4
4
|
focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400
|
|
5
5
|
dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 whitespace-normal af-quill-editor"
|
|
6
|
+
:class="'bg-lightInputBackground placeholder-lightInputPlaceholderText text-lightInputText border-lightInputBorder dark:!bg-darkInputBackground dark:!placeholder-darkInputPlaceholderText dark:!text-darkInputText dark:!border-darkInputBorder'"
|
|
6
7
|
>
|
|
7
8
|
<div
|
|
8
9
|
ref="editor"
|
|
@@ -289,6 +290,21 @@ onMounted(() => {
|
|
|
289
290
|
|
|
290
291
|
});
|
|
291
292
|
|
|
293
|
+
function isQuillContentEmpty(html: string): boolean {
|
|
294
|
+
const div = document.createElement('div');
|
|
295
|
+
div.innerHTML = html;
|
|
296
|
+
|
|
297
|
+
div.querySelectorAll('br').forEach(br => br.remove());
|
|
298
|
+
|
|
299
|
+
div.querySelectorAll('p').forEach(p => {
|
|
300
|
+
if (!p.textContent?.trim()) {
|
|
301
|
+
p.remove();
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
|
|
305
|
+
const text = div.textContent?.trim();
|
|
306
|
+
return !text;
|
|
307
|
+
}
|
|
292
308
|
|
|
293
309
|
async function emitTextUpdate() {
|
|
294
310
|
const editorHtml = quill.root.innerHTML;
|
|
@@ -311,9 +327,9 @@ async function emitTextUpdate() {
|
|
|
311
327
|
lastText = html;
|
|
312
328
|
|
|
313
329
|
await (new Promise((resolve) => setTimeout(resolve, 0)));
|
|
314
|
-
|
|
330
|
+
const isEmpty = isQuillContentEmpty(html);
|
|
315
331
|
dbg('⬆️ emit value suggestion-input', html);
|
|
316
|
-
emit('update:value', html);
|
|
332
|
+
emit('update:value', isEmpty ? '' : html);
|
|
317
333
|
}
|
|
318
334
|
|
|
319
335
|
// Auto-Completion functions
|