@vaadin/rich-text-editor 24.1.9 → 24.1.11
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 +11 -11
- package/src/vaadin-rich-text-editor.js +60 -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": "24.1.
|
|
3
|
+
"version": "24.1.11",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
],
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@polymer/polymer": "^3.0.0",
|
|
43
|
-
"@vaadin/button": "~24.1.
|
|
44
|
-
"@vaadin/component-base": "~24.1.
|
|
45
|
-
"@vaadin/confirm-dialog": "~24.1.
|
|
46
|
-
"@vaadin/text-field": "~24.1.
|
|
47
|
-
"@vaadin/tooltip": "~24.1.
|
|
48
|
-
"@vaadin/vaadin-lumo-styles": "~24.1.
|
|
49
|
-
"@vaadin/vaadin-material-styles": "~24.1.
|
|
50
|
-
"@vaadin/vaadin-themable-mixin": "~24.1.
|
|
43
|
+
"@vaadin/button": "~24.1.11",
|
|
44
|
+
"@vaadin/component-base": "~24.1.11",
|
|
45
|
+
"@vaadin/confirm-dialog": "~24.1.11",
|
|
46
|
+
"@vaadin/text-field": "~24.1.11",
|
|
47
|
+
"@vaadin/tooltip": "~24.1.11",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "~24.1.11",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "~24.1.11",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "~24.1.11"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
54
|
-
"@vaadin/a11y-base": "~24.1.
|
|
54
|
+
"@vaadin/a11y-base": "~24.1.11",
|
|
55
55
|
"@vaadin/testing-helpers": "^0.4.2",
|
|
56
56
|
"gulp": "^4.0.2",
|
|
57
57
|
"gulp-cli": "^2.3.0",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"web-types.json",
|
|
64
64
|
"web-types.lit.json"
|
|
65
65
|
],
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "620733f1bd92346c0e52bd2b8aa2e403a6314ee2"
|
|
67
67
|
}
|
|
@@ -26,6 +26,35 @@ 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) child.attributes.copy(span);
|
|
44
|
+
if (child.unwrap) child.unwrap();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
this.remove();
|
|
48
|
+
|
|
49
|
+
return span; // eslint-disable-line no-constructor-return
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
CustomColor.blotName = 'customColor';
|
|
54
|
+
CustomColor.tagName = 'FONT';
|
|
55
|
+
|
|
56
|
+
Quill.register(CustomColor, true);
|
|
57
|
+
|
|
29
58
|
const HANDLERS = [
|
|
30
59
|
'bold',
|
|
31
60
|
'italic',
|
|
@@ -533,6 +562,20 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
533
562
|
}
|
|
534
563
|
}
|
|
535
564
|
|
|
565
|
+
/** @protected */
|
|
566
|
+
disconnectedCallback() {
|
|
567
|
+
super.disconnectedCallback();
|
|
568
|
+
|
|
569
|
+
// Ensure that htmlValue property set before attach
|
|
570
|
+
// gets applied in case of detach and re-attach.
|
|
571
|
+
if (this.__debounceSetValue && this.__debounceSetValue.isActive()) {
|
|
572
|
+
this.__debounceSetValue.flush();
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
this._editor.emitter.removeAllListeners();
|
|
576
|
+
this._editor.emitter.listeners = {};
|
|
577
|
+
}
|
|
578
|
+
|
|
536
579
|
/** @private */
|
|
537
580
|
__setDirection(dir) {
|
|
538
581
|
// Needed for proper `ql-align` class to be set and activate the toolbar align button
|
|
@@ -554,18 +597,14 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
554
597
|
}
|
|
555
598
|
|
|
556
599
|
/** @protected */
|
|
557
|
-
|
|
558
|
-
super.
|
|
600
|
+
connectedCallback() {
|
|
601
|
+
super.connectedCallback();
|
|
559
602
|
|
|
560
603
|
const editor = this.shadowRoot.querySelector('[part="content"]');
|
|
561
|
-
const toolbarConfig = this._prepareToolbar();
|
|
562
|
-
this._toolbar = toolbarConfig.container;
|
|
563
|
-
|
|
564
|
-
this._addToolbarListeners();
|
|
565
604
|
|
|
566
605
|
this._editor = new Quill(editor, {
|
|
567
606
|
modules: {
|
|
568
|
-
toolbar:
|
|
607
|
+
toolbar: this._toolbarConfig,
|
|
569
608
|
},
|
|
570
609
|
});
|
|
571
610
|
|
|
@@ -577,10 +616,6 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
577
616
|
this.__patchFirefoxFocus();
|
|
578
617
|
}
|
|
579
618
|
|
|
580
|
-
this.$.linkDialog.$.dialog.$.overlay.addEventListener('vaadin-overlay-open', () => {
|
|
581
|
-
this.$.linkUrl.focus();
|
|
582
|
-
});
|
|
583
|
-
|
|
584
619
|
const editorContent = editor.querySelector('.ql-editor');
|
|
585
620
|
|
|
586
621
|
editorContent.setAttribute('role', 'textbox');
|
|
@@ -632,6 +667,20 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
632
667
|
this._editor.on('selection-change', this.__announceFormatting.bind(this));
|
|
633
668
|
}
|
|
634
669
|
|
|
670
|
+
/** @protected */
|
|
671
|
+
ready() {
|
|
672
|
+
super.ready();
|
|
673
|
+
|
|
674
|
+
this._toolbarConfig = this._prepareToolbar();
|
|
675
|
+
this._toolbar = this._toolbarConfig.container;
|
|
676
|
+
|
|
677
|
+
this._addToolbarListeners();
|
|
678
|
+
|
|
679
|
+
this.$.linkDialog.$.dialog.$.overlay.addEventListener('vaadin-overlay-open', () => {
|
|
680
|
+
this.$.linkUrl.focus();
|
|
681
|
+
});
|
|
682
|
+
}
|
|
683
|
+
|
|
635
684
|
/** @private */
|
|
636
685
|
_prepareToolbar() {
|
|
637
686
|
const clean = Quill.imports['modules/toolbar'].DEFAULTS.handlers.clean;
|
package/web-types.json
CHANGED