@atlaskit/editor-plugin-card 5.0.5 → 5.0.7

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,21 @@
1
1
  # @atlaskit/editor-plugin-card
2
2
 
3
+ ## 5.0.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#121092](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/121092)
8
+ [`8cd08b738070d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8cd08b738070d) -
9
+ [ux] Implemented full height separator as per design for media and card
10
+
11
+ ## 5.0.6
12
+
13
+ ### Patch Changes
14
+
15
+ - [#120575](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/120575)
16
+ [`0da64a47689b5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0da64a47689b5) -
17
+ [ux] Add overflow menu on editor floating toolbar for media and card plugin
18
+
3
19
  ## 5.0.5
4
20
 
5
21
  ### 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"));
@@ -331,22 +332,8 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
331
332
  title: intl.formatMessage(_messages.default.remove),
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
- 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'
335
+ type: 'separator',
336
+ fullHeight: true
350
337
  }, {
351
338
  id: 'editor.link.openLink',
352
339
  type: 'button',
@@ -356,17 +343,9 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
356
343
  className: 'hyperlink-open-link',
357
344
  title: intl.formatMessage(_messages.linkMessages.openLink),
358
345
  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
346
  }], (0, _toConsumableArray2.default)(commentItems.length > 1 ? [{
369
- type: 'separator'
347
+ type: 'separator',
348
+ fullHeight: true
370
349
  }, commentItems[0]] : commentItems));
371
350
  if (currentAppearance === 'embed') {
372
351
  var _pluginInjectionApi$a4;
@@ -420,6 +399,32 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
420
399
  type: 'separator'
421
400
  }]));
422
401
  }
402
+ if (toolbarItems.length > 0 && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
403
+ var overflowMenuConfig = [{
404
+ type: 'separator',
405
+ supportsViewMode: true,
406
+ fullHeight: true
407
+ }, {
408
+ type: 'overflow-dropdown',
409
+ options: [{
410
+ title: 'Copy',
411
+ onClick: function onClick() {
412
+ // TODO replace with copy-button plugin
413
+ return true;
414
+ },
415
+ icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
416
+ label: "Copy"
417
+ })
418
+ }, {
419
+ title: 'Delete',
420
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
421
+ icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
422
+ label: "Delete"
423
+ })
424
+ }]
425
+ }];
426
+ toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
427
+ }
423
428
  return toolbarItems;
424
429
  }
425
430
  };
@@ -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';
@@ -323,22 +324,8 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
323
324
  title: intl.formatMessage(commonMessages.remove),
324
325
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
325
326
  }] : [...editItems, ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
326
- 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'
327
+ type: 'separator',
328
+ fullHeight: true
342
329
  }, {
343
330
  id: 'editor.link.openLink',
344
331
  type: 'button',
@@ -348,17 +335,9 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
348
335
  className: 'hyperlink-open-link',
349
336
  title: intl.formatMessage(linkMessages.openLink),
350
337
  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
338
  }, ...(commentItems.length > 1 ? [{
361
- type: 'separator'
339
+ type: 'separator',
340
+ fullHeight: true
362
341
  }, commentItems[0]] : commentItems)];
363
342
  if (currentAppearance === 'embed') {
364
343
  var _pluginInjectionApi$a5;
@@ -410,6 +389,32 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
410
389
  type: 'separator'
411
390
  });
412
391
  }
392
+ if (toolbarItems.length > 0 && editorExperiment('platform_editor_controls', 'variant1')) {
393
+ const overflowMenuConfig = [{
394
+ type: 'separator',
395
+ supportsViewMode: true,
396
+ fullHeight: true
397
+ }, {
398
+ type: 'overflow-dropdown',
399
+ options: [{
400
+ title: 'Copy',
401
+ onClick: () => {
402
+ // TODO replace with copy-button plugin
403
+ return true;
404
+ },
405
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
406
+ label: "Copy"
407
+ })
408
+ }, {
409
+ title: 'Delete',
410
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
411
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
412
+ label: "Delete"
413
+ })
414
+ }]
415
+ }];
416
+ toolbarItems.push(...overflowMenuConfig);
417
+ }
413
418
  return toolbarItems;
414
419
  }
415
420
  };
@@ -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';
@@ -321,22 +322,8 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
321
322
  title: intl.formatMessage(commonMessages.remove),
322
323
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
323
324
  }]) : [].concat(editItems, _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [getSettingsButton(intl, editorAnalyticsApi, cardOptions.userPreferencesLink), {
324
- 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'
325
+ type: 'separator',
326
+ fullHeight: true
340
327
  }, {
341
328
  id: 'editor.link.openLink',
342
329
  type: 'button',
@@ -346,17 +333,9 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
346
333
  className: 'hyperlink-open-link',
347
334
  title: intl.formatMessage(linkMessages.openLink),
348
335
  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
336
  }], _toConsumableArray(commentItems.length > 1 ? [{
359
- type: 'separator'
337
+ type: 'separator',
338
+ fullHeight: true
360
339
  }, commentItems[0]] : commentItems));
361
340
  if (currentAppearance === 'embed') {
362
341
  var _pluginInjectionApi$a4;
@@ -410,6 +389,32 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
410
389
  type: 'separator'
411
390
  }]));
412
391
  }
392
+ if (toolbarItems.length > 0 && editorExperiment('platform_editor_controls', 'variant1')) {
393
+ var overflowMenuConfig = [{
394
+ type: 'separator',
395
+ supportsViewMode: true,
396
+ fullHeight: true
397
+ }, {
398
+ type: 'overflow-dropdown',
399
+ options: [{
400
+ title: 'Copy',
401
+ onClick: function onClick() {
402
+ // TODO replace with copy-button plugin
403
+ return true;
404
+ },
405
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
406
+ label: "Copy"
407
+ })
408
+ }, {
409
+ title: 'Delete',
410
+ onClick: withToolbarMetadata(removeCard(editorAnalyticsApi)),
411
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
412
+ label: "Delete"
413
+ })
414
+ }]
415
+ }];
416
+ toolbarItems.push.apply(toolbarItems, overflowMenuConfig);
417
+ }
413
418
  return toolbarItems;
414
419
  }
415
420
  };
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.7",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -63,7 +63,7 @@
63
63
  "@atlaskit/smart-card": "^35.1.0",
64
64
  "@atlaskit/theme": "^17.0.0",
65
65
  "@atlaskit/tmp-editor-statsig": "^3.3.0",
66
- "@atlaskit/tokens": "^4.2.0",
66
+ "@atlaskit/tokens": "^4.3.0",
67
67
  "@babel/runtime": "^7.0.0",
68
68
  "@emotion/react": "^11.7.1",
69
69
  "lodash": "^4.17.21",