@atlaskit/editor-core 188.2.4 → 188.2.6

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.
Files changed (55) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/dist/cjs/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -1
  3. package/dist/cjs/plugins/text-color/commands/change-color.js +6 -5
  4. package/dist/cjs/plugins/text-color/commands/toggle-color.js +1 -1
  5. package/dist/cjs/plugins/text-color/index.js +6 -4
  6. package/dist/cjs/plugins/text-color/types.js +5 -0
  7. package/dist/cjs/plugins/text-color/ui/ToolbarTextColor/index.js +21 -25
  8. package/dist/cjs/plugins/text-color/utils/disabled.js +1 -1
  9. package/dist/cjs/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +1 -1
  10. package/dist/cjs/ui/styles.js +1 -7
  11. package/dist/cjs/version-wrapper.js +1 -1
  12. package/dist/es2019/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -1
  13. package/dist/es2019/plugins/text-color/commands/change-color.js +6 -5
  14. package/dist/es2019/plugins/text-color/commands/toggle-color.js +1 -1
  15. package/dist/es2019/plugins/text-color/index.js +5 -3
  16. package/dist/es2019/plugins/text-color/types.js +1 -0
  17. package/dist/es2019/plugins/text-color/ui/ToolbarTextColor/index.js +15 -12
  18. package/dist/es2019/plugins/text-color/utils/disabled.js +1 -1
  19. package/dist/es2019/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
  20. package/dist/es2019/ui/styles.js +1 -5
  21. package/dist/es2019/version-wrapper.js +1 -1
  22. package/dist/esm/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.js +1 -1
  23. package/dist/esm/plugins/text-color/commands/change-color.js +6 -5
  24. package/dist/esm/plugins/text-color/commands/toggle-color.js +1 -1
  25. package/dist/esm/plugins/text-color/index.js +5 -3
  26. package/dist/esm/plugins/text-color/types.js +1 -0
  27. package/dist/esm/plugins/text-color/ui/ToolbarTextColor/index.js +14 -13
  28. package/dist/esm/plugins/text-color/utils/disabled.js +1 -1
  29. package/dist/esm/plugins/toolbar-lists-indentation/ui/ToolbarDropdown.js +2 -1
  30. package/dist/esm/ui/styles.js +1 -5
  31. package/dist/esm/version-wrapper.js +1 -1
  32. package/dist/types/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -1
  33. package/dist/types/plugins/text-color/commands/change-color.d.ts +3 -2
  34. package/dist/types/plugins/text-color/commands/remove-color.d.ts +1 -1
  35. package/dist/types/plugins/text-color/commands/toggle-color.d.ts +1 -1
  36. package/dist/types/plugins/text-color/index.d.ts +3 -7
  37. package/dist/types/plugins/text-color/pm-plugins/main.d.ts +1 -1
  38. package/dist/types/plugins/text-color/types.d.ts +10 -0
  39. package/dist/types/plugins/text-color/ui/ToolbarTextColor/index.d.ts +5 -2
  40. package/dist/types/ui/styles.d.ts +0 -1
  41. package/dist/types-ts4.5/plugins/insert-block/ui/ToolbarInsertBlock/dropdown-button.d.ts +1 -1
  42. package/dist/types-ts4.5/plugins/text-color/commands/change-color.d.ts +3 -2
  43. package/dist/types-ts4.5/plugins/text-color/commands/remove-color.d.ts +1 -1
  44. package/dist/types-ts4.5/plugins/text-color/commands/toggle-color.d.ts +1 -1
  45. package/dist/types-ts4.5/plugins/text-color/index.d.ts +3 -8
  46. package/dist/types-ts4.5/plugins/text-color/pm-plugins/main.d.ts +1 -1
  47. package/dist/types-ts4.5/plugins/text-color/types.d.ts +12 -0
  48. package/dist/types-ts4.5/plugins/text-color/ui/ToolbarTextColor/index.d.ts +5 -2
  49. package/dist/types-ts4.5/ui/styles.d.ts +0 -1
  50. package/package.json +2 -2
  51. package/dist/cjs/utils/mark.js +0 -40
  52. package/dist/es2019/utils/mark.js +0 -26
  53. package/dist/esm/utils/mark.js +0 -34
  54. package/dist/types/utils/mark.d.ts +0 -4
  55. package/dist/types-ts4.5/utils/mark.d.ts +0 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 188.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#41212](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41212) [`db0107e09d7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/db0107e09d7) - Updates failing datasources playwright test
8
+
9
+ ## 188.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [#41103](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41103) [`e268e178096`](https://bitbucket.org/atlassian/atlassian-frontend/commits/e268e178096) - ED-20195 Decouple Text color plugin from editor core
14
+ - Updated dependencies
15
+
3
16
  ## 188.2.4
4
17
 
5
18
  ### Patch Changes
@@ -11,7 +11,7 @@ var _add = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/add"));
11
11
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
12
12
  var _keymaps = require("../../../../keymaps");
13
13
  var _ToolbarButton = _interopRequireDefault(require("../../../../ui/ToolbarButton"));
14
- var _styles = require("../../../../ui/styles");
14
+ var _styles = require("@atlaskit/editor-common/styles");
15
15
  var _styles2 = require("./styles");
16
16
  /** @jsx jsx */
17
17
 
@@ -4,7 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.changeColor = void 0;
7
- var _analytics = require("../../analytics");
7
+ var _analytics = require("@atlaskit/editor-common/analytics");
8
+ var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
8
9
  var _main = require("../pm-plugins/main");
9
10
  var _color = require("../utils/color");
10
11
  var _removeColor = require("./remove-color");
@@ -16,7 +17,7 @@ var _toggleColor = require("./toggle-color");
16
17
  * @param palette - Current palette of colors
17
18
  * @return Higher order command with analytics logic inside.
18
19
  */
19
- function createWithColorAnalytics(newColor, previousColor, palette) {
20
+ function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi) {
20
21
  var newColorFromPalette = palette.find(function (_ref) {
21
22
  var value = _ref.value;
22
23
  return value === newColor;
@@ -27,7 +28,7 @@ function createWithColorAnalytics(newColor, previousColor, palette) {
27
28
  });
28
29
  var newColorLabel = newColorFromPalette ? newColorFromPalette.label : newColor;
29
30
  var previousColorLabel = previousColorFromPalette ? previousColorFromPalette.label : previousColor || '';
30
- return (0, _analytics.withAnalytics)({
31
+ return (0, _editorAnalytics.withAnalytics)(editorAnalyticsApi, {
31
32
  action: _analytics.ACTION.FORMATTED,
32
33
  actionSubject: _analytics.ACTION_SUBJECT.TEXT,
33
34
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.FORMAT_COLOR,
@@ -38,13 +39,13 @@ function createWithColorAnalytics(newColor, previousColor, palette) {
38
39
  }
39
40
  });
40
41
  }
41
- var changeColor = exports.changeColor = function changeColor(color) {
42
+ var changeColor = exports.changeColor = function changeColor(color, editorAnalyticsApi) {
42
43
  return function (state, dispatch) {
43
44
  var textColor = state.schema.marks.textColor;
44
45
  if (textColor) {
45
46
  var pluginState = _main.pluginKey.getState(state);
46
47
  var activeColor = (0, _color.getActiveColor)(state);
47
- var withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || []);
48
+ var withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || [], editorAnalyticsApi);
48
49
  if (pluginState !== null && pluginState !== void 0 && pluginState.disabled) {
49
50
  return false;
50
51
  }
@@ -5,9 +5,9 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.toggleColor = void 0;
7
7
  var _mark = require("@atlaskit/editor-common/mark");
8
+ var _preset = require("@atlaskit/editor-common/preset");
8
9
  var _main = require("../pm-plugins/main");
9
10
  var _disabled = require("../utils/disabled");
10
- var _preset = require("@atlaskit/editor-common/preset");
11
11
  var toggleColor = exports.toggleColor = function toggleColor(color) {
12
12
  return function (state, dispatch) {
13
13
  var textColor = state.schema.marks.textColor;
@@ -13,7 +13,7 @@ Object.defineProperty(exports, "textColorPluginKey", {
13
13
  });
14
14
  var _react = _interopRequireDefault(require("react"));
15
15
  var _adfSchema = require("@atlaskit/adf-schema");
16
- var _WithPluginState = _interopRequireDefault(require("../../ui/WithPluginState"));
16
+ var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
17
17
  var _main = require("./pm-plugins/main");
18
18
  var _ToolbarTextColor = _interopRequireDefault(require("./ui/ToolbarTextColor"));
19
19
  var pluginConfig = function pluginConfig(textColorConfig) {
@@ -23,7 +23,8 @@ var pluginConfig = function pluginConfig(textColorConfig) {
23
23
  return textColorConfig;
24
24
  };
25
25
  var textColorPlugin = function textColorPlugin(_ref) {
26
- var textColorConfig = _ref.config;
26
+ var textColorConfig = _ref.config,
27
+ api = _ref.api;
27
28
  return {
28
29
  name: 'textColor',
29
30
  marks: function marks() {
@@ -49,7 +50,7 @@ var textColorPlugin = function textColorPlugin(_ref) {
49
50
  isToolbarReducedSpacing = _ref3.isToolbarReducedSpacing,
50
51
  dispatchAnalyticsEvent = _ref3.dispatchAnalyticsEvent,
51
52
  disabled = _ref3.disabled;
52
- return /*#__PURE__*/_react.default.createElement(_WithPluginState.default, {
53
+ return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
53
54
  plugins: {
54
55
  textColor: _main.pluginKey
55
56
  },
@@ -63,7 +64,8 @@ var textColorPlugin = function textColorPlugin(_ref) {
63
64
  popupsBoundariesElement: popupsBoundariesElement,
64
65
  popupsScrollableElement: popupsScrollableElement,
65
66
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
66
- disabled: disabled
67
+ disabled: disabled,
68
+ pluginInjectionApi: api
67
69
  });
68
70
  }
69
71
  });
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
@@ -18,19 +17,14 @@ var _react2 = require("@emotion/react");
18
17
  var _reactIntlNext = require("react-intl-next");
19
18
  var _uiColor = require("@atlaskit/editor-common/ui-color");
20
19
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
20
+ var _styles = require("@atlaskit/editor-common/styles");
21
+ var _analytics = require("@atlaskit/editor-common/analytics");
21
22
  var _editorPalette = require("@atlaskit/editor-palette");
22
23
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
23
24
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/chevron-down"));
24
- var _ColorPalette = _interopRequireWildcard(require("../../../../ui/ColorPalette"));
25
- var _styles = require("../../../../ui/styles");
26
- var _styles2 = require("@atlaskit/editor-common/styles");
27
- var _ToolbarButton = _interopRequireWildcard(require("../../../../ui/ToolbarButton"));
28
- var _analytics = require("../../../analytics");
29
- var commands = _interopRequireWildcard(require("../../commands/change-color"));
25
+ var _changeColor = require("../../commands/change-color");
30
26
  var _icon = require("./icon");
31
- var _styles3 = require("./styles");
32
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
33
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
27
+ var _styles2 = require("./styles");
34
28
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
35
29
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
36
30
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
@@ -59,8 +53,8 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
59
53
  isOpenedByKeyboard: false
60
54
  });
61
55
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toolbarItemRef", /*#__PURE__*/_react.default.createRef());
62
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeColor", function (color) {
63
- return commands.changeColor(color)(_this.props.editorView.state, _this.props.editorView.dispatch);
56
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeColor", function (color, editorAnalyticsApi) {
57
+ return (0, _changeColor.changeColor)(color, editorAnalyticsApi)(_this.props.editorView.state, _this.props.editorView.dispatch);
64
58
  });
65
59
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "onOpenChange", function (attrs) {
66
60
  _this.handleOpenChange({
@@ -69,7 +63,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
69
63
  event: attrs.event
70
64
  });
71
65
  });
72
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeTextColor", function (color, disabled) {
66
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "changeTextColor", function (color, editorAnalyticsApi, disabled) {
73
67
  var _this$toolbarItemRef;
74
68
  if (!disabled) {
75
69
  var _this$props$editorVie;
@@ -86,7 +80,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
86
80
  isOpen: false,
87
81
  logCloseEvent: false
88
82
  });
89
- _this.changeColor(color);
83
+ _this.changeColor(color, editorAnalyticsApi);
90
84
  //To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
91
85
  (_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 || _this$props$editorVie.focus();
92
86
  }
@@ -166,7 +160,8 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
166
160
  isReducedSpacing = _this$props.isReducedSpacing,
167
161
  pluginState = _this$props.pluginState,
168
162
  formatMessage = _this$props.intl.formatMessage,
169
- disabled = _this$props.disabled;
163
+ disabled = _this$props.disabled,
164
+ pluginInjectionApi = _this$props.pluginInjectionApi;
170
165
  var labelTextColor = formatMessage(messages.textColor);
171
166
  var palette = pluginState.palette;
172
167
  var fitWidth;
@@ -182,7 +177,7 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
182
177
  selectedRowIndex = _getSelectedRowAndCol.selectedRowIndex,
183
178
  selectedColumnIndex = _getSelectedRowAndCol.selectedColumnIndex;
184
179
  return (0, _react2.jsx)("span", {
185
- css: _styles2.wrapperStyle
180
+ css: _styles.wrapperStyle
186
181
  }, (0, _react2.jsx)(_uiMenu.DropdownContainer, {
187
182
  mountTo: popupsMountPoint,
188
183
  boundariesElement: popupsBoundariesElement,
@@ -201,8 +196,8 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
201
196
  isOpenedByKeyboard: isOpenedByKeyboard,
202
197
  isPopupPositioned: true
203
198
  },
204
- trigger: (0, _react2.jsx)(_ToolbarButton.default, {
205
- buttonId: _ToolbarButton.TOOLBAR_BUTTON.TEXT_COLOR,
199
+ trigger: (0, _react2.jsx)(_uiMenu.ToolbarButton, {
200
+ buttonId: _uiMenu.TOOLBAR_BUTTON.TEXT_COLOR,
206
201
  spacing: isReducedSpacing ? 'none' : 'default',
207
202
  disabled: disabled || pluginState.disabled,
208
203
  selected: isOpen,
@@ -214,11 +209,11 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
214
209
  onKeyDown: this.onKeyDown,
215
210
  ref: this.toolbarItemRef,
216
211
  iconBefore: (0, _react2.jsx)("div", {
217
- css: _styles2.triggerWrapperStyles
212
+ css: _styles.triggerWrapperStyles
218
213
  }, (0, _react2.jsx)("div", {
219
- css: _styles3.textColorIconWrapper
214
+ css: _styles2.textColorIconWrapper
220
215
  }, (0, _react2.jsx)(_icon.EditorTextColorIcon, null), (0, _react2.jsx)("div", {
221
- css: [_styles3.textColorIconBar, selectedColor ? "background: ".concat(selectedColor, ";") : pluginState.disabled && _styles3.backgroundDisabled]
216
+ css: [_styles2.textColorIconBar, selectedColor ? "background: ".concat(selectedColor, ";") : pluginState.disabled && _styles2.backgroundDisabled]
222
217
  })), (0, _react2.jsx)("span", {
223
218
  css: _styles.expandIconWrapperStyle
224
219
  }, (0, _react2.jsx)(_chevronDown.default, {
@@ -227,18 +222,19 @@ var ToolbarTextColor = exports.ToolbarTextColor = /*#__PURE__*/function (_React$
227
222
  })
228
223
  }, (0, _react2.jsx)("div", {
229
224
  "data-testid": "text-color-palette"
230
- }, (0, _react2.jsx)(_ColorPalette.default, {
225
+ }, (0, _react2.jsx)(_uiColor.ColorPalette, {
231
226
  onClick: function onClick(color) {
232
- return _this2.changeTextColor(color, pluginState.disabled);
227
+ var _pluginInjectionApi$a;
228
+ return _this2.changeTextColor(color, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, pluginState.disabled);
233
229
  },
234
230
  selectedColor: pluginState.color,
235
231
  paletteOptions: {
236
232
  palette: palette,
237
233
  hexToPaletteColor: _editorPalette.hexToEditorTextPaletteColor,
238
- paletteColorTooltipMessages: _ColorPalette.textPaletteTooltipMessages
234
+ paletteColorTooltipMessages: _uiColor.textPaletteTooltipMessages
239
235
  }
240
236
  }))), (0, _react2.jsx)("span", {
241
- css: _styles2.separatorStyles
237
+ css: _styles.separatorStyles
242
238
  }));
243
239
  }
244
240
  }, {
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.getDisabledState = void 0;
7
- var _mark = require("../../../utils/mark");
7
+ var _mark = require("@atlaskit/editor-common/mark");
8
8
  var hasLinkMark = function hasLinkMark($pos) {
9
9
  var linkMarkType = $pos.doc.type.schema.marks.link,
10
10
  pos = $pos.pos;
@@ -100,7 +100,7 @@ function ToolbarDropdown(props) {
100
100
  }, (0, _react.jsx)(_bulletList.default, {
101
101
  label: labelLists
102
102
  }), (0, _react.jsx)("span", {
103
- css: _styles.expandIconWrapperStyle
103
+ css: _styles2.expandIconWrapperStyle
104
104
  }, (0, _react.jsx)(_chevronDown.default, {
105
105
  label: ""
106
106
  })))
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
3
  Object.defineProperty(exports, "__esModule", {
5
4
  value: true
6
5
  });
7
- exports.expandIconWrapperStyle = void 0;
8
6
  Object.defineProperty(exports, "scrollbarStyles", {
9
7
  enumerable: true,
10
8
  get: function get() {
@@ -17,9 +15,5 @@ Object.defineProperty(exports, "shortcutStyle", {
17
15
  return _shortcut.shortcutStyle;
18
16
  }
19
17
  });
20
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
21
- var _react = require("@emotion/react");
22
18
  var _shortcut = require("@atlaskit/editor-shared-styles/shortcut");
23
- var _scrollbar = require("@atlaskit/editor-shared-styles/scrollbar");
24
- var _templateObject;
25
- var expandIconWrapperStyle = exports.expandIconWrapperStyle = (0, _react.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n margin-left: -8px;\n"])));
19
+ var _scrollbar = require("@atlaskit/editor-shared-styles/scrollbar");
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = exports.name = "@atlaskit/editor-core";
8
- var version = exports.version = "188.2.4";
8
+ var version = exports.version = "188.2.6";
9
9
  var nextMajorVersion = exports.nextMajorVersion = function nextMajorVersion() {
10
10
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
11
11
  };
@@ -5,7 +5,7 @@ import AddIcon from '@atlaskit/icon/glyph/editor/add';
5
5
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
6
6
  import { ToolTipContent } from '../../../../keymaps';
7
7
  import ToolbarButton from '../../../../ui/ToolbarButton';
8
- import { expandIconWrapperStyle } from '../../../../ui/styles';
8
+ import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
9
9
  import { triggerWrapper } from './styles';
10
10
  const DropDownButtonIcon = /*#__PURE__*/React.memo(props => jsx("span", {
11
11
  css: triggerWrapper
@@ -1,4 +1,5 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, withAnalytics } from '../../analytics';
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
2
3
  import { pluginKey } from '../pm-plugins/main';
3
4
  import { getActiveColor } from '../utils/color';
4
5
  import { removeColor } from './remove-color';
@@ -11,7 +12,7 @@ import { toggleColor } from './toggle-color';
11
12
  * @param palette - Current palette of colors
12
13
  * @return Higher order command with analytics logic inside.
13
14
  */
14
- function createWithColorAnalytics(newColor, previousColor, palette) {
15
+ function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi) {
15
16
  const newColorFromPalette = palette.find(({
16
17
  value
17
18
  }) => value === newColor);
@@ -20,7 +21,7 @@ function createWithColorAnalytics(newColor, previousColor, palette) {
20
21
  }) => value === previousColor);
21
22
  const newColorLabel = newColorFromPalette ? newColorFromPalette.label : newColor;
22
23
  const previousColorLabel = previousColorFromPalette ? previousColorFromPalette.label : previousColor || '';
23
- return withAnalytics({
24
+ return withAnalytics(editorAnalyticsApi, {
24
25
  action: ACTION.FORMATTED,
25
26
  actionSubject: ACTION_SUBJECT.TEXT,
26
27
  actionSubjectId: ACTION_SUBJECT_ID.FORMAT_COLOR,
@@ -31,14 +32,14 @@ function createWithColorAnalytics(newColor, previousColor, palette) {
31
32
  }
32
33
  });
33
34
  }
34
- export const changeColor = color => (state, dispatch) => {
35
+ export const changeColor = (color, editorAnalyticsApi) => (state, dispatch) => {
35
36
  const {
36
37
  textColor
37
38
  } = state.schema.marks;
38
39
  if (textColor) {
39
40
  const pluginState = pluginKey.getState(state);
40
41
  const activeColor = getActiveColor(state);
41
- const withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || []);
42
+ const withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || [], editorAnalyticsApi);
42
43
  if (pluginState !== null && pluginState !== void 0 && pluginState.disabled) {
43
44
  return false;
44
45
  }
@@ -1,7 +1,7 @@
1
1
  import { toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
2
3
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
3
4
  import { getDisabledState } from '../utils/disabled';
4
- import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
5
5
  export const toggleColor = color => (state, dispatch) => {
6
6
  const {
7
7
  textColor
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { textColor } from '@atlaskit/adf-schema';
3
- import WithPluginState from '../../ui/WithPluginState';
3
+ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
4
4
  import { createPlugin, pluginKey as textColorPluginKey } from './pm-plugins/main';
5
5
  import ToolbarTextColor from './ui/ToolbarTextColor';
6
6
  const pluginConfig = textColorConfig => {
@@ -10,7 +10,8 @@ const pluginConfig = textColorConfig => {
10
10
  return textColorConfig;
11
11
  };
12
12
  const textColorPlugin = ({
13
- config: textColorConfig
13
+ config: textColorConfig,
14
+ api
14
15
  }) => {
15
16
  return {
16
17
  name: 'textColor',
@@ -51,7 +52,8 @@ const textColorPlugin = ({
51
52
  popupsBoundariesElement: popupsBoundariesElement,
52
53
  popupsScrollableElement: popupsScrollableElement,
53
54
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
54
- disabled: disabled
55
+ disabled: disabled,
56
+ pluginInjectionApi: api
55
57
  })
56
58
  });
57
59
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -5,16 +5,15 @@ import { jsx } from '@emotion/react';
5
5
  import { defineMessages, injectIntl } from 'react-intl-next';
6
6
  import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
7
7
  import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
8
+ import { ColorPalette, textPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
9
+ import { wrapperStyle, separatorStyles, triggerWrapperStyles } from '@atlaskit/editor-common/styles';
10
+ import { DropdownContainer as Dropdown, ToolbarButton, TOOLBAR_BUTTON } from '@atlaskit/editor-common/ui-menu';
11
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
8
12
  import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
9
13
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
10
14
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
11
- import ColorPalette, { textPaletteTooltipMessages } from '../../../../ui/ColorPalette';
12
- import { DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
13
- import { expandIconWrapperStyle } from '../../../../ui/styles';
14
- import { wrapperStyle, separatorStyles, triggerWrapperStyles } from '@atlaskit/editor-common/styles';
15
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
16
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../../analytics';
17
- import * as commands from '../../commands/change-color';
15
+ import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
16
+ import { changeColor as changeColorWithAnalytics } from '../../commands/change-color';
18
17
  import { EditorTextColorIcon } from './icon';
19
18
  import { backgroundDisabled, textColorIconBar, textColorIconWrapper } from './styles';
20
19
  const EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
@@ -34,7 +33,7 @@ export class ToolbarTextColor extends React.Component {
34
33
  isOpenedByKeyboard: false
35
34
  });
36
35
  _defineProperty(this, "toolbarItemRef", /*#__PURE__*/React.createRef());
37
- _defineProperty(this, "changeColor", color => commands.changeColor(color)(this.props.editorView.state, this.props.editorView.dispatch));
36
+ _defineProperty(this, "changeColor", (color, editorAnalyticsApi) => changeColorWithAnalytics(color, editorAnalyticsApi)(this.props.editorView.state, this.props.editorView.dispatch));
38
37
  _defineProperty(this, "onOpenChange", attrs => {
39
38
  this.handleOpenChange({
40
39
  isOpen: attrs.isOpen,
@@ -42,7 +41,7 @@ export class ToolbarTextColor extends React.Component {
42
41
  event: attrs.event
43
42
  });
44
43
  });
45
- _defineProperty(this, "changeTextColor", (color, disabled) => {
44
+ _defineProperty(this, "changeTextColor", (color, editorAnalyticsApi, disabled) => {
46
45
  var _this$toolbarItemRef, _this$toolbarItemRef$;
47
46
  if (!disabled) {
48
47
  var _this$props$editorVie;
@@ -61,7 +60,7 @@ export class ToolbarTextColor extends React.Component {
61
60
  isOpen: false,
62
61
  logCloseEvent: false
63
62
  });
64
- this.changeColor(color);
63
+ this.changeColor(color, editorAnalyticsApi);
65
64
  //To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
66
65
  (_this$props$editorVie = this.props.editorView) === null || _this$props$editorVie === void 0 ? void 0 : _this$props$editorVie.focus();
67
66
  }
@@ -143,7 +142,8 @@ export class ToolbarTextColor extends React.Component {
143
142
  intl: {
144
143
  formatMessage
145
144
  },
146
- disabled
145
+ disabled,
146
+ pluginInjectionApi
147
147
  } = this.props;
148
148
  const labelTextColor = formatMessage(messages.textColor);
149
149
  const palette = pluginState.palette;
@@ -207,7 +207,10 @@ export class ToolbarTextColor extends React.Component {
207
207
  }, jsx("div", {
208
208
  "data-testid": "text-color-palette"
209
209
  }, jsx(ColorPalette, {
210
- onClick: color => this.changeTextColor(color, pluginState.disabled),
210
+ onClick: color => {
211
+ var _pluginInjectionApi$a;
212
+ return this.changeTextColor(color, pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, pluginState.disabled);
213
+ },
211
214
  selectedColor: pluginState.color,
212
215
  paletteOptions: {
213
216
  palette,
@@ -1,4 +1,4 @@
1
- import { isMarkAllowedInRange, isMarkExcluded } from '../../../utils/mark';
1
+ import { isMarkAllowedInRange, isMarkExcluded } from '@atlaskit/editor-common/mark';
2
2
  const hasLinkMark = $pos => {
3
3
  const {
4
4
  doc: {
@@ -7,7 +7,8 @@ import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
7
7
  import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, tooltip } from '../../../keymaps';
8
8
  import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
9
9
  import ToolbarButton from '../../../ui/ToolbarButton';
10
- import { expandIconWrapperStyle, shortcutStyle } from '../../../ui/styles';
10
+ import { shortcutStyle } from '../../../ui/styles';
11
+ import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
11
12
  import { wrapperStyle, separatorStyles } from '@atlaskit/editor-common/styles';
12
13
  import { listMessages } from '@atlaskit/editor-common/messages';
13
14
  import { messages as indentationMessages } from '../../indentation/messages';
@@ -1,6 +1,2 @@
1
- import { css } from '@emotion/react';
2
1
  export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
3
- export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
4
- export const expandIconWrapperStyle = css`
5
- margin-left: -8px;
6
- `;
2
+ export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "188.2.4";
2
+ export const version = "188.2.6";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -5,7 +5,7 @@ import AddIcon from '@atlaskit/icon/glyph/editor/add';
5
5
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
6
6
  import { ToolTipContent } from '../../../../keymaps';
7
7
  import ToolbarButton from '../../../../ui/ToolbarButton';
8
- import { expandIconWrapperStyle } from '../../../../ui/styles';
8
+ import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
9
9
  import { triggerWrapper } from './styles';
10
10
  var DropDownButtonIcon = /*#__PURE__*/React.memo(function (props) {
11
11
  return jsx("span", {
@@ -1,4 +1,5 @@
1
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, withAnalytics } from '../../analytics';
1
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
2
+ import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
2
3
  import { pluginKey } from '../pm-plugins/main';
3
4
  import { getActiveColor } from '../utils/color';
4
5
  import { removeColor } from './remove-color';
@@ -11,7 +12,7 @@ import { toggleColor } from './toggle-color';
11
12
  * @param palette - Current palette of colors
12
13
  * @return Higher order command with analytics logic inside.
13
14
  */
14
- function createWithColorAnalytics(newColor, previousColor, palette) {
15
+ function createWithColorAnalytics(newColor, previousColor, palette, editorAnalyticsApi) {
15
16
  var newColorFromPalette = palette.find(function (_ref) {
16
17
  var value = _ref.value;
17
18
  return value === newColor;
@@ -22,7 +23,7 @@ function createWithColorAnalytics(newColor, previousColor, palette) {
22
23
  });
23
24
  var newColorLabel = newColorFromPalette ? newColorFromPalette.label : newColor;
24
25
  var previousColorLabel = previousColorFromPalette ? previousColorFromPalette.label : previousColor || '';
25
- return withAnalytics({
26
+ return withAnalytics(editorAnalyticsApi, {
26
27
  action: ACTION.FORMATTED,
27
28
  actionSubject: ACTION_SUBJECT.TEXT,
28
29
  actionSubjectId: ACTION_SUBJECT_ID.FORMAT_COLOR,
@@ -33,13 +34,13 @@ function createWithColorAnalytics(newColor, previousColor, palette) {
33
34
  }
34
35
  });
35
36
  }
36
- export var changeColor = function changeColor(color) {
37
+ export var changeColor = function changeColor(color, editorAnalyticsApi) {
37
38
  return function (state, dispatch) {
38
39
  var textColor = state.schema.marks.textColor;
39
40
  if (textColor) {
40
41
  var pluginState = pluginKey.getState(state);
41
42
  var activeColor = getActiveColor(state);
42
- var withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || []);
43
+ var withColorAnalytics = createWithColorAnalytics(color, activeColor, (pluginState === null || pluginState === void 0 ? void 0 : pluginState.palette) || [], editorAnalyticsApi);
43
44
  if (pluginState !== null && pluginState !== void 0 && pluginState.disabled) {
44
45
  return false;
45
46
  }
@@ -1,7 +1,7 @@
1
1
  import { toggleMark } from '@atlaskit/editor-common/mark';
2
+ import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
2
3
  import { ACTIONS, pluginKey } from '../pm-plugins/main';
3
4
  import { getDisabledState } from '../utils/disabled';
4
- import { editorCommandToPMCommand } from '@atlaskit/editor-common/preset';
5
5
  export var toggleColor = function toggleColor(color) {
6
6
  return function (state, dispatch) {
7
7
  var textColor = state.schema.marks.textColor;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { textColor } from '@atlaskit/adf-schema';
3
- import WithPluginState from '../../ui/WithPluginState';
3
+ import { WithPluginState } from '@atlaskit/editor-common/with-plugin-state';
4
4
  import { createPlugin, pluginKey as textColorPluginKey } from './pm-plugins/main';
5
5
  import ToolbarTextColor from './ui/ToolbarTextColor';
6
6
  var pluginConfig = function pluginConfig(textColorConfig) {
@@ -10,7 +10,8 @@ var pluginConfig = function pluginConfig(textColorConfig) {
10
10
  return textColorConfig;
11
11
  };
12
12
  var textColorPlugin = function textColorPlugin(_ref) {
13
- var textColorConfig = _ref.config;
13
+ var textColorConfig = _ref.config,
14
+ api = _ref.api;
14
15
  return {
15
16
  name: 'textColor',
16
17
  marks: function marks() {
@@ -50,7 +51,8 @@ var textColorPlugin = function textColorPlugin(_ref) {
50
51
  popupsBoundariesElement: popupsBoundariesElement,
51
52
  popupsScrollableElement: popupsScrollableElement,
52
53
  dispatchAnalyticsEvent: dispatchAnalyticsEvent,
53
- disabled: disabled
54
+ disabled: disabled,
55
+ pluginInjectionApi: api
54
56
  });
55
57
  }
56
58
  });
@@ -0,0 +1 @@
1
+ export {};
@@ -15,16 +15,15 @@ import { jsx } from '@emotion/react';
15
15
  import { defineMessages, injectIntl } from 'react-intl-next';
16
16
  import { getSelectedRowAndColumnFromPalette } from '@atlaskit/editor-common/ui-color';
17
17
  import { ArrowKeyNavigationType } from '@atlaskit/editor-common/ui-menu';
18
+ import { ColorPalette, textPaletteTooltipMessages } from '@atlaskit/editor-common/ui-color';
19
+ import { wrapperStyle, separatorStyles, triggerWrapperStyles } from '@atlaskit/editor-common/styles';
20
+ import { DropdownContainer as Dropdown, ToolbarButton, TOOLBAR_BUTTON } from '@atlaskit/editor-common/ui-menu';
21
+ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
18
22
  import { hexToEditorTextPaletteColor } from '@atlaskit/editor-palette';
19
23
  import { akEditorMenuZIndex } from '@atlaskit/editor-shared-styles';
20
24
  import ExpandIcon from '@atlaskit/icon/glyph/chevron-down';
21
- import ColorPalette, { textPaletteTooltipMessages } from '../../../../ui/ColorPalette';
22
- import { DropdownContainer as Dropdown } from '@atlaskit/editor-common/ui-menu';
23
- import { expandIconWrapperStyle } from '../../../../ui/styles';
24
- import { wrapperStyle, separatorStyles, triggerWrapperStyles } from '@atlaskit/editor-common/styles';
25
- import ToolbarButton, { TOOLBAR_BUTTON } from '../../../../ui/ToolbarButton';
26
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '../../../analytics';
27
- import * as commands from '../../commands/change-color';
25
+ import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
26
+ import { changeColor as changeColorWithAnalytics } from '../../commands/change-color';
28
27
  import { EditorTextColorIcon } from './icon';
29
28
  import { backgroundDisabled, textColorIconBar, textColorIconWrapper } from './styles';
30
29
  var EXPERIMENT_NAME = 'editor.toolbarTextColor.moreColors';
@@ -51,8 +50,8 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
51
50
  isOpenedByKeyboard: false
52
51
  });
53
52
  _defineProperty(_assertThisInitialized(_this), "toolbarItemRef", /*#__PURE__*/React.createRef());
54
- _defineProperty(_assertThisInitialized(_this), "changeColor", function (color) {
55
- return commands.changeColor(color)(_this.props.editorView.state, _this.props.editorView.dispatch);
53
+ _defineProperty(_assertThisInitialized(_this), "changeColor", function (color, editorAnalyticsApi) {
54
+ return changeColorWithAnalytics(color, editorAnalyticsApi)(_this.props.editorView.state, _this.props.editorView.dispatch);
56
55
  });
57
56
  _defineProperty(_assertThisInitialized(_this), "onOpenChange", function (attrs) {
58
57
  _this.handleOpenChange({
@@ -61,7 +60,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
61
60
  event: attrs.event
62
61
  });
63
62
  });
64
- _defineProperty(_assertThisInitialized(_this), "changeTextColor", function (color, disabled) {
63
+ _defineProperty(_assertThisInitialized(_this), "changeTextColor", function (color, editorAnalyticsApi, disabled) {
65
64
  var _this$toolbarItemRef;
66
65
  if (!disabled) {
67
66
  var _this$props$editorVie;
@@ -78,7 +77,7 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
78
77
  isOpen: false,
79
78
  logCloseEvent: false
80
79
  });
81
- _this.changeColor(color);
80
+ _this.changeColor(color, editorAnalyticsApi);
82
81
  //To set the focus on the textcolor button when the menu is closed by 'Esc' only to meet aria guidelines
83
82
  (_this$props$editorVie = _this.props.editorView) === null || _this$props$editorVie === void 0 || _this$props$editorVie.focus();
84
83
  }
@@ -158,7 +157,8 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
158
157
  isReducedSpacing = _this$props.isReducedSpacing,
159
158
  pluginState = _this$props.pluginState,
160
159
  formatMessage = _this$props.intl.formatMessage,
161
- disabled = _this$props.disabled;
160
+ disabled = _this$props.disabled,
161
+ pluginInjectionApi = _this$props.pluginInjectionApi;
162
162
  var labelTextColor = formatMessage(messages.textColor);
163
163
  var palette = pluginState.palette;
164
164
  var fitWidth;
@@ -221,7 +221,8 @@ export var ToolbarTextColor = /*#__PURE__*/function (_React$Component) {
221
221
  "data-testid": "text-color-palette"
222
222
  }, jsx(ColorPalette, {
223
223
  onClick: function onClick(color) {
224
- return _this2.changeTextColor(color, pluginState.disabled);
224
+ var _pluginInjectionApi$a;
225
+ return _this2.changeTextColor(color, pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions, pluginState.disabled);
225
226
  },
226
227
  selectedColor: pluginState.color,
227
228
  paletteOptions: {
@@ -1,4 +1,4 @@
1
- import { isMarkAllowedInRange, isMarkExcluded } from '../../../utils/mark';
1
+ import { isMarkAllowedInRange, isMarkExcluded } from '@atlaskit/editor-common/mark';
2
2
  var hasLinkMark = function hasLinkMark($pos) {
3
3
  var linkMarkType = $pos.doc.type.schema.marks.link,
4
4
  pos = $pos.pos;
@@ -8,7 +8,8 @@ import BulletListIcon from '@atlaskit/icon/glyph/editor/bullet-list';
8
8
  import { toggleBulletList as toggleBulletListKeymap, toggleOrderedList as toggleOrderedListKeymap, indent as toggleIndentKeymap, outdent as toggleOutdentKeymap, tooltip } from '../../../keymaps';
9
9
  import { DropdownMenuWithKeyboardNavigation as DropdownMenu } from '@atlaskit/editor-common/ui-menu';
10
10
  import ToolbarButton from '../../../ui/ToolbarButton';
11
- import { expandIconWrapperStyle, shortcutStyle } from '../../../ui/styles';
11
+ import { shortcutStyle } from '../../../ui/styles';
12
+ import { expandIconWrapperStyle } from '@atlaskit/editor-common/styles';
12
13
  import { wrapperStyle, separatorStyles } from '@atlaskit/editor-common/styles';
13
14
  import { listMessages } from '@atlaskit/editor-common/messages';
14
15
  import { messages as indentationMessages } from '../../indentation/messages';
@@ -1,6 +1,2 @@
1
- import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
2
- var _templateObject;
3
- import { css } from '@emotion/react';
4
1
  export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
5
- export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
6
- export var expandIconWrapperStyle = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n margin-left: -8px;\n"])));
2
+ export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "188.2.4";
2
+ export var version = "188.2.6";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { ToolbarButtonRef } from '../../../../ui/ToolbarButton';
3
+ import type { ToolbarButtonRef } from '../../../../ui/ToolbarButton';
4
4
  export interface DropDownButtonProps {
5
5
  label: string;
6
6
  selected: boolean;
@@ -1,2 +1,3 @@
1
- import { Command } from '../../../types';
2
- export declare const changeColor: (color: string) => Command;
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ export declare const changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
@@ -1,2 +1,2 @@
1
- import type { Command } from '../../../types';
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
2
  export declare const removeColor: () => Command;
@@ -1,2 +1,2 @@
1
- import type { Command } from '../../../types';
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
2
  export declare const toggleColor: (color: string) => Command;
@@ -1,11 +1,7 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
1
+ import type { TextColorPluginState } from './pm-plugins/main';
3
2
  import { pluginKey as textColorPluginKey } from './pm-plugins/main';
4
- type Config = TextColorPluginConfig | boolean;
5
- declare const textColorPlugin: NextEditorPlugin<'textColor', {
6
- pluginConfiguration: Config | undefined;
7
- dependencies: [];
8
- }>;
3
+ import type { TextColorPlugin } from './types';
4
+ declare const textColorPlugin: TextColorPlugin;
9
5
  export { textColorPluginKey };
10
6
  export type { TextColorPluginState };
11
7
  export default textColorPlugin;
@@ -1,6 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { Dispatch } from '../../../event-dispatcher';
3
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
4
4
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
5
5
  export { DEFAULT_COLOR } from '../utils/color';
6
6
  export type TextColorPluginState = {
@@ -0,0 +1,10 @@
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { TextColorPluginConfig } from './pm-plugins/main';
4
+ type Config = TextColorPluginConfig | boolean;
5
+ export type TextColorPluginDependencies = [OptionalPlugin<AnalyticsPlugin>];
6
+ export type TextColorPlugin = NextEditorPlugin<'textColor', {
7
+ pluginConfiguration: Config | undefined;
8
+ dependencies: TextColorPluginDependencies;
9
+ }>;
10
+ export {};
@@ -3,8 +3,10 @@ import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { WrappedComponentProps } from 'react-intl-next';
6
- import type { DispatchAnalyticsEvent } from '../../../analytics';
6
+ import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
7
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
8
  import type { TextColorPluginState } from '../../pm-plugins/main';
9
+ import type { TextColorPlugin } from '../../types';
8
10
  export declare const messages: {
9
11
  textColor: {
10
12
  id: string;
@@ -25,11 +27,12 @@ export interface Props {
25
27
  isReducedSpacing?: boolean;
26
28
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
27
29
  disabled?: boolean;
30
+ pluginInjectionApi: ExtractInjectionAPI<TextColorPlugin> | undefined;
28
31
  }
29
32
  export declare class ToolbarTextColor extends React.Component<Props & WrappedComponentProps, State> {
30
33
  state: State;
31
34
  private toolbarItemRef;
32
- changeColor: (color: string) => boolean;
35
+ changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => boolean;
33
36
  render(): jsx.JSX.Element;
34
37
  private onOpenChange;
35
38
  private changeTextColor;
@@ -1,3 +1,2 @@
1
1
  export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
2
2
  export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
3
- export declare const expandIconWrapperStyle: import("@emotion/react").SerializedStyles;
@@ -1,6 +1,6 @@
1
1
  /** @jsx jsx */
2
2
  import React from 'react';
3
- import { ToolbarButtonRef } from '../../../../ui/ToolbarButton';
3
+ import type { ToolbarButtonRef } from '../../../../ui/ToolbarButton';
4
4
  export interface DropDownButtonProps {
5
5
  label: string;
6
6
  selected: boolean;
@@ -1,2 +1,3 @@
1
- import { Command } from '../../../types';
2
- export declare const changeColor: (color: string) => Command;
1
+ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ export declare const changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => Command;
@@ -1,2 +1,2 @@
1
- import type { Command } from '../../../types';
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
2
  export declare const removeColor: () => Command;
@@ -1,2 +1,2 @@
1
- import type { Command } from '../../../types';
1
+ import type { Command } from '@atlaskit/editor-common/types';
2
2
  export declare const toggleColor: (color: string) => Command;
@@ -1,12 +1,7 @@
1
- import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
2
- import type { TextColorPluginConfig, TextColorPluginState } from './pm-plugins/main';
1
+ import type { TextColorPluginState } from './pm-plugins/main';
3
2
  import { pluginKey as textColorPluginKey } from './pm-plugins/main';
4
- type Config = TextColorPluginConfig | boolean;
5
- declare const textColorPlugin: NextEditorPlugin<'textColor', {
6
- pluginConfiguration: Config | undefined;
7
- dependencies: [
8
- ];
9
- }>;
3
+ import type { TextColorPlugin } from './types';
4
+ declare const textColorPlugin: TextColorPlugin;
10
5
  export { textColorPluginKey };
11
6
  export type { TextColorPluginState };
12
7
  export default textColorPlugin;
@@ -1,6 +1,6 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
- import type { Dispatch } from '../../../event-dispatcher';
3
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
4
4
  import type { PaletteColor } from '@atlaskit/editor-common/ui-color';
5
5
  export { DEFAULT_COLOR } from '../utils/color';
6
6
  export type TextColorPluginState = {
@@ -0,0 +1,12 @@
1
+ import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
+ import type { TextColorPluginConfig } from './pm-plugins/main';
4
+ type Config = TextColorPluginConfig | boolean;
5
+ export type TextColorPluginDependencies = [
6
+ OptionalPlugin<AnalyticsPlugin>
7
+ ];
8
+ export type TextColorPlugin = NextEditorPlugin<'textColor', {
9
+ pluginConfiguration: Config | undefined;
10
+ dependencies: TextColorPluginDependencies;
11
+ }>;
12
+ export {};
@@ -3,8 +3,10 @@ import React from 'react';
3
3
  import { jsx } from '@emotion/react';
4
4
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
5
5
  import type { WrappedComponentProps } from 'react-intl-next';
6
- import type { DispatchAnalyticsEvent } from '../../../analytics';
6
+ import type { DispatchAnalyticsEvent, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
7
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
7
8
  import type { TextColorPluginState } from '../../pm-plugins/main';
9
+ import type { TextColorPlugin } from '../../types';
8
10
  export declare const messages: {
9
11
  textColor: {
10
12
  id: string;
@@ -25,11 +27,12 @@ export interface Props {
25
27
  isReducedSpacing?: boolean;
26
28
  dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
27
29
  disabled?: boolean;
30
+ pluginInjectionApi: ExtractInjectionAPI<TextColorPlugin> | undefined;
28
31
  }
29
32
  export declare class ToolbarTextColor extends React.Component<Props & WrappedComponentProps, State> {
30
33
  state: State;
31
34
  private toolbarItemRef;
32
- changeColor: (color: string) => boolean;
35
+ changeColor: (color: string, editorAnalyticsApi: EditorAnalyticsAPI | undefined) => boolean;
33
36
  render(): jsx.JSX.Element;
34
37
  private onOpenChange;
35
38
  private changeTextColor;
@@ -1,3 +1,2 @@
1
1
  export { shortcutStyle } from '@atlaskit/editor-shared-styles/shortcut';
2
2
  export { scrollbarStyles } from '@atlaskit/editor-shared-styles/scrollbar';
3
- export declare const expandIconWrapperStyle: import("@emotion/react").SerializedStyles;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "188.2.4",
3
+ "version": "188.2.6",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -55,7 +55,7 @@
55
55
  "@atlaskit/code": "^14.6.0",
56
56
  "@atlaskit/date": "^0.10.0",
57
57
  "@atlaskit/datetime-picker": "^12.10.0",
58
- "@atlaskit/editor-common": "^76.3.0",
58
+ "@atlaskit/editor-common": "^76.4.0",
59
59
  "@atlaskit/editor-json-transformer": "^8.10.0",
60
60
  "@atlaskit/editor-markdown-transformer": "^5.2.5",
61
61
  "@atlaskit/editor-palette": "1.5.1",
@@ -1,40 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.isMarkExcluded = exports.isMarkAllowedInRange = void 0;
7
- var isMarkAllowedInRange = exports.isMarkAllowedInRange = function isMarkAllowedInRange(doc, ranges, type) {
8
- var _loop = function _loop() {
9
- var _ranges$i = ranges[i],
10
- $from = _ranges$i.$from,
11
- $to = _ranges$i.$to;
12
- var can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false;
13
- doc.nodesBetween($from.pos, $to.pos, function (node) {
14
- if (can) {
15
- return false;
16
- }
17
- can = node.inlineContent && node.type.allowsMarkType(type);
18
- return;
19
- });
20
- if (can) {
21
- return {
22
- v: can
23
- };
24
- }
25
- },
26
- _ret;
27
- for (var i = 0; i < ranges.length; i++) {
28
- _ret = _loop();
29
- if (_ret) return _ret.v;
30
- }
31
- return false;
32
- };
33
- var isMarkExcluded = exports.isMarkExcluded = function isMarkExcluded(type, marks) {
34
- if (marks) {
35
- return marks.some(function (mark) {
36
- return mark.type !== type && mark.type.excludes(type);
37
- });
38
- }
39
- return false;
40
- };
@@ -1,26 +0,0 @@
1
- export const isMarkAllowedInRange = (doc, ranges, type) => {
2
- for (let i = 0; i < ranges.length; i++) {
3
- const {
4
- $from,
5
- $to
6
- } = ranges[i];
7
- let can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false;
8
- doc.nodesBetween($from.pos, $to.pos, node => {
9
- if (can) {
10
- return false;
11
- }
12
- can = node.inlineContent && node.type.allowsMarkType(type);
13
- return;
14
- });
15
- if (can) {
16
- return can;
17
- }
18
- }
19
- return false;
20
- };
21
- export const isMarkExcluded = (type, marks) => {
22
- if (marks) {
23
- return marks.some(mark => mark.type !== type && mark.type.excludes(type));
24
- }
25
- return false;
26
- };
@@ -1,34 +0,0 @@
1
- export var isMarkAllowedInRange = function isMarkAllowedInRange(doc, ranges, type) {
2
- var _loop = function _loop() {
3
- var _ranges$i = ranges[i],
4
- $from = _ranges$i.$from,
5
- $to = _ranges$i.$to;
6
- var can = $from.depth === 0 ? doc.type.allowsMarkType(type) : false;
7
- doc.nodesBetween($from.pos, $to.pos, function (node) {
8
- if (can) {
9
- return false;
10
- }
11
- can = node.inlineContent && node.type.allowsMarkType(type);
12
- return;
13
- });
14
- if (can) {
15
- return {
16
- v: can
17
- };
18
- }
19
- },
20
- _ret;
21
- for (var i = 0; i < ranges.length; i++) {
22
- _ret = _loop();
23
- if (_ret) return _ret.v;
24
- }
25
- return false;
26
- };
27
- export var isMarkExcluded = function isMarkExcluded(type, marks) {
28
- if (marks) {
29
- return marks.some(function (mark) {
30
- return mark.type !== type && mark.type.excludes(type);
31
- });
32
- }
33
- return false;
34
- };
@@ -1,4 +0,0 @@
1
- import type { Node, Mark, MarkType } from '@atlaskit/editor-prosemirror/model';
2
- import type { SelectionRange } from '@atlaskit/editor-prosemirror/state';
3
- export declare const isMarkAllowedInRange: (doc: Node, ranges: readonly SelectionRange[], type: MarkType) => boolean;
4
- export declare const isMarkExcluded: (type: MarkType, marks?: readonly Mark[] | null) => boolean;
@@ -1,4 +0,0 @@
1
- import type { Node, Mark, MarkType } from '@atlaskit/editor-prosemirror/model';
2
- import type { SelectionRange } from '@atlaskit/editor-prosemirror/state';
3
- export declare const isMarkAllowedInRange: (doc: Node, ranges: readonly SelectionRange[], type: MarkType) => boolean;
4
- export declare const isMarkExcluded: (type: MarkType, marks?: readonly Mark[] | null) => boolean;