@progress/kendo-react-editor 5.6.0-dev.202208090813 → 5.6.0-dev.202208100947

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.
@@ -40,6 +40,9 @@ export declare class Editor extends React.Component<EditorProps, EditorStateInte
40
40
  contentStyle: PropTypes.Requireable<object>;
41
41
  dir: PropTypes.Requireable<string>;
42
42
  className: PropTypes.Requireable<string>;
43
+ ariaDescribedBy: PropTypes.Requireable<string>;
44
+ ariaLabelledBy: PropTypes.Requireable<string>;
45
+ ariaLabel: PropTypes.Requireable<string>;
43
46
  style: PropTypes.Requireable<object>;
44
47
  tools: PropTypes.Requireable<any[]>;
45
48
  keyboardNavigation: PropTypes.Requireable<boolean>;
package/dist/es/Editor.js CHANGED
@@ -35,7 +35,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
35
35
  };
36
36
  import * as React from 'react';
37
37
  import * as PropTypes from 'prop-types';
38
- import { ButtonGroup, Toolbar, ToolbarSeparator } from '@progress/kendo-react-buttons';
38
+ import { ButtonGroup, Toolbar, ToolbarSeparator, toolbarButtons } from '@progress/kendo-react-buttons';
39
39
  import { classNames } from '@progress/kendo-react-common';
40
40
  import { EditorState, Plugin, PluginKey, EditorView, Schema, baseKeymap, keymap, history, dropCursor, gapCursor, getMark, spacesFix, tableEditing, caretColor } from '@progress/kendo-editor-common';
41
41
  import { marks, nodes } from './config/schema';
@@ -49,6 +49,8 @@ var link = EditorToolsSettings.link, bold = EditorToolsSettings.bold, italic = E
49
49
  import { firefox } from './utils/browser-detection';
50
50
  import * as licensing from '@progress/kendo-licensing';
51
51
  import { packageMetadata } from './package-metadata';
52
+ import { messages, keys } from './messages';
53
+ import { registerForLocalization, provideLocalizationService } from '@progress/kendo-react-intl';
52
54
  /**
53
55
  * Represents the [KendoReact Editor component]({% slug overview_editor %}).
54
56
  *
@@ -280,6 +282,7 @@ var Editor = /** @class */ (function (_super) {
280
282
  Editor.prototype.render = function () {
281
283
  var _this = this;
282
284
  var _a = this.props, _b = _a.tools, tools = _b === void 0 ? [] : _b, _c = _a.defaultEditMode, defaultEditMode = _c === void 0 ? 'iframe' : _c, _d = _a.preserveWhitespace, preserveWhitespace = _d === void 0 ? 'full' : _d, style = _a.style, className = _a.className;
285
+ var localization = provideLocalizationService(this);
283
286
  if (this.view) {
284
287
  var editorProps = editorPropsKey.getState(this.view.state);
285
288
  editorProps.preserveWhitespace = preserveWhitespace;
@@ -299,9 +302,9 @@ var Editor = /** @class */ (function (_super) {
299
302
  (React.createElement("div", { className: "k-editor-content" },
300
303
  React.createElement("iframe", { onLoad: firefox ? function () {
301
304
  _this.initialize();
302
- } : undefined, ref: function (e) { return _this.iframe = e; }, frameBorder: "0", style: contentStyle, className: "k-iframe" }))) :
305
+ } : undefined, ref: function (e) { return _this.iframe = e; }, frameBorder: "0", title: localization.toLanguageString(keys.iframeTitle, messages[keys.iframeTitle]), style: contentStyle, className: "k-iframe" }))) :
303
306
  (React.createElement("div", { style: contentStyle, className: "k-editor-content" },
304
- React.createElement("div", { ref: function (e) { return _this._contentElement = e; }, suppressContentEditableWarning: true }))),
307
+ React.createElement("div", { ref: function (e) { return _this._contentElement = e; }, suppressContentEditableWarning: true, role: "textbox", "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, "aria-label": this.props.ariaLabel }))),
305
308
  this.renderDialog(EditorDialogs.InsertLinkDialog, link, 'linkDialog')));
306
309
  };
307
310
  Editor.prototype.initialize = function () {
@@ -370,6 +373,17 @@ var Editor = /** @class */ (function (_super) {
370
373
  }
371
374
  }
372
375
  return !linkDialog;
376
+ }, 'Alt-F10': function () {
377
+ var _a;
378
+ var toolbar = (_a = _this.element) === null || _a === void 0 ? void 0 : _a.querySelector('.k-toolbar');
379
+ if (toolbar) {
380
+ var button = toolbar.querySelector(toolbarButtons.join(','));
381
+ if (button) {
382
+ button.focus();
383
+ return true;
384
+ }
385
+ }
386
+ return false;
373
387
  } });
374
388
  var _b = this.props, _c = _b.defaultContent, defaultContent = _c === void 0 ? '' : _c, value = _b.value, onMount = _b.onMount;
375
389
  var doc = (value && typeof value !== 'string') ? value :
@@ -403,6 +417,9 @@ var Editor = /** @class */ (function (_super) {
403
417
  contentStyle: PropTypes.object,
404
418
  dir: PropTypes.string,
405
419
  className: PropTypes.string,
420
+ ariaDescribedBy: PropTypes.string,
421
+ ariaLabelledBy: PropTypes.string,
422
+ ariaLabel: PropTypes.string,
406
423
  style: PropTypes.object,
407
424
  tools: PropTypes.arrayOf(PropTypes.any),
408
425
  keyboardNavigation: PropTypes.bool,
@@ -418,3 +435,4 @@ var Editor = /** @class */ (function (_super) {
418
435
  return Editor;
419
436
  }(React.Component));
420
437
  export { Editor };
438
+ registerForLocalization(Editor);
@@ -128,6 +128,18 @@ export interface EditorProps {
128
128
  * Sets styles to the Editor.
129
129
  */
130
130
  style?: React.CSSProperties;
131
+ /**
132
+ * Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
133
+ */
134
+ ariaDescribedBy?: string;
135
+ /**
136
+ * Identifies the element(s) which will label the component.
137
+ */
138
+ ariaLabelledBy?: string;
139
+ /**
140
+ * The accessible label of the component.
141
+ */
142
+ ariaLabel?: string;
131
143
  /**
132
144
  * Specifies if the Editor will be resizable.
133
145
  */
@@ -80,6 +80,7 @@ export declare const messages: {
80
80
  "editor.findReplace-prevMatch": string;
81
81
  "editor.findReplace-nextMatch": string;
82
82
  "editor.findReplace-matches": string;
83
+ "editor.iframeTitle": string;
83
84
  };
84
85
  /**
85
86
  * @hidden
@@ -163,4 +164,5 @@ export declare const keys: {
163
164
  findReplacePrevMatch: string;
164
165
  findReplaceNextMatch: string;
165
166
  findReplaceMatches: string;
167
+ iframeTitle: string;
166
168
  };
@@ -311,6 +311,10 @@ var findReplaceNextMatch = 'editor.findReplace-nextMatch';
311
311
  * @hidden
312
312
  */
313
313
  var findReplaceMatches = 'editor.findReplace-matches';
314
+ /**
315
+ * @hidden
316
+ */
317
+ var iframeTitle = 'editor.iframeTitle';
314
318
  /**
315
319
  * @hidden
316
320
  */
@@ -399,6 +403,7 @@ export var messages = (_a = {},
399
403
  _a[findReplacePrevMatch] = 'Prev',
400
404
  _a[findReplaceNextMatch] = 'Next',
401
405
  _a[findReplaceMatches] = '{0} of {1} matches',
406
+ _a[iframeTitle] = 'Editable area. Press Alt + F10 for toolbar.',
402
407
  _a);
403
408
  /**
404
409
  * @hidden
@@ -481,5 +486,6 @@ export var keys = {
481
486
  findReplaceUseRegExp: findReplaceUseRegExp,
482
487
  findReplacePrevMatch: findReplacePrevMatch,
483
488
  findReplaceNextMatch: findReplaceNextMatch,
484
- findReplaceMatches: findReplaceMatches
489
+ findReplaceMatches: findReplaceMatches,
490
+ iframeTitle: iframeTitle
485
491
  };
@@ -5,7 +5,7 @@ export var packageMetadata = {
5
5
  name: '@progress/kendo-react-editor',
6
6
  productName: 'KendoReact',
7
7
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
8
- publishDate: 1660031856,
8
+ publishDate: 1660124040,
9
9
  version: '',
10
10
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
11
11
  };
@@ -80,7 +80,7 @@ export var FontStyleToolNS;
80
80
  defaultItem.text = defaultItem.localizationKey ? localization.toLanguageString(defaultItem.localizationKey, messages[defaultItem.localizationKey]) : defaultItem.text;
81
81
  }
82
82
  var value = new Set(styles).size === 1 ? styles[0] : null;
83
- var dropdown = (React.createElement(DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, data: items, defaultItem: defaultItem, itemRender: itemRender, textField: "text", dataItemKey: "value", onChange: this.onChange, style: userSelectNone, leftRightKeysNavigation: false }, ddlProps)));
83
+ var dropdown = (React.createElement(DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, data: items, defaultItem: defaultItem, itemRender: itemRender, textField: "text", dataItemKey: "value", onChange: this.onChange, style: userSelectNone, leftRightKeysNavigation: false, title: defaultItem.text }, ddlProps)));
84
84
  return render ? render.call(undefined, dropdown, { view: view }) : dropdown;
85
85
  };
86
86
  return DropDownListTool;
@@ -78,7 +78,7 @@ export var FormatBlockToolNS;
78
78
  defaultItem.text = defaultItem.localizationKey ? localization.toLanguageString(defaultItem.localizationKey, messages[defaultItem.localizationKey]) : defaultItem.text;
79
79
  }
80
80
  var value = new Set(formats).size === 1 ? formats[0] : null;
81
- var dropdown = (React.createElement(DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, onChange: this.onChange, itemRender: itemRender, data: items, defaultItem: defaultItem, textField: "text", dataItemKey: "value", style: userSelectNone, leftRightKeysNavigation: false }, ddlProps)));
81
+ var dropdown = (React.createElement(DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, onChange: this.onChange, itemRender: itemRender, data: items, defaultItem: defaultItem, textField: "text", dataItemKey: "value", style: userSelectNone, leftRightKeysNavigation: false, title: defaultItem.text }, ddlProps)));
82
82
  return render ? render.call(undefined, dropdown, { view: view }) : dropdown;
83
83
  };
84
84
  return FormatBlockDropDownList;
@@ -40,6 +40,9 @@ export declare class Editor extends React.Component<EditorProps, EditorStateInte
40
40
  contentStyle: PropTypes.Requireable<object>;
41
41
  dir: PropTypes.Requireable<string>;
42
42
  className: PropTypes.Requireable<string>;
43
+ ariaDescribedBy: PropTypes.Requireable<string>;
44
+ ariaLabelledBy: PropTypes.Requireable<string>;
45
+ ariaLabel: PropTypes.Requireable<string>;
43
46
  style: PropTypes.Requireable<object>;
44
47
  tools: PropTypes.Requireable<any[]>;
45
48
  keyboardNavigation: PropTypes.Requireable<boolean>;
@@ -52,6 +52,8 @@ var link = toolsSettings_1.EditorToolsSettings.link, bold = toolsSettings_1.Edit
52
52
  var browser_detection_1 = require("./utils/browser-detection");
53
53
  var licensing = require("@progress/kendo-licensing");
54
54
  var package_metadata_1 = require("./package-metadata");
55
+ var messages_1 = require("./messages");
56
+ var kendo_react_intl_1 = require("@progress/kendo-react-intl");
55
57
  /**
56
58
  * Represents the [KendoReact Editor component]({% slug overview_editor %}).
57
59
  *
@@ -283,6 +285,7 @@ var Editor = /** @class */ (function (_super) {
283
285
  Editor.prototype.render = function () {
284
286
  var _this = this;
285
287
  var _a = this.props, _b = _a.tools, tools = _b === void 0 ? [] : _b, _c = _a.defaultEditMode, defaultEditMode = _c === void 0 ? 'iframe' : _c, _d = _a.preserveWhitespace, preserveWhitespace = _d === void 0 ? 'full' : _d, style = _a.style, className = _a.className;
288
+ var localization = (0, kendo_react_intl_1.provideLocalizationService)(this);
286
289
  if (this.view) {
287
290
  var editorProps = props_key_1.editorPropsKey.getState(this.view.state);
288
291
  editorProps.preserveWhitespace = preserveWhitespace;
@@ -302,9 +305,9 @@ var Editor = /** @class */ (function (_super) {
302
305
  (React.createElement("div", { className: "k-editor-content" },
303
306
  React.createElement("iframe", { onLoad: browser_detection_1.firefox ? function () {
304
307
  _this.initialize();
305
- } : undefined, ref: function (e) { return _this.iframe = e; }, frameBorder: "0", style: contentStyle, className: "k-iframe" }))) :
308
+ } : undefined, ref: function (e) { return _this.iframe = e; }, frameBorder: "0", title: localization.toLanguageString(messages_1.keys.iframeTitle, messages_1.messages[messages_1.keys.iframeTitle]), style: contentStyle, className: "k-iframe" }))) :
306
309
  (React.createElement("div", { style: contentStyle, className: "k-editor-content" },
307
- React.createElement("div", { ref: function (e) { return _this._contentElement = e; }, suppressContentEditableWarning: true }))),
310
+ React.createElement("div", { ref: function (e) { return _this._contentElement = e; }, suppressContentEditableWarning: true, role: "textbox", "aria-labelledby": this.props.ariaLabelledBy, "aria-describedby": this.props.ariaDescribedBy, "aria-label": this.props.ariaLabel }))),
308
311
  this.renderDialog(main_1.EditorDialogs.InsertLinkDialog, link, 'linkDialog')));
309
312
  };
310
313
  Editor.prototype.initialize = function () {
@@ -373,6 +376,17 @@ var Editor = /** @class */ (function (_super) {
373
376
  }
374
377
  }
375
378
  return !linkDialog;
379
+ }, 'Alt-F10': function () {
380
+ var _a;
381
+ var toolbar = (_a = _this.element) === null || _a === void 0 ? void 0 : _a.querySelector('.k-toolbar');
382
+ if (toolbar) {
383
+ var button = toolbar.querySelector(kendo_react_buttons_1.toolbarButtons.join(','));
384
+ if (button) {
385
+ button.focus();
386
+ return true;
387
+ }
388
+ }
389
+ return false;
376
390
  } });
377
391
  var _b = this.props, _c = _b.defaultContent, defaultContent = _c === void 0 ? '' : _c, value = _b.value, onMount = _b.onMount;
378
392
  var doc = (value && typeof value !== 'string') ? value :
@@ -406,6 +420,9 @@ var Editor = /** @class */ (function (_super) {
406
420
  contentStyle: PropTypes.object,
407
421
  dir: PropTypes.string,
408
422
  className: PropTypes.string,
423
+ ariaDescribedBy: PropTypes.string,
424
+ ariaLabelledBy: PropTypes.string,
425
+ ariaLabel: PropTypes.string,
409
426
  style: PropTypes.object,
410
427
  tools: PropTypes.arrayOf(PropTypes.any),
411
428
  keyboardNavigation: PropTypes.bool,
@@ -421,3 +438,4 @@ var Editor = /** @class */ (function (_super) {
421
438
  return Editor;
422
439
  }(React.Component));
423
440
  exports.Editor = Editor;
441
+ (0, kendo_react_intl_1.registerForLocalization)(Editor);
@@ -128,6 +128,18 @@ export interface EditorProps {
128
128
  * Sets styles to the Editor.
129
129
  */
130
130
  style?: React.CSSProperties;
131
+ /**
132
+ * Identifies the element(s) which will describe the component, similar to [HTML aria-describedby attribute](https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/ARIA_Techniques/Using_the_aria-describedby_attribute).
133
+ */
134
+ ariaDescribedBy?: string;
135
+ /**
136
+ * Identifies the element(s) which will label the component.
137
+ */
138
+ ariaLabelledBy?: string;
139
+ /**
140
+ * The accessible label of the component.
141
+ */
142
+ ariaLabel?: string;
131
143
  /**
132
144
  * Specifies if the Editor will be resizable.
133
145
  */
@@ -80,6 +80,7 @@ export declare const messages: {
80
80
  "editor.findReplace-prevMatch": string;
81
81
  "editor.findReplace-nextMatch": string;
82
82
  "editor.findReplace-matches": string;
83
+ "editor.iframeTitle": string;
83
84
  };
84
85
  /**
85
86
  * @hidden
@@ -163,4 +164,5 @@ export declare const keys: {
163
164
  findReplacePrevMatch: string;
164
165
  findReplaceNextMatch: string;
165
166
  findReplaceMatches: string;
167
+ iframeTitle: string;
166
168
  };
@@ -314,6 +314,10 @@ var findReplaceNextMatch = 'editor.findReplace-nextMatch';
314
314
  * @hidden
315
315
  */
316
316
  var findReplaceMatches = 'editor.findReplace-matches';
317
+ /**
318
+ * @hidden
319
+ */
320
+ var iframeTitle = 'editor.iframeTitle';
317
321
  /**
318
322
  * @hidden
319
323
  */
@@ -402,6 +406,7 @@ exports.messages = (_a = {},
402
406
  _a[findReplacePrevMatch] = 'Prev',
403
407
  _a[findReplaceNextMatch] = 'Next',
404
408
  _a[findReplaceMatches] = '{0} of {1} matches',
409
+ _a[iframeTitle] = 'Editable area. Press Alt + F10 for toolbar.',
405
410
  _a);
406
411
  /**
407
412
  * @hidden
@@ -484,5 +489,6 @@ exports.keys = {
484
489
  findReplaceUseRegExp: findReplaceUseRegExp,
485
490
  findReplacePrevMatch: findReplacePrevMatch,
486
491
  findReplaceNextMatch: findReplaceNextMatch,
487
- findReplaceMatches: findReplaceMatches
492
+ findReplaceMatches: findReplaceMatches,
493
+ iframeTitle: iframeTitle
488
494
  };
@@ -8,7 +8,7 @@ exports.packageMetadata = {
8
8
  name: '@progress/kendo-react-editor',
9
9
  productName: 'KendoReact',
10
10
  productCodes: ['KENDOUIREACT', 'KENDOUICOMPLETE'],
11
- publishDate: 1660031856,
11
+ publishDate: 1660124040,
12
12
  version: '',
13
13
  licensingDocsUrl: 'https://www.telerik.com/kendo-react-ui/my-license/?utm_medium=product&utm_source=kendoreact&utm_campaign=kendo-ui-react-purchase-license-keys-warning'
14
14
  };
@@ -83,7 +83,7 @@ var FontStyleToolNS;
83
83
  defaultItem.text = defaultItem.localizationKey ? localization.toLanguageString(defaultItem.localizationKey, messages_1.messages[defaultItem.localizationKey]) : defaultItem.text;
84
84
  }
85
85
  var value = new Set(styles).size === 1 ? styles[0] : null;
86
- var dropdown = (React.createElement(kendo_react_dropdowns_1.DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, data: items, defaultItem: defaultItem, itemRender: utils_1.itemRender, textField: "text", dataItemKey: "value", onChange: this.onChange, style: utils_1.userSelectNone, leftRightKeysNavigation: false }, ddlProps)));
86
+ var dropdown = (React.createElement(kendo_react_dropdowns_1.DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, data: items, defaultItem: defaultItem, itemRender: utils_1.itemRender, textField: "text", dataItemKey: "value", onChange: this.onChange, style: utils_1.userSelectNone, leftRightKeysNavigation: false, title: defaultItem.text }, ddlProps)));
87
87
  return render ? render.call(undefined, dropdown, { view: view }) : dropdown;
88
88
  };
89
89
  return DropDownListTool;
@@ -81,7 +81,7 @@ var FormatBlockToolNS;
81
81
  defaultItem.text = defaultItem.localizationKey ? localization.toLanguageString(defaultItem.localizationKey, messages_1.messages[defaultItem.localizationKey]) : defaultItem.text;
82
82
  }
83
83
  var value = new Set(formats).size === 1 ? formats[0] : null;
84
- var dropdown = (React.createElement(kendo_react_dropdowns_1.DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, onChange: this.onChange, itemRender: utils_1.itemRender, data: items, defaultItem: defaultItem, textField: "text", dataItemKey: "value", style: utils_1.userSelectNone, leftRightKeysNavigation: false }, ddlProps)));
84
+ var dropdown = (React.createElement(kendo_react_dropdowns_1.DropDownList, __assign({ value: value ? items.find(function (i) { return i.value === value; }) : value, onChange: this.onChange, itemRender: utils_1.itemRender, data: items, defaultItem: defaultItem, textField: "text", dataItemKey: "value", style: utils_1.userSelectNone, leftRightKeysNavigation: false, title: defaultItem.text }, ddlProps)));
85
85
  return render ? render.call(undefined, dropdown, { view: view }) : dropdown;
86
86
  };
87
87
  return FormatBlockDropDownList;