@vaadin/rich-text-editor 25.0.0-alpha1 → 25.0.0-alpha10
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 +16 -20
- package/src/styles/vaadin-rich-text-editor-base-icons.js +36 -0
- package/src/styles/vaadin-rich-text-editor-base-styles.d.ts +13 -0
- package/src/styles/vaadin-rich-text-editor-base-styles.js +346 -0
- package/src/styles/vaadin-rich-text-editor-core-styles.d.ts +13 -0
- package/src/{vaadin-rich-text-editor-toolbar-styles.js → styles/vaadin-rich-text-editor-core-styles.js} +152 -6
- package/src/styles/vaadin-rich-text-editor-popup-overlay-base-styles.js +43 -0
- package/src/styles/vaadin-rich-text-editor-popup-overlay-core-styles.js +13 -0
- package/src/vaadin-rich-text-editor-mixin.js +29 -81
- package/src/vaadin-rich-text-editor-popup.js +97 -13
- package/src/vaadin-rich-text-editor.d.ts +1 -1
- package/src/vaadin-rich-text-editor.js +134 -77
- package/theme/lumo/vaadin-rich-text-editor-styles.js +6 -5
- package/web-types.json +2 -2
- package/web-types.lit.json +2 -2
- package/src/vaadin-rich-text-editor-content-styles.js +0 -118
- package/src/vaadin-rich-text-editor-icons.js +0 -93
- package/src/vaadin-rich-text-editor-popup-mixin.js +0 -70
- package/src/vaadin-rich-text-editor-styles.js +0 -61
|
@@ -13,20 +13,21 @@ import '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
|
13
13
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
14
14
|
import '@vaadin/tooltip/src/vaadin-tooltip.js';
|
|
15
15
|
import './vaadin-rich-text-editor-popup.js';
|
|
16
|
-
import { html, LitElement } from 'lit';
|
|
16
|
+
import { html, LitElement, render } from 'lit';
|
|
17
17
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
18
18
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
19
19
|
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
20
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
20
21
|
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
22
|
+
import { richTextEditorStyles } from './styles/vaadin-rich-text-editor-core-styles.js';
|
|
21
23
|
import { RichTextEditorMixin } from './vaadin-rich-text-editor-mixin.js';
|
|
22
|
-
import { richTextEditorStyles } from './vaadin-rich-text-editor-styles.js';
|
|
23
24
|
|
|
24
25
|
/**
|
|
25
26
|
* `<vaadin-rich-text-editor>` is a Web Component for rich text editing.
|
|
26
27
|
* It provides a set of toolbar controls to apply formatting on the content,
|
|
27
28
|
* which is stored and can be accessed as HTML5 or JSON string.
|
|
28
29
|
*
|
|
29
|
-
* ```
|
|
30
|
+
* ```html
|
|
30
31
|
* <vaadin-rich-text-editor></vaadin-rich-text-editor>
|
|
31
32
|
* ```
|
|
32
33
|
*
|
|
@@ -99,7 +100,9 @@ import { richTextEditorStyles } from './vaadin-rich-text-editor-styles.js';
|
|
|
99
100
|
* @mixes RichTextEditorMixin
|
|
100
101
|
* @mixes ThemableMixin
|
|
101
102
|
*/
|
|
102
|
-
class RichTextEditor extends RichTextEditorMixin(
|
|
103
|
+
class RichTextEditor extends RichTextEditorMixin(
|
|
104
|
+
ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
105
|
+
) {
|
|
103
106
|
static get is() {
|
|
104
107
|
return 'vaadin-rich-text-editor';
|
|
105
108
|
}
|
|
@@ -124,35 +127,51 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
124
127
|
id="btn-undo"
|
|
125
128
|
type="button"
|
|
126
129
|
part="toolbar-button toolbar-button-undo"
|
|
130
|
+
aria-label="${this.__effectiveI18n.undo}"
|
|
127
131
|
@click="${this._undo}"
|
|
128
132
|
></button>
|
|
129
|
-
<vaadin-tooltip for="btn-undo" .text="${this.__effectiveI18n.undo}"></vaadin-tooltip>
|
|
130
133
|
|
|
131
134
|
<button
|
|
132
135
|
id="btn-redo"
|
|
133
136
|
type="button"
|
|
134
137
|
part="toolbar-button toolbar-button-redo"
|
|
138
|
+
aria-label="${this.__effectiveI18n.redo}"
|
|
135
139
|
@click="${this._redo}"
|
|
136
140
|
></button>
|
|
137
|
-
<vaadin-tooltip for="btn-redo" .text="${this.__effectiveI18n.redo}"></vaadin-tooltip>
|
|
138
141
|
</span>
|
|
139
142
|
|
|
140
143
|
<span part="toolbar-group toolbar-group-emphasis">
|
|
141
144
|
<!-- Bold -->
|
|
142
|
-
<button
|
|
143
|
-
|
|
145
|
+
<button
|
|
146
|
+
id="btn-bold"
|
|
147
|
+
class="ql-bold"
|
|
148
|
+
part="toolbar-button toolbar-button-bold"
|
|
149
|
+
aria-label="${this.__effectiveI18n.bold}"
|
|
150
|
+
></button>
|
|
144
151
|
|
|
145
152
|
<!-- Italic -->
|
|
146
|
-
<button
|
|
147
|
-
|
|
153
|
+
<button
|
|
154
|
+
id="btn-italic"
|
|
155
|
+
class="ql-italic"
|
|
156
|
+
part="toolbar-button toolbar-button-italic"
|
|
157
|
+
aria-label="${this.__effectiveI18n.italic}"
|
|
158
|
+
></button>
|
|
148
159
|
|
|
149
160
|
<!-- Underline -->
|
|
150
|
-
<button
|
|
151
|
-
|
|
161
|
+
<button
|
|
162
|
+
id="btn-underline"
|
|
163
|
+
class="ql-underline"
|
|
164
|
+
part="toolbar-button toolbar-button-underline"
|
|
165
|
+
aria-label="${this.__effectiveI18n.underline}"
|
|
166
|
+
></button>
|
|
152
167
|
|
|
153
168
|
<!-- Strike -->
|
|
154
|
-
<button
|
|
155
|
-
|
|
169
|
+
<button
|
|
170
|
+
id="btn-strike"
|
|
171
|
+
class="ql-strike"
|
|
172
|
+
part="toolbar-button toolbar-button-strike"
|
|
173
|
+
aria-label="${this.__effectiveI18n.strike}"
|
|
174
|
+
></button>
|
|
156
175
|
</span>
|
|
157
176
|
|
|
158
177
|
<span part="toolbar-group toolbar-group-style">
|
|
@@ -161,17 +180,17 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
161
180
|
id="btn-color"
|
|
162
181
|
type="button"
|
|
163
182
|
part="toolbar-button toolbar-button-color"
|
|
183
|
+
aria-label="${this.__effectiveI18n.color}"
|
|
164
184
|
@click="${this.__onColorClick}"
|
|
165
185
|
></button>
|
|
166
|
-
<vaadin-tooltip for="btn-color" .text="${this.__effectiveI18n.color}"></vaadin-tooltip>
|
|
167
186
|
<!-- Background -->
|
|
168
187
|
<button
|
|
169
188
|
id="btn-background"
|
|
170
189
|
type="button"
|
|
171
190
|
part="toolbar-button toolbar-button-background"
|
|
191
|
+
aria-label="${this.__effectiveI18n.background}"
|
|
172
192
|
@click="${this.__onBackgroundClick}"
|
|
173
193
|
></button>
|
|
174
|
-
<vaadin-tooltip for="btn-background" .text="${this.__effectiveI18n.background}"></vaadin-tooltip>
|
|
175
194
|
</span>
|
|
176
195
|
|
|
177
196
|
<span part="toolbar-group toolbar-group-heading">
|
|
@@ -182,24 +201,24 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
182
201
|
class="ql-header"
|
|
183
202
|
value="1"
|
|
184
203
|
part="toolbar-button toolbar-button-h1"
|
|
204
|
+
aria-label="${this.__effectiveI18n.h1}"
|
|
185
205
|
></button>
|
|
186
|
-
<vaadin-tooltip for="btn-h1" .text="${this.__effectiveI18n.h1}"></vaadin-tooltip>
|
|
187
206
|
<button
|
|
188
207
|
id="btn-h2"
|
|
189
208
|
type="button"
|
|
190
209
|
class="ql-header"
|
|
191
210
|
value="2"
|
|
192
211
|
part="toolbar-button toolbar-button-h2"
|
|
212
|
+
aria-label="${this.__effectiveI18n.h2}"
|
|
193
213
|
></button>
|
|
194
|
-
<vaadin-tooltip for="btn-h2" .text="${this.__effectiveI18n.h2}"></vaadin-tooltip>
|
|
195
214
|
<button
|
|
196
215
|
id="btn-h3"
|
|
197
216
|
type="button"
|
|
198
217
|
class="ql-header"
|
|
199
218
|
value="3"
|
|
200
219
|
part="toolbar-button toolbar-button-h3"
|
|
220
|
+
aria-label="${this.__effectiveI18n.h3}"
|
|
201
221
|
></button>
|
|
202
|
-
<vaadin-tooltip for="btn-h3" .text="${this.__effectiveI18n.h3}"></vaadin-tooltip>
|
|
203
222
|
</span>
|
|
204
223
|
|
|
205
224
|
<span part="toolbar-group toolbar-group-glyph-transformation">
|
|
@@ -209,15 +228,15 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
209
228
|
class="ql-script"
|
|
210
229
|
value="sub"
|
|
211
230
|
part="toolbar-button toolbar-button-subscript"
|
|
231
|
+
aria-label="${this.__effectiveI18n.subscript}"
|
|
212
232
|
></button>
|
|
213
|
-
<vaadin-tooltip for="btn-subscript" .text="${this.__effectiveI18n.subscript}"></vaadin-tooltip>
|
|
214
233
|
<button
|
|
215
234
|
id="btn-superscript"
|
|
216
235
|
class="ql-script"
|
|
217
236
|
value="super"
|
|
218
237
|
part="toolbar-button toolbar-button-superscript"
|
|
238
|
+
aria-label="${this.__effectiveI18n.superscript}"
|
|
219
239
|
></button>
|
|
220
|
-
<vaadin-tooltip for="btn-superscript" text="${this.__effectiveI18n.superscript}"></vaadin-tooltip>
|
|
221
240
|
</span>
|
|
222
241
|
|
|
223
242
|
<span part="toolbar-group toolbar-group-list">
|
|
@@ -228,16 +247,16 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
228
247
|
class="ql-list"
|
|
229
248
|
value="ordered"
|
|
230
249
|
part="toolbar-button toolbar-button-list-ordered"
|
|
250
|
+
aria-label="${this.__effectiveI18n.listOrdered}"
|
|
231
251
|
></button>
|
|
232
|
-
<vaadin-tooltip for="btn-ol" text="${this.__effectiveI18n.listOrdered}"></vaadin-tooltip>
|
|
233
252
|
<button
|
|
234
253
|
id="btn-ul"
|
|
235
254
|
type="button"
|
|
236
255
|
class="ql-list"
|
|
237
256
|
value="bullet"
|
|
238
257
|
part="toolbar-button toolbar-button-list-bullet"
|
|
258
|
+
aria-label="${this.__effectiveI18n.listBullet}"
|
|
239
259
|
></button>
|
|
240
|
-
<vaadin-tooltip for="btn-ul" text="${this.__effectiveI18n.listBullet}"></vaadin-tooltip>
|
|
241
260
|
</span>
|
|
242
261
|
|
|
243
262
|
<span part="toolbar-group toolbar-group-alignment">
|
|
@@ -248,24 +267,24 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
248
267
|
class="ql-align"
|
|
249
268
|
value=""
|
|
250
269
|
part="toolbar-button toolbar-button-align-left"
|
|
270
|
+
aria-label="${this.__effectiveI18n.alignLeft}"
|
|
251
271
|
></button>
|
|
252
|
-
<vaadin-tooltip for="btn-left" .text="${this.__effectiveI18n.alignLeft}"></vaadin-tooltip>
|
|
253
272
|
<button
|
|
254
273
|
id="btn-center"
|
|
255
274
|
type="button"
|
|
256
275
|
class="ql-align"
|
|
257
276
|
value="center"
|
|
258
277
|
part="toolbar-button toolbar-button-align-center"
|
|
278
|
+
aria-label="${this.__effectiveI18n.alignCenter}"
|
|
259
279
|
></button>
|
|
260
|
-
<vaadin-tooltip for="btn-center" .text="${this.__effectiveI18n.alignCenter}"></vaadin-tooltip>
|
|
261
280
|
<button
|
|
262
281
|
id="btn-right"
|
|
263
282
|
type="button"
|
|
264
283
|
class="ql-align"
|
|
265
284
|
value="right"
|
|
266
285
|
part="toolbar-button toolbar-button-align-right"
|
|
286
|
+
aria-label="${this.__effectiveI18n.alignRight}"
|
|
267
287
|
></button>
|
|
268
|
-
<vaadin-tooltip for="btn-right" .text="${this.__effectiveI18n.alignRight}"></vaadin-tooltip>
|
|
269
288
|
</span>
|
|
270
289
|
|
|
271
290
|
<span part="toolbar-group toolbar-group-rich-text">
|
|
@@ -274,18 +293,18 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
274
293
|
id="btn-image"
|
|
275
294
|
type="button"
|
|
276
295
|
part="toolbar-button toolbar-button-image"
|
|
296
|
+
aria-label="${this.__effectiveI18n.image}"
|
|
277
297
|
@touchend="${this._onImageTouchEnd}"
|
|
278
298
|
@click="${this._onImageClick}"
|
|
279
299
|
></button>
|
|
280
|
-
<vaadin-tooltip for="btn-image" .text="${this.__effectiveI18n.image}"></vaadin-tooltip>
|
|
281
300
|
<!-- Link -->
|
|
282
301
|
<button
|
|
283
302
|
id="btn-link"
|
|
284
303
|
type="button"
|
|
285
304
|
part="toolbar-button toolbar-button-link"
|
|
305
|
+
aria-label="${this.__effectiveI18n.link}"
|
|
286
306
|
@click="${this._onLinkClick}"
|
|
287
307
|
></button>
|
|
288
|
-
<vaadin-tooltip for="btn-link" .text="${this.__effectiveI18n.link}"></vaadin-tooltip>
|
|
289
308
|
</span>
|
|
290
309
|
|
|
291
310
|
<span part="toolbar-group toolbar-group-block">
|
|
@@ -295,22 +314,27 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
295
314
|
type="button"
|
|
296
315
|
class="ql-blockquote"
|
|
297
316
|
part="toolbar-button toolbar-button-blockquote"
|
|
317
|
+
aria-label="${this.__effectiveI18n.blockquote}"
|
|
298
318
|
></button>
|
|
299
|
-
<vaadin-tooltip for="btn-blockquote" .text="${this.__effectiveI18n.blockquote}"></vaadin-tooltip>
|
|
300
319
|
<!-- Code block -->
|
|
301
320
|
<button
|
|
302
321
|
id="btn-code"
|
|
303
322
|
type="button"
|
|
304
323
|
class="ql-code-block"
|
|
305
324
|
part="toolbar-button toolbar-button-code-block"
|
|
325
|
+
aria-label="${this.__effectiveI18n.codeBlock}"
|
|
306
326
|
></button>
|
|
307
|
-
<vaadin-tooltip for="btn-code" .text="${this.__effectiveI18n.codeBlock}"></vaadin-tooltip>
|
|
308
327
|
</span>
|
|
309
328
|
|
|
310
329
|
<span part="toolbar-group toolbar-group-format">
|
|
311
330
|
<!-- Clean -->
|
|
312
|
-
<button
|
|
313
|
-
|
|
331
|
+
<button
|
|
332
|
+
id="btn-clean"
|
|
333
|
+
type="button"
|
|
334
|
+
class="ql-clean"
|
|
335
|
+
part="toolbar-button toolbar-button-clean"
|
|
336
|
+
aria-label="${this.__effectiveI18n.clean}"
|
|
337
|
+
></button>
|
|
314
338
|
</span>
|
|
315
339
|
|
|
316
340
|
<input
|
|
@@ -326,54 +350,75 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
326
350
|
<div class="announcer" aria-live="polite"></div>
|
|
327
351
|
</div>
|
|
328
352
|
|
|
329
|
-
<
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
id="linkUrl"
|
|
337
|
-
.value="${this._linkUrl}"
|
|
338
|
-
style="width: 100%;"
|
|
339
|
-
@keydown="${this._onLinkKeydown}"
|
|
340
|
-
@value-changed="${this._onLinkUrlChanged}"
|
|
341
|
-
></vaadin-text-field>
|
|
342
|
-
<vaadin-button id="confirmLink" slot="confirm-button" theme="primary" @click="${this._onLinkEditConfirm}">
|
|
343
|
-
${this.__effectiveI18n.ok}
|
|
344
|
-
</vaadin-button>
|
|
345
|
-
<vaadin-button
|
|
346
|
-
id="removeLink"
|
|
347
|
-
slot="reject-button"
|
|
348
|
-
theme="error"
|
|
349
|
-
@click="${this._onLinkEditRemove}"
|
|
350
|
-
?hidden="${!this._linkRange}"
|
|
351
|
-
>
|
|
352
|
-
${this.__effectiveI18n.remove}
|
|
353
|
-
</vaadin-button>
|
|
354
|
-
<vaadin-button id="cancelLink" slot="cancel-button" @click="${this._onLinkEditCancel}">
|
|
355
|
-
${this.__effectiveI18n.cancel}
|
|
356
|
-
</vaadin-button>
|
|
357
|
-
</vaadin-confirm-dialog>
|
|
358
|
-
|
|
359
|
-
<vaadin-rich-text-editor-popup
|
|
360
|
-
id="colorPopup"
|
|
361
|
-
.colors="${this.colorOptions}"
|
|
362
|
-
.opened="${this._colorEditing}"
|
|
363
|
-
@color-selected="${this.__onColorSelected}"
|
|
364
|
-
@opened-changed="${this.__onColorEditingChanged}"
|
|
365
|
-
></vaadin-rich-text-editor-popup>
|
|
366
|
-
|
|
367
|
-
<vaadin-rich-text-editor-popup
|
|
368
|
-
id="backgroundPopup"
|
|
369
|
-
.colors="${this.colorOptions}"
|
|
370
|
-
.opened="${this._backgroundEditing}"
|
|
371
|
-
@color-selected="${this.__onBackgroundSelected}"
|
|
372
|
-
@opened-changed="${this.__onBackgroundEditingChanged}"
|
|
373
|
-
></vaadin-rich-text-editor-popup>
|
|
353
|
+
<slot name="tooltip"></slot>
|
|
354
|
+
|
|
355
|
+
<slot name="link-dialog"></slot>
|
|
356
|
+
|
|
357
|
+
<slot name="color-popup"></slot>
|
|
358
|
+
|
|
359
|
+
<slot name="background-popup"></slot>
|
|
374
360
|
`;
|
|
375
361
|
}
|
|
376
362
|
|
|
363
|
+
/**
|
|
364
|
+
* Override update to render slotted overlays into light DOM after rendering shadow DOM.
|
|
365
|
+
* @param changedProperties
|
|
366
|
+
* @protected
|
|
367
|
+
*/
|
|
368
|
+
update(changedProperties) {
|
|
369
|
+
super.update(changedProperties);
|
|
370
|
+
|
|
371
|
+
this.__renderSlottedOverlays();
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/** @private */
|
|
375
|
+
__renderSlottedOverlays() {
|
|
376
|
+
render(
|
|
377
|
+
html`
|
|
378
|
+
<vaadin-confirm-dialog
|
|
379
|
+
slot="link-dialog"
|
|
380
|
+
cancel-button-visible
|
|
381
|
+
reject-theme="error"
|
|
382
|
+
.opened="${this._linkEditing}"
|
|
383
|
+
.header="${this.__effectiveI18n.linkDialogTitle}"
|
|
384
|
+
.confirmText="${this.__effectiveI18n.ok}"
|
|
385
|
+
.rejectText="${this.__effectiveI18n.remove}"
|
|
386
|
+
.cancelText="${this.__effectiveI18n.cancel}"
|
|
387
|
+
.rejectButtonVisible="${!!this._linkRange}"
|
|
388
|
+
@confirm="${this._onLinkEditConfirm}"
|
|
389
|
+
@cancel="${this._onLinkEditCancel}"
|
|
390
|
+
@reject="${this._onLinkEditRemove}"
|
|
391
|
+
@opened-changed="${this._onLinkEditingChanged}"
|
|
392
|
+
>
|
|
393
|
+
<vaadin-text-field
|
|
394
|
+
.value="${this._linkUrl}"
|
|
395
|
+
style="width: 100%;"
|
|
396
|
+
@keydown="${this._onLinkKeydown}"
|
|
397
|
+
@value-changed="${this._onLinkUrlChanged}"
|
|
398
|
+
></vaadin-text-field>
|
|
399
|
+
</vaadin-confirm-dialog>
|
|
400
|
+
|
|
401
|
+
<vaadin-rich-text-editor-popup
|
|
402
|
+
slot="color-popup"
|
|
403
|
+
.colors="${this.colorOptions}"
|
|
404
|
+
.opened="${this._colorEditing}"
|
|
405
|
+
@color-selected="${this.__onColorSelected}"
|
|
406
|
+
@opened-changed="${this.__onColorEditingChanged}"
|
|
407
|
+
></vaadin-rich-text-editor-popup>
|
|
408
|
+
|
|
409
|
+
<vaadin-rich-text-editor-popup
|
|
410
|
+
slot="background-popup"
|
|
411
|
+
.colors="${this.colorOptions}"
|
|
412
|
+
.opened="${this._backgroundEditing}"
|
|
413
|
+
@color-selected="${this.__onBackgroundSelected}"
|
|
414
|
+
@opened-changed="${this.__onBackgroundEditingChanged}"
|
|
415
|
+
></vaadin-rich-text-editor-popup>
|
|
416
|
+
`,
|
|
417
|
+
this,
|
|
418
|
+
{ host: this },
|
|
419
|
+
);
|
|
420
|
+
}
|
|
421
|
+
|
|
377
422
|
/** @private */
|
|
378
423
|
__onBackgroundEditingChanged(event) {
|
|
379
424
|
this._backgroundEditing = event.detail.value;
|
|
@@ -386,6 +431,18 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
386
431
|
|
|
387
432
|
/** @private */
|
|
388
433
|
_onLinkEditingChanged(event) {
|
|
434
|
+
// Autofocus the URL field when the dialog opens
|
|
435
|
+
if (event.detail.value) {
|
|
436
|
+
const confirmDialog = event.target;
|
|
437
|
+
const urlField = confirmDialog.querySelector('vaadin-text-field');
|
|
438
|
+
confirmDialog.$.overlay.addEventListener(
|
|
439
|
+
'vaadin-overlay-open',
|
|
440
|
+
() => {
|
|
441
|
+
urlField.focus();
|
|
442
|
+
},
|
|
443
|
+
{ once: true },
|
|
444
|
+
);
|
|
445
|
+
}
|
|
389
446
|
this._linkEditing = event.detail.value;
|
|
390
447
|
}
|
|
391
448
|
|
|
@@ -122,12 +122,14 @@ const richTextEditor = css`
|
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
[part~='toolbar-button-background']:hover::before {
|
|
125
|
-
background-image:
|
|
125
|
+
background-image:
|
|
126
|
+
linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct)),
|
|
126
127
|
linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct));
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
[part~='toolbar-button-background']:active::before {
|
|
130
|
-
background-image:
|
|
131
|
+
background-image:
|
|
132
|
+
linear-gradient(var(--lumo-contrast-5pct), var(--lumo-contrast-5pct)),
|
|
131
133
|
linear-gradient(var(--lumo-contrast-10pct), var(--lumo-contrast-10pct));
|
|
132
134
|
}
|
|
133
135
|
|
|
@@ -198,12 +200,11 @@ const richTextEditor = css`
|
|
|
198
200
|
}
|
|
199
201
|
|
|
200
202
|
[part~='toolbar-button-link']::before {
|
|
201
|
-
|
|
202
|
-
font-size: var(--lumo-icon-size-m);
|
|
203
|
+
content: var(--lumo-icons-link);
|
|
203
204
|
}
|
|
204
205
|
|
|
205
206
|
[part~='toolbar-button-clean']::before {
|
|
206
|
-
|
|
207
|
+
content: var(--lumo-icons-clean);
|
|
207
208
|
font-size: var(--lumo-font-size-l);
|
|
208
209
|
}
|
|
209
210
|
|
package/web-types.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/rich-text-editor",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
8
8
|
"elements": [
|
|
9
9
|
{
|
|
10
10
|
"name": "vaadin-rich-text-editor",
|
|
11
|
-
"description": "`<vaadin-rich-text-editor>` is a Web Component for rich text editing.\nIt provides a set of toolbar controls to apply formatting on the content,\nwhich is stored and can be accessed as HTML5 or JSON string.\n\n
|
|
11
|
+
"description": "`<vaadin-rich-text-editor>` is a Web Component for rich text editing.\nIt provides a set of toolbar controls to apply formatting on the content,\nwhich is stored and can be accessed as HTML5 or JSON string.\n\n```html\n<vaadin-rich-text-editor></vaadin-rich-text-editor>\n```\n\nVaadin Rich Text Editor focuses on the structure, not the styling of content.\nTherefore, the semantic HTML5 tags such as <h1>, <strong> and <ul> are used,\nand CSS usage is limited to most common cases, like horizontal text alignment.\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n-------------|-------------|------------\n`disabled` | Set to a disabled text editor | :host\n`readonly` | Set to a readonly text editor | :host\n`on` | Set to a toolbar button applied to the selected text | toolbar-button\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------------------------------|----------------\n`content` | The content wrapper\n`toolbar` | The toolbar wrapper\n`toolbar-group` | The group for toolbar controls\n`toolbar-group-history` | The group for histroy controls\n`toolbar-group-emphasis` | The group for emphasis controls\n`toolbar-group-heading` | The group for heading controls\n`toolbar-group-style` | The group for style controls\n`toolbar-group-glyph-transformation` | The group for glyph transformation controls\n`toolbar-group-group-list` | The group for group list controls\n`toolbar-group-alignment` | The group for alignment controls\n`toolbar-group-rich-text` | The group for rich text controls\n`toolbar-group-block` | The group for preformatted block controls\n`toolbar-group-format` | The group for format controls\n`toolbar-button` | The toolbar button (applies to all buttons)\n`toolbar-button-pressed` | The toolbar button in pressed state (applies to all buttons)\n`toolbar-button-undo` | The \"undo\" button\n`toolbar-button-redo` | The \"redo\" button\n`toolbar-button-bold` | The \"bold\" button\n`toolbar-button-italic` | The \"italic\" button\n`toolbar-button-underline` | The \"underline\" button\n`toolbar-button-strike` | The \"strike-through\" button\n`toolbar-button-color` | The \"color\" button\n`toolbar-button-background` | The \"background\" button\n`toolbar-button-h1` | The \"header 1\" button\n`toolbar-button-h2` | The \"header 2\" button\n`toolbar-button-h3` | The \"header 3\" button\n`toolbar-button-subscript` | The \"subscript\" button\n`toolbar-button-superscript` | The \"superscript\" button\n`toolbar-button-list-ordered` | The \"ordered list\" button\n`toolbar-button-list-bullet` | The \"bullet list\" button\n`toolbar-button-align-left` | The \"left align\" button\n`toolbar-button-align-center` | The \"center align\" button\n`toolbar-button-align-right` | The \"right align\" button\n`toolbar-button-image` | The \"image\" button\n`toolbar-button-link` | The \"link\" button\n`toolbar-button-blockquote` | The \"blockquote\" button\n`toolbar-button-code-block` | The \"code block\" button\n`toolbar-button-clean` | The \"clean formatting\" button\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
12
12
|
"attributes": [
|
|
13
13
|
{
|
|
14
14
|
"name": "value",
|
package/web-types.lit.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://json.schemastore.org/web-types",
|
|
3
3
|
"name": "@vaadin/rich-text-editor",
|
|
4
|
-
"version": "25.0.0-
|
|
4
|
+
"version": "25.0.0-alpha10",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"framework": "lit",
|
|
7
7
|
"framework-config": {
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"elements": [
|
|
17
17
|
{
|
|
18
18
|
"name": "vaadin-rich-text-editor",
|
|
19
|
-
"description": "`<vaadin-rich-text-editor>` is a Web Component for rich text editing.\nIt provides a set of toolbar controls to apply formatting on the content,\nwhich is stored and can be accessed as HTML5 or JSON string.\n\n
|
|
19
|
+
"description": "`<vaadin-rich-text-editor>` is a Web Component for rich text editing.\nIt provides a set of toolbar controls to apply formatting on the content,\nwhich is stored and can be accessed as HTML5 or JSON string.\n\n```html\n<vaadin-rich-text-editor></vaadin-rich-text-editor>\n```\n\nVaadin Rich Text Editor focuses on the structure, not the styling of content.\nTherefore, the semantic HTML5 tags such as <h1>, <strong> and <ul> are used,\nand CSS usage is limited to most common cases, like horizontal text alignment.\n\n### Styling\n\nThe following state attributes are available for styling:\n\nAttribute | Description | Part name\n-------------|-------------|------------\n`disabled` | Set to a disabled text editor | :host\n`readonly` | Set to a readonly text editor | :host\n`on` | Set to a toolbar button applied to the selected text | toolbar-button\n\nThe following shadow DOM parts are available for styling:\n\nPart name | Description\n-------------------------------------|----------------\n`content` | The content wrapper\n`toolbar` | The toolbar wrapper\n`toolbar-group` | The group for toolbar controls\n`toolbar-group-history` | The group for histroy controls\n`toolbar-group-emphasis` | The group for emphasis controls\n`toolbar-group-heading` | The group for heading controls\n`toolbar-group-style` | The group for style controls\n`toolbar-group-glyph-transformation` | The group for glyph transformation controls\n`toolbar-group-group-list` | The group for group list controls\n`toolbar-group-alignment` | The group for alignment controls\n`toolbar-group-rich-text` | The group for rich text controls\n`toolbar-group-block` | The group for preformatted block controls\n`toolbar-group-format` | The group for format controls\n`toolbar-button` | The toolbar button (applies to all buttons)\n`toolbar-button-pressed` | The toolbar button in pressed state (applies to all buttons)\n`toolbar-button-undo` | The \"undo\" button\n`toolbar-button-redo` | The \"redo\" button\n`toolbar-button-bold` | The \"bold\" button\n`toolbar-button-italic` | The \"italic\" button\n`toolbar-button-underline` | The \"underline\" button\n`toolbar-button-strike` | The \"strike-through\" button\n`toolbar-button-color` | The \"color\" button\n`toolbar-button-background` | The \"background\" button\n`toolbar-button-h1` | The \"header 1\" button\n`toolbar-button-h2` | The \"header 2\" button\n`toolbar-button-h3` | The \"header 3\" button\n`toolbar-button-subscript` | The \"subscript\" button\n`toolbar-button-superscript` | The \"superscript\" button\n`toolbar-button-list-ordered` | The \"ordered list\" button\n`toolbar-button-list-bullet` | The \"bullet list\" button\n`toolbar-button-align-left` | The \"left align\" button\n`toolbar-button-align-center` | The \"center align\" button\n`toolbar-button-align-right` | The \"right align\" button\n`toolbar-button-image` | The \"image\" button\n`toolbar-button-link` | The \"link\" button\n`toolbar-button-blockquote` | The \"blockquote\" button\n`toolbar-button-code-block` | The \"code block\" button\n`toolbar-button-clean` | The \"clean formatting\" button\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
|
|
20
20
|
"extension": true,
|
|
21
21
|
"attributes": [
|
|
22
22
|
{
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright (c) 2000 - 2025 Vaadin Ltd.
|
|
4
|
-
*
|
|
5
|
-
* This program is available under Vaadin Commercial License and Service Terms.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* See https://vaadin.com/commercial-license-and-service-terms for the full
|
|
9
|
-
* license.
|
|
10
|
-
*/
|
|
11
|
-
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
12
|
-
|
|
13
|
-
export const contentStyles = css`
|
|
14
|
-
[part='content'] {
|
|
15
|
-
box-sizing: border-box;
|
|
16
|
-
position: relative;
|
|
17
|
-
flex: auto;
|
|
18
|
-
display: flex;
|
|
19
|
-
flex-direction: column;
|
|
20
|
-
overflow: hidden;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/*
|
|
24
|
-
Quill core styles.
|
|
25
|
-
CSS selectors removed: margin & padding reset, check list, indentation, video, colors, ordered & unordered list, h1-6, anchor
|
|
26
|
-
*/
|
|
27
|
-
.ql-clipboard {
|
|
28
|
-
left: -100000px;
|
|
29
|
-
height: 1px;
|
|
30
|
-
overflow-y: hidden;
|
|
31
|
-
position: absolute;
|
|
32
|
-
top: 50%;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.ql-clipboard p {
|
|
36
|
-
margin: 0;
|
|
37
|
-
padding: 0;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.ql-editor {
|
|
41
|
-
box-sizing: border-box;
|
|
42
|
-
line-height: 1.42;
|
|
43
|
-
height: 100%;
|
|
44
|
-
outline: none;
|
|
45
|
-
overflow-y: auto;
|
|
46
|
-
padding: 0.75em 1em;
|
|
47
|
-
-moz-tab-size: 4;
|
|
48
|
-
tab-size: 4;
|
|
49
|
-
text-align: left;
|
|
50
|
-
white-space: pre-wrap;
|
|
51
|
-
word-wrap: break-word;
|
|
52
|
-
flex: 1;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
.ql-editor > * {
|
|
56
|
-
cursor: text;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
.ql-align-left {
|
|
60
|
-
text-align: left;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.ql-direction-rtl {
|
|
64
|
-
direction: rtl;
|
|
65
|
-
text-align: inherit;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.ql-align-center {
|
|
69
|
-
text-align: center;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.ql-align-justify {
|
|
73
|
-
text-align: justify;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.ql-align-right {
|
|
77
|
-
text-align: right;
|
|
78
|
-
}
|
|
79
|
-
/* quill core end */
|
|
80
|
-
|
|
81
|
-
blockquote {
|
|
82
|
-
border-left: 0.25em solid #ccc;
|
|
83
|
-
margin-bottom: 0.3125em;
|
|
84
|
-
margin-top: 0.3125em;
|
|
85
|
-
padding-left: 1em;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
code,
|
|
89
|
-
pre {
|
|
90
|
-
background-color: #f0f0f0;
|
|
91
|
-
border-radius: 0.1875em;
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
pre {
|
|
95
|
-
white-space: pre-wrap;
|
|
96
|
-
margin-bottom: 0.3125em;
|
|
97
|
-
margin-top: 0.3125em;
|
|
98
|
-
padding: 0.3125em 0.625em;
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
code {
|
|
102
|
-
font-size: 85%;
|
|
103
|
-
padding: 0.125em 0.25em;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
img {
|
|
107
|
-
max-width: 100%;
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
/* RTL specific styles */
|
|
111
|
-
:host([dir='rtl']) .ql-editor {
|
|
112
|
-
direction: rtl;
|
|
113
|
-
text-align: right;
|
|
114
|
-
}
|
|
115
|
-
`;
|
|
116
|
-
|
|
117
|
-
// Register a module with ID for backwards compatibility.
|
|
118
|
-
registerStyles('', contentStyles, { moduleId: 'vaadin-rich-text-editor-content-styles' });
|