@atlaskit/editor-plugin-card 5.0.5 → 5.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 5.0.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#120575](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120575)
8
+ [`0da64a47689b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0da64a47689b5) -
9
+ [ux] Add overflow menu on editor floating toolbar for media and card plugin
10
+
3
11
  ## 5.0.5
4
12
 
5
13
  ### Patch Changes
@@ -19,6 +19,7 @@ var _utils = require("@atlaskit/editor-common/utils");
19
19
  var _state = require("@atlaskit/editor-prosemirror/state");
20
20
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
21
21
  var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
22
+ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
22
23
  var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
23
24
  var _linkBroken = _interopRequireDefault(require("@atlaskit/icon/core/link-broken"));
24
25
  var _linkExternal = _interopRequireDefault(require("@atlaskit/icon/core/link-external"));
@@ -332,21 +333,6 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
332
333
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
333
334
  }]) : [].concat(editItems, (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
334
335
  type: 'separator'
335
- }, {
336
- id: 'editor.link.delete',
337
- focusEditoronEnter: true,
338
- type: 'button',
339
- appearance: 'danger',
340
- icon: _delete.default,
341
- iconFallback: _remove.default,
342
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
343
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
344
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
345
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
346
- title: intl.formatMessage(_messages.default.remove),
347
- onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
348
- }, {
349
- type: 'separator'
350
336
  }, {
351
337
  id: 'editor.link.openLink',
352
338
  type: 'button',
@@ -356,15 +342,6 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
356
342
  className: 'hyperlink-open-link',
357
343
  title: intl.formatMessage(_messages.linkMessages.openLink),
358
344
  onClick: visitCardLink(editorAnalyticsApi)
359
- }, {
360
- type: 'separator'
361
- }, {
362
- type: 'copy-button',
363
- items: [{
364
- state: state,
365
- formatMessage: intl.formatMessage,
366
- nodeType: node.type
367
- }]
368
345
  }], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
369
346
  type: 'separator'
370
347
  }, commentItems[0]] : commentItems));
@@ -420,6 +397,31 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
420
397
  type: 'separator'
421
398
  }]));
422
399
  }
400
+ if (toolbarItems.length > 0 && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
401
+ var overflowMenuConfig = [{
402
+ type: 'separator',
403
+ supportsViewMode: true
404
+ }, {
405
+ type: 'overflow-dropdown',
406
+ options: [{
407
+ title: 'Copy',
408
+ onClick: function onClick() {
409
+ // TODO replace with copy-button plugin
410
+ return true;
411
+ },
412
+ icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
413
+ label: "Copy"
414
+ })
415
+ }, {
416
+ title: 'Delete',
417
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
418
+ icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
419
+ label: "Delete"
420
+ })
421
+ }]
422
+ }];
423
+ toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
424
+ }
423
425
  return toolbarItems;
424
426
  }
425
427
  };
@@ -9,6 +9,7 @@ import { canRenderDatasource } from '@atlaskit/editor-common/utils';
9
9
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
10
10
  import { findDomRefAtPos, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
11
11
  import CommentIcon from '@atlaskit/icon/core/comment';
12
+ import CopyIcon from '@atlaskit/icon/core/copy';
12
13
  import DeleteIcon from '@atlaskit/icon/core/delete';
13
14
  import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
14
15
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
@@ -324,21 +325,6 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
324
325
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
325
326
  }] : [...editItems, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
326
327
  type: 'separator'
327
- }, {
328
- id: 'editor.link.delete',
329
- focusEditoronEnter: true,
330
- type: 'button',
331
- appearance: 'danger',
332
- icon: DeleteIcon,
333
- iconFallback: RemoveIcon,
334
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
335
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
336
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
337
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
338
- title: intl.formatMessage(commonMessages.remove),
339
- onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
340
- }, {
341
- type: 'separator'
342
328
  }, {
343
329
  id: 'editor.link.openLink',
344
330
  type: 'button',
@@ -348,15 +334,6 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
348
334
  className: 'hyperlink-open-link',
349
335
  title: intl.formatMessage(linkMessages.openLink),
350
336
  onClick: visitCardLink(editorAnalyticsApi)
351
- }, {
352
- type: 'separator'
353
- }, {
354
- type: 'copy-button',
355
- items: [{
356
- state,
357
- formatMessage: intl.formatMessage,
358
- nodeType: node.type
359
- }]
360
337
  }, ...(commentItems.length > 1 ? [{
361
338
  type: 'separator'
362
339
  }, commentItems[0]] : commentItems)];
@@ -410,6 +387,31 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
410
387
  type: 'separator'
411
388
  });
412
389
  }
390
+ if (toolbarItems.length > 0 && editorExperiment('platform_editor_controls', 'variant1')) {
391
+ const overflowMenuConfig = [{
392
+ type: 'separator',
393
+ supportsViewMode: true
394
+ }, {
395
+ type: 'overflow-dropdown',
396
+ options: [{
397
+ title: 'Copy',
398
+ onClick: () => {
399
+ // TODO replace with copy-button plugin
400
+ return true;
401
+ },
402
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
403
+ label: "Copy"
404
+ })
405
+ }, {
406
+ title: 'Delete',
407
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
408
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
409
+ label: "Delete"
410
+ })
411
+ }]
412
+ }];
413
+ toolbarItems.push(...overflowMenuConfig);
414
+ }
413
415
  return toolbarItems;
414
416
  }
415
417
  };
@@ -13,6 +13,7 @@ import { canRenderDatasource } from '@atlaskit/editor-common/utils';
13
13
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
14
14
  import { findDomRefAtPos, removeSelectedNode } from '@atlaskit/editor-prosemirror/utils';
15
15
  import CommentIcon from '@atlaskit/icon/core/comment';
16
+ import CopyIcon from '@atlaskit/icon/core/copy';
16
17
  import DeleteIcon from '@atlaskit/icon/core/delete';
17
18
  import LinkBrokenIcon from '@atlaskit/icon/core/link-broken';
18
19
  import LinkExternalIcon from '@atlaskit/icon/core/link-external';
@@ -322,21 +323,6 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
322
323
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
323
324
  }]) : [].concat(editItems, _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
324
325
  type: 'separator'
325
- }, {
326
- id: 'editor.link.delete',
327
- focusEditoronEnter: true,
328
- type: 'button',
329
- appearance: 'danger',
330
- icon: DeleteIcon,
331
- iconFallback: RemoveIcon,
332
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
333
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
334
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, true),
335
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
336
- title: intl.formatMessage(commonMessages.remove),
337
- onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
338
- }, {
339
- type: 'separator'
340
326
  }, {
341
327
  id: 'editor.link.openLink',
342
328
  type: 'button',
@@ -346,15 +332,6 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
346
332
  className: 'hyperlink-open-link',
347
333
  title: intl.formatMessage(linkMessages.openLink),
348
334
  onClick: visitCardLink(editorAnalyticsApi)
349
- }, {
350
- type: 'separator'
351
- }, {
352
- type: 'copy-button',
353
- items: [{
354
- state: state,
355
- formatMessage: intl.formatMessage,
356
- nodeType: node.type
357
- }]
358
335
  }], _toConsumableArray(commentItems.length > 1 ? [{
359
336
  type: 'separator'
360
337
  }, commentItems[0]] : commentItems));
@@ -410,6 +387,31 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
410
387
  type: 'separator'
411
388
  }]));
412
389
  }
390
+ if (toolbarItems.length > 0 && editorExperiment('platform_editor_controls', 'variant1')) {
391
+ var overflowMenuConfig = [{
392
+ type: 'separator',
393
+ supportsViewMode: true
394
+ }, {
395
+ type: 'overflow-dropdown',
396
+ options: [{
397
+ title: 'Copy',
398
+ onClick: function onClick() {
399
+ // TODO replace with copy-button plugin
400
+ return true;
401
+ },
402
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
403
+ label: "Copy"
404
+ })
405
+ }, {
406
+ title: 'Delete',
407
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
408
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
409
+ label: "Delete"
410
+ })
411
+ }]
412
+ }];
413
+ toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
414
+ }
413
415
  return toolbarItems;
414
416
  }
415
417
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "5.0.5",
3
+ "version": "5.0.6",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",