@vaadin/rich-text-editor 24.2.0-beta3 → 24.2.0-beta4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vaadin/rich-text-editor",
3
- "version": "24.2.0-beta3",
3
+ "version": "24.2.0-beta4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -24,8 +24,6 @@
24
24
  },
25
25
  "files": [
26
26
  "src",
27
- "!src/vaadin-lit-rich-text-editor.d.ts",
28
- "!src/vaadin-lit-rich-text-editor.js",
29
27
  "theme",
30
28
  "vaadin-*.d.ts",
31
29
  "vaadin-*.js",
@@ -41,20 +39,19 @@
41
39
  "polymer"
42
40
  ],
43
41
  "dependencies": {
44
- "@open-wc/dedupe-mixin": "^1.3.0",
45
42
  "@polymer/polymer": "^3.0.0",
46
- "@vaadin/button": "24.2.0-beta3",
47
- "@vaadin/component-base": "24.2.0-beta3",
48
- "@vaadin/confirm-dialog": "24.2.0-beta3",
49
- "@vaadin/text-field": "24.2.0-beta3",
50
- "@vaadin/tooltip": "24.2.0-beta3",
51
- "@vaadin/vaadin-lumo-styles": "24.2.0-beta3",
52
- "@vaadin/vaadin-material-styles": "24.2.0-beta3",
53
- "@vaadin/vaadin-themable-mixin": "24.2.0-beta3"
43
+ "@vaadin/button": "24.2.0-beta4",
44
+ "@vaadin/component-base": "24.2.0-beta4",
45
+ "@vaadin/confirm-dialog": "24.2.0-beta4",
46
+ "@vaadin/text-field": "24.2.0-beta4",
47
+ "@vaadin/tooltip": "24.2.0-beta4",
48
+ "@vaadin/vaadin-lumo-styles": "24.2.0-beta4",
49
+ "@vaadin/vaadin-material-styles": "24.2.0-beta4",
50
+ "@vaadin/vaadin-themable-mixin": "24.2.0-beta4"
54
51
  },
55
52
  "devDependencies": {
56
53
  "@esm-bundle/chai": "^4.3.4",
57
- "@vaadin/a11y-base": "24.2.0-beta3",
54
+ "@vaadin/a11y-base": "24.2.0-beta4",
58
55
  "@vaadin/testing-helpers": "^0.5.0",
59
56
  "gulp": "^4.0.2",
60
57
  "gulp-cli": "^2.3.0",
@@ -66,5 +63,5 @@
66
63
  "web-types.json",
67
64
  "web-types.lit.json"
68
65
  ],
69
- "gitHead": "91ea11e7ad706065340acdb93b92316919ce5e69"
66
+ "gitHead": "04da1e1e5c5713ea45e4b7d659dc6ac6b4604f4c"
70
67
  }
@@ -12,35 +12,6 @@ import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
12
12
  import { contentStyles } from './vaadin-rich-text-editor-content-styles.js';
13
13
  import { toolbarStyles } from './vaadin-rich-text-editor-toolbar-styles.js';
14
14
 
15
- export const baseStyles = css`
16
- :host {
17
- display: flex;
18
- flex-direction: column;
19
- box-sizing: border-box;
20
- }
21
-
22
- :host([hidden]) {
23
- display: none !important;
24
- }
25
-
26
- .announcer {
27
- position: fixed;
28
- clip: rect(0, 0, 0, 0);
29
- }
30
-
31
- input[type='file'] {
32
- display: none;
33
- }
34
-
35
- .vaadin-rich-text-editor-container {
36
- display: flex;
37
- flex-direction: column;
38
- min-height: inherit;
39
- max-height: inherit;
40
- flex: auto;
41
- }
42
- `;
43
-
44
15
  export const statesStyles = css`
45
16
  :host([readonly]) [part='toolbar'] {
46
17
  display: none;
@@ -59,4 +30,4 @@ export const statesStyles = css`
59
30
  }
60
31
  `;
61
32
 
62
- export const richTextEditorStyles = [baseStyles, contentStyles, toolbarStyles, statesStyles];
33
+ export const richTextEditorStyles = [contentStyles, toolbarStyles, statesStyles];
@@ -10,8 +10,34 @@
10
10
  */
11
11
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
12
12
  import { ThemableMixin } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
13
- import { type RichTextEditorCustomEventMap, RichTextEditorMixin } from './vaadin-rich-text-editor-mixin.js';
14
- export * from './vaadin-rich-text-editor-mixin.js';
13
+
14
+ export interface RichTextEditorI18n {
15
+ undo: string;
16
+ redo: string;
17
+ bold: string;
18
+ italic: string;
19
+ underline: string;
20
+ strike: string;
21
+ h1: string;
22
+ h2: string;
23
+ h3: string;
24
+ subscript: string;
25
+ superscript: string;
26
+ listOrdered: string;
27
+ listBullet: string;
28
+ alignLeft: string;
29
+ alignCenter: string;
30
+ alignRight: string;
31
+ image: string;
32
+ link: string;
33
+ blockquote: string;
34
+ codeBlock: string;
35
+ clean: string;
36
+ linkDialogTitle: string;
37
+ ok: string;
38
+ cancel: string;
39
+ remove: string;
40
+ }
15
41
 
16
42
  /**
17
43
  * Fired when the user commits a value change.
@@ -20,6 +46,22 @@ export type RichTextEditorChangeEvent = Event & {
20
46
  target: RichTextEditor;
21
47
  };
22
48
 
49
+ /**
50
+ * Fired when the `htmlValue` property changes.
51
+ */
52
+ export type RichTextEditorHtmlValueChangedEvent = CustomEvent<{ value: string }>;
53
+
54
+ /**
55
+ * Fired when the `value` property changes.
56
+ */
57
+ export type RichTextEditorValueChangedEvent = CustomEvent<{ value: string }>;
58
+
59
+ export interface RichTextEditorCustomEventMap {
60
+ 'html-value-changed': RichTextEditorHtmlValueChangedEvent;
61
+
62
+ 'value-changed': RichTextEditorValueChangedEvent;
63
+ }
64
+
23
65
  export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEditorCustomEventMap {
24
66
  change: RichTextEditorChangeEvent;
25
67
  }
@@ -92,7 +134,55 @@ export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEdi
92
134
  * @fires {CustomEvent} html-value-changed - Fired when the `htmlValue` property changes.
93
135
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
94
136
  */
95
- declare class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(HTMLElement))) {
137
+ declare class RichTextEditor extends ElementMixin(ThemableMixin(HTMLElement)) {
138
+ /**
139
+ * Value is a list of the operations which describe change to the document.
140
+ * Each of those operations describe the change at the current index.
141
+ * They can be an `insert`, `delete` or `retain`. The format is as follows:
142
+ *
143
+ * ```js
144
+ * [
145
+ * { insert: 'Hello World' },
146
+ * { insert: '!', attributes: { bold: true }}
147
+ * ]
148
+ * ```
149
+ *
150
+ * See also https://github.com/quilljs/delta for detailed documentation.
151
+ */
152
+ value: string;
153
+
154
+ /**
155
+ * HTML representation of the rich text editor content.
156
+ */
157
+ readonly htmlValue: string | null | undefined;
158
+
159
+ /**
160
+ * When true, the user can not modify, nor copy the editor content.
161
+ */
162
+ disabled: boolean;
163
+
164
+ /**
165
+ * When true, the user can not modify the editor content, but can copy it.
166
+ */
167
+ readonly: boolean;
168
+
169
+ /**
170
+ * An object used to localize this component. The properties are used
171
+ * e.g. as the tooltips for the editor toolbar buttons.
172
+ */
173
+ i18n: RichTextEditorI18n;
174
+
175
+ /**
176
+ * Sets content represented by HTML snippet into the editor.
177
+ * The snippet is interpreted by [Quill's Clipboard matchers](https://quilljs.com/docs/modules/clipboard/#matchers),
178
+ * which may not produce the exactly input HTML.
179
+ *
180
+ * **NOTE:** Improper handling of HTML can lead to cross site scripting (XSS) and failure to sanitize
181
+ * properly is both notoriously error-prone and a leading cause of web vulnerabilities.
182
+ * This method is aptly named to ensure the developer has taken the necessary precautions.
183
+ */
184
+ dangerouslySetHtmlValue(htmlValue: string): void;
185
+
96
186
  addEventListener<K extends keyof RichTextEditorEventMap>(
97
187
  type: K,
98
188
  listener: (this: RichTextEditor, ev: RichTextEditorEventMap[K]) => void,