@vaadin/rich-text-editor 23.3.24 → 23.3.25
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 +10 -10
- package/src/vaadin-rich-text-editor.js +64 -11
- package/web-types.json +1 -1
- package/web-types.lit.json +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/rich-text-editor",
|
|
3
|
-
"version": "23.3.
|
|
3
|
+
"version": "23.3.25",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,14 +40,14 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@polymer/polymer": "^3.0.0",
|
|
43
|
-
"@vaadin/button": "~23.3.
|
|
44
|
-
"@vaadin/component-base": "~23.3.
|
|
45
|
-
"@vaadin/confirm-dialog": "~23.3.
|
|
46
|
-
"@vaadin/text-field": "~23.3.
|
|
47
|
-
"@vaadin/tooltip": "~23.3.
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "~23.3.
|
|
49
|
-
"@vaadin/vaadin-material-styles": "~23.3.
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "~23.3.
|
|
43
|
+
"@vaadin/button": "~23.3.25",
|
|
44
|
+
"@vaadin/component-base": "~23.3.25",
|
|
45
|
+
"@vaadin/confirm-dialog": "~23.3.25",
|
|
46
|
+
"@vaadin/text-field": "~23.3.25",
|
|
47
|
+
"@vaadin/tooltip": "~23.3.25",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "~23.3.25",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "~23.3.25",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "~23.3.25"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"web-types.json",
|
|
63
63
|
"web-types.lit.json"
|
|
64
64
|
],
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "61b55b7a7e925aa853530b363bfa3549e44c661c"
|
|
66
66
|
}
|
|
@@ -26,6 +26,39 @@ registerStyles('vaadin-rich-text-editor', richTextEditorStyles, { moduleId: 'vaa
|
|
|
26
26
|
|
|
27
27
|
const Quill = window.Quill;
|
|
28
28
|
|
|
29
|
+
// Workaround for text disappearing when accepting spellcheck suggestion
|
|
30
|
+
// See https://github.com/quilljs/quill/issues/2096#issuecomment-399576957
|
|
31
|
+
const Inline = Quill.import('blots/inline');
|
|
32
|
+
|
|
33
|
+
class CustomColor extends Inline {
|
|
34
|
+
constructor(domNode, value) {
|
|
35
|
+
super(domNode, value);
|
|
36
|
+
|
|
37
|
+
// Map <font> properties
|
|
38
|
+
domNode.style.color = domNode.color;
|
|
39
|
+
|
|
40
|
+
const span = this.replaceWith(new Inline(Inline.create()));
|
|
41
|
+
|
|
42
|
+
span.children.forEach((child) => {
|
|
43
|
+
if (child.attributes) {
|
|
44
|
+
child.attributes.copy(span);
|
|
45
|
+
}
|
|
46
|
+
if (child.unwrap) {
|
|
47
|
+
child.unwrap();
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
this.remove();
|
|
52
|
+
|
|
53
|
+
return span; // eslint-disable-line no-constructor-return
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
CustomColor.blotName = 'customColor';
|
|
58
|
+
CustomColor.tagName = 'FONT';
|
|
59
|
+
|
|
60
|
+
Quill.register(CustomColor, true);
|
|
61
|
+
|
|
29
62
|
const HANDLERS = [
|
|
30
63
|
'bold',
|
|
31
64
|
'italic',
|
|
@@ -526,6 +559,20 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
526
559
|
}
|
|
527
560
|
}
|
|
528
561
|
|
|
562
|
+
/** @protected */
|
|
563
|
+
disconnectedCallback() {
|
|
564
|
+
super.disconnectedCallback();
|
|
565
|
+
|
|
566
|
+
// Ensure that htmlValue property set before attach
|
|
567
|
+
// gets applied in case of detach and re-attach.
|
|
568
|
+
if (this.__debounceSetValue && this.__debounceSetValue.isActive()) {
|
|
569
|
+
this.__debounceSetValue.flush();
|
|
570
|
+
}
|
|
571
|
+
|
|
572
|
+
this._editor.emitter.removeAllListeners();
|
|
573
|
+
this._editor.emitter.listeners = {};
|
|
574
|
+
}
|
|
575
|
+
|
|
529
576
|
/** @private */
|
|
530
577
|
__setDirection(dir) {
|
|
531
578
|
// Needed for proper `ql-align` class to be set and activate the toolbar align button
|
|
@@ -547,18 +594,14 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
547
594
|
}
|
|
548
595
|
|
|
549
596
|
/** @protected */
|
|
550
|
-
|
|
551
|
-
super.
|
|
597
|
+
connectedCallback() {
|
|
598
|
+
super.connectedCallback();
|
|
552
599
|
|
|
553
600
|
const editor = this.shadowRoot.querySelector('[part="content"]');
|
|
554
|
-
const toolbarConfig = this._prepareToolbar();
|
|
555
|
-
this._toolbar = toolbarConfig.container;
|
|
556
|
-
|
|
557
|
-
this._addToolbarListeners();
|
|
558
601
|
|
|
559
602
|
this._editor = new Quill(editor, {
|
|
560
603
|
modules: {
|
|
561
|
-
toolbar:
|
|
604
|
+
toolbar: this._toolbarConfig,
|
|
562
605
|
},
|
|
563
606
|
});
|
|
564
607
|
|
|
@@ -570,10 +613,6 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
570
613
|
this.__patchFirefoxFocus();
|
|
571
614
|
}
|
|
572
615
|
|
|
573
|
-
this.$.linkDialog.$.dialog.$.overlay.addEventListener('vaadin-overlay-open', () => {
|
|
574
|
-
this.$.linkUrl.focus();
|
|
575
|
-
});
|
|
576
|
-
|
|
577
616
|
const editorContent = editor.querySelector('.ql-editor');
|
|
578
617
|
|
|
579
618
|
editorContent.setAttribute('role', 'textbox');
|
|
@@ -604,6 +643,20 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
604
643
|
this._editor.on('selection-change', this.__announceFormatting.bind(this));
|
|
605
644
|
}
|
|
606
645
|
|
|
646
|
+
/** @protected */
|
|
647
|
+
ready() {
|
|
648
|
+
super.ready();
|
|
649
|
+
|
|
650
|
+
this._toolbarConfig = this._prepareToolbar();
|
|
651
|
+
this._toolbar = this._toolbarConfig.container;
|
|
652
|
+
|
|
653
|
+
this._addToolbarListeners();
|
|
654
|
+
|
|
655
|
+
this.$.linkDialog.$.dialog.$.overlay.addEventListener('vaadin-overlay-open', () => {
|
|
656
|
+
this.$.linkUrl.focus();
|
|
657
|
+
});
|
|
658
|
+
}
|
|
659
|
+
|
|
607
660
|
/** @private */
|
|
608
661
|
_prepareToolbar() {
|
|
609
662
|
const clean = Quill.imports['modules/toolbar'].DEFAULTS.handlers.clean;
|
package/web-types.json
CHANGED