@adminforth/rich-editor 1.2.1 → 1.2.3
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/README.md +1 -1
- package/build.log +2 -2
- package/custom/quillEditor.vue +80 -4
- package/dist/custom/quillEditor.vue +80 -4
- package/dist/index.js +3 -0
- package/index.ts +3 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
Allows to add a rich text editor to your AdminForth text columns.
|
|
6
6
|
|
|
7
|
-
## For
|
|
7
|
+
## For usage, see [AdminForth RichEditor Documentation](https://adminforth.dev/docs/tutorial/Plugins/RichEditor/)
|
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 20,967 bytes received 115 bytes 42,164.00 bytes/sec
|
|
14
|
+
total size is 20,550 speedup is 0.97
|
package/custom/quillEditor.vue
CHANGED
|
@@ -27,7 +27,6 @@ import AsyncQueue from './async-queue';
|
|
|
27
27
|
import Quill from "quill";
|
|
28
28
|
import "quill/dist/quill.snow.css";
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
function dbg(title: string,...args: any[]) {
|
|
32
31
|
// return; // comment for debug
|
|
33
32
|
console.log(title, ...args.map(a =>JSON.stringify(a, null, 1)));
|
|
@@ -292,7 +291,16 @@ onMounted(() => {
|
|
|
292
291
|
async function emitTextUpdate() {
|
|
293
292
|
const editorHtml = quill.root.innerHTML;
|
|
294
293
|
// remove completion from html
|
|
295
|
-
|
|
294
|
+
let html = editorHtml.replace(/<span[^>]*completer[^>]*>.*?<\/span>/g, '');
|
|
295
|
+
|
|
296
|
+
// remove all style attributes
|
|
297
|
+
const parser = new DOMParser();
|
|
298
|
+
const doc = parser.parseFromString(html, 'text/html');
|
|
299
|
+
const elements = doc.querySelectorAll('*');
|
|
300
|
+
elements.forEach((el) => {
|
|
301
|
+
el.removeAttribute('style');
|
|
302
|
+
});
|
|
303
|
+
html = doc.body.innerHTML;
|
|
296
304
|
|
|
297
305
|
if (lastText === html) {
|
|
298
306
|
return;
|
|
@@ -527,8 +535,76 @@ function removeCompletionOnBlur() {
|
|
|
527
535
|
font-style: italic;
|
|
528
536
|
}
|
|
529
537
|
|
|
530
|
-
|
|
531
|
-
|
|
538
|
+
// basic typography
|
|
539
|
+
.ql-editor {
|
|
540
|
+
line-height: 1.5;
|
|
541
|
+
|
|
542
|
+
/* Headings */
|
|
543
|
+
h1, h2, h3, h4, h5, h6 {
|
|
544
|
+
margin-top: 0.5rem;
|
|
545
|
+
margin-bottom: 0.25rem;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/* Paragraphs */
|
|
549
|
+
p {
|
|
550
|
+
margin-bottom: 0.4rem;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/* Lists */
|
|
554
|
+
ul, ol {
|
|
555
|
+
margin-top: 0.4rem;
|
|
556
|
+
margin-bottom: 0.4rem;
|
|
557
|
+
padding-left: 1rem;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/* List items */
|
|
561
|
+
li {
|
|
562
|
+
margin-bottom: 0.2rem;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* Horizontal rule */
|
|
566
|
+
hr {
|
|
567
|
+
margin: 0.8rem 0;
|
|
568
|
+
border: none;
|
|
569
|
+
border-top: 1px solid #ddd;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/* Blockquotes */
|
|
573
|
+
blockquote {
|
|
574
|
+
margin: 0.8rem 0;
|
|
575
|
+
padding-left: 0.8rem;
|
|
576
|
+
border-left: 2px solid #ccc;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/* Preformatted text */
|
|
580
|
+
pre {
|
|
581
|
+
margin: 0.8rem 0;
|
|
582
|
+
padding: 0.4rem;
|
|
583
|
+
background: #f8f9fa;
|
|
584
|
+
border-radius: 3px;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/* Tables */
|
|
588
|
+
table {
|
|
589
|
+
margin: 0.8rem 0;
|
|
590
|
+
border-collapse: collapse;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
th, td {
|
|
594
|
+
padding: 0.3rem;
|
|
595
|
+
border: 1px solid #ddd;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
thead th {
|
|
599
|
+
border-bottom: 1.5px solid #aaa;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/* Images */
|
|
603
|
+
img {
|
|
604
|
+
margin: 0.4rem 0;
|
|
605
|
+
max-width: 100%;
|
|
606
|
+
height: auto;
|
|
607
|
+
}
|
|
532
608
|
}
|
|
533
609
|
|
|
534
610
|
.ql-snow .ql-stroke {
|
|
@@ -27,7 +27,6 @@ import AsyncQueue from './async-queue';
|
|
|
27
27
|
import Quill from "quill";
|
|
28
28
|
import "quill/dist/quill.snow.css";
|
|
29
29
|
|
|
30
|
-
|
|
31
30
|
function dbg(title: string,...args: any[]) {
|
|
32
31
|
// return; // comment for debug
|
|
33
32
|
console.log(title, ...args.map(a =>JSON.stringify(a, null, 1)));
|
|
@@ -292,7 +291,16 @@ onMounted(() => {
|
|
|
292
291
|
async function emitTextUpdate() {
|
|
293
292
|
const editorHtml = quill.root.innerHTML;
|
|
294
293
|
// remove completion from html
|
|
295
|
-
|
|
294
|
+
let html = editorHtml.replace(/<span[^>]*completer[^>]*>.*?<\/span>/g, '');
|
|
295
|
+
|
|
296
|
+
// remove all style attributes
|
|
297
|
+
const parser = new DOMParser();
|
|
298
|
+
const doc = parser.parseFromString(html, 'text/html');
|
|
299
|
+
const elements = doc.querySelectorAll('*');
|
|
300
|
+
elements.forEach((el) => {
|
|
301
|
+
el.removeAttribute('style');
|
|
302
|
+
});
|
|
303
|
+
html = doc.body.innerHTML;
|
|
296
304
|
|
|
297
305
|
if (lastText === html) {
|
|
298
306
|
return;
|
|
@@ -527,8 +535,76 @@ function removeCompletionOnBlur() {
|
|
|
527
535
|
font-style: italic;
|
|
528
536
|
}
|
|
529
537
|
|
|
530
|
-
|
|
531
|
-
|
|
538
|
+
// basic typography
|
|
539
|
+
.ql-editor {
|
|
540
|
+
line-height: 1.5;
|
|
541
|
+
|
|
542
|
+
/* Headings */
|
|
543
|
+
h1, h2, h3, h4, h5, h6 {
|
|
544
|
+
margin-top: 0.5rem;
|
|
545
|
+
margin-bottom: 0.25rem;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
/* Paragraphs */
|
|
549
|
+
p {
|
|
550
|
+
margin-bottom: 0.4rem;
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
/* Lists */
|
|
554
|
+
ul, ol {
|
|
555
|
+
margin-top: 0.4rem;
|
|
556
|
+
margin-bottom: 0.4rem;
|
|
557
|
+
padding-left: 1rem;
|
|
558
|
+
}
|
|
559
|
+
|
|
560
|
+
/* List items */
|
|
561
|
+
li {
|
|
562
|
+
margin-bottom: 0.2rem;
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
/* Horizontal rule */
|
|
566
|
+
hr {
|
|
567
|
+
margin: 0.8rem 0;
|
|
568
|
+
border: none;
|
|
569
|
+
border-top: 1px solid #ddd;
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
/* Blockquotes */
|
|
573
|
+
blockquote {
|
|
574
|
+
margin: 0.8rem 0;
|
|
575
|
+
padding-left: 0.8rem;
|
|
576
|
+
border-left: 2px solid #ccc;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/* Preformatted text */
|
|
580
|
+
pre {
|
|
581
|
+
margin: 0.8rem 0;
|
|
582
|
+
padding: 0.4rem;
|
|
583
|
+
background: #f8f9fa;
|
|
584
|
+
border-radius: 3px;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
/* Tables */
|
|
588
|
+
table {
|
|
589
|
+
margin: 0.8rem 0;
|
|
590
|
+
border-collapse: collapse;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
th, td {
|
|
594
|
+
padding: 0.3rem;
|
|
595
|
+
border: 1px solid #ddd;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
thead th {
|
|
599
|
+
border-bottom: 1.5px solid #aaa;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
/* Images */
|
|
603
|
+
img {
|
|
604
|
+
margin: 0.4rem 0;
|
|
605
|
+
max-width: 100%;
|
|
606
|
+
height: auto;
|
|
607
|
+
}
|
|
532
608
|
}
|
|
533
609
|
|
|
534
610
|
.ql-snow .ql-stroke {
|
package/dist/index.js
CHANGED
|
@@ -101,6 +101,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
|
|
|
101
101
|
})));
|
|
102
102
|
});
|
|
103
103
|
const deleteAttachmentRecords = (adminforth, options, s3Paths, adminUser) => __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
if (!s3Paths.length) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
104
107
|
const attachmentPrimaryKeyField = this.attachmentResource.columns.find(c => c.primaryKey);
|
|
105
108
|
const attachments = yield adminforth.resource(options.attachments.attachmentResource).list(Filters.IN(options.attachments.attachmentFieldName, s3Paths));
|
|
106
109
|
yield Promise.all(attachments.map((a) => __awaiter(this, void 0, void 0, function* () {
|
package/index.ts
CHANGED
|
@@ -122,7 +122,9 @@ export default class RichEditorPlugin extends AdminForthPlugin {
|
|
|
122
122
|
const deleteAttachmentRecords = async (
|
|
123
123
|
adminforth: IAdminForth, options: PluginOptions, s3Paths: string[], adminUser: AdminUser
|
|
124
124
|
) => {
|
|
125
|
-
|
|
125
|
+
if (!s3Paths.length) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
126
128
|
const attachmentPrimaryKeyField = this.attachmentResource.columns.find(c => c.primaryKey);
|
|
127
129
|
|
|
128
130
|
const attachments = await adminforth.resource(options.attachments.attachmentResource).list(
|