@vaadin/rich-text-editor 25.4.0-dev.55bb86e155 → 25.4.0-rc1
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/rich-text-editor",
|
|
3
|
-
"version": "25.4.0-
|
|
3
|
+
"version": "25.4.0-rc1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -35,22 +35,22 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@open-wc/dedupe-mixin": "^1.3.0",
|
|
38
|
-
"@vaadin/a11y-base": "25.4.0-
|
|
39
|
-
"@vaadin/button": "25.4.0-
|
|
40
|
-
"@vaadin/component-base": "25.4.0-
|
|
41
|
-
"@vaadin/confirm-dialog": "25.4.0-
|
|
42
|
-
"@vaadin/overlay": "25.4.0-
|
|
43
|
-
"@vaadin/text-field": "25.4.0-
|
|
44
|
-
"@vaadin/tooltip": "25.4.0-
|
|
45
|
-
"@vaadin/vaadin-themable-mixin": "25.4.0-
|
|
38
|
+
"@vaadin/a11y-base": "25.4.0-rc1",
|
|
39
|
+
"@vaadin/button": "25.4.0-rc1",
|
|
40
|
+
"@vaadin/component-base": "25.4.0-rc1",
|
|
41
|
+
"@vaadin/confirm-dialog": "25.4.0-rc1",
|
|
42
|
+
"@vaadin/overlay": "25.4.0-rc1",
|
|
43
|
+
"@vaadin/text-field": "25.4.0-rc1",
|
|
44
|
+
"@vaadin/tooltip": "25.4.0-rc1",
|
|
45
|
+
"@vaadin/vaadin-themable-mixin": "25.4.0-rc1",
|
|
46
46
|
"lit": "^3.0.0"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
-
"@vaadin/aura": "25.4.0-
|
|
50
|
-
"@vaadin/chai-plugins": "25.4.0-
|
|
51
|
-
"@vaadin/test-runner-commands": "25.4.0-
|
|
49
|
+
"@vaadin/aura": "25.4.0-rc1",
|
|
50
|
+
"@vaadin/chai-plugins": "25.4.0-rc1",
|
|
51
|
+
"@vaadin/test-runner-commands": "25.4.0-rc1",
|
|
52
52
|
"@vaadin/testing-helpers": "^2.0.0",
|
|
53
|
-
"@vaadin/vaadin-lumo-styles": "25.4.0-
|
|
53
|
+
"@vaadin/vaadin-lumo-styles": "25.4.0-rc1",
|
|
54
54
|
"sinon": "^22.0.0"
|
|
55
55
|
},
|
|
56
56
|
"cvdlName": "vaadin-rich-text-editor",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"web-types.json",
|
|
60
60
|
"web-types.lit.json"
|
|
61
61
|
],
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "abe6d2338024cb71110c7df9bd5d97c0d110a135"
|
|
63
63
|
}
|
|
@@ -24,9 +24,9 @@ const QuillCodeBlockContainer = Quill.import('formats/code-block-container');
|
|
|
24
24
|
class CodeBlockContainer extends QuillCodeBlockContainer {
|
|
25
25
|
html(index, length) {
|
|
26
26
|
const markup = super.html(index, length);
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
const preTag =
|
|
27
|
+
const template = document.createElement('template');
|
|
28
|
+
template.innerHTML = markup;
|
|
29
|
+
const preTag = template.content.querySelector('pre');
|
|
30
30
|
if (preTag) {
|
|
31
31
|
preTag.setAttribute('spellcheck', 'false');
|
|
32
32
|
return preTag.outerHTML;
|
|
@@ -735,16 +735,17 @@ export const RichTextEditorMixin = (superClass) =>
|
|
|
735
735
|
|
|
736
736
|
/** @private */
|
|
737
737
|
__processQuillClasses(content) {
|
|
738
|
-
|
|
739
|
-
|
|
738
|
+
// Use template to parse the content inertly, without loading resources or running handlers
|
|
739
|
+
const template = document.createElement('template');
|
|
740
|
+
template.innerHTML = content;
|
|
740
741
|
// Process only elements with align or indent classes
|
|
741
|
-
const elementsToProcess =
|
|
742
|
+
const elementsToProcess = template.content.querySelectorAll('[class*="ql-align"], [class*="ql-indent"]');
|
|
742
743
|
elementsToProcess.forEach((element) => {
|
|
743
744
|
this.__processAlignClasses(element);
|
|
744
745
|
this.__processIndentClasses(element);
|
|
745
746
|
element.removeAttribute('class');
|
|
746
747
|
});
|
|
747
|
-
return
|
|
748
|
+
return template.innerHTML;
|
|
748
749
|
}
|
|
749
750
|
|
|
750
751
|
/** @private */
|
|
@@ -12,9 +12,10 @@ import '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
|
12
12
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
13
13
|
import '@vaadin/tooltip/src/vaadin-tooltip.js';
|
|
14
14
|
import './vaadin-rich-text-editor-popup.js';
|
|
15
|
-
import { html, LitElement
|
|
15
|
+
import { html, LitElement } from 'lit';
|
|
16
16
|
import { isKeyboardActive } from '@vaadin/a11y-base/src/focus-utils.js';
|
|
17
17
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
18
|
+
import { slotContent } from '@vaadin/component-base/src/directives/slot-content.js';
|
|
18
19
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
19
20
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
20
21
|
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
@@ -403,71 +404,66 @@ class RichTextEditor extends RichTextEditorMixin(
|
|
|
403
404
|
|
|
404
405
|
<slot name="tooltip"></slot>
|
|
405
406
|
|
|
406
|
-
<slot name="link-dialog"></slot>
|
|
407
|
+
<slot name="link-dialog" ${slotContent(this.__renderLinkDialog())}></slot>
|
|
407
408
|
|
|
408
|
-
<slot name="color-popup"></slot>
|
|
409
|
+
<slot name="color-popup" ${slotContent(this.__renderColorPopup())}></slot>
|
|
409
410
|
|
|
410
|
-
<slot name="background-popup"></slot>
|
|
411
|
+
<slot name="background-popup" ${slotContent(this.__renderBackgroundPopup())}></slot>
|
|
411
412
|
`;
|
|
412
413
|
}
|
|
413
414
|
|
|
414
|
-
/**
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
415
|
+
/** @private */
|
|
416
|
+
__renderLinkDialog() {
|
|
417
|
+
return html`
|
|
418
|
+
<vaadin-confirm-dialog
|
|
419
|
+
slot="link-dialog"
|
|
420
|
+
cancel-button-visible
|
|
421
|
+
reject-theme="error"
|
|
422
|
+
.opened="${this._linkEditing}"
|
|
423
|
+
.header="${this.__effectiveI18n.linkDialogTitle}"
|
|
424
|
+
.confirmText="${this.__effectiveI18n.ok}"
|
|
425
|
+
.rejectText="${this.__effectiveI18n.remove}"
|
|
426
|
+
.cancelText="${this.__effectiveI18n.cancel}"
|
|
427
|
+
.rejectButtonVisible="${!!this._linkRange}"
|
|
428
|
+
@confirm="${this._onLinkEditConfirm}"
|
|
429
|
+
@cancel="${this._onLinkEditCancel}"
|
|
430
|
+
@reject="${this._onLinkEditRemove}"
|
|
431
|
+
@opened-changed="${this._onLinkEditingChanged}"
|
|
432
|
+
>
|
|
433
|
+
<vaadin-text-field
|
|
434
|
+
.value="${this._linkUrl}"
|
|
435
|
+
style="width: 100%;"
|
|
436
|
+
@keydown="${this._onLinkKeydown}"
|
|
437
|
+
@value-changed="${this._onLinkUrlChanged}"
|
|
438
|
+
></vaadin-text-field>
|
|
439
|
+
</vaadin-confirm-dialog>
|
|
440
|
+
`;
|
|
441
|
+
}
|
|
421
442
|
|
|
422
|
-
|
|
443
|
+
/** @private */
|
|
444
|
+
__renderColorPopup() {
|
|
445
|
+
return html`
|
|
446
|
+
<vaadin-rich-text-editor-popup
|
|
447
|
+
slot="color-popup"
|
|
448
|
+
.colors="${['#000000', ...[...this.colorOptions].filter((c) => c !== '#000000')]}"
|
|
449
|
+
.opened="${this._colorEditing}"
|
|
450
|
+
@color-selected="${this.__onColorSelected}"
|
|
451
|
+
@opened-changed="${this.__onColorEditingChanged}"
|
|
452
|
+
></vaadin-rich-text-editor-popup>
|
|
453
|
+
`;
|
|
423
454
|
}
|
|
424
455
|
|
|
425
456
|
/** @private */
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
.rejectText="${this.__effectiveI18n.remove}"
|
|
437
|
-
.cancelText="${this.__effectiveI18n.cancel}"
|
|
438
|
-
.rejectButtonVisible="${!!this._linkRange}"
|
|
439
|
-
@confirm="${this._onLinkEditConfirm}"
|
|
440
|
-
@cancel="${this._onLinkEditCancel}"
|
|
441
|
-
@reject="${this._onLinkEditRemove}"
|
|
442
|
-
@opened-changed="${this._onLinkEditingChanged}"
|
|
443
|
-
>
|
|
444
|
-
<vaadin-text-field
|
|
445
|
-
.value="${this._linkUrl}"
|
|
446
|
-
style="width: 100%;"
|
|
447
|
-
@keydown="${this._onLinkKeydown}"
|
|
448
|
-
@value-changed="${this._onLinkUrlChanged}"
|
|
449
|
-
></vaadin-text-field>
|
|
450
|
-
</vaadin-confirm-dialog>
|
|
451
|
-
|
|
452
|
-
<vaadin-rich-text-editor-popup
|
|
453
|
-
slot="color-popup"
|
|
454
|
-
.colors="${['#000000', ...[...this.colorOptions].filter((c) => c !== '#000000')]}"
|
|
455
|
-
.opened="${this._colorEditing}"
|
|
456
|
-
@color-selected="${this.__onColorSelected}"
|
|
457
|
-
@opened-changed="${this.__onColorEditingChanged}"
|
|
458
|
-
></vaadin-rich-text-editor-popup>
|
|
459
|
-
|
|
460
|
-
<vaadin-rich-text-editor-popup
|
|
461
|
-
slot="background-popup"
|
|
462
|
-
.colors="${['#ffffff', ...[...this.colorOptions].filter((c) => c !== '#ffffff')]}"
|
|
463
|
-
.opened="${this._backgroundEditing}"
|
|
464
|
-
@color-selected="${this.__onBackgroundSelected}"
|
|
465
|
-
@opened-changed="${this.__onBackgroundEditingChanged}"
|
|
466
|
-
></vaadin-rich-text-editor-popup>
|
|
467
|
-
`,
|
|
468
|
-
this,
|
|
469
|
-
{ host: this },
|
|
470
|
-
);
|
|
457
|
+
__renderBackgroundPopup() {
|
|
458
|
+
return html`
|
|
459
|
+
<vaadin-rich-text-editor-popup
|
|
460
|
+
slot="background-popup"
|
|
461
|
+
.colors="${['#ffffff', ...[...this.colorOptions].filter((c) => c !== '#ffffff')]}"
|
|
462
|
+
.opened="${this._backgroundEditing}"
|
|
463
|
+
@color-selected="${this.__onBackgroundSelected}"
|
|
464
|
+
@opened-changed="${this.__onBackgroundEditingChanged}"
|
|
465
|
+
></vaadin-rich-text-editor-popup>
|
|
466
|
+
`;
|
|
471
467
|
}
|
|
472
468
|
|
|
473
469
|
/** @private */
|