@atlaskit/editor-plugin-extension 5.0.0 → 5.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,23 @@
1
1
  # @atlaskit/editor-plugin-extension
2
2
 
3
+ ## 5.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#123345](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/123345)
8
+ [`31b02e82858e5`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/31b02e82858e5) -
9
+ NO-ISSUE: Update usages of selection utils
10
+ - Updated dependencies
11
+
12
+ ## 5.0.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [#123010](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/123010)
17
+ [`de55801631775`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/de55801631775) -
18
+ [ux] Move copy/delete to overflow menu on editor floating toolbar
19
+ - Updated dependencies
20
+
3
21
  ## 5.0.0
4
22
 
5
23
  ### Major Changes
@@ -8,6 +8,7 @@ exports.extensionPlugin = void 0;
8
8
  var _adfSchema = require("@atlaskit/adf-schema");
9
9
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
10
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
11
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
11
12
  var _actions = require("./editor-actions/actions");
12
13
  var _commands = require("./editor-commands/commands");
13
14
  var _extensionApi = require("./pm-plugins/extension-api");
@@ -179,7 +180,8 @@ var extensionPlugin = exports.extensionPlugin = function extensionPlugin(_ref) {
179
180
  breakoutEnabled: options.breakoutEnabled,
180
181
  hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
181
182
  applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange,
182
- editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions
183
+ editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
184
+ extensionApi: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1') ? _api : undefined
183
185
  }),
184
186
  contextPanel: !(0, _platformFeatureFlags.fg)('platform_editor_ai_object_sidebar_injection') ? (0, _contextPanel.getContextPanel)(function () {
185
187
  var _editorViewRef$curren;
@@ -227,7 +227,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
227
227
  var maybeBodiedExtension = selection instanceof _state.TextSelection ? (0, _utils.findParentNodeOfTypeClosestToPos)($head, bodiedExtension) : (0, _utils.findSelectedNodeOfType)(bodiedExtension)(selection);
228
228
  if (maybeBodiedExtension) {
229
229
  var end = maybeBodiedExtension.pos + maybeBodiedExtension.node.nodeSize;
230
- if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && (0, _selection2.isSelectionAtStartOfNode)($head, maybeBodiedExtension)) {
230
+ if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && (0, _selection2.isSelectionAtStartOfNode)($head, maybeBodiedExtension === null || maybeBodiedExtension === void 0 ? void 0 : maybeBodiedExtension.node)) {
231
231
  var anchor = end + 1;
232
232
 
233
233
  // an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
@@ -237,7 +237,7 @@ var createPlugin = exports.createPlugin = function createPlugin(dispatch, provid
237
237
  view.dispatch(tr.setSelection(newSelection));
238
238
  return true;
239
239
  }
240
- if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && (0, _selection2.isSelectionAtEndOfNode)($head, maybeBodiedExtension)) {
240
+ if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && (0, _selection2.isSelectionAtEndOfNode)($head, maybeBodiedExtension === null || maybeBodiedExtension === void 0 ? void 0 : maybeBodiedExtension.node)) {
241
241
  var _anchor = maybeBodiedExtension.pos - 1;
242
242
  var _head = end + 1;
243
243
  var _newSelection = _state.TextSelection.create(doc, Math.min(_anchor, selection.anchor), _head);
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  });
7
7
  exports.getToolbarConfig = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
+ var _react = _interopRequireDefault(require("react"));
9
10
  var _extensions = require("@atlaskit/editor-common/extensions");
10
11
  var _messages = _interopRequireDefault(require("@atlaskit/editor-common/messages"));
11
12
  var _styles = require("@atlaskit/editor-common/styles");
@@ -13,6 +14,7 @@ var _utils = require("@atlaskit/editor-common/utils");
13
14
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
14
15
  var _contentWidthNarrow = _interopRequireDefault(require("@atlaskit/icon/core/content-width-narrow"));
15
16
  var _contentWidthWide = _interopRequireDefault(require("@atlaskit/icon/core/content-width-wide"));
17
+ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/copy"));
16
18
  var _delete = _interopRequireDefault(require("@atlaskit/icon/core/delete"));
17
19
  var _edit = _interopRequireDefault(require("@atlaskit/icon/core/edit"));
18
20
  var _expandHorizontal = _interopRequireDefault(require("@atlaskit/icon/core/expand-horizontal"));
@@ -139,7 +141,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
139
141
  editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
140
142
  }
141
143
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
142
- var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4, _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
144
+ var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
143
145
  var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
144
146
  var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
145
147
  var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
@@ -215,13 +217,13 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
215
217
  left: nextPos.left
216
218
  };
217
219
  },
218
- items: [].concat((0, _toConsumableArray2.default)(editButtonArray), (0, _toConsumableArray2.default)(breakoutButtonArray), [{
220
+ items: [].concat((0, _toConsumableArray2.default)(editButtonArray), (0, _toConsumableArray2.default)(breakoutButtonArray), (0, _toConsumableArray2.default)((0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [{
219
221
  type: 'separator',
220
222
  hidden: editButtonArray.length === 0 && breakoutButtonArray.length === 0
221
223
  }, {
222
224
  type: 'extensions-placeholder',
223
225
  separator: 'end'
224
- }], (0, _toConsumableArray2.default)((0, _experiments.editorExperiment)('platform_editor_controls', 'control') ? [{
226
+ }, {
225
227
  type: 'copy-button',
226
228
  items: [{
227
229
  state: state,
@@ -246,28 +248,27 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig(_ref
246
248
  tabIndex: null,
247
249
  confirmDialog: confirmDialog
248
250
  }] : [{
249
- id: 'editor.extension.delete',
250
- type: 'button',
251
- icon: _delete.default,
252
- iconFallback: _remove.default,
253
- appearance: 'danger',
254
- onClick: (0, _commands.removeExtension)(editorAnalyticsAPI),
255
- onMouseEnter: (_hoverDecoration5 = hoverDecoration) === null || _hoverDecoration5 === void 0 ? void 0 : _hoverDecoration5(nodeType, true),
256
- onMouseLeave: (_hoverDecoration6 = hoverDecoration) === null || _hoverDecoration6 === void 0 ? void 0 : _hoverDecoration6(nodeType, false),
257
- onFocus: (_hoverDecoration7 = hoverDecoration) === null || _hoverDecoration7 === void 0 ? void 0 : _hoverDecoration7(nodeType, true),
258
- onBlur: (_hoverDecoration8 = hoverDecoration) === null || _hoverDecoration8 === void 0 ? void 0 : _hoverDecoration8(nodeType, false),
259
- focusEditoronEnter: true,
260
- title: formatMessage(_messages.default.remove),
261
- tabIndex: null,
262
- confirmDialog: confirmDialog
263
- }, {
264
- type: 'separator'
251
+ type: 'separator',
252
+ fullHeight: true
265
253
  }, {
266
- type: 'copy-button',
267
- items: [{
268
- state: state,
269
- formatMessage: intl.formatMessage,
270
- nodeType: nodeType
254
+ type: 'overflow-dropdown',
255
+ options: [{
256
+ title: 'Copy',
257
+ onClick: function onClick() {
258
+ var _extensionApi$core, _extensionApi$floatin;
259
+ extensionApi === null || extensionApi === void 0 || (_extensionApi$core = extensionApi.core) === null || _extensionApi$core === void 0 || _extensionApi$core.actions.execute( // @ts-ignore
260
+ extensionApi === null || extensionApi === void 0 || (_extensionApi$floatin = extensionApi.floatingToolbar) === null || _extensionApi$floatin === void 0 ? void 0 : _extensionApi$floatin.commands.copyNode(nodeType));
261
+ return true;
262
+ },
263
+ icon: /*#__PURE__*/_react.default.createElement(_copy.default, {
264
+ label: "Copy"
265
+ })
266
+ }, {
267
+ title: 'Delete',
268
+ onClick: (0, _commands.removeExtension)(editorAnalyticsAPI),
269
+ icon: /*#__PURE__*/_react.default.createElement(_delete.default, {
270
+ label: "Delete"
271
+ })
271
272
  }]
272
273
  }])),
273
274
  scrollable: true
@@ -1,6 +1,7 @@
1
1
  import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
5
  import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension, insertOrReplaceExtension } from './editor-actions/actions';
5
6
  import { forceAutoSave } from './editor-commands/commands';
6
7
  import { createExtensionAPI } from './pm-plugins/extension-api';
@@ -167,7 +168,8 @@ export const extensionPlugin = ({
167
168
  breakoutEnabled: options.breakoutEnabled,
168
169
  hoverDecoration: api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
169
170
  applyChangeToContextPanel: api === null || api === void 0 ? void 0 : (_api$contextPanel4 = api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange,
170
- editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions
171
+ editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
172
+ extensionApi: editorExperiment('platform_editor_controls', 'variant1') ? api : undefined
171
173
  }),
172
174
  contextPanel: !fg('platform_editor_ai_object_sidebar_injection') ? getContextPanel(() => {
173
175
  var _editorViewRef$curren;
@@ -176,7 +176,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
176
176
  const maybeBodiedExtension = selection instanceof TextSelection ? findParentNodeOfTypeClosestToPos($head, bodiedExtension) : findSelectedNodeOfType(bodiedExtension)(selection);
177
177
  if (maybeBodiedExtension) {
178
178
  const end = maybeBodiedExtension.pos + maybeBodiedExtension.node.nodeSize;
179
- if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && isSelectionAtStartOfNode($head, maybeBodiedExtension)) {
179
+ if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && isSelectionAtStartOfNode($head, maybeBodiedExtension === null || maybeBodiedExtension === void 0 ? void 0 : maybeBodiedExtension.node)) {
180
180
  const anchor = end + 1;
181
181
 
182
182
  // an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
@@ -186,7 +186,7 @@ export const createPlugin = (dispatch, providerFactory, extensionHandlers, porta
186
186
  view.dispatch(tr.setSelection(newSelection));
187
187
  return true;
188
188
  }
189
- if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && isSelectionAtEndOfNode($head, maybeBodiedExtension)) {
189
+ if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && isSelectionAtEndOfNode($head, maybeBodiedExtension === null || maybeBodiedExtension === void 0 ? void 0 : maybeBodiedExtension.node)) {
190
190
  const anchor = maybeBodiedExtension.pos - 1;
191
191
  const head = end + 1;
192
192
  const newSelection = TextSelection.create(doc, Math.min(anchor, selection.anchor), head);
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { messages } from '@atlaskit/editor-common/extensions';
2
3
  import commonMessages from '@atlaskit/editor-common/messages';
3
4
  import { BODIED_EXT_MBE_MARGIN_TOP } from '@atlaskit/editor-common/styles';
@@ -5,6 +6,7 @@ import { getChildrenInfo, getNodeName, isReferencedSource } from '@atlaskit/edit
5
6
  import { findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
6
7
  import ContentWidthNarrowIcon from '@atlaskit/icon/core/content-width-narrow';
7
8
  import ContentWidthWideIcon from '@atlaskit/icon/core/content-width-wide';
9
+ import CopyIcon from '@atlaskit/icon/core/copy';
8
10
  import DeleteIcon from '@atlaskit/icon/core/delete';
9
11
  import EditIcon from '@atlaskit/icon/core/edit';
10
12
  import ExpandHorizontalIcon from '@atlaskit/icon/core/expand-horizontal';
@@ -145,7 +147,7 @@ export const getToolbarConfig = ({
145
147
  editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
146
148
  }
147
149
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
148
- var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4, _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
150
+ var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
149
151
  const nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
150
152
  const editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
151
153
  const breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
@@ -217,13 +219,13 @@ export const getToolbarConfig = ({
217
219
  left: nextPos.left
218
220
  };
219
221
  },
220
- items: [...editButtonArray, ...breakoutButtonArray, {
222
+ items: [...editButtonArray, ...breakoutButtonArray, ...(editorExperiment('platform_editor_controls', 'control') ? [{
221
223
  type: 'separator',
222
224
  hidden: editButtonArray.length === 0 && breakoutButtonArray.length === 0
223
225
  }, {
224
226
  type: 'extensions-placeholder',
225
227
  separator: 'end'
226
- }, ...(editorExperiment('platform_editor_controls', 'control') ? [{
228
+ }, {
227
229
  type: 'copy-button',
228
230
  items: [{
229
231
  state,
@@ -248,28 +250,27 @@ export const getToolbarConfig = ({
248
250
  tabIndex: null,
249
251
  confirmDialog
250
252
  }] : [{
251
- id: 'editor.extension.delete',
252
- type: 'button',
253
- icon: DeleteIcon,
254
- iconFallback: RemoveIcon,
255
- appearance: 'danger',
256
- onClick: removeExtension(editorAnalyticsAPI),
257
- onMouseEnter: (_hoverDecoration5 = hoverDecoration) === null || _hoverDecoration5 === void 0 ? void 0 : _hoverDecoration5(nodeType, true),
258
- onMouseLeave: (_hoverDecoration6 = hoverDecoration) === null || _hoverDecoration6 === void 0 ? void 0 : _hoverDecoration6(nodeType, false),
259
- onFocus: (_hoverDecoration7 = hoverDecoration) === null || _hoverDecoration7 === void 0 ? void 0 : _hoverDecoration7(nodeType, true),
260
- onBlur: (_hoverDecoration8 = hoverDecoration) === null || _hoverDecoration8 === void 0 ? void 0 : _hoverDecoration8(nodeType, false),
261
- focusEditoronEnter: true,
262
- title: formatMessage(commonMessages.remove),
263
- tabIndex: null,
264
- confirmDialog
265
- }, {
266
- type: 'separator'
253
+ type: 'separator',
254
+ fullHeight: true
267
255
  }, {
268
- type: 'copy-button',
269
- items: [{
270
- state,
271
- formatMessage: intl.formatMessage,
272
- nodeType
256
+ type: 'overflow-dropdown',
257
+ options: [{
258
+ title: 'Copy',
259
+ onClick: () => {
260
+ var _extensionApi$core, _extensionApi$floatin;
261
+ extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$core = extensionApi.core) === null || _extensionApi$core === void 0 ? void 0 : _extensionApi$core.actions.execute( // @ts-ignore
262
+ extensionApi === null || extensionApi === void 0 ? void 0 : (_extensionApi$floatin = extensionApi.floatingToolbar) === null || _extensionApi$floatin === void 0 ? void 0 : _extensionApi$floatin.commands.copyNode(nodeType));
263
+ return true;
264
+ },
265
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
266
+ label: "Copy"
267
+ })
268
+ }, {
269
+ title: 'Delete',
270
+ onClick: removeExtension(editorAnalyticsAPI),
271
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
272
+ label: "Delete"
273
+ })
273
274
  }]
274
275
  }])],
275
276
  scrollable: true
@@ -1,6 +1,7 @@
1
1
  import { extension, extensionFrame, inlineExtension, multiBodiedExtension } from '@atlaskit/adf-schema';
2
2
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
5
  import { createEditSelectedExtensionAction, insertOrReplaceBodiedExtension as _insertOrReplaceBodiedExtension, insertOrReplaceExtension as _insertOrReplaceExtension } from './editor-actions/actions';
5
6
  import { forceAutoSave } from './editor-commands/commands';
6
7
  import { createExtensionAPI } from './pm-plugins/extension-api';
@@ -171,7 +172,8 @@ export var extensionPlugin = function extensionPlugin(_ref) {
171
172
  breakoutEnabled: options.breakoutEnabled,
172
173
  hoverDecoration: _api === null || _api === void 0 || (_api$decorations = _api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions.hoverDecoration,
173
174
  applyChangeToContextPanel: _api === null || _api === void 0 || (_api$contextPanel4 = _api.contextPanel) === null || _api$contextPanel4 === void 0 ? void 0 : _api$contextPanel4.actions.applyChange,
174
- editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions
175
+ editorAnalyticsAPI: _api === null || _api === void 0 || (_api$analytics4 = _api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
176
+ extensionApi: editorExperiment('platform_editor_controls', 'variant1') ? _api : undefined
175
177
  }),
176
178
  contextPanel: !fg('platform_editor_ai_object_sidebar_injection') ? getContextPanel(function () {
177
179
  var _editorViewRef$curren;
@@ -220,7 +220,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
220
220
  var maybeBodiedExtension = selection instanceof TextSelection ? findParentNodeOfTypeClosestToPos($head, bodiedExtension) : findSelectedNodeOfType(bodiedExtension)(selection);
221
221
  if (maybeBodiedExtension) {
222
222
  var end = maybeBodiedExtension.pos + maybeBodiedExtension.node.nodeSize;
223
- if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && isSelectionAtStartOfNode($head, maybeBodiedExtension)) {
223
+ if (event.key === 'ArrowUp' || event.key === 'ArrowLeft' && isSelectionAtStartOfNode($head, maybeBodiedExtension === null || maybeBodiedExtension === void 0 ? void 0 : maybeBodiedExtension.node)) {
224
224
  var anchor = end + 1;
225
225
 
226
226
  // an offset is used here so that left arrow selects the first character before the node (consistent with arrow right)
@@ -230,7 +230,7 @@ export var createPlugin = function createPlugin(dispatch, providerFactory, exten
230
230
  view.dispatch(tr.setSelection(newSelection));
231
231
  return true;
232
232
  }
233
- if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && isSelectionAtEndOfNode($head, maybeBodiedExtension)) {
233
+ if (event.key === 'ArrowDown' || event.key === 'ArrowRight' && isSelectionAtEndOfNode($head, maybeBodiedExtension === null || maybeBodiedExtension === void 0 ? void 0 : maybeBodiedExtension.node)) {
234
234
  var _anchor = maybeBodiedExtension.pos - 1;
235
235
  var _head = end + 1;
236
236
  var _newSelection = TextSelection.create(doc, Math.min(_anchor, selection.anchor), _head);
@@ -1,4 +1,5 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
+ import React from 'react';
2
3
  import { messages } from '@atlaskit/editor-common/extensions';
3
4
  import commonMessages from '@atlaskit/editor-common/messages';
4
5
  import { BODIED_EXT_MBE_MARGIN_TOP } from '@atlaskit/editor-common/styles';
@@ -6,6 +7,7 @@ import { getChildrenInfo as _getChildrenInfo, getNodeName, isReferencedSource }
6
7
  import { findParentNodeOfType, hasParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
7
8
  import ContentWidthNarrowIcon from '@atlaskit/icon/core/content-width-narrow';
8
9
  import ContentWidthWideIcon from '@atlaskit/icon/core/content-width-wide';
10
+ import CopyIcon from '@atlaskit/icon/core/copy';
9
11
  import DeleteIcon from '@atlaskit/icon/core/delete';
10
12
  import EditIcon from '@atlaskit/icon/core/edit';
11
13
  import ExpandHorizontalIcon from '@atlaskit/icon/core/expand-horizontal';
@@ -132,7 +134,7 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
132
134
  editorAnalyticsAPI = extensionApi === null || extensionApi === void 0 || (_extensionApi$analyti = extensionApi.analytics) === null || _extensionApi$analyti === void 0 ? void 0 : _extensionApi$analyti.actions;
133
135
  }
134
136
  if (extensionState && !extensionState.showContextPanel && extensionState.element) {
135
- var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4, _hoverDecoration5, _hoverDecoration6, _hoverDecoration7, _hoverDecoration8;
137
+ var _hoverDecoration, _hoverDecoration2, _hoverDecoration3, _hoverDecoration4;
136
138
  var nodeType = [state.schema.nodes.extension, state.schema.nodes.inlineExtension, state.schema.nodes.bodiedExtension, state.schema.nodes.multiBodiedExtension];
137
139
  var editButtonArray = editButton(formatMessage, extensionState, applyChangeToContextPanel, editorAnalyticsAPI);
138
140
  var breakoutButtonArray = breakoutOptions(state, formatMessage, extensionState, breakoutEnabled, editorAnalyticsAPI);
@@ -208,13 +210,13 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
208
210
  left: nextPos.left
209
211
  };
210
212
  },
211
- items: [].concat(_toConsumableArray(editButtonArray), _toConsumableArray(breakoutButtonArray), [{
213
+ items: [].concat(_toConsumableArray(editButtonArray), _toConsumableArray(breakoutButtonArray), _toConsumableArray(editorExperiment('platform_editor_controls', 'control') ? [{
212
214
  type: 'separator',
213
215
  hidden: editButtonArray.length === 0 && breakoutButtonArray.length === 0
214
216
  }, {
215
217
  type: 'extensions-placeholder',
216
218
  separator: 'end'
217
- }], _toConsumableArray(editorExperiment('platform_editor_controls', 'control') ? [{
219
+ }, {
218
220
  type: 'copy-button',
219
221
  items: [{
220
222
  state: state,
@@ -239,28 +241,27 @@ export var getToolbarConfig = function getToolbarConfig(_ref) {
239
241
  tabIndex: null,
240
242
  confirmDialog: confirmDialog
241
243
  }] : [{
242
- id: 'editor.extension.delete',
243
- type: 'button',
244
- icon: DeleteIcon,
245
- iconFallback: RemoveIcon,
246
- appearance: 'danger',
247
- onClick: removeExtension(editorAnalyticsAPI),
248
- onMouseEnter: (_hoverDecoration5 = hoverDecoration) === null || _hoverDecoration5 === void 0 ? void 0 : _hoverDecoration5(nodeType, true),
249
- onMouseLeave: (_hoverDecoration6 = hoverDecoration) === null || _hoverDecoration6 === void 0 ? void 0 : _hoverDecoration6(nodeType, false),
250
- onFocus: (_hoverDecoration7 = hoverDecoration) === null || _hoverDecoration7 === void 0 ? void 0 : _hoverDecoration7(nodeType, true),
251
- onBlur: (_hoverDecoration8 = hoverDecoration) === null || _hoverDecoration8 === void 0 ? void 0 : _hoverDecoration8(nodeType, false),
252
- focusEditoronEnter: true,
253
- title: formatMessage(commonMessages.remove),
254
- tabIndex: null,
255
- confirmDialog: confirmDialog
256
- }, {
257
- type: 'separator'
244
+ type: 'separator',
245
+ fullHeight: true
258
246
  }, {
259
- type: 'copy-button',
260
- items: [{
261
- state: state,
262
- formatMessage: intl.formatMessage,
263
- nodeType: nodeType
247
+ type: 'overflow-dropdown',
248
+ options: [{
249
+ title: 'Copy',
250
+ onClick: function onClick() {
251
+ var _extensionApi$core, _extensionApi$floatin;
252
+ extensionApi === null || extensionApi === void 0 || (_extensionApi$core = extensionApi.core) === null || _extensionApi$core === void 0 || _extensionApi$core.actions.execute( // @ts-ignore
253
+ extensionApi === null || extensionApi === void 0 || (_extensionApi$floatin = extensionApi.floatingToolbar) === null || _extensionApi$floatin === void 0 ? void 0 : _extensionApi$floatin.commands.copyNode(nodeType));
254
+ return true;
255
+ },
256
+ icon: /*#__PURE__*/React.createElement(CopyIcon, {
257
+ label: "Copy"
258
+ })
259
+ }, {
260
+ title: 'Delete',
261
+ onClick: removeExtension(editorAnalyticsAPI),
262
+ icon: /*#__PURE__*/React.createElement(DeleteIcon, {
263
+ label: "Delete"
264
+ })
264
265
  }]
265
266
  }])),
266
267
  scrollable: true
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-extension",
3
- "version": "5.0.0",
3
+ "version": "5.0.2",
4
4
  "description": "editor-plugin-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  "@atlaskit/button": "^21.1.0",
33
33
  "@atlaskit/checkbox": "^17.0.0",
34
34
  "@atlaskit/datetime-picker": "^16.1.0",
35
- "@atlaskit/editor-common": "^101.1.0",
35
+ "@atlaskit/editor-common": "^102.0.0",
36
36
  "@atlaskit/editor-json-transformer": "^8.24.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^2.1.0",
38
38
  "@atlaskit/editor-plugin-context-identifier": "^2.0.0",
@@ -45,12 +45,12 @@
45
45
  "@atlaskit/editor-tables": "^2.9.0",
46
46
  "@atlaskit/empty-state": "^9.0.0",
47
47
  "@atlaskit/form": "^12.0.0",
48
- "@atlaskit/heading": "5.1.0",
48
+ "@atlaskit/heading": "^5.1.0",
49
49
  "@atlaskit/icon": "^24.1.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
51
  "@atlaskit/primitives": "^14.1.0",
52
52
  "@atlaskit/radio": "^8.0.0",
53
- "@atlaskit/section-message": "^8.0.0",
53
+ "@atlaskit/section-message": "^8.1.0",
54
54
  "@atlaskit/select": "^20.0.0",
55
55
  "@atlaskit/smart-user-picker": "^8.0.0",
56
56
  "@atlaskit/spinner": "^18.0.0",