@vaadin/rich-text-editor 25.1.0-alpha8 → 25.1.0-beta1

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-alpha8",
3
+ "version": "25.1.0-beta1",
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-alpha8",
39
- "@vaadin/button": "25.1.0-alpha8",
40
- "@vaadin/component-base": "25.1.0-alpha8",
41
- "@vaadin/confirm-dialog": "25.1.0-alpha8",
42
- "@vaadin/overlay": "25.1.0-alpha8",
43
- "@vaadin/text-field": "25.1.0-alpha8",
44
- "@vaadin/tooltip": "25.1.0-alpha8",
45
- "@vaadin/vaadin-themable-mixin": "25.1.0-alpha8",
38
+ "@vaadin/a11y-base": "25.1.0-beta1",
39
+ "@vaadin/button": "25.1.0-beta1",
40
+ "@vaadin/component-base": "25.1.0-beta1",
41
+ "@vaadin/confirm-dialog": "25.1.0-beta1",
42
+ "@vaadin/overlay": "25.1.0-beta1",
43
+ "@vaadin/text-field": "25.1.0-beta1",
44
+ "@vaadin/tooltip": "25.1.0-beta1",
45
+ "@vaadin/vaadin-themable-mixin": "25.1.0-beta1",
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-alpha8",
51
- "@vaadin/chai-plugins": "25.1.0-alpha8",
52
- "@vaadin/test-runner-commands": "25.1.0-alpha8",
50
+ "@vaadin/aura": "25.1.0-beta1",
51
+ "@vaadin/chai-plugins": "25.1.0-beta1",
52
+ "@vaadin/test-runner-commands": "25.1.0-beta1",
53
53
  "@vaadin/testing-helpers": "^2.0.0",
54
- "@vaadin/vaadin-lumo-styles": "25.1.0-alpha8",
54
+ "@vaadin/vaadin-lumo-styles": "25.1.0-beta1",
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": "810590c9c7682a9326c9352df795b5ea4891a71f"
63
+ "gitHead": "0ccf77c385fc6a92ac2a6344ce8804b94956226d"
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',
@@ -379,6 +381,23 @@ export const RichTextEditorMixin = (superClass) =>
379
381
  }
380
382
  });
381
383
 
384
+ // Workaround for Quill 2.0 reporting stale selection on navigation keys.
385
+ // Quill's selectionchange handler reads the selection before the browser
386
+ // commits the new cursor position, causing toolbar to show previous format.
387
+ // Deferring via rAF ensures we read the correct, committed selection.
388
+ // See https://github.com/slab/quill/issues/4305
389
+ // See https://github.com/slab/quill/issues/4168
390
+ editorContent.addEventListener('keydown', (e) => {
391
+ if (NAVIGATION_KEYS.includes(e.key)) {
392
+ requestAnimationFrame(() => {
393
+ const selection = this._editor.getSelection();
394
+ if (selection) {
395
+ this._editor.getModule('toolbar').update(selection);
396
+ }
397
+ });
398
+ }
399
+ });
400
+
382
401
  editorContent.addEventListener('blur', () => {
383
402
  if (this.__tabBindings) {
384
403
  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-alpha8",
4
+ "version": "25.1.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -10,15 +10,6 @@
10
10
  "name": "vaadin-rich-text-editor",
11
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```html\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\n-------------|------------------------------\n`disabled` | Set to a disabled text editor\n`readonly` | Set to a readonly text editor\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 history controls\n`toolbar-group-emphasis` | The group for emphasis controls\n`toolbar-group-heading` | The group for heading controls\n`toolbar-group-style` | The group for style controls\n`toolbar-group-glyph-transformation` | The group for glyph transformation controls\n`toolbar-group-list` | The group for list controls\n`toolbar-group-indent` | The group for indentation 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-pressed` | The toolbar button in pressed state (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-color` | The \"color\" button\n`toolbar-button-background` | The \"background\" 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-outdent` | The \"decrease indentation\" button\n`toolbar-button-indent` | The \"increase indentation\" 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\nThe following custom CSS properties are available for styling:\n\nCustom CSS property |\n:-------------------------------|\n`--vaadin-rich-text-editor-background` |\n`--vaadin-rich-text-editor-content-color` |\n`--vaadin-rich-text-editor-content-font-size` |\n`--vaadin-rich-text-editor-content-line-height` |\n`--vaadin-rich-text-editor-content-padding` |\n`--vaadin-rich-text-editor-toolbar-background` |\n`--vaadin-rich-text-editor-toolbar-gap` |\n`--vaadin-rich-text-editor-toolbar-padding` |\n`--vaadin-rich-text-editor-toolbar-button-background` |\n`--vaadin-rich-text-editor-toolbar-button-border-width` |\n`--vaadin-rich-text-editor-toolbar-button-border-color` |\n`--vaadin-rich-text-editor-toolbar-button-border-radius` |\n`--vaadin-rich-text-editor-toolbar-button-text-color` |\n`--vaadin-rich-text-editor-toolbar-button-padding` |\n\nSee [Styling Components](https://vaadin.com/docs/latest/styling/styling-components) documentation.",
12
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
13
  {
23
14
  "name": "disabled",
24
15
  "description": "When true, the user can not modify, nor copy the editor content.",
@@ -47,34 +38,45 @@
47
38
  "undefined"
48
39
  ]
49
40
  }
41
+ },
42
+ {
43
+ "name": "value",
44
+ "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
+ "value": {
46
+ "type": [
47
+ "string"
48
+ ]
49
+ }
50
50
  }
51
51
  ],
52
52
  "js": {
53
53
  "properties": [
54
54
  {
55
- "name": "i18n",
56
- "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.",
55
+ "name": "colorOptions",
56
+ "description": "The list of colors used by the background and text color\nselection controls. Should contain an array of HEX strings.\n\nWhen user selects `#000000` (black) as a text color,\nor `#ffffff` (white) as a background color, it resets\nthe corresponding format for the selected text.",
57
57
  "value": {
58
58
  "type": [
59
- "RichTextEditorI18n"
59
+ "Array",
60
+ "null",
61
+ "undefined"
60
62
  ]
61
63
  }
62
64
  },
63
65
  {
64
- "name": "value",
65
- "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.",
66
+ "name": "disabled",
67
+ "description": "When true, the user can not modify, nor copy the editor content.",
66
68
  "value": {
67
69
  "type": [
68
- "string"
70
+ "boolean"
69
71
  ]
70
72
  }
71
73
  },
72
74
  {
73
- "name": "disabled",
74
- "description": "When true, the user can not modify, nor copy the editor content.",
75
+ "name": "i18n",
76
+ "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.",
75
77
  "value": {
76
78
  "type": [
77
- "boolean"
79
+ "RichTextEditorI18n"
78
80
  ]
79
81
  }
80
82
  },
@@ -88,25 +90,23 @@
88
90
  }
89
91
  },
90
92
  {
91
- "name": "colorOptions",
92
- "description": "The list of colors used by the background and text color\nselection controls. Should contain an array of HEX strings.\n\nWhen user selects `#000000` (black) as a text color,\nor `#ffffff` (white) as a background color, it resets\nthe corresponding format for the selected text.",
93
+ "name": "value",
94
+ "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.",
93
95
  "value": {
94
96
  "type": [
95
- "Array",
96
- "null",
97
- "undefined"
97
+ "string"
98
98
  ]
99
99
  }
100
100
  }
101
101
  ],
102
102
  "events": [
103
- {
104
- "name": "value-changed",
105
- "description": "Fired when the `value` property changes."
106
- },
107
103
  {
108
104
  "name": "html-value-changed",
109
105
  "description": "Fired when the `htmlValue` property changes."
106
+ },
107
+ {
108
+ "name": "value-changed",
109
+ "description": "Fired when the `value` property changes."
110
110
  }
111
111
  ]
112
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-alpha8",
4
+ "version": "25.1.0-beta1",
5
5
  "description-markup": "markdown",
6
6
  "framework": "lit",
7
7
  "framework-config": {
@@ -33,6 +33,13 @@
33
33
  "kind": "expression"
34
34
  }
35
35
  },
36
+ {
37
+ "name": ".colorOptions",
38
+ "description": "The list of colors used by the background and text color\nselection controls. Should contain an array of HEX strings.\n\nWhen user selects `#000000` (black) as a text color,\nor `#ffffff` (white) as a background color, it resets\nthe corresponding format for the selected text.",
39
+ "value": {
40
+ "kind": "expression"
41
+ }
42
+ },
36
43
  {
37
44
  "name": ".i18n",
38
45
  "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.",
@@ -48,8 +55,8 @@
48
55
  }
49
56
  },
50
57
  {
51
- "name": ".colorOptions",
52
- "description": "The list of colors used by the background and text color\nselection controls. Should contain an array of HEX strings.\n\nWhen user selects `#000000` (black) as a text color,\nor `#ffffff` (white) as a background color, it resets\nthe corresponding format for the selected text.",
58
+ "name": "@html-value-changed",
59
+ "description": "Fired when the `htmlValue` property changes.",
53
60
  "value": {
54
61
  "kind": "expression"
55
62
  }
@@ -60,13 +67,6 @@
60
67
  "value": {
61
68
  "kind": "expression"
62
69
  }
63
- },
64
- {
65
- "name": "@html-value-changed",
66
- "description": "Fired when the `htmlValue` property changes.",
67
- "value": {
68
- "kind": "expression"
69
- }
70
70
  }
71
71
  ]
72
72
  }