@vaadin/rich-text-editor 25.1.0-alpha9 → 25.1.0-beta2

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": "25.1.0-alpha9",
3
+ "version": "25.1.0-beta2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -35,23 +35,23 @@
35
35
  ],
36
36
  "dependencies": {
37
37
  "@open-wc/dedupe-mixin": "^1.3.0",
38
- "@vaadin/a11y-base": "25.1.0-alpha9",
39
- "@vaadin/button": "25.1.0-alpha9",
40
- "@vaadin/component-base": "25.1.0-alpha9",
41
- "@vaadin/confirm-dialog": "25.1.0-alpha9",
42
- "@vaadin/overlay": "25.1.0-alpha9",
43
- "@vaadin/text-field": "25.1.0-alpha9",
44
- "@vaadin/tooltip": "25.1.0-alpha9",
45
- "@vaadin/vaadin-themable-mixin": "25.1.0-alpha9",
38
+ "@vaadin/a11y-base": "25.1.0-beta2",
39
+ "@vaadin/button": "25.1.0-beta2",
40
+ "@vaadin/component-base": "25.1.0-beta2",
41
+ "@vaadin/confirm-dialog": "25.1.0-beta2",
42
+ "@vaadin/overlay": "25.1.0-beta2",
43
+ "@vaadin/text-field": "25.1.0-beta2",
44
+ "@vaadin/tooltip": "25.1.0-beta2",
45
+ "@vaadin/vaadin-themable-mixin": "25.1.0-beta2",
46
46
  "lit": "^3.0.0"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@vaadin/a11y-base": "25.1.0-alpha0",
50
- "@vaadin/aura": "25.1.0-alpha9",
51
- "@vaadin/chai-plugins": "25.1.0-alpha9",
52
- "@vaadin/test-runner-commands": "25.1.0-alpha9",
50
+ "@vaadin/aura": "25.1.0-beta2",
51
+ "@vaadin/chai-plugins": "25.1.0-beta2",
52
+ "@vaadin/test-runner-commands": "25.1.0-beta2",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.1.0-alpha9",
54
+ "@vaadin/vaadin-lumo-styles": "25.1.0-beta2",
55
55
  "sinon": "^21.0.0"
56
56
  },
57
57
  "cvdlName": "vaadin-rich-text-editor",
@@ -60,5 +60,5 @@
60
60
  "web-types.json",
61
61
  "web-types.lit.json"
62
62
  ],
63
- "gitHead": "ef432311376ba3dac4233cb23d393a49a425e0a4"
63
+ "gitHead": "ffbedbae08a5160d13bcd1c6fcaa328df5103a05"
64
64
  }
@@ -37,6 +37,8 @@ class CodeBlockContainer extends QuillCodeBlockContainer {
37
37
 
38
38
  Quill.register('formats/code-block-container', CodeBlockContainer, true);
39
39
 
40
+ const NAVIGATION_KEYS = ['ArrowUp', 'ArrowDown', 'ArrowLeft', 'ArrowRight', 'Home', 'End', 'PageUp', 'PageDown'];
41
+
40
42
  const HANDLERS = [
41
43
  'bold',
42
44
  'italic',
@@ -114,7 +116,6 @@ export const RichTextEditorMixin = (superClass) =>
114
116
  * ```
115
117
  *
116
118
  * See also https://github.com/quilljs/delta for detailed documentation.
117
- * @type {string}
118
119
  */
119
120
  value: {
120
121
  type: String,
@@ -134,7 +135,6 @@ export const RichTextEditorMixin = (superClass) =>
134
135
 
135
136
  /**
136
137
  * When true, the user can not modify, nor copy the editor content.
137
- * @type {boolean}
138
138
  */
139
139
  disabled: {
140
140
  type: Boolean,
@@ -144,7 +144,6 @@ export const RichTextEditorMixin = (superClass) =>
144
144
 
145
145
  /**
146
146
  * When true, the user can not modify the editor content, but can copy it.
147
- * @type {boolean}
148
147
  */
149
148
  readonly: {
150
149
  type: Boolean,
@@ -254,7 +253,7 @@ export const RichTextEditorMixin = (superClass) =>
254
253
  * The properties are used e.g. as the tooltips for the editor toolbar
255
254
  * buttons.
256
255
  *
257
- * @return {!RichTextEditorI18n}
256
+ * @type {!RichTextEditorI18n}
258
257
  */
259
258
  get i18n() {
260
259
  return super.i18n;
@@ -379,6 +378,23 @@ export const RichTextEditorMixin = (superClass) =>
379
378
  }
380
379
  });
381
380
 
381
+ // Workaround for Quill 2.0 reporting stale selection on navigation keys.
382
+ // Quill's selectionchange handler reads the selection before the browser
383
+ // commits the new cursor position, causing toolbar to show previous format.
384
+ // Deferring via rAF ensures we read the correct, committed selection.
385
+ // See https://github.com/slab/quill/issues/4305
386
+ // See https://github.com/slab/quill/issues/4168
387
+ editorContent.addEventListener('keydown', (e) => {
388
+ if (NAVIGATION_KEYS.includes(e.key)) {
389
+ requestAnimationFrame(() => {
390
+ const selection = this._editor.getSelection();
391
+ if (selection) {
392
+ this._editor.getModule('toolbar').update(selection);
393
+ }
394
+ });
395
+ }
396
+ });
397
+
382
398
  editorContent.addEventListener('blur', () => {
383
399
  if (this.__tabBindings) {
384
400
  this._editor.keyboard.bindings.Tab = this.__tabBindings;
package/web-types.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": "25.1.0-alpha9",
4
+ "version": "25.1.0-beta2",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -15,7 +15,9 @@
15
15
  "description": "When true, the user can not modify, nor copy the editor content.",
16
16
  "value": {
17
17
  "type": [
18
- "boolean"
18
+ "boolean",
19
+ "null",
20
+ "undefined"
19
21
  ]
20
22
  }
21
23
  },
@@ -24,7 +26,9 @@
24
26
  "description": "When true, the user can not modify the editor content, but can copy it.",
25
27
  "value": {
26
28
  "type": [
27
- "boolean"
29
+ "boolean",
30
+ "null",
31
+ "undefined"
28
32
  ]
29
33
  }
30
34
  },
@@ -44,7 +48,9 @@
44
48
  "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.",
45
49
  "value": {
46
50
  "type": [
47
- "string"
51
+ "string",
52
+ "null",
53
+ "undefined"
48
54
  ]
49
55
  }
50
56
  }
@@ -67,7 +73,9 @@
67
73
  "description": "When true, the user can not modify, nor copy the editor content.",
68
74
  "value": {
69
75
  "type": [
70
- "boolean"
76
+ "boolean",
77
+ "null",
78
+ "undefined"
71
79
  ]
72
80
  }
73
81
  },
@@ -76,7 +84,7 @@
76
84
  "description": "The object used to localize this component. To change the default\nlocalization, replace this with an object that provides all properties, or\njust the individual properties you want to change.\n\nThe properties are used e.g. as the tooltips for the editor toolbar\nbuttons.",
77
85
  "value": {
78
86
  "type": [
79
- "RichTextEditorI18n"
87
+ "?"
80
88
  ]
81
89
  }
82
90
  },
@@ -85,7 +93,9 @@
85
93
  "description": "When true, the user can not modify the editor content, but can copy it.",
86
94
  "value": {
87
95
  "type": [
88
- "boolean"
96
+ "boolean",
97
+ "null",
98
+ "undefined"
89
99
  ]
90
100
  }
91
101
  },
@@ -94,7 +104,9 @@
94
104
  "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.",
95
105
  "value": {
96
106
  "type": [
97
- "string"
107
+ "string",
108
+ "null",
109
+ "undefined"
98
110
  ]
99
111
  }
100
112
  }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/web-types",
3
3
  "name": "@vaadin/rich-text-editor",
4
- "version": "25.1.0-alpha9",
4
+ "version": "25.1.0-beta2",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {