@atlaskit/editor-plugin-card 6.0.1 → 6.0.2

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-card
2
2
 
3
+ ## 6.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#154277](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/154277)
8
+ [`84e1566863396`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/84e1566863396) -
9
+ [ux] ED-27809 Update edit button for datasource link toolbars so users can update search query
10
+ - Updated dependencies
11
+
3
12
  ## 6.0.1
4
13
 
5
14
  ### Patch Changes
@@ -14,6 +14,7 @@ var _card = require("@atlaskit/editor-common/card");
14
14
  var _ui = require("@atlaskit/editor-common/ui");
15
15
  var _uiMenu = require("@atlaskit/editor-common/ui-menu");
16
16
  var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/utility/migration/chevron-down"));
17
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
17
18
  var _compiled = require("@atlaskit/primitives/compiled");
18
19
  var _LinkToolbarAppearanceDropdown = require("./LinkToolbarAppearanceDropdown");
19
20
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
@@ -148,7 +149,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
148
149
  return null;
149
150
  }
150
151
  var dispatchCommand = function dispatchCommand(fn) {
151
- fn && fn(editorView && editorView.state, editorView && editorView.dispatch);
152
+ fn && fn(editorView && editorView.state, editorView && editorView.dispatch, (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9') ? editorView : undefined);
152
153
  // Refocus the view to ensure the editor has focus
153
154
  if (editorView && !editorView.hasFocus()) {
154
155
  editorView.focus();
@@ -325,6 +325,30 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
325
325
  type: 'separator'
326
326
  }] : [];
327
327
  var openLinkInputMethod = (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_analytics') ? _analytics.INPUT_METHOD.FLOATING_TB : _analytics.INPUT_METHOD.TOOLBAR;
328
+ var editButtonItems = cardOptions.allowDatasource && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_9') ? [{
329
+ type: 'custom',
330
+ fallback: [],
331
+ render: function render(editorView) {
332
+ return /*#__PURE__*/_react.default.createElement(_EditToolbarButton.EditToolbarButton, {
333
+ key: "edit-toolbar-item",
334
+ url: url,
335
+ intl: intl,
336
+ editorAnalyticsApi: editorAnalyticsApi,
337
+ editorView: editorView,
338
+ onLinkEditClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true),
339
+ currentAppearance: currentAppearance
340
+ });
341
+ }
342
+ }] : [{
343
+ id: 'editor.link.edit',
344
+ type: 'button',
345
+ selected: false,
346
+ metadata: metadata,
347
+ title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
348
+ icon: _edit.default,
349
+ testId: 'link-toolbar-edit-link-button',
350
+ onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
351
+ }];
328
352
  var toolbarItems = (0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [_objectSpread({
329
353
  id: 'editor.link.openLink',
330
354
  type: 'button',
@@ -363,16 +387,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
363
387
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
364
388
  title: intl.formatMessage(_messages.default.remove),
365
389
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
366
- }]) : [{
367
- id: 'editor.link.edit',
368
- type: 'button',
369
- selected: false,
370
- metadata: metadata,
371
- title: intl.formatMessage(_messages.linkToolbarMessages.editLink),
372
- icon: _edit.default,
373
- testId: 'link-toolbar-edit-link-button',
374
- onClick: (0, _EditLinkToolbar.getEditLinkCallback)(editorAnalyticsApi, true)
375
- }].concat((0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') ? [] : [{
390
+ }]) : [].concat(editButtonItems, (0, _toConsumableArray2.default)((0, _platformFeatureFlags.fg)('platform_editor_controls_patch_6') ? [] : [{
376
391
  type: 'separator'
377
392
  }]), (0, _toConsumableArray2.default)(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [_objectSpread({
378
393
  id: 'editor.link.openLink',
@@ -3,6 +3,7 @@ import { appearancePropsMap } from '@atlaskit/editor-common/card';
3
3
  import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
4
4
  import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
5
5
  import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
6
+ import { fg } from '@atlaskit/platform-feature-flags';
6
7
  import { Flex } from '@atlaskit/primitives/compiled';
7
8
  import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
8
9
  const CustomHyperlinkDropdown = props => {
@@ -68,7 +69,7 @@ const CustomHyperlinkDropdown = props => {
68
69
  return null;
69
70
  }
70
71
  const dispatchCommand = fn => {
71
- fn && fn(editorView && editorView.state, editorView && editorView.dispatch);
72
+ fn && fn(editorView && editorView.state, editorView && editorView.dispatch, fg('platform_editor_controls_patch_9') ? editorView : undefined);
72
73
  // Refocus the view to ensure the editor has focus
73
74
  if (editorView && !editorView.hasFocus()) {
74
75
  editorView.focus();
@@ -319,6 +319,28 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
319
319
  type: 'separator'
320
320
  }] : [];
321
321
  const openLinkInputMethod = fg('platform_editor_controls_patch_analytics') ? INPUT_METHOD.FLOATING_TB : INPUT_METHOD.TOOLBAR;
322
+ const editButtonItems = cardOptions.allowDatasource && fg('platform_editor_controls_patch_9') ? [{
323
+ type: 'custom',
324
+ fallback: [],
325
+ render: editorView => /*#__PURE__*/React.createElement(EditToolbarButton, {
326
+ key: "edit-toolbar-item",
327
+ url: url,
328
+ intl: intl,
329
+ editorAnalyticsApi: editorAnalyticsApi,
330
+ editorView: editorView,
331
+ onLinkEditClick: getEditLinkCallback(editorAnalyticsApi, true),
332
+ currentAppearance: currentAppearance
333
+ })
334
+ }] : [{
335
+ id: 'editor.link.edit',
336
+ type: 'button',
337
+ selected: false,
338
+ metadata: metadata,
339
+ title: intl.formatMessage(linkToolbarMessages.editLink),
340
+ icon: EditIcon,
341
+ testId: 'link-toolbar-edit-link-button',
342
+ onClick: getEditLinkCallback(editorAnalyticsApi, true)
343
+ }];
322
344
  const toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [...editItems, ...commentItems, {
323
345
  id: 'editor.link.openLink',
324
346
  type: 'button',
@@ -358,16 +380,7 @@ const generateToolbarItems = (state, intl, providerFactory, cardOptions, lpLinkP
358
380
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
359
381
  title: intl.formatMessage(commonMessages.remove),
360
382
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
361
- }] : [{
362
- id: 'editor.link.edit',
363
- type: 'button',
364
- selected: false,
365
- metadata: metadata,
366
- title: intl.formatMessage(linkToolbarMessages.editLink),
367
- icon: EditIcon,
368
- testId: 'link-toolbar-edit-link-button',
369
- onClick: getEditLinkCallback(editorAnalyticsApi, true)
370
- }, ...(fg('platform_editor_controls_patch_6') ? [] : [{
383
+ }] : [...editButtonItems, ...(fg('platform_editor_controls_patch_6') ? [] : [{
371
384
  type: 'separator'
372
385
  }]), ...getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi), {
373
386
  id: 'editor.link.openLink',
@@ -6,6 +6,7 @@ import { appearancePropsMap } from '@atlaskit/editor-common/card';
6
6
  import { FloatingToolbarButton as Button, FloatingToolbarSeparator as Separator } from '@atlaskit/editor-common/ui';
7
7
  import { ArrowKeyNavigationType, DropdownContainer as UiDropdown } from '@atlaskit/editor-common/ui-menu';
8
8
  import ChevronDownIcon from '@atlaskit/icon/utility/migration/chevron-down';
9
+ import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { Flex } from '@atlaskit/primitives/compiled';
10
11
  import { LinkAppearanceMenu } from './LinkToolbarAppearanceDropdown';
11
12
  var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
@@ -138,7 +139,7 @@ var CustomHyperlinkDropdown = function CustomHyperlinkDropdown(props) {
138
139
  return null;
139
140
  }
140
141
  var dispatchCommand = function dispatchCommand(fn) {
141
- fn && fn(editorView && editorView.state, editorView && editorView.dispatch);
142
+ fn && fn(editorView && editorView.state, editorView && editorView.dispatch, fg('platform_editor_controls_patch_9') ? editorView : undefined);
142
143
  // Refocus the view to ensure the editor has focus
143
144
  if (editorView && !editorView.hasFocus()) {
144
145
  editorView.focus();
@@ -315,6 +315,30 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
315
315
  type: 'separator'
316
316
  }] : [];
317
317
  var openLinkInputMethod = fg('platform_editor_controls_patch_analytics') ? INPUT_METHOD.FLOATING_TB : INPUT_METHOD.TOOLBAR;
318
+ var editButtonItems = cardOptions.allowDatasource && fg('platform_editor_controls_patch_9') ? [{
319
+ type: 'custom',
320
+ fallback: [],
321
+ render: function render(editorView) {
322
+ return /*#__PURE__*/React.createElement(EditToolbarButton, {
323
+ key: "edit-toolbar-item",
324
+ url: url,
325
+ intl: intl,
326
+ editorAnalyticsApi: editorAnalyticsApi,
327
+ editorView: editorView,
328
+ onLinkEditClick: getEditLinkCallback(editorAnalyticsApi, true),
329
+ currentAppearance: currentAppearance
330
+ });
331
+ }
332
+ }] : [{
333
+ id: 'editor.link.edit',
334
+ type: 'button',
335
+ selected: false,
336
+ metadata: metadata,
337
+ title: intl.formatMessage(linkToolbarMessages.editLink),
338
+ icon: EditIcon,
339
+ testId: 'link-toolbar-edit-link-button',
340
+ onClick: getEditLinkCallback(editorAnalyticsApi, true)
341
+ }];
318
342
  var toolbarItems = editorExperiment('platform_editor_controls', 'control') ? [].concat(editItems, commentItems, [_objectSpread({
319
343
  id: 'editor.link.openLink',
320
344
  type: 'button',
@@ -353,16 +377,7 @@ var generateToolbarItems = function generateToolbarItems(state, intl, providerFa
353
377
  onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(node.type, false),
354
378
  title: intl.formatMessage(commonMessages.remove),
355
379
  onClick: withToolbarMetadata(removeCard(editorAnalyticsApi))
356
- }]) : [{
357
- id: 'editor.link.edit',
358
- type: 'button',
359
- selected: false,
360
- metadata: metadata,
361
- title: intl.formatMessage(linkToolbarMessages.editLink),
362
- icon: EditIcon,
363
- testId: 'link-toolbar-edit-link-button',
364
- onClick: getEditLinkCallback(editorAnalyticsApi, true)
365
- }].concat(_toConsumableArray(fg('platform_editor_controls_patch_6') ? [] : [{
380
+ }]) : [].concat(editButtonItems, _toConsumableArray(fg('platform_editor_controls_patch_6') ? [] : [{
366
381
  type: 'separator'
367
382
  }]), _toConsumableArray(getUnlinkButtonGroup(state, intl, node, inlineCard, editorAnalyticsApi)), [_objectSpread({
368
383
  id: 'editor.link.openLink',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-card",
3
- "version": "6.0.1",
3
+ "version": "6.0.2",
4
4
  "description": "Card plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -60,7 +60,7 @@
60
60
  "@atlaskit/menu": "^5.0.0",
61
61
  "@atlaskit/platform-feature-flags": "^1.1.0",
62
62
  "@atlaskit/primitives": "^14.7.0",
63
- "@atlaskit/smart-card": "^38.0.0",
63
+ "@atlaskit/smart-card": "^38.1.0",
64
64
  "@atlaskit/theme": "^18.0.0",
65
65
  "@atlaskit/tmp-editor-statsig": "^4.21.0",
66
66
  "@atlaskit/tokens": "^4.8.0",
@@ -140,6 +140,9 @@
140
140
  "platform_editor_controls_patch_6": {
141
141
  "type": "boolean"
142
142
  },
143
+ "platform_editor_controls_patch_9": {
144
+ "type": "boolean"
145
+ },
143
146
  "platform_editor_controls_patch_analytics": {
144
147
  "type": "boolean"
145
148
  },