@vaadin/rich-text-editor 24.3.0-alpha1 → 24.3.0-alpha11

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.
@@ -12,6 +12,35 @@ 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
+
15
44
  export const statesStyles = css`
16
45
  :host([readonly]) [part='toolbar'] {
17
46
  display: none;
@@ -30,4 +59,4 @@ export const statesStyles = css`
30
59
  }
31
60
  `;
32
61
 
33
- export const richTextEditorStyles = [contentStyles, toolbarStyles, statesStyles];
62
+ export const richTextEditorStyles = [baseStyles, contentStyles, toolbarStyles, statesStyles];
@@ -10,34 +10,8 @@
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
-
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
- }
13
+ import { type RichTextEditorCustomEventMap, RichTextEditorMixin } from './vaadin-rich-text-editor-mixin.js';
14
+ export * from './vaadin-rich-text-editor-mixin.js';
41
15
 
42
16
  /**
43
17
  * Fired when the user commits a value change.
@@ -46,22 +20,6 @@ export type RichTextEditorChangeEvent = Event & {
46
20
  target: RichTextEditor;
47
21
  };
48
22
 
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
-
65
23
  export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEditorCustomEventMap {
66
24
  change: RichTextEditorChangeEvent;
67
25
  }
@@ -106,6 +64,7 @@ export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEdi
106
64
  * `toolbar-group-block` | The group for preformatted block controls
107
65
  * `toolbar-group-format` | The group for format controls
108
66
  * `toolbar-button` | The toolbar button (applies to all buttons)
67
+ * `toolbar-button-pressed` | The toolbar button in pressed state (applies to all buttons)
109
68
  * `toolbar-button-undo` | The "undo" button
110
69
  * `toolbar-button-redo` | The "redo" button
111
70
  * `toolbar-button-bold` | The "bold" button
@@ -134,55 +93,7 @@ export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEdi
134
93
  * @fires {CustomEvent} html-value-changed - Fired when the `htmlValue` property changes.
135
94
  * @fires {CustomEvent} value-changed - Fired when the `value` property changes.
136
95
  */
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
+ declare class RichTextEditor extends RichTextEditorMixin(ElementMixin(ThemableMixin(HTMLElement))) {
186
97
  addEventListener<K extends keyof RichTextEditorEventMap>(
187
98
  type: K,
188
99
  listener: (this: RichTextEditor, ev: RichTextEditorEventMap[K]) => void,