@atlaskit/editor-plugin-floating-toolbar 0.7.13 → 0.7.14

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.
@@ -10,8 +10,9 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
10
10
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13;
11
11
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
12
12
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
13
+ /** @jsx jsx */
13
14
  import React, { Component } from 'react';
14
- import { css } from '@emotion/react';
15
+ import { css, jsx } from '@emotion/react';
15
16
  import { injectIntl } from 'react-intl-next';
16
17
  import ButtonGroup from '@atlaskit/button/button-group';
17
18
  import { areSameItems } from '@atlaskit/editor-common/floating-toolbar';
@@ -53,7 +54,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
53
54
  featureFlags = _ref.featureFlags,
54
55
  api = _ref.api;
55
56
  var emojiAndColourPickerMountPoint = scrollable ? popupsMountPoint || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.fabric-editor-popup-scroll-parent')) || (editorView === null || editorView === void 0 ? void 0 : editorView.dom.closest('.ak-editor-content-area')) || undefined : popupsMountPoint;
56
- return /*#__PURE__*/React.createElement(ButtonGroup, null, items.filter(function (item) {
57
+ return jsx(ButtonGroup, null, items.filter(function (item) {
57
58
  return !item.hidden;
58
59
  }).map(function (item, idx) {
59
60
  var _api$contextPanel, _api$extension;
@@ -70,12 +71,12 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
70
71
  }
71
72
  }
72
73
  };
73
- return /*#__PURE__*/React.createElement(Button, {
74
+ return jsx(Button, {
74
75
  className: item.className,
75
76
  key: idx,
76
77
  title: item.title,
77
78
  href: item.href,
78
- icon: item.icon ? /*#__PURE__*/React.createElement(ButtonIcon, {
79
+ icon: item.icon ? jsx(ButtonIcon, {
79
80
  label: item.title
80
81
  }) : undefined,
81
82
  appearance: item.appearance,
@@ -102,7 +103,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
102
103
  tabIndex: item.tabIndex
103
104
  }, item.showTitle && item.title);
104
105
  case 'input':
105
- return /*#__PURE__*/React.createElement(Input, {
106
+ return jsx(Input, {
106
107
  key: idx,
107
108
  mountPoint: popupsMountPoint,
108
109
  boundariesElement: popupsBoundariesElement,
@@ -121,10 +122,10 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
121
122
  }
122
123
  case 'dropdown':
123
124
  var DropdownIcon = item.icon;
124
- return /*#__PURE__*/React.createElement(Dropdown, {
125
+ return jsx(Dropdown, {
125
126
  key: idx,
126
127
  title: item.title,
127
- icon: DropdownIcon && /*#__PURE__*/React.createElement(DropdownIcon, {
128
+ icon: DropdownIcon && jsx(DropdownIcon, {
128
129
  label: item.title
129
130
  }),
130
131
  dispatchCommand: dispatchCommand,
@@ -147,7 +148,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
147
148
  case 'select':
148
149
  if (item.selectType === 'list') {
149
150
  var ariaLabel = item.title || item.placeholder;
150
- return /*#__PURE__*/React.createElement(Select, {
151
+ return jsx(Select, {
151
152
  key: idx,
152
153
  dispatchCommand: dispatchCommand,
153
154
  options: item.options,
@@ -167,7 +168,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
167
168
  });
168
169
  }
169
170
  if (item.selectType === 'color') {
170
- return /*#__PURE__*/React.createElement(ColorPickerButton, {
171
+ return jsx(ColorPickerButton, {
171
172
  skipFocusButtonAfterPick: true,
172
173
  key: idx,
173
174
  title: item.title,
@@ -193,7 +194,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
193
194
  });
194
195
  }
195
196
  if (item.selectType === 'emoji') {
196
- return /*#__PURE__*/React.createElement(EmojiPickerButton, {
197
+ return jsx(EmojiPickerButton, {
197
198
  key: idx,
198
199
  editorView: editorView,
199
200
  title: item.title,
@@ -216,7 +217,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
216
217
  if (!extendFloatingToolbar) {
217
218
  return null;
218
219
  }
219
- return /*#__PURE__*/React.createElement(ExtensionsPlaceholder, {
220
+ return jsx(ExtensionsPlaceholder, {
220
221
  key: idx,
221
222
  node: node,
222
223
  editorView: editorView,
@@ -226,7 +227,7 @@ var ToolbarItems = /*#__PURE__*/React.memo(function (_ref) {
226
227
  extensionApi: api === null || api === void 0 || (_api$extension = api.extension) === null || _api$extension === void 0 ? void 0 : _api$extension.actions.api()
227
228
  });
228
229
  case 'separator':
229
- return /*#__PURE__*/React.createElement(Separator, {
230
+ return jsx(Separator, {
230
231
  key: idx
231
232
  });
232
233
  }
@@ -365,7 +366,8 @@ var Toolbar = /*#__PURE__*/function (_Component) {
365
366
  className = _this$props2.className,
366
367
  node = _this$props2.node,
367
368
  intl = _this$props2.intl,
368
- scrollable = _this$props2.scrollable;
369
+ scrollable = _this$props2.scrollable,
370
+ mediaAssistiveMessage = _this$props2.mediaAssistiveMessage;
369
371
  if (!items || !items.length) {
370
372
  return null;
371
373
  }
@@ -379,14 +381,14 @@ var Toolbar = /*#__PURE__*/function (_Component) {
379
381
  //Alt + F10 to reach first element in this floating toolbar
380
382
  return event.altKey && (event.key === 'F10' || event.keyCode === 121);
381
383
  };
382
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ToolbarArrowKeyNavigationProvider, {
384
+ return jsx(React.Fragment, null, jsx(ToolbarArrowKeyNavigationProvider, {
383
385
  editorView: this.props.editorView,
384
386
  handleEscape: this.handleEscape,
385
387
  disableArrowKeyNavigation: !this.shouldHandleArrowKeys(),
386
388
  childComponentSelector: "[data-testid='editor-floating-toolbar']",
387
389
  isShortcutToFocusToolbar: isShortcutToFocusToolbar,
388
390
  intl: intl
389
- }, /*#__PURE__*/React.createElement("div", {
391
+ }, jsx("div", {
390
392
  ref: this.toolbarContainerRef,
391
393
  css: function css(theme) {
392
394
  return [toolbarContainer({
@@ -397,26 +399,26 @@ var Toolbar = /*#__PURE__*/function (_Component) {
397
399
  role: "toolbar",
398
400
  "data-testid": "editor-floating-toolbar",
399
401
  className: className
400
- }, /*#__PURE__*/React.createElement(Announcer, {
401
- text: intl.formatMessage(messages.floatingToolbarAnnouncer),
402
+ }, jsx(Announcer, {
403
+ text: mediaAssistiveMessage ? "".concat(mediaAssistiveMessage, ", ").concat(intl.formatMessage(messages.floatingToolbarAnnouncer)) : intl.formatMessage(messages.floatingToolbarAnnouncer),
402
404
  delay: 250
403
- }), /*#__PURE__*/React.createElement("div", {
405
+ }), jsx("div", {
404
406
  "data-testid": "floating-toolbar-items",
405
407
  ref: this.scrollContainerRef
406
408
  // eslint-disable-next-line @atlaskit/design-system/consistent-css-prop-usage
407
409
  ,
408
410
  css: toolbarOverflow(scrollable, this.state.scrollDisabled, firstElementIsSelect)
409
- }, /*#__PURE__*/React.createElement(ToolbarItems, _extends({}, this.props, {
411
+ }, jsx(ToolbarItems, _extends({}, this.props, {
410
412
  setDisableScroll: this.setDisableScroll.bind(this),
411
413
  mountRef: this.mountRef,
412
414
  mounted: this.state.mounted,
413
415
  featureFlags: this.props.featureFlags
414
- }))), scrollable && /*#__PURE__*/React.createElement(ScrollButtons, {
416
+ }))), scrollable && jsx(ScrollButtons, {
415
417
  intl: intl,
416
418
  scrollContainerRef: this.scrollContainerRef,
417
419
  node: node,
418
420
  disabled: this.state.scrollDisabled
419
- })), /*#__PURE__*/React.createElement("div", {
421
+ })), jsx("div", {
420
422
  ref: this.mountRef
421
423
  })));
422
424
  }
@@ -33,6 +33,7 @@ export interface Props {
33
33
  OptionalPlugin<typeof contextPanelPlugin>,
34
34
  OptionalPlugin<ExtensionPlugin>
35
35
  ]> | undefined;
36
+ mediaAssistiveMessage?: string;
36
37
  }
37
38
  export interface State {
38
39
  scrollDisabled: boolean;
@@ -33,6 +33,7 @@ export interface Props {
33
33
  OptionalPlugin<typeof contextPanelPlugin>,
34
34
  OptionalPlugin<ExtensionPlugin>
35
35
  ]> | undefined;
36
+ mediaAssistiveMessage?: string;
36
37
  }
37
38
  export interface State {
38
39
  scrollDisabled: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-floating-toolbar",
3
- "version": "0.7.13",
3
+ "version": "0.7.14",
4
4
  "description": "Floating toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -27,7 +27,7 @@
27
27
  "@atlaskit/adf-utils": "^19.0.0",
28
28
  "@atlaskit/button": "^16.17.0",
29
29
  "@atlaskit/checkbox": "^13.0.0",
30
- "@atlaskit/editor-common": "^76.24.0",
30
+ "@atlaskit/editor-common": "^76.25.0",
31
31
  "@atlaskit/editor-palette": "1.5.2",
32
32
  "@atlaskit/editor-plugin-context-panel": "^0.2.0",
33
33
  "@atlaskit/editor-plugin-copy-button": "^1.0.0",