@vaadin/rich-text-editor 24.8.4 → 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/README.md +0 -23
- package/package.json +17 -24
- 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 +123 -25
- package/src/vaadin-rich-text-editor.d.ts +1 -1
- package/src/vaadin-rich-text-editor.js +183 -91
- package/theme/lumo/vaadin-rich-text-editor-styles.js +6 -5
- package/web-types.json +2 -6
- package/web-types.lit.json +2 -9
- package/src/vaadin-lit-rich-text-editor-popup.js +0 -91
- package/src/vaadin-lit-rich-text-editor.js +0 -330
- 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
- package/theme/lumo/vaadin-lit-rich-text-editor.d.ts +0 -6
- package/theme/lumo/vaadin-lit-rich-text-editor.js +0 -6
- package/theme/material/vaadin-lit-rich-text-editor.d.ts +0 -6
- package/theme/material/vaadin-lit-rich-text-editor.js +0 -6
- package/theme/material/vaadin-rich-text-editor-styles.d.ts +0 -1
- package/theme/material/vaadin-rich-text-editor-styles.js +0 -143
- package/theme/material/vaadin-rich-text-editor.d.ts +0 -6
- package/theme/material/vaadin-rich-text-editor.js +0 -6
- package/vaadin-lit-rich-text-editor.d.ts +0 -1
- package/vaadin-lit-rich-text-editor.js +0 -2
|
@@ -13,22 +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 '
|
|
17
|
-
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
16
|
+
import { html, LitElement, render } from 'lit';
|
|
18
17
|
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
19
18
|
import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
|
|
20
|
-
import {
|
|
19
|
+
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
20
|
+
import { LumoInjectionMixin } from '@vaadin/vaadin-themable-mixin/lumo-injection-mixin.js';
|
|
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
|
-
registerStyles('vaadin-rich-text-editor', richTextEditorStyles, { moduleId: 'vaadin-rich-text-editor-styles' });
|
|
25
24
|
|
|
26
25
|
/**
|
|
27
26
|
* `<vaadin-rich-text-editor>` is a Web Component for rich text editing.
|
|
28
27
|
* It provides a set of toolbar controls to apply formatting on the content,
|
|
29
28
|
* which is stored and can be accessed as HTML5 or JSON string.
|
|
30
29
|
*
|
|
31
|
-
* ```
|
|
30
|
+
* ```html
|
|
32
31
|
* <vaadin-rich-text-editor></vaadin-rich-text-editor>
|
|
33
32
|
* ```
|
|
34
33
|
*
|
|
@@ -101,37 +100,78 @@ registerStyles('vaadin-rich-text-editor', richTextEditorStyles, { moduleId: 'vaa
|
|
|
101
100
|
* @mixes RichTextEditorMixin
|
|
102
101
|
* @mixes ThemableMixin
|
|
103
102
|
*/
|
|
104
|
-
class RichTextEditor extends RichTextEditorMixin(
|
|
105
|
-
|
|
103
|
+
class RichTextEditor extends RichTextEditorMixin(
|
|
104
|
+
ElementMixin(ThemableMixin(PolylitMixin(LumoInjectionMixin(LitElement)))),
|
|
105
|
+
) {
|
|
106
|
+
static get is() {
|
|
107
|
+
return 'vaadin-rich-text-editor';
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
static get cvdlName() {
|
|
111
|
+
return 'vaadin-rich-text-editor';
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
static get styles() {
|
|
115
|
+
return richTextEditorStyles;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/** @protected */
|
|
119
|
+
render() {
|
|
106
120
|
return html`
|
|
107
121
|
<div class="vaadin-rich-text-editor-container">
|
|
108
122
|
<!-- Create toolbar container -->
|
|
109
123
|
<div part="toolbar" role="toolbar">
|
|
110
124
|
<span part="toolbar-group toolbar-group-history">
|
|
111
125
|
<!-- Undo and Redo -->
|
|
112
|
-
<button
|
|
113
|
-
|
|
126
|
+
<button
|
|
127
|
+
id="btn-undo"
|
|
128
|
+
type="button"
|
|
129
|
+
part="toolbar-button toolbar-button-undo"
|
|
130
|
+
aria-label="${this.__effectiveI18n.undo}"
|
|
131
|
+
@click="${this._undo}"
|
|
132
|
+
></button>
|
|
114
133
|
|
|
115
|
-
<button
|
|
116
|
-
|
|
134
|
+
<button
|
|
135
|
+
id="btn-redo"
|
|
136
|
+
type="button"
|
|
137
|
+
part="toolbar-button toolbar-button-redo"
|
|
138
|
+
aria-label="${this.__effectiveI18n.redo}"
|
|
139
|
+
@click="${this._redo}"
|
|
140
|
+
></button>
|
|
117
141
|
</span>
|
|
118
142
|
|
|
119
143
|
<span part="toolbar-group toolbar-group-emphasis">
|
|
120
144
|
<!-- Bold -->
|
|
121
|
-
<button
|
|
122
|
-
|
|
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>
|
|
123
151
|
|
|
124
152
|
<!-- Italic -->
|
|
125
|
-
<button
|
|
126
|
-
|
|
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>
|
|
127
159
|
|
|
128
160
|
<!-- Underline -->
|
|
129
|
-
<button
|
|
130
|
-
|
|
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>
|
|
131
167
|
|
|
132
168
|
<!-- Strike -->
|
|
133
|
-
<button
|
|
134
|
-
|
|
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>
|
|
135
175
|
</span>
|
|
136
176
|
|
|
137
177
|
<span part="toolbar-group toolbar-group-style">
|
|
@@ -140,17 +180,17 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
140
180
|
id="btn-color"
|
|
141
181
|
type="button"
|
|
142
182
|
part="toolbar-button toolbar-button-color"
|
|
143
|
-
|
|
183
|
+
aria-label="${this.__effectiveI18n.color}"
|
|
184
|
+
@click="${this.__onColorClick}"
|
|
144
185
|
></button>
|
|
145
|
-
<vaadin-tooltip for="btn-color" text="[[__effectiveI18n.color]]"></vaadin-tooltip>
|
|
146
186
|
<!-- Background -->
|
|
147
187
|
<button
|
|
148
188
|
id="btn-background"
|
|
149
189
|
type="button"
|
|
150
190
|
part="toolbar-button toolbar-button-background"
|
|
151
|
-
|
|
191
|
+
aria-label="${this.__effectiveI18n.background}"
|
|
192
|
+
@click="${this.__onBackgroundClick}"
|
|
152
193
|
></button>
|
|
153
|
-
<vaadin-tooltip for="btn-background" text="[[__effectiveI18n.background]]"></vaadin-tooltip>
|
|
154
194
|
</span>
|
|
155
195
|
|
|
156
196
|
<span part="toolbar-group toolbar-group-heading">
|
|
@@ -161,24 +201,24 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
161
201
|
class="ql-header"
|
|
162
202
|
value="1"
|
|
163
203
|
part="toolbar-button toolbar-button-h1"
|
|
204
|
+
aria-label="${this.__effectiveI18n.h1}"
|
|
164
205
|
></button>
|
|
165
|
-
<vaadin-tooltip for="btn-h1" text="[[__effectiveI18n.h1]]"></vaadin-tooltip>
|
|
166
206
|
<button
|
|
167
207
|
id="btn-h2"
|
|
168
208
|
type="button"
|
|
169
209
|
class="ql-header"
|
|
170
210
|
value="2"
|
|
171
211
|
part="toolbar-button toolbar-button-h2"
|
|
212
|
+
aria-label="${this.__effectiveI18n.h2}"
|
|
172
213
|
></button>
|
|
173
|
-
<vaadin-tooltip for="btn-h2" text="[[__effectiveI18n.h2]]"></vaadin-tooltip>
|
|
174
214
|
<button
|
|
175
215
|
id="btn-h3"
|
|
176
216
|
type="button"
|
|
177
217
|
class="ql-header"
|
|
178
218
|
value="3"
|
|
179
219
|
part="toolbar-button toolbar-button-h3"
|
|
220
|
+
aria-label="${this.__effectiveI18n.h3}"
|
|
180
221
|
></button>
|
|
181
|
-
<vaadin-tooltip for="btn-h3" text="[[__effectiveI18n.h3]]"></vaadin-tooltip>
|
|
182
222
|
</span>
|
|
183
223
|
|
|
184
224
|
<span part="toolbar-group toolbar-group-glyph-transformation">
|
|
@@ -188,15 +228,15 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
188
228
|
class="ql-script"
|
|
189
229
|
value="sub"
|
|
190
230
|
part="toolbar-button toolbar-button-subscript"
|
|
231
|
+
aria-label="${this.__effectiveI18n.subscript}"
|
|
191
232
|
></button>
|
|
192
|
-
<vaadin-tooltip for="btn-subscript" text="[[__effectiveI18n.subscript]]"></vaadin-tooltip>
|
|
193
233
|
<button
|
|
194
234
|
id="btn-superscript"
|
|
195
235
|
class="ql-script"
|
|
196
236
|
value="super"
|
|
197
237
|
part="toolbar-button toolbar-button-superscript"
|
|
238
|
+
aria-label="${this.__effectiveI18n.superscript}"
|
|
198
239
|
></button>
|
|
199
|
-
<vaadin-tooltip for="btn-superscript" text="[[__effectiveI18n.superscript]]"></vaadin-tooltip>
|
|
200
240
|
</span>
|
|
201
241
|
|
|
202
242
|
<span part="toolbar-group toolbar-group-list">
|
|
@@ -207,16 +247,16 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
207
247
|
class="ql-list"
|
|
208
248
|
value="ordered"
|
|
209
249
|
part="toolbar-button toolbar-button-list-ordered"
|
|
250
|
+
aria-label="${this.__effectiveI18n.listOrdered}"
|
|
210
251
|
></button>
|
|
211
|
-
<vaadin-tooltip for="btn-ol" text="[[__effectiveI18n.listOrdered]]"></vaadin-tooltip>
|
|
212
252
|
<button
|
|
213
253
|
id="btn-ul"
|
|
214
254
|
type="button"
|
|
215
255
|
class="ql-list"
|
|
216
256
|
value="bullet"
|
|
217
257
|
part="toolbar-button toolbar-button-list-bullet"
|
|
258
|
+
aria-label="${this.__effectiveI18n.listBullet}"
|
|
218
259
|
></button>
|
|
219
|
-
<vaadin-tooltip for="btn-ul" text="[[__effectiveI18n.listBullet]]"></vaadin-tooltip>
|
|
220
260
|
</span>
|
|
221
261
|
|
|
222
262
|
<span part="toolbar-group toolbar-group-alignment">
|
|
@@ -227,24 +267,24 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
227
267
|
class="ql-align"
|
|
228
268
|
value=""
|
|
229
269
|
part="toolbar-button toolbar-button-align-left"
|
|
270
|
+
aria-label="${this.__effectiveI18n.alignLeft}"
|
|
230
271
|
></button>
|
|
231
|
-
<vaadin-tooltip for="btn-left" text="[[__effectiveI18n.alignLeft]]"></vaadin-tooltip>
|
|
232
272
|
<button
|
|
233
273
|
id="btn-center"
|
|
234
274
|
type="button"
|
|
235
275
|
class="ql-align"
|
|
236
276
|
value="center"
|
|
237
277
|
part="toolbar-button toolbar-button-align-center"
|
|
278
|
+
aria-label="${this.__effectiveI18n.alignCenter}"
|
|
238
279
|
></button>
|
|
239
|
-
<vaadin-tooltip for="btn-center" text="[[__effectiveI18n.alignCenter]]"></vaadin-tooltip>
|
|
240
280
|
<button
|
|
241
281
|
id="btn-right"
|
|
242
282
|
type="button"
|
|
243
283
|
class="ql-align"
|
|
244
284
|
value="right"
|
|
245
285
|
part="toolbar-button toolbar-button-align-right"
|
|
286
|
+
aria-label="${this.__effectiveI18n.alignRight}"
|
|
246
287
|
></button>
|
|
247
|
-
<vaadin-tooltip for="btn-right" text="[[__effectiveI18n.alignRight]]"></vaadin-tooltip>
|
|
248
288
|
</span>
|
|
249
289
|
|
|
250
290
|
<span part="toolbar-group toolbar-group-rich-text">
|
|
@@ -253,18 +293,18 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
253
293
|
id="btn-image"
|
|
254
294
|
type="button"
|
|
255
295
|
part="toolbar-button toolbar-button-image"
|
|
256
|
-
|
|
257
|
-
|
|
296
|
+
aria-label="${this.__effectiveI18n.image}"
|
|
297
|
+
@touchend="${this._onImageTouchEnd}"
|
|
298
|
+
@click="${this._onImageClick}"
|
|
258
299
|
></button>
|
|
259
|
-
<vaadin-tooltip for="btn-image" text="[[__effectiveI18n.image]]"></vaadin-tooltip>
|
|
260
300
|
<!-- Link -->
|
|
261
301
|
<button
|
|
262
302
|
id="btn-link"
|
|
263
303
|
type="button"
|
|
264
304
|
part="toolbar-button toolbar-button-link"
|
|
265
|
-
|
|
305
|
+
aria-label="${this.__effectiveI18n.link}"
|
|
306
|
+
@click="${this._onLinkClick}"
|
|
266
307
|
></button>
|
|
267
|
-
<vaadin-tooltip for="btn-link" text="[[__effectiveI18n.link]]"></vaadin-tooltip>
|
|
268
308
|
</span>
|
|
269
309
|
|
|
270
310
|
<span part="toolbar-group toolbar-group-block">
|
|
@@ -274,29 +314,34 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
274
314
|
type="button"
|
|
275
315
|
class="ql-blockquote"
|
|
276
316
|
part="toolbar-button toolbar-button-blockquote"
|
|
317
|
+
aria-label="${this.__effectiveI18n.blockquote}"
|
|
277
318
|
></button>
|
|
278
|
-
<vaadin-tooltip for="btn-blockquote" text="[[__effectiveI18n.blockquote]]"></vaadin-tooltip>
|
|
279
319
|
<!-- Code block -->
|
|
280
320
|
<button
|
|
281
321
|
id="btn-code"
|
|
282
322
|
type="button"
|
|
283
323
|
class="ql-code-block"
|
|
284
324
|
part="toolbar-button toolbar-button-code-block"
|
|
325
|
+
aria-label="${this.__effectiveI18n.codeBlock}"
|
|
285
326
|
></button>
|
|
286
|
-
<vaadin-tooltip for="btn-code" text="[[__effectiveI18n.codeBlock]]"></vaadin-tooltip>
|
|
287
327
|
</span>
|
|
288
328
|
|
|
289
329
|
<span part="toolbar-group toolbar-group-format">
|
|
290
330
|
<!-- Clean -->
|
|
291
|
-
<button
|
|
292
|
-
|
|
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>
|
|
293
338
|
</span>
|
|
294
339
|
|
|
295
340
|
<input
|
|
296
341
|
id="fileInput"
|
|
297
342
|
type="file"
|
|
298
343
|
accept="image/png, image/gif, image/jpeg, image/bmp, image/x-icon"
|
|
299
|
-
|
|
344
|
+
@change="${this._uploadImage}"
|
|
300
345
|
/>
|
|
301
346
|
</div>
|
|
302
347
|
|
|
@@ -305,59 +350,106 @@ class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(Poly
|
|
|
305
350
|
<div class="announcer" aria-live="polite"></div>
|
|
306
351
|
</div>
|
|
307
352
|
|
|
308
|
-
<
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
<vaadin-button id="confirmLink" slot="confirm-button" theme="primary" on-click="_onLinkEditConfirm">
|
|
316
|
-
[[__effectiveI18n.ok]]
|
|
317
|
-
</vaadin-button>
|
|
318
|
-
<vaadin-button
|
|
319
|
-
id="removeLink"
|
|
320
|
-
slot="reject-button"
|
|
321
|
-
theme="error"
|
|
322
|
-
on-click="_onLinkEditRemove"
|
|
323
|
-
hidden$="[[!_linkRange]]"
|
|
324
|
-
>
|
|
325
|
-
[[__effectiveI18n.remove]]
|
|
326
|
-
</vaadin-button>
|
|
327
|
-
<vaadin-button id="cancelLink" slot="cancel-button" on-click="_onLinkEditCancel">
|
|
328
|
-
[[__effectiveI18n.cancel]]
|
|
329
|
-
</vaadin-button>
|
|
330
|
-
</vaadin-confirm-dialog>
|
|
331
|
-
|
|
332
|
-
<vaadin-rich-text-editor-popup
|
|
333
|
-
id="colorPopup"
|
|
334
|
-
colors="[[colorOptions]]"
|
|
335
|
-
opened="{{_colorEditing}}"
|
|
336
|
-
on-color-selected="__onColorSelected"
|
|
337
|
-
></vaadin-rich-text-editor-popup>
|
|
338
|
-
|
|
339
|
-
<vaadin-rich-text-editor-popup
|
|
340
|
-
id="backgroundPopup"
|
|
341
|
-
colors="[[colorOptions]]"
|
|
342
|
-
opened="{{_backgroundEditing}}"
|
|
343
|
-
on-color-selected="__onBackgroundSelected"
|
|
344
|
-
></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>
|
|
345
360
|
`;
|
|
346
361
|
}
|
|
347
362
|
|
|
348
|
-
|
|
349
|
-
|
|
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();
|
|
350
372
|
}
|
|
351
373
|
|
|
352
|
-
|
|
353
|
-
|
|
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
|
+
);
|
|
354
420
|
}
|
|
355
421
|
|
|
356
|
-
/**
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
422
|
+
/** @private */
|
|
423
|
+
__onBackgroundEditingChanged(event) {
|
|
424
|
+
this._backgroundEditing = event.detail.value;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
/** @private */
|
|
428
|
+
__onColorEditingChanged(event) {
|
|
429
|
+
this._colorEditing = event.detail.value;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** @private */
|
|
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
|
+
}
|
|
446
|
+
this._linkEditing = event.detail.value;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
/** @private */
|
|
450
|
+
_onLinkUrlChanged(event) {
|
|
451
|
+
this._linkUrl = event.detail.value;
|
|
452
|
+
}
|
|
361
453
|
}
|
|
362
454
|
|
|
363
455
|
defineCustomElement(RichTextEditor);
|
|
@@ -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": "
|
|
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",
|
|
@@ -100,10 +100,6 @@
|
|
|
100
100
|
}
|
|
101
101
|
],
|
|
102
102
|
"events": [
|
|
103
|
-
{
|
|
104
|
-
"name": "change",
|
|
105
|
-
"description": "Fired when the user commits a value change."
|
|
106
|
-
},
|
|
107
103
|
{
|
|
108
104
|
"name": "value-changed",
|
|
109
105
|
"description": "Fired when the `value` property changes."
|
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": "
|
|
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
|
{
|
|
@@ -54,13 +54,6 @@
|
|
|
54
54
|
"kind": "expression"
|
|
55
55
|
}
|
|
56
56
|
},
|
|
57
|
-
{
|
|
58
|
-
"name": "@change",
|
|
59
|
-
"description": "Fired when the user commits a value change.",
|
|
60
|
-
"value": {
|
|
61
|
-
"kind": "expression"
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
57
|
{
|
|
65
58
|
"name": "@value-changed",
|
|
66
59
|
"description": "Fired when the `value` property changes.",
|
|
@@ -1,91 +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, html, LitElement } from 'lit';
|
|
12
|
-
import { defineCustomElement } from '@vaadin/component-base/src/define.js';
|
|
13
|
-
import { DirMixin } from '@vaadin/component-base/src/dir-mixin.js';
|
|
14
|
-
import { PolylitMixin } from '@vaadin/component-base/src/polylit-mixin.js';
|
|
15
|
-
import { OverlayMixin } from '@vaadin/overlay/src/vaadin-overlay-mixin.js';
|
|
16
|
-
import { PositionMixin } from '@vaadin/overlay/src/vaadin-overlay-position-mixin.js';
|
|
17
|
-
import { overlayStyles } from '@vaadin/overlay/src/vaadin-overlay-styles.js';
|
|
18
|
-
import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
19
|
-
import { RichTextEditorPopupMixin } from './vaadin-rich-text-editor-popup-mixin.js';
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* An element used internally by `<vaadin-rich-text-editor>`. Not intended to be used separately.
|
|
23
|
-
* @private
|
|
24
|
-
*/
|
|
25
|
-
class RichTextEditorPopup extends RichTextEditorPopupMixin(PolylitMixin(LitElement)) {
|
|
26
|
-
static get is() {
|
|
27
|
-
return 'vaadin-rich-text-editor-popup';
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
static get styles() {
|
|
31
|
-
return css`
|
|
32
|
-
:host {
|
|
33
|
-
display: none;
|
|
34
|
-
}
|
|
35
|
-
`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
/** @protected */
|
|
39
|
-
render() {
|
|
40
|
-
return html`
|
|
41
|
-
<vaadin-rich-text-editor-popup-overlay
|
|
42
|
-
.renderer="${this.renderer}"
|
|
43
|
-
.opened="${this.opened}"
|
|
44
|
-
.positionTarget="${this.target}"
|
|
45
|
-
no-vertical-overlap
|
|
46
|
-
horizontal-align="start"
|
|
47
|
-
vertical-align="top"
|
|
48
|
-
focus-trap
|
|
49
|
-
@opened-changed="${this._onOpenedChanged}"
|
|
50
|
-
@vaadin-overlay-escape-press="${this._onOverlayEscapePress}"
|
|
51
|
-
></vaadin-rich-text-editor-popup-overlay>
|
|
52
|
-
`;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
/** @private */
|
|
56
|
-
_onOpenedChanged(event) {
|
|
57
|
-
this.opened = event.detail.value;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
defineCustomElement(RichTextEditorPopup);
|
|
62
|
-
|
|
63
|
-
export { RichTextEditorPopup };
|
|
64
|
-
|
|
65
|
-
/**
|
|
66
|
-
* An element used internally by `<vaadin-rich-text-editor>`. Not intended to be used separately.
|
|
67
|
-
* @private
|
|
68
|
-
*/
|
|
69
|
-
class RichTextEditorPopupOverlay extends PositionMixin(
|
|
70
|
-
OverlayMixin(DirMixin(ThemableMixin(PolylitMixin(LitElement)))),
|
|
71
|
-
) {
|
|
72
|
-
static get is() {
|
|
73
|
-
return 'vaadin-rich-text-editor-popup-overlay';
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
static get styles() {
|
|
77
|
-
return overlayStyles;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
/** @protected */
|
|
81
|
-
render() {
|
|
82
|
-
return html`
|
|
83
|
-
<div id="backdrop" part="backdrop" hidden></div>
|
|
84
|
-
<div part="overlay" id="overlay">
|
|
85
|
-
<div part="content" id="content"><slot></slot></div>
|
|
86
|
-
</div>
|
|
87
|
-
`;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
defineCustomElement(RichTextEditorPopupOverlay);
|