@atlaskit/editor-plugin-extension 5.1.0 → 5.1.1

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/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 5.1.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#134468](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/134468)
8
+ [`e312ec529d05a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e312ec529d05a) -
9
+ [ux] Apply hover decoration when hovering on copy/delete button on overflow menu
10
+ - Updated dependencies
11
+
3
12
  ## 5.1.0
4
13
 
5
14
  ### Minor Changes
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports.getToolbarConfig = void 0;
8
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
8
9
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
10
  var _react = _interopRequireDefault(require("react"));
10
11
  var _extensions = require("@atlaskit/editor-common/extensions");
@@ -12,6 +13,7 @@ var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages
12
13
  var _styles = require("@atlaskit/editor-common/styles");
13
14
  var _utils = require("@atlaskit/editor-common/utils");
14
15
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
16
+ var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
15
17
  var _contentWidthNarrow = _interopRequireDefault(require("@atlaskit/icon/core/content-width-narrow"));
16
18
  var _contentWidthWide = _interopRequireDefault(require("@atlaskit/icon/core/content-width-wide"));
17
19
  var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
@@ -30,6 +32,8 @@ var _commands = require("../editor-commands/commands");
30
32
  var _pluginKey = require("./macro/plugin-key");
31
33
  var _pluginFactory = require("./plugin-factory");
32
34
  var _utils3 = require("./utils");
35
+ 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; }
36
+ 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; }
33
37
  // non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
34
38
  var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
35
39
  var _state$schema$nodes = state.schema.nodes,
@@ -254,7 +258,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
254
258
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
255
259
  extensionApi = _ref.extensionApi;
256
260
  return function (state, intl) {
257
- var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
261
+ var _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
258
262
  var formatMessage = intl.formatMessage;
259
263
  var extensionState = (0, _pluginFactory.getPluginState)(state);
260
264
  if ((0, _platformFeatureFlags.fg)('platform_editor_legacy_content_macro')) {
@@ -295,6 +299,15 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
295
299
  };
296
300
  };
297
301
  }
302
+ var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
303
+ var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
304
+ return (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_1') ? {
305
+ onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true, className),
306
+ onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false, className),
307
+ onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true, className),
308
+ onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false, className)
309
+ } : undefined;
310
+ };
298
311
  return {
299
312
  title: 'Extension floating controls',
300
313
  // Ignored via go/ees005
@@ -328,10 +341,10 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
328
341
  iconFallback: _remove.default,
329
342
  appearance: 'danger',
330
343
  onClick: (0, _commands.removeExtension)(editorAnalyticsAPI),
331
- onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true),
332
- onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false),
333
- onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true),
334
- onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false),
344
+ onMouseEnter: (_hoverDecoration5 = hoverDecoration) === null || _hoverDecoration5 === void 0 ? void 0 : _hoverDecoration5(nodeType, true),
345
+ onMouseLeave: (_hoverDecoration6 = hoverDecoration) === null || _hoverDecoration6 === void 0 ? void 0 : _hoverDecoration6(nodeType, false),
346
+ onFocus: (_hoverDecoration7 = hoverDecoration) === null || _hoverDecoration7 === void 0 ? void 0 : _hoverDecoration7(nodeType, true),
347
+ onBlur: (_hoverDecoration8 = hoverDecoration) === null || _hoverDecoration8 === void 0 ? void 0 : _hoverDecoration8(nodeType, false),
335
348
  focusEditoronEnter: true,
336
349
  title: formatMessage(_messages.default.remove),
337
350
  tabIndex: null,
@@ -344,7 +357,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
344
357
  separator: breakoutItems.length > 0 ? 'both' : 'end'
345
358
  }, {
346
359
  type: 'overflow-dropdown',
347
- options: [{
360
+ options: [_objectSpread({
348
361
  title: 'Copy',
349
362
  onClick: function onClick() {
350
363
  var _extensionApi$core, _extensionApi$floatin;
@@ -355,13 +368,13 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
355
368
  icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
356
369
  label: "Copy"
357
370
  })
358
- }, {
371
+ }, hoverDecorationProps(nodeType, _editorSharedStyles.akEditorSelectedNodeClassName)), _objectSpread({
359
372
  title: 'Delete',
360
373
  onClick: (0, _commands.removeExtension)(editorAnalyticsAPI),
361
374
  icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
362
375
  label: "Delete"
363
376
  })
364
- }]
377
+ }, hoverDecorationProps(nodeType))]
365
378
  }])),
366
379
  scrollable: true
367
380
  };
@@ -4,6 +4,7 @@ import commonMessages from '@atlaskit/editor-common/messages';
4
4
  import { BODIED_EXT_MBE_MARGIN_TOP } from '@atlaskit/editor-common/styles';
5
5
  import { getChildrenInfo, getNodeName, isReferencedSource } from '@atlaskit/editor-common/utils';
6
6
  import { findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
+ import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
7
8
  import ContentWidthNarrowIcon from '@atlaskit/icon/core/content-width-narrow';
8
9
  import ContentWidthWideIcon from '@atlaskit/icon/core/content-width-wide';
9
10
  import CopyIcon from '@atlaskit/icon/core/copy';
@@ -22,6 +23,7 @@ import { removeDescendantNodes, removeExtension, updateExtensionLayout } from '.
22
23
  import { pluginKey as macroPluginKey } from './macro/plugin-key';
23
24
  import { getPluginState } from './plugin-factory';
24
25
  import { getSelectedExtension } from './utils';
26
+
25
27
  // non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
26
28
  const isNestedNBM = (state, selectedExtNode) => {
27
29
  const {
@@ -261,7 +263,7 @@ export const getToolbarConfig = ({
261
263
  editorAnalyticsAPI,
262
264
  extensionApi
263
265
  }) => (state, intl) => {
264
- var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
266
+ var _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
265
267
  const {
266
268
  formatMessage
267
269
  } = intl;
@@ -299,6 +301,15 @@ export const getToolbarConfig = ({
299
301
  };
300
302
  };
301
303
  }
304
+ const hoverDecorationProps = (nodeType, className) => {
305
+ var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
306
+ return fg('platform_editor_controls_patch_1') ? {
307
+ onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true, className),
308
+ onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false, className),
309
+ onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true, className),
310
+ onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false, className)
311
+ } : undefined;
312
+ };
302
313
  return {
303
314
  title: 'Extension floating controls',
304
315
  // Ignored via go/ees005
@@ -328,10 +339,10 @@ export const getToolbarConfig = ({
328
339
  iconFallback: RemoveIcon,
329
340
  appearance: 'danger',
330
341
  onClick: removeExtension(editorAnalyticsAPI),
331
- onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true),
332
- onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false),
333
- onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true),
334
- onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false),
342
+ onMouseEnter: (_hoverDecoration5 = hoverDecoration) === null || _hoverDecoration5 === void 0 ? void 0 : _hoverDecoration5(nodeType, true),
343
+ onMouseLeave: (_hoverDecoration6 = hoverDecoration) === null || _hoverDecoration6 === void 0 ? void 0 : _hoverDecoration6(nodeType, false),
344
+ onFocus: (_hoverDecoration7 = hoverDecoration) === null || _hoverDecoration7 === void 0 ? void 0 : _hoverDecoration7(nodeType, true),
345
+ onBlur: (_hoverDecoration8 = hoverDecoration) === null || _hoverDecoration8 === void 0 ? void 0 : _hoverDecoration8(nodeType, false),
335
346
  focusEditoronEnter: true,
336
347
  title: formatMessage(commonMessages.remove),
337
348
  tabIndex: null,
@@ -354,13 +365,15 @@ export const getToolbarConfig = ({
354
365
  },
355
366
  icon: /*#__PURE__*/React.createElement(CopyIcon, {
356
367
  label: "Copy"
357
- })
368
+ }),
369
+ ...hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)
358
370
  }, {
359
371
  title: 'Delete',
360
372
  onClick: removeExtension(editorAnalyticsAPI),
361
373
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
362
374
  label: "Delete"
363
- })
375
+ }),
376
+ ...hoverDecorationProps(nodeType)
364
377
  }]
365
378
  }])],
366
379
  scrollable: true
@@ -1,10 +1,14 @@
1
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
1
2
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
3
+ 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; }
4
+ 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) { _defineProperty(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; }
2
5
  import React from 'react';
3
6
  import { messages } from '@atlaskit/editor-common/extensions';
4
7
  import commonMessages from '@atlaskit/editor-common/messages';
5
8
  import { BODIED_EXT_MBE_MARGIN_TOP } from '@atlaskit/editor-common/styles';
6
9
  import { getChildrenInfo as _getChildrenInfo, getNodeName, isReferencedSource } from '@atlaskit/editor-common/utils';
7
10
  import { findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
11
+ import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
8
12
  import ContentWidthNarrowIcon from '@atlaskit/icon/core/content-width-narrow';
9
13
  import ContentWidthWideIcon from '@atlaskit/icon/core/content-width-wide';
10
14
  import CopyIcon from '@atlaskit/icon/core/copy';
@@ -23,6 +27,7 @@ import { removeDescendantNodes, removeExtension, updateExtensionLayout } from '.
23
27
  import { pluginKey as macroPluginKey } from './macro/plugin-key';
24
28
  import { getPluginState } from './plugin-factory';
25
29
  import { getSelectedExtension } from './utils';
30
+
26
31
  // non-bodied extensions nested inside panels, blockquotes and lists do not support layouts
27
32
  var isNestedNBM = function isNestedNBM(state, selectedExtNode) {
28
33
  var _state$schema$nodes = state.schema.nodes,
@@ -247,7 +252,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
247
252
  editorAnalyticsAPI = _ref.editorAnalyticsAPI,
248
253
  extensionApi = _ref.extensionApi;
249
254
  return function (state, intl) {
250
- var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
255
+ var _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
251
256
  var formatMessage = intl.formatMessage;
252
257
  var extensionState = getPluginState(state);
253
258
  if (fg('platform_editor_legacy_content_macro')) {
@@ -288,6 +293,15 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
288
293
  };
289
294
  };
290
295
  }
296
+ var hoverDecorationProps = function hoverDecorationProps(nodeType, className) {
297
+ var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
298
+ return fg('platform_editor_controls_patch_1') ? {
299
+ onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true, className),
300
+ onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false, className),
301
+ onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true, className),
302
+ onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false, className)
303
+ } : undefined;
304
+ };
291
305
  return {
292
306
  title: 'Extension floating controls',
293
307
  // Ignored via go/ees005
@@ -321,10 +335,10 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
321
335
  iconFallback: RemoveIcon,
322
336
  appearance: 'danger',
323
337
  onClick: removeExtension(editorAnalyticsAPI),
324
- onMouseEnter: (_hoverDecoration = hoverDecoration) === null || _hoverDecoration === void 0 ? void 0 : _hoverDecoration(nodeType, true),
325
- onMouseLeave: (_hoverDecoration2 = hoverDecoration) === null || _hoverDecoration2 === void 0 ? void 0 : _hoverDecoration2(nodeType, false),
326
- onFocus: (_hoverDecoration3 = hoverDecoration) === null || _hoverDecoration3 === void 0 ? void 0 : _hoverDecoration3(nodeType, true),
327
- onBlur: (_hoverDecoration4 = hoverDecoration) === null || _hoverDecoration4 === void 0 ? void 0 : _hoverDecoration4(nodeType, false),
338
+ onMouseEnter: (_hoverDecoration5 = hoverDecoration) === null || _hoverDecoration5 === void 0 ? void 0 : _hoverDecoration5(nodeType, true),
339
+ onMouseLeave: (_hoverDecoration6 = hoverDecoration) === null || _hoverDecoration6 === void 0 ? void 0 : _hoverDecoration6(nodeType, false),
340
+ onFocus: (_hoverDecoration7 = hoverDecoration) === null || _hoverDecoration7 === void 0 ? void 0 : _hoverDecoration7(nodeType, true),
341
+ onBlur: (_hoverDecoration8 = hoverDecoration) === null || _hoverDecoration8 === void 0 ? void 0 : _hoverDecoration8(nodeType, false),
328
342
  focusEditoronEnter: true,
329
343
  title: formatMessage(commonMessages.remove),
330
344
  tabIndex: null,
@@ -337,7 +351,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
337
351
  separator: breakoutItems.length > 0 ? 'both' : 'end'
338
352
  }, {
339
353
  type: 'overflow-dropdown',
340
- options: [{
354
+ options: [_objectSpread({
341
355
  title: 'Copy',
342
356
  onClick: function onClick() {
343
357
  var _extensionApi$core, _extensionApi$floatin;
@@ -348,13 +362,13 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
348
362
  icon: /*#__PURE__*/React.createElement(CopyIcon, {
349
363
  label: "Copy"
350
364
  })
351
- }, {
365
+ }, hoverDecorationProps(nodeType, akEditorSelectedNodeClassName)), _objectSpread({
352
366
  title: 'Delete',
353
367
  onClick: removeExtension(editorAnalyticsAPI),
354
368
  icon: /*#__PURE__*/React.createElement(DeleteIcon, {
355
369
  label: "Delete"
356
370
  })
357
- }]
371
+ }, hoverDecorationProps(nodeType))]
358
372
  }])),
359
373
  scrollable: true
360
374
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "5.1.0",
3
+ "version": "5.1.1",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -58,7 +58,7 @@
58
58
  "@atlaskit/textarea": "^8.0.0",
59
59
  "@atlaskit/textfield": "^8.0.0",
60
60
  "@atlaskit/theme": "^18.0.0",
61
- "@atlaskit/tmp-editor-statsig": "^4.5.0",
61
+ "@atlaskit/tmp-editor-statsig": "^4.6.0",
62
62
  "@atlaskit/toggle": "^15.0.0",
63
63
  "@atlaskit/tokens": "^4.5.0",
64
64
  "@atlaskit/tooltip": "^20.0.0",
@@ -120,6 +120,9 @@
120
120
  },
121
121
  "platform_editor_extension_deprecation_status": {
122
122
  "type": "boolean"
123
+ },
124
+ "platform_editor_controls_patch_1": {
125
+ "type": "boolean"
123
126
  }
124
127
  },
125
128
  "stricter": {