@vaadin/rich-text-editor 22.0.2 → 23.0.0-alpha4

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": "22.0.2",
3
+ "version": "23.0.0-alpha4",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -18,6 +18,7 @@
18
18
  },
19
19
  "main": "vaadin-rich-text-editor.js",
20
20
  "module": "vaadin-rich-text-editor.js",
21
+ "type": "module",
21
22
  "scripts": {
22
23
  "icons": "gulp icons"
23
24
  },
@@ -37,14 +38,14 @@
37
38
  ],
38
39
  "dependencies": {
39
40
  "@polymer/polymer": "^3.0.0",
40
- "@vaadin/button": "^22.0.2",
41
- "@vaadin/component-base": "^22.0.2",
42
- "@vaadin/confirm-dialog": "^22.0.2",
43
- "@vaadin/text-field": "^22.0.2",
41
+ "@vaadin/button": "23.0.0-alpha4",
42
+ "@vaadin/component-base": "23.0.0-alpha4",
43
+ "@vaadin/confirm-dialog": "23.0.0-alpha4",
44
+ "@vaadin/text-field": "23.0.0-alpha4",
44
45
  "@vaadin/vaadin-license-checker": "^2.1.0",
45
- "@vaadin/vaadin-lumo-styles": "^22.0.2",
46
- "@vaadin/vaadin-material-styles": "^22.0.2",
47
- "@vaadin/vaadin-themable-mixin": "^22.0.2"
46
+ "@vaadin/vaadin-lumo-styles": "23.0.0-alpha4",
47
+ "@vaadin/vaadin-material-styles": "23.0.0-alpha4",
48
+ "@vaadin/vaadin-themable-mixin": "23.0.0-alpha4"
48
49
  },
49
50
  "devDependencies": {
50
51
  "@esm-bundle/chai": "^4.3.4",
@@ -54,5 +55,5 @@
54
55
  "gulp-iconfont": "^11.0.0",
55
56
  "sinon": "^9.2.1"
56
57
  },
57
- "gitHead": "df21370c4a655a38eac11f79686021ab3b0887ad"
58
+ "gitHead": "81e2deee5147bb7c1f4884760f4598613306f1fb"
58
59
  }
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2020 Vaadin Ltd
3
+ * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2021 Vaadin Ltd
3
+ * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
@@ -1,17 +1,14 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2020 Vaadin Ltd
3
+ * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import { css } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
7
  import { contentStyles } from './vaadin-rich-text-editor-content-styles.js';
8
8
  import { toolbarStyles } from './vaadin-rich-text-editor-toolbar-styles.js';
9
9
 
10
- const richTextEditorStyles = css`
11
- ${contentStyles}
12
- ${toolbarStyles}
13
-
14
- :host([readonly]) [part='toolbar'] {
10
+ export const statesStyles = css`
11
+ :host([readonly]) [part='toolbar'] {
15
12
  display: none;
16
13
  }
17
14
 
@@ -28,4 +25,4 @@ const richTextEditorStyles = css`
28
25
  }
29
26
  `;
30
27
 
31
- export { richTextEditorStyles };
28
+ export const richTextEditorStyles = [contentStyles, toolbarStyles, statesStyles];
@@ -1,14 +1,12 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2020 Vaadin Ltd
3
+ * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import { css, registerStyles } from '@vaadin/vaadin-themable-mixin/vaadin-themable-mixin.js';
7
7
  import { iconsStyles } from './vaadin-rich-text-editor-icons.js';
8
8
 
9
- export const toolbarStyles = css`
10
- ${iconsStyles}
11
-
9
+ export const buttonsStyles = css`
12
10
  [part='toolbar'] {
13
11
  display: flex;
14
12
  flex-wrap: wrap;
@@ -132,5 +130,7 @@ export const toolbarStyles = css`
132
130
  }
133
131
  `;
134
132
 
133
+ export const toolbarStyles = [iconsStyles, buttonsStyles];
134
+
135
135
  // Register a module with ID for backwards compatibility.
136
136
  registerStyles('', toolbarStyles, { moduleId: 'vaadin-rich-text-editor-toolbar-styles' });
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2020 Vaadin Ltd
3
+ * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import { ElementMixin } from '@vaadin/component-base/src/element-mixin.js';
@@ -34,6 +34,13 @@ export interface RichTextEditorI18n {
34
34
  remove: string;
35
35
  }
36
36
 
37
+ /**
38
+ * Fired when the user commits a value change.
39
+ */
40
+ export type RichTextEditorChangeEvent = Event & {
41
+ target: RichTextEditor;
42
+ };
43
+
37
44
  /**
38
45
  * Fired when the `htmlValue` property changes.
39
46
  */
@@ -50,7 +57,9 @@ export interface RichTextEditorCustomEventMap {
50
57
  'value-changed': RichTextEditorValueChangedEvent;
51
58
  }
52
59
 
53
- export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEditorCustomEventMap {}
60
+ export interface RichTextEditorEventMap extends HTMLElementEventMap, RichTextEditorCustomEventMap {
61
+ change: RichTextEditorChangeEvent;
62
+ }
54
63
 
55
64
  /**
56
65
  * `<vaadin-rich-text-editor>` is a Web Component for rich text editing.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * @license
3
- * Copyright (c) 2020 Vaadin Ltd
3
+ * Copyright (c) 2018 - 2022 Vaadin Ltd.
4
4
  * This program is available under Commercial Vaadin Developer License 4.0, available at https://vaadin.com/license/cvdl-4.0.
5
5
  */
6
6
  import '@vaadin/button/src/vaadin-button.js';
@@ -9,7 +9,6 @@ import '@vaadin/text-field/src/vaadin-text-field.js';
9
9
  import '@vaadin/vaadin-license-checker/vaadin-license-checker.js';
10
10
  import '../vendor/vaadin-quill.js';
11
11
  import './vaadin-rich-text-editor-toolbar-styles.js';
12
- import { resetMouseCanceller } from '@polymer/polymer/lib/utils/gestures.js';
13
12
  import { html, PolymerElement } from '@polymer/polymer/polymer-element.js';
14
13
  import { timeOut } from '@vaadin/component-base/src/async.js';
15
14
  import { isFirefox } from '@vaadin/component-base/src/browser-utils.js';
@@ -645,11 +644,14 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
645
644
  e.preventDefault();
646
645
  let index = buttons.indexOf(e.target);
647
646
  buttons[index].setAttribute('tabindex', '-1');
648
- if (e.keyCode === 39 && ++index === buttons.length) {
649
- index = 0;
650
- } else if (e.keyCode === 37 && --index === -1) {
651
- index = buttons.length - 1;
647
+
648
+ let step;
649
+ if (e.keyCode === 39) {
650
+ step = 1;
651
+ } else if (e.keyCode === 37) {
652
+ step = -1;
652
653
  }
654
+ index = (buttons.length + index + step) % buttons.length;
653
655
  buttons[index].removeAttribute('tabindex');
654
656
  buttons[index].focus();
655
657
  }
@@ -714,7 +716,9 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
714
716
  document.body.appendChild(this.__fakeTarget);
715
717
  // let the focus step out of shadow root!
716
718
  this.__fakeTarget.focus();
717
- return new Promise((resolve) => setTimeout(resolve));
719
+ return new Promise((resolve) => {
720
+ setTimeout(resolve);
721
+ });
718
722
  };
719
723
 
720
724
  const focusBack = (offsetNode, offset) => {
@@ -992,18 +996,9 @@ class RichTextEditor extends ElementMixin(ThemableMixin(PolymerElement)) {
992
996
  _onImageTouchEnd(e) {
993
997
  // Cancel the event to avoid the following click event
994
998
  e.preventDefault();
995
- // FIXME(platosha): workaround for Polymer Gestures mouseCanceller
996
- // cancelling the following synthetic click. See also:
997
- // https://github.com/Polymer/polymer/issues/5289
998
- this.__resetMouseCanceller();
999
999
  this._onImageClick();
1000
1000
  }
1001
1001
 
1002
- /** @private */
1003
- __resetMouseCanceller() {
1004
- resetMouseCanceller();
1005
- }
1006
-
1007
1002
  /** @private */
1008
1003
  _onImageClick() {
1009
1004
  this.$.fileInput.value = '';