@vaadin/rich-text-editor 23.2.0-dev.8a7678b70 → 23.3.0-alpha1
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 +4 -4
- package/package.json +20 -14
- package/src/vaadin-rich-text-editor-icons.js +3 -3
- package/src/vaadin-rich-text-editor.d.ts +3 -3
- package/src/vaadin-rich-text-editor.js +50 -56
- package/theme/lumo/vaadin-rich-text-editor.js +1 -0
- package/theme/material/vaadin-rich-text-editor.js +1 -0
- package/web-types.json +114 -0
- package/web-types.lit.json +83 -0
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ An input field web component for entering rich text.
|
|
|
4
4
|
|
|
5
5
|
> ℹ️ A commercial Vaadin [subscription](https://vaadin.com/pricing) is required to use Rich Text Editor in your project.
|
|
6
6
|
|
|
7
|
-
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/
|
|
7
|
+
[Documentation + Live Demo ↗](https://vaadin.com/docs/latest/components/rich-text-editor)
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/@vaadin/rich-text-editor)
|
|
10
10
|
[](https://discord.gg/PHmkCKC)
|
|
@@ -13,7 +13,7 @@ An input field web component for entering rich text.
|
|
|
13
13
|
<vaadin-rich-text-editor></vaadin-rich-text-editor>
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/rich-text-editor/screenshot.png" width="656" alt="Screenshot of vaadin-rich-text-editor">](https://vaadin.com/docs/latest/
|
|
16
|
+
[<img src="https://raw.githubusercontent.com/vaadin/web-components/master/packages/rich-text-editor/screenshot.png" width="656" alt="Screenshot of vaadin-rich-text-editor">](https://vaadin.com/docs/latest/components/rich-text-editor)
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -31,7 +31,7 @@ import '@vaadin/rich-text-editor';
|
|
|
31
31
|
|
|
32
32
|
## Themes
|
|
33
33
|
|
|
34
|
-
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/
|
|
34
|
+
Vaadin components come with two built-in [themes](https://vaadin.com/docs/latest/styling), Lumo and Material.
|
|
35
35
|
The [main entrypoint](https://github.com/vaadin/web-components/blob/master/packages/rich-text-editor/vaadin-rich-text-editor.js) of the package uses the Lumo theme.
|
|
36
36
|
|
|
37
37
|
To use the Material theme, import the component from the `theme/material` folder:
|
|
@@ -54,7 +54,7 @@ import '@vaadin/rich-text-editor/src/vaadin-rich-text-editor.js';
|
|
|
54
54
|
|
|
55
55
|
## Contributing
|
|
56
56
|
|
|
57
|
-
Read the [contributing guide](https://vaadin.com/docs/latest/
|
|
57
|
+
Read the [contributing guide](https://vaadin.com/docs/latest/contributing/overview) to learn about our development process, how to propose bugfixes and improvements, and how to test your changes to Vaadin components.
|
|
58
58
|
|
|
59
59
|
## License
|
|
60
60
|
|
package/package.json
CHANGED
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vaadin/rich-text-editor",
|
|
3
|
-
"version": "23.
|
|
3
|
+
"version": "23.3.0-alpha1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
7
|
"description": "vaadin-rich-text-editor",
|
|
8
|
-
"license": "
|
|
9
|
-
"cvdlName": "vaadin-rich-text-editor",
|
|
8
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
10
9
|
"repository": {
|
|
11
10
|
"type": "git",
|
|
12
11
|
"url": "https://github.com/vaadin/web-components.git",
|
|
@@ -21,14 +20,16 @@
|
|
|
21
20
|
"module": "vaadin-rich-text-editor.js",
|
|
22
21
|
"type": "module",
|
|
23
22
|
"scripts": {
|
|
24
|
-
"icons": "gulp icons"
|
|
23
|
+
"icons": "gulp icons --gulpfile gulpfile.cjs"
|
|
25
24
|
},
|
|
26
25
|
"files": [
|
|
27
26
|
"src",
|
|
28
27
|
"theme",
|
|
29
28
|
"vaadin-*.d.ts",
|
|
30
29
|
"vaadin-*.js",
|
|
31
|
-
"vendor"
|
|
30
|
+
"vendor",
|
|
31
|
+
"web-types.json",
|
|
32
|
+
"web-types.lit.json"
|
|
32
33
|
],
|
|
33
34
|
"keywords": [
|
|
34
35
|
"Vaadin",
|
|
@@ -39,14 +40,14 @@
|
|
|
39
40
|
],
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@polymer/polymer": "^3.0.0",
|
|
42
|
-
"@vaadin/button": "23.
|
|
43
|
-
"@vaadin/component-base": "23.
|
|
44
|
-
"@vaadin/confirm-dialog": "23.
|
|
45
|
-
"@vaadin/text-field": "23.
|
|
46
|
-
"@vaadin/
|
|
47
|
-
"@vaadin/vaadin-lumo-styles": "23.
|
|
48
|
-
"@vaadin/vaadin-material-styles": "23.
|
|
49
|
-
"@vaadin/vaadin-themable-mixin": "23.
|
|
43
|
+
"@vaadin/button": "23.3.0-alpha1",
|
|
44
|
+
"@vaadin/component-base": "23.3.0-alpha1",
|
|
45
|
+
"@vaadin/confirm-dialog": "23.3.0-alpha1",
|
|
46
|
+
"@vaadin/text-field": "23.3.0-alpha1",
|
|
47
|
+
"@vaadin/tooltip": "23.3.0-alpha1",
|
|
48
|
+
"@vaadin/vaadin-lumo-styles": "23.3.0-alpha1",
|
|
49
|
+
"@vaadin/vaadin-material-styles": "23.3.0-alpha1",
|
|
50
|
+
"@vaadin/vaadin-themable-mixin": "23.3.0-alpha1"
|
|
50
51
|
},
|
|
51
52
|
"devDependencies": {
|
|
52
53
|
"@esm-bundle/chai": "^4.3.4",
|
|
@@ -56,5 +57,10 @@
|
|
|
56
57
|
"gulp-iconfont": "^11.0.0",
|
|
57
58
|
"sinon": "^13.0.2"
|
|
58
59
|
},
|
|
59
|
-
"
|
|
60
|
+
"cvdlName": "vaadin-rich-text-editor",
|
|
61
|
+
"web-types": [
|
|
62
|
+
"web-types.json",
|
|
63
|
+
"web-types.lit.json"
|
|
64
|
+
],
|
|
65
|
+
"gitHead": "beabc527d4b1274eb798ff701d406fed45cfe638"
|
|
60
66
|
}
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const template = document.createElement('template');
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
template.innerHTML = `
|
|
11
11
|
<style>
|
|
12
12
|
@font-face {
|
|
13
13
|
font-family: 'vaadin-rte-icons';
|
|
@@ -31,7 +31,7 @@ $_documentContainer.innerHTML = `
|
|
|
31
31
|
</style>
|
|
32
32
|
`;
|
|
33
33
|
|
|
34
|
-
document.head.appendChild(
|
|
34
|
+
document.head.appendChild(template.content);
|
|
35
35
|
|
|
36
36
|
export const iconsStyles = css`
|
|
37
37
|
[part~='toolbar-button-align-center']::before {
|
|
@@ -123,7 +123,7 @@ export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEdi
|
|
|
123
123
|
* `toolbar-button-code-block` | The "code block" button
|
|
124
124
|
* `toolbar-button-clean` | The "clean formatting" button
|
|
125
125
|
*
|
|
126
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
126
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
127
127
|
*
|
|
128
128
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
129
129
|
* @fires {CustomEvent} html-value-changed - Fired when the `htmlValue` property changes.
|
|
@@ -181,13 +181,13 @@ declare class RichTextEditor extends ElementMixin(ThemableMixin(HTMLElement)) {
|
|
|
181
181
|
addEventListener<K extends keyof RichTextEditorEventMap>(
|
|
182
182
|
type: K,
|
|
183
183
|
listener: (this: RichTextEditor, ev: RichTextEditorEventMap[K]) => void,
|
|
184
|
-
options?:
|
|
184
|
+
options?: AddEventListenerOptions | boolean,
|
|
185
185
|
): void;
|
|
186
186
|
|
|
187
187
|
removeEventListener<K extends keyof RichTextEditorEventMap>(
|
|
188
188
|
type: K,
|
|
189
189
|
listener: (this: RichTextEditor, ev: RichTextEditorEventMap[K]) => void,
|
|
190
|
-
options?:
|
|
190
|
+
options?: EventListenerOptions | boolean,
|
|
191
191
|
): void;
|
|
192
192
|
}
|
|
193
193
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import '@vaadin/button/src/vaadin-button.js';
|
|
7
7
|
import '@vaadin/confirm-dialog/src/vaadin-confirm-dialog.js';
|
|
8
8
|
import '@vaadin/text-field/src/vaadin-text-field.js';
|
|
9
|
-
import '@vaadin/
|
|
9
|
+
import '@vaadin/tooltip/src/vaadin-tooltip.js';
|
|
10
10
|
import '../vendor/vaadin-quill.js';
|
|
11
11
|
import './vaadin-rich-text-editor-toolbar-styles.js';
|
|
12
12
|
import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
|
|
@@ -110,7 +110,7 @@ const TAB_KEY = 9;
|
|
|
110
110
|
* `toolbar-button-code-block` | The "code block" button
|
|
111
111
|
* `toolbar-button-clean` | The "clean formatting" button
|
|
112
112
|
*
|
|
113
|
-
* See [Styling Components](https://vaadin.com/docs/latest/
|
|
113
|
+
* See [Styling Components](https://vaadin.com/docs/latest/styling/custom-theme/styling-components) documentation.
|
|
114
114
|
*
|
|
115
115
|
* @fires {Event} change - Fired when the user commits a value change.
|
|
116
116
|
* @fires {CustomEvent} html-value-changed - Fired when the `htmlValue` property changes.
|
|
@@ -157,166 +157,168 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
157
157
|
<div part="toolbar">
|
|
158
158
|
<span part="toolbar-group toolbar-group-history">
|
|
159
159
|
<!-- Undo and Redo -->
|
|
160
|
-
<button
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
></button>
|
|
166
|
-
<button
|
|
167
|
-
type="button"
|
|
168
|
-
part="toolbar-button toolbar-button-redo"
|
|
169
|
-
on-click="_redo"
|
|
170
|
-
title$="[[i18n.redo]]"
|
|
171
|
-
></button>
|
|
160
|
+
<button id="btn-undo" type="button" part="toolbar-button toolbar-button-undo" on-click="_undo"></button>
|
|
161
|
+
<vaadin-tooltip for="btn-undo" text="[[i18n.undo]]"></vaadin-tooltip>
|
|
162
|
+
|
|
163
|
+
<button id="btn-redo" type="button" part="toolbar-button toolbar-button-redo" on-click="_redo"></button>
|
|
164
|
+
<vaadin-tooltip for="btn-redo" text="[[i18n.redo]]"></vaadin-tooltip>
|
|
172
165
|
</span>
|
|
173
166
|
|
|
174
167
|
<span part="toolbar-group toolbar-group-emphasis">
|
|
175
168
|
<!-- Bold -->
|
|
176
|
-
<button class="ql-bold" part="toolbar-button toolbar-button-bold"
|
|
169
|
+
<button id="btn-bold" class="ql-bold" part="toolbar-button toolbar-button-bold"></button>
|
|
170
|
+
<vaadin-tooltip for="btn-bold" text="[[i18n.bold]]"></vaadin-tooltip>
|
|
177
171
|
|
|
178
172
|
<!-- Italic -->
|
|
179
|
-
<button class="ql-italic" part="toolbar-button toolbar-button-italic"
|
|
173
|
+
<button id="btn-italic" class="ql-italic" part="toolbar-button toolbar-button-italic"></button>
|
|
174
|
+
<vaadin-tooltip for="btn-italic" text="[[i18n.italic]]"></vaadin-tooltip>
|
|
180
175
|
|
|
181
176
|
<!-- Underline -->
|
|
182
|
-
<button
|
|
183
|
-
|
|
184
|
-
part="toolbar-button toolbar-button-underline"
|
|
185
|
-
title$="[[i18n.underline]]"
|
|
186
|
-
></button>
|
|
177
|
+
<button id="btn-underline" class="ql-underline" part="toolbar-button toolbar-button-underline"></button>
|
|
178
|
+
<vaadin-tooltip for="btn-underline" text="[[i18n.underline]]"></vaadin-tooltip>
|
|
187
179
|
|
|
188
180
|
<!-- Strike -->
|
|
189
|
-
<button class="ql-strike" part="toolbar-button toolbar-button-strike"
|
|
181
|
+
<button id="btn-strike" class="ql-strike" part="toolbar-button toolbar-button-strike"></button>
|
|
182
|
+
<vaadin-tooltip for="btn-strike" text="[[i18n.strike]]"></vaadin-tooltip>
|
|
190
183
|
</span>
|
|
191
184
|
|
|
192
185
|
<span part="toolbar-group toolbar-group-heading">
|
|
193
186
|
<!-- Header buttons -->
|
|
194
187
|
<button
|
|
188
|
+
id="btn-h1"
|
|
195
189
|
type="button"
|
|
196
190
|
class="ql-header"
|
|
197
191
|
value="1"
|
|
198
192
|
part="toolbar-button toolbar-button-h1"
|
|
199
|
-
title$="[[i18n.h1]]"
|
|
200
193
|
></button>
|
|
194
|
+
<vaadin-tooltip for="btn-h1" text="[[i18n.h1]]"></vaadin-tooltip>
|
|
201
195
|
<button
|
|
196
|
+
id="btn-h2"
|
|
202
197
|
type="button"
|
|
203
198
|
class="ql-header"
|
|
204
199
|
value="2"
|
|
205
200
|
part="toolbar-button toolbar-button-h2"
|
|
206
|
-
title$="[[i18n.h2]]"
|
|
207
201
|
></button>
|
|
202
|
+
<vaadin-tooltip for="btn-h2" text="[[i18n.h2]]"></vaadin-tooltip>
|
|
208
203
|
<button
|
|
204
|
+
id="btn-h3"
|
|
209
205
|
type="button"
|
|
210
206
|
class="ql-header"
|
|
211
207
|
value="3"
|
|
212
208
|
part="toolbar-button toolbar-button-h3"
|
|
213
|
-
title$="[[i18n.h3]]"
|
|
214
209
|
></button>
|
|
210
|
+
<vaadin-tooltip for="btn-h3" text="[[i18n.h3]]"></vaadin-tooltip>
|
|
215
211
|
</span>
|
|
216
212
|
|
|
217
213
|
<span part="toolbar-group toolbar-group-glyph-transformation">
|
|
218
214
|
<!-- Subscript and superscript -->
|
|
219
215
|
<button
|
|
216
|
+
id="btn-subscript"
|
|
220
217
|
class="ql-script"
|
|
221
218
|
value="sub"
|
|
222
219
|
part="toolbar-button toolbar-button-subscript"
|
|
223
|
-
title$="[[i18n.subscript]]"
|
|
224
220
|
></button>
|
|
221
|
+
<vaadin-tooltip for="btn-subscript" text="[[i18n.subscript]]"></vaadin-tooltip>
|
|
225
222
|
<button
|
|
223
|
+
id="btn-superscript"
|
|
226
224
|
class="ql-script"
|
|
227
225
|
value="super"
|
|
228
226
|
part="toolbar-button toolbar-button-superscript"
|
|
229
|
-
title$="[[i18n.superscript]]"
|
|
230
227
|
></button>
|
|
228
|
+
<vaadin-tooltip for="btn-superscript" text="[[i18n.superscript]]"></vaadin-tooltip>
|
|
231
229
|
</span>
|
|
232
230
|
|
|
233
231
|
<span part="toolbar-group toolbar-group-list">
|
|
234
232
|
<!-- List buttons -->
|
|
235
233
|
<button
|
|
234
|
+
id="btn-ol"
|
|
236
235
|
type="button"
|
|
237
236
|
class="ql-list"
|
|
238
237
|
value="ordered"
|
|
239
238
|
part="toolbar-button toolbar-button-list-ordered"
|
|
240
|
-
title$="[[i18n.listOrdered]]"
|
|
241
239
|
></button>
|
|
240
|
+
<vaadin-tooltip for="btn-ol" text="[[i18n.listOrdered]]"></vaadin-tooltip>
|
|
242
241
|
<button
|
|
242
|
+
id="btn-ul"
|
|
243
243
|
type="button"
|
|
244
244
|
class="ql-list"
|
|
245
245
|
value="bullet"
|
|
246
246
|
part="toolbar-button toolbar-button-list-bullet"
|
|
247
|
-
title$="[[i18n.listBullet]]"
|
|
248
247
|
></button>
|
|
248
|
+
<vaadin-tooltip for="btn-ul" text="[[i18n.listBullet]]"></vaadin-tooltip>
|
|
249
249
|
</span>
|
|
250
250
|
|
|
251
251
|
<span part="toolbar-group toolbar-group-alignment">
|
|
252
252
|
<!-- Align buttons -->
|
|
253
253
|
<button
|
|
254
|
+
id="btn-left"
|
|
254
255
|
type="button"
|
|
255
256
|
class="ql-align"
|
|
256
257
|
value=""
|
|
257
258
|
part="toolbar-button toolbar-button-align-left"
|
|
258
|
-
title$="[[i18n.alignLeft]]"
|
|
259
259
|
></button>
|
|
260
|
+
<vaadin-tooltip for="btn-left" text="[[i18n.alignLeft]]"></vaadin-tooltip>
|
|
260
261
|
<button
|
|
262
|
+
id="btn-center"
|
|
261
263
|
type="button"
|
|
262
264
|
class="ql-align"
|
|
263
265
|
value="center"
|
|
264
266
|
part="toolbar-button toolbar-button-align-center"
|
|
265
|
-
title$="[[i18n.alignCenter]]"
|
|
266
267
|
></button>
|
|
268
|
+
<vaadin-tooltip for="btn-center" text="[[i18n.alignCenter]]"></vaadin-tooltip>
|
|
267
269
|
<button
|
|
270
|
+
id="btn-right"
|
|
268
271
|
type="button"
|
|
269
272
|
class="ql-align"
|
|
270
273
|
value="right"
|
|
271
274
|
part="toolbar-button toolbar-button-align-right"
|
|
272
|
-
title$="[[i18n.alignRight]]"
|
|
273
275
|
></button>
|
|
276
|
+
<vaadin-tooltip for="btn-right" text="[[i18n.alignRight]]"></vaadin-tooltip>
|
|
274
277
|
</span>
|
|
275
278
|
|
|
276
279
|
<span part="toolbar-group toolbar-group-rich-text">
|
|
277
280
|
<!-- Image -->
|
|
278
281
|
<button
|
|
282
|
+
id="btn-image"
|
|
279
283
|
type="button"
|
|
280
284
|
part="toolbar-button toolbar-button-image"
|
|
281
|
-
title$="[[i18n.image]]"
|
|
282
285
|
on-touchend="_onImageTouchEnd"
|
|
283
286
|
on-click="_onImageClick"
|
|
284
287
|
></button>
|
|
288
|
+
<vaadin-tooltip for="btn-image" text="[[i18n.image]]"></vaadin-tooltip>
|
|
285
289
|
<!-- Link -->
|
|
286
290
|
<button
|
|
291
|
+
id="btn-link"
|
|
287
292
|
type="button"
|
|
288
293
|
part="toolbar-button toolbar-button-link"
|
|
289
|
-
title$="[[i18n.link]]"
|
|
290
294
|
on-click="_onLinkClick"
|
|
291
295
|
></button>
|
|
296
|
+
<vaadin-tooltip for="btn-link" text="[[i18n.link]]"></vaadin-tooltip>
|
|
292
297
|
</span>
|
|
293
298
|
|
|
294
299
|
<span part="toolbar-group toolbar-group-block">
|
|
295
300
|
<!-- Blockquote -->
|
|
296
301
|
<button
|
|
302
|
+
id="btn-blockquote"
|
|
297
303
|
type="button"
|
|
298
304
|
class="ql-blockquote"
|
|
299
305
|
part="toolbar-button toolbar-button-blockquote"
|
|
300
|
-
title$="[[i18n.blockquote]]"
|
|
301
306
|
></button>
|
|
302
|
-
|
|
307
|
+
<vaadin-tooltip for="btn-blockquote" text="[[i18n.blockquote]]"></vaadin-tooltip>
|
|
303
308
|
<!-- Code block -->
|
|
304
309
|
<button
|
|
310
|
+
id="btn-code"
|
|
305
311
|
type="button"
|
|
306
312
|
class="ql-code-block"
|
|
307
313
|
part="toolbar-button toolbar-button-code-block"
|
|
308
|
-
title$="[[i18n.codeBlock]]"
|
|
309
314
|
></button>
|
|
315
|
+
<vaadin-tooltip for="btn-code" text="[[i18n.codeBlock]]"></vaadin-tooltip>
|
|
310
316
|
</span>
|
|
311
317
|
|
|
312
318
|
<span part="toolbar-group toolbar-group-format">
|
|
313
319
|
<!-- Clean -->
|
|
314
|
-
<button
|
|
315
|
-
|
|
316
|
-
class="ql-clean"
|
|
317
|
-
part="toolbar-button toolbar-button-clean"
|
|
318
|
-
title$="[[i18n.clean]]"
|
|
319
|
-
></button>
|
|
320
|
+
<button id="btn-clean" type="button" class="ql-clean" part="toolbar-button toolbar-button-clean"></button>
|
|
321
|
+
<vaadin-tooltip for="btn-clean" text="[[i18n.clean]]"></vaadin-tooltip>
|
|
320
322
|
</span>
|
|
321
323
|
|
|
322
324
|
<input
|
|
@@ -504,17 +506,6 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
504
506
|
return ['_valueChanged(value, _editor)', '_disabledChanged(disabled, readonly, _editor)'];
|
|
505
507
|
}
|
|
506
508
|
|
|
507
|
-
/** @protected */
|
|
508
|
-
static _finalizeClass() {
|
|
509
|
-
super._finalizeClass();
|
|
510
|
-
|
|
511
|
-
const devModeCallback = window.Vaadin.developmentModeCallback;
|
|
512
|
-
const licenseChecker = devModeCallback && devModeCallback['vaadin-license-checker'];
|
|
513
|
-
if (typeof licenseChecker === 'function') {
|
|
514
|
-
licenseChecker(RichTextEditor);
|
|
515
|
-
}
|
|
516
|
-
}
|
|
517
|
-
|
|
518
509
|
/**
|
|
519
510
|
* @param {string} prop
|
|
520
511
|
* @param {?string} oldVal
|
|
@@ -569,7 +560,7 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
569
560
|
this.__patchToolbar();
|
|
570
561
|
this.__patchKeyboard();
|
|
571
562
|
|
|
572
|
-
/*
|
|
563
|
+
/* c8 ignore next 3 */
|
|
573
564
|
if (isFirefox) {
|
|
574
565
|
this.__patchFirefoxFocus();
|
|
575
566
|
}
|
|
@@ -952,7 +943,10 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
|
|
|
952
943
|
timeOut.after(timeout),
|
|
953
944
|
() => {
|
|
954
945
|
const formatting = Array.from(this.shadowRoot.querySelectorAll('[part="toolbar"] .ql-active'))
|
|
955
|
-
.map((button) =>
|
|
946
|
+
.map((button) => {
|
|
947
|
+
const tooltip = this.shadowRoot.querySelector(`[for="${button.id}"]`);
|
|
948
|
+
return tooltip.text;
|
|
949
|
+
})
|
|
956
950
|
.join(', ');
|
|
957
951
|
announcer.textContent = formatting;
|
|
958
952
|
},
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@vaadin/button/theme/lumo/vaadin-button.js';
|
|
2
2
|
import '@vaadin/confirm-dialog/theme/lumo/vaadin-confirm-dialog.js';
|
|
3
3
|
import '@vaadin/text-field/theme/lumo/vaadin-text-field.js';
|
|
4
|
+
import '@vaadin/tooltip/theme/lumo/vaadin-tooltip.js';
|
|
4
5
|
import './vaadin-rich-text-editor-styles.js';
|
|
5
6
|
import '../../src/vaadin-rich-text-editor.js';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import '@vaadin/button/theme/material/vaadin-button.js';
|
|
2
2
|
import '@vaadin/confirm-dialog/theme/material/vaadin-confirm-dialog.js';
|
|
3
3
|
import '@vaadin/text-field/theme/material/vaadin-text-field.js';
|
|
4
|
+
import '@vaadin/tooltip/theme/material/vaadin-tooltip.js';
|
|
4
5
|
import './vaadin-rich-text-editor-styles.js';
|
|
5
6
|
import '../../src/vaadin-rich-text-editor.js';
|
package/web-types.json
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/rich-text-editor",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"contributions": {
|
|
7
|
+
"html": {
|
|
8
|
+
"elements": [
|
|
9
|
+
{
|
|
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```\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-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-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-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/custom-theme/styling-components) documentation.",
|
|
12
|
+
"attributes": [
|
|
13
|
+
{
|
|
14
|
+
"name": "value",
|
|
15
|
+
"description": "Value is a list of the operations which describe change to the document.\nEach of those operations describe the change at the current index.\nThey can be an `insert`, `delete` or `retain`. The format is as follows:\n\n```js\n [\n { insert: 'Hello World' },\n { insert: '!', attributes: { bold: true }}\n ]\n```\n\nSee also https://github.com/quilljs/delta for detailed documentation.",
|
|
16
|
+
"value": {
|
|
17
|
+
"type": [
|
|
18
|
+
"string"
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
"name": "disabled",
|
|
24
|
+
"description": "When true, the user can not modify, nor copy the editor content.",
|
|
25
|
+
"value": {
|
|
26
|
+
"type": [
|
|
27
|
+
"boolean"
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "readonly",
|
|
33
|
+
"description": "When true, the user can not modify the editor content, but can copy it.",
|
|
34
|
+
"value": {
|
|
35
|
+
"type": [
|
|
36
|
+
"boolean"
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"name": "theme",
|
|
42
|
+
"description": "The theme variants to apply to the component.",
|
|
43
|
+
"value": {
|
|
44
|
+
"type": [
|
|
45
|
+
"string",
|
|
46
|
+
"null",
|
|
47
|
+
"undefined"
|
|
48
|
+
]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"js": {
|
|
53
|
+
"properties": [
|
|
54
|
+
{
|
|
55
|
+
"name": "value",
|
|
56
|
+
"description": "Value is a list of the operations which describe change to the document.\nEach of those operations describe the change at the current index.\nThey can be an `insert`, `delete` or `retain`. The format is as follows:\n\n```js\n [\n { insert: 'Hello World' },\n { insert: '!', attributes: { bold: true }}\n ]\n```\n\nSee also https://github.com/quilljs/delta for detailed documentation.",
|
|
57
|
+
"value": {
|
|
58
|
+
"type": [
|
|
59
|
+
"string"
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"name": "disabled",
|
|
65
|
+
"description": "When true, the user can not modify, nor copy the editor content.",
|
|
66
|
+
"value": {
|
|
67
|
+
"type": [
|
|
68
|
+
"boolean"
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "readonly",
|
|
74
|
+
"description": "When true, the user can not modify the editor content, but can copy it.",
|
|
75
|
+
"value": {
|
|
76
|
+
"type": [
|
|
77
|
+
"boolean"
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"name": "i18n",
|
|
83
|
+
"description": "An object used to localize this component. The properties are used\ne.g. as the tooltips for the editor toolbar buttons.",
|
|
84
|
+
"value": {
|
|
85
|
+
"type": [
|
|
86
|
+
"RichTextEditorI18n"
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
],
|
|
91
|
+
"events": [
|
|
92
|
+
{
|
|
93
|
+
"name": "change",
|
|
94
|
+
"description": "Fired when the user commits a value change."
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "value-changed",
|
|
98
|
+
"description": "Fired when the `value` property changes."
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "html-value-changed",
|
|
102
|
+
"description": "Fired when the `htmlValue` property changes."
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
"name": "htmlValue-changed",
|
|
106
|
+
"description": "Fired when the `htmlValue` property changes."
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
]
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/web-types",
|
|
3
|
+
"name": "@vaadin/rich-text-editor",
|
|
4
|
+
"version": "23.3.0-alpha1",
|
|
5
|
+
"description-markup": "markdown",
|
|
6
|
+
"framework": "lit",
|
|
7
|
+
"framework-config": {
|
|
8
|
+
"enable-when": {
|
|
9
|
+
"node-packages": [
|
|
10
|
+
"lit"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
"contributions": {
|
|
15
|
+
"html": {
|
|
16
|
+
"elements": [
|
|
17
|
+
{
|
|
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```\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-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-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-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/custom-theme/styling-components) documentation.",
|
|
20
|
+
"extension": true,
|
|
21
|
+
"attributes": [
|
|
22
|
+
{
|
|
23
|
+
"name": "?disabled",
|
|
24
|
+
"description": "When true, the user can not modify, nor copy the editor content.",
|
|
25
|
+
"value": {
|
|
26
|
+
"kind": "expression"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"name": "?readonly",
|
|
31
|
+
"description": "When true, the user can not modify the editor content, but can copy it.",
|
|
32
|
+
"value": {
|
|
33
|
+
"kind": "expression"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
"name": ".value",
|
|
38
|
+
"description": "Value is a list of the operations which describe change to the document.\nEach of those operations describe the change at the current index.\nThey can be an `insert`, `delete` or `retain`. The format is as follows:\n\n```js\n [\n { insert: 'Hello World' },\n { insert: '!', attributes: { bold: true }}\n ]\n```\n\nSee also https://github.com/quilljs/delta for detailed documentation.",
|
|
39
|
+
"value": {
|
|
40
|
+
"kind": "expression"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
"name": ".i18n",
|
|
45
|
+
"description": "An object used to localize this component. The properties are used\ne.g. as the tooltips for the editor toolbar buttons.",
|
|
46
|
+
"value": {
|
|
47
|
+
"kind": "expression"
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"name": "@change",
|
|
52
|
+
"description": "Fired when the user commits a value change.",
|
|
53
|
+
"value": {
|
|
54
|
+
"kind": "expression"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"name": "@value-changed",
|
|
59
|
+
"description": "Fired when the `value` property changes.",
|
|
60
|
+
"value": {
|
|
61
|
+
"kind": "expression"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
"name": "@html-value-changed",
|
|
66
|
+
"description": "Fired when the `htmlValue` property changes.",
|
|
67
|
+
"value": {
|
|
68
|
+
"kind": "expression"
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "@htmlValue-changed",
|
|
73
|
+
"description": "Fired when the `htmlValue` property changes.",
|
|
74
|
+
"value": {
|
|
75
|
+
"kind": "expression"
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|