@atlaskit/editor-plugin-code-block 4.4.9 → 4.4.10

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-code-block
2
2
 
3
+ ## 4.4.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#166652](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/166652)
8
+ [`6a35dedfa94ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/6a35dedfa94ef) -
9
+ ED-27806 Move copy and delete button in codeblock floating toolbar to overflow menu
10
+ - Updated dependencies
11
+
3
12
  ## 4.4.9
4
13
 
5
14
  ### Patch Changes
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
8
  exports.languageListFilter = exports.getToolbarConfig = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
10
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
11
  var _codeBlock = require("@atlaskit/editor-common/code-block");
11
12
  var _messages = _interopRequireWildcard(require("@atlaskit/editor-common/messages"));
@@ -15,6 +16,7 @@ var _copy = _interopRequireDefault(require("@atlaskit/icon/core/migration/copy")
15
16
  var _deleteEditorRemove = _interopRequireDefault(require("@atlaskit/icon/core/migration/delete--editor-remove"));
16
17
  var _textWrap = _interopRequireDefault(require("@atlaskit/icon/core/text-wrap"));
17
18
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
19
+ var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
18
20
  var _editorCommands = require("../editor-commands");
19
21
  var _WrapIcon = require("../ui/icons/WrapIcon");
20
22
  var _codeBlockCopySelectionPlugin = require("./codeBlockCopySelectionPlugin");
@@ -28,8 +30,9 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
28
30
  var api = arguments.length > 1 ? arguments[1] : undefined;
29
31
  var overrideLanguageName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
30
32
  return function (state, _ref) {
31
- var _api$decorations$acti, _api$decorations, _api$analytics, _codeBlockState$pos, _node$attrs;
33
+ var _api$editorViewMode, _api$decorations$acti, _api$decorations, _api$analytics, _codeBlockState$pos, _node$attrs;
32
34
  var formatMessage = _ref.formatMessage;
35
+ var isViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
33
36
  var _ref2 = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
34
37
  hoverDecoration = _ref2.hoverDecoration;
35
38
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
@@ -99,20 +102,58 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
99
102
  disabled: codeBlockState.isNodeSelected,
100
103
  tabIndex: null
101
104
  }, separator];
102
- var deleteButton = {
103
- id: 'editor.codeBlock.delete',
104
- type: 'button',
105
- appearance: 'danger',
106
- icon: _delete.default,
107
- iconFallback: _deleteEditorRemove.default,
108
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
109
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
110
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
111
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
112
- onClick: (0, _editorCommands.removeCodeBlockWithAnalytics)(editorAnalyticsAPI),
113
- title: formatMessage(_messages.default.remove),
114
- tabIndex: null
115
- };
105
+ var copyAndDeleteButtonMenuItems = [];
106
+ if ((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13')) {
107
+ var overflowMenuOptions = [{
108
+ title: formatMessage(_messages.default.delete),
109
+ icon: (0, _delete.default)({
110
+ label: ''
111
+ }),
112
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
113
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
114
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
115
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
116
+ onClick: (0, _editorCommands.removeCodeBlockWithAnalytics)(editorAnalyticsAPI)
117
+ }];
118
+ if (allowCopyToClipboard) {
119
+ overflowMenuOptions.unshift({
120
+ title: formatMessage(_messages.default.copyToClipboard),
121
+ onClick: (0, _editorCommands.copyContentToClipboardWithAnalytics)(editorAnalyticsAPI),
122
+ icon: (0, _copy.default)({
123
+ label: ''
124
+ }),
125
+ onMouseEnter: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
126
+ onMouseLeave: _editorCommands.resetCopiedState,
127
+ onFocus: _codeBlockCopySelectionPlugin.provideVisualFeedbackForCopyButton,
128
+ onBlur: _codeBlockCopySelectionPlugin.removeVisualFeedbackForCopyButton,
129
+ disabled: codeBlockState.isNodeSelected
130
+ });
131
+ }
132
+ copyAndDeleteButtonMenuItems = isViewMode ? [].concat(copyToClipboardItems) : [{
133
+ type: 'separator',
134
+ fullHeight: true
135
+ }, {
136
+ type: 'overflow-dropdown',
137
+ testId: 'code-block-overflow-dropdown-trigger',
138
+ options: overflowMenuOptions
139
+ }];
140
+ } else {
141
+ var deleteButton = {
142
+ id: 'editor.codeBlock.delete',
143
+ type: 'button',
144
+ appearance: 'danger',
145
+ icon: _delete.default,
146
+ iconFallback: _deleteEditorRemove.default,
147
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
148
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
149
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
150
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
151
+ onClick: (0, _editorCommands.removeCodeBlockWithAnalytics)(editorAnalyticsAPI),
152
+ title: formatMessage(_messages.default.remove),
153
+ tabIndex: null
154
+ };
155
+ copyAndDeleteButtonMenuItems = [separator].concat(copyToClipboardItems, [deleteButton]);
156
+ }
116
157
  var codeBlockWrapButton = {
117
158
  id: 'editor.codeBlock.wrap',
118
159
  type: 'button',
@@ -132,7 +173,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
132
173
  return (0, _utils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
133
174
  },
134
175
  nodeType: nodeType,
135
- items: [languageSelect, separator, codeBlockWrapButton, separator].concat(copyToClipboardItems, [deleteButton]),
176
+ items: [languageSelect].concat((0, _toConsumableArray2.default)((0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_controls', 'cohort', 'variant1') && (0, _platformFeatureFlags.fg)('platform_editor_controls_patch_13') ? [] : [separator]), [codeBlockWrapButton], (0, _toConsumableArray2.default)(copyAndDeleteButtonMenuItems)),
136
177
  scrollable: true
137
178
  };
138
179
  };
@@ -6,6 +6,7 @@ import CopyIcon from '@atlaskit/icon/core/migration/copy';
6
6
  import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
7
7
  import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
9
10
  import { changeLanguage, copyContentToClipboardWithAnalytics, removeCodeBlockWithAnalytics, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
10
11
  import { WrapIcon } from '../ui/icons/WrapIcon';
11
12
  import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './codeBlockCopySelectionPlugin';
@@ -14,7 +15,8 @@ import { pluginKey } from './plugin-key';
14
15
  export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLanguageName = undefined) => (state, {
15
16
  formatMessage
16
17
  }) => {
17
- var _api$decorations$acti, _api$decorations, _api$analytics, _codeBlockState$pos, _node$attrs;
18
+ var _api$editorViewMode, _api$editorViewMode$s, _api$decorations$acti, _api$decorations, _api$analytics, _codeBlockState$pos, _node$attrs;
19
+ const isViewMode = (api === null || api === void 0 ? void 0 : (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 ? void 0 : (_api$editorViewMode$s = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode$s === void 0 ? void 0 : _api$editorViewMode$s.mode) === 'view';
18
20
  const {
19
21
  hoverDecoration
20
22
  } = (_api$decorations$acti = api === null || api === void 0 ? void 0 : (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {};
@@ -76,20 +78,58 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
76
78
  disabled: codeBlockState.isNodeSelected,
77
79
  tabIndex: null
78
80
  }, separator];
79
- const deleteButton = {
80
- id: 'editor.codeBlock.delete',
81
- type: 'button',
82
- appearance: 'danger',
83
- icon: DeleteIcon,
84
- iconFallback: RemoveIcon,
85
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
86
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
87
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
88
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
89
- onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI),
90
- title: formatMessage(commonMessages.remove),
91
- tabIndex: null
92
- };
81
+ let copyAndDeleteButtonMenuItems = [];
82
+ if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') && fg('platform_editor_controls_patch_13')) {
83
+ const overflowMenuOptions = [{
84
+ title: formatMessage(commonMessages.delete),
85
+ icon: DeleteIcon({
86
+ label: ''
87
+ }),
88
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
89
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
90
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
91
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
92
+ onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI)
93
+ }];
94
+ if (allowCopyToClipboard) {
95
+ overflowMenuOptions.unshift({
96
+ title: formatMessage(commonMessages.copyToClipboard),
97
+ onClick: copyContentToClipboardWithAnalytics(editorAnalyticsAPI),
98
+ icon: CopyIcon({
99
+ label: ''
100
+ }),
101
+ onMouseEnter: provideVisualFeedbackForCopyButton,
102
+ onMouseLeave: resetCopiedState,
103
+ onFocus: provideVisualFeedbackForCopyButton,
104
+ onBlur: removeVisualFeedbackForCopyButton,
105
+ disabled: codeBlockState.isNodeSelected
106
+ });
107
+ }
108
+ copyAndDeleteButtonMenuItems = isViewMode ? [...copyToClipboardItems] : [{
109
+ type: 'separator',
110
+ fullHeight: true
111
+ }, {
112
+ type: 'overflow-dropdown',
113
+ testId: 'code-block-overflow-dropdown-trigger',
114
+ options: overflowMenuOptions
115
+ }];
116
+ } else {
117
+ const deleteButton = {
118
+ id: 'editor.codeBlock.delete',
119
+ type: 'button',
120
+ appearance: 'danger',
121
+ icon: DeleteIcon,
122
+ iconFallback: RemoveIcon,
123
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
124
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
125
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
126
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
127
+ onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI),
128
+ title: formatMessage(commonMessages.remove),
129
+ tabIndex: null
130
+ };
131
+ copyAndDeleteButtonMenuItems = [separator, ...copyToClipboardItems, deleteButton];
132
+ }
93
133
  const codeBlockWrapButton = {
94
134
  id: 'editor.codeBlock.wrap',
95
135
  type: 'button',
@@ -107,7 +147,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
107
147
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
108
148
  getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
109
149
  nodeType,
110
- items: [languageSelect, separator, codeBlockWrapButton, separator, ...copyToClipboardItems, deleteButton],
150
+ items: [languageSelect, ...(expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') && fg('platform_editor_controls_patch_13') ? [] : [separator]), codeBlockWrapButton, ...copyAndDeleteButtonMenuItems],
111
151
  scrollable: true
112
152
  };
113
153
  };
@@ -1,3 +1,4 @@
1
+ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
1
2
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
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; }
3
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; }
@@ -9,6 +10,7 @@ import CopyIcon from '@atlaskit/icon/core/migration/copy';
9
10
  import RemoveIcon from '@atlaskit/icon/core/migration/delete--editor-remove';
10
11
  import TextWrapIcon from '@atlaskit/icon/core/text-wrap';
11
12
  import { fg } from '@atlaskit/platform-feature-flags';
13
+ import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
12
14
  import { changeLanguage, copyContentToClipboardWithAnalytics, removeCodeBlockWithAnalytics, resetCopiedState, toggleWordWrapStateForCodeBlockNode } from '../editor-commands';
13
15
  import { WrapIcon } from '../ui/icons/WrapIcon';
14
16
  import { provideVisualFeedbackForCopyButton, removeVisualFeedbackForCopyButton } from './codeBlockCopySelectionPlugin';
@@ -19,8 +21,9 @@ export var getToolbarConfig = function getToolbarConfig() {
19
21
  var api = arguments.length > 1 ? arguments[1] : undefined;
20
22
  var overrideLanguageName = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
21
23
  return function (state, _ref) {
22
- var _api$decorations$acti, _api$decorations, _api$analytics, _codeBlockState$pos, _node$attrs;
24
+ var _api$editorViewMode, _api$decorations$acti, _api$decorations, _api$analytics, _codeBlockState$pos, _node$attrs;
23
25
  var formatMessage = _ref.formatMessage;
26
+ var isViewMode = (api === null || api === void 0 || (_api$editorViewMode = api.editorViewMode) === null || _api$editorViewMode === void 0 || (_api$editorViewMode = _api$editorViewMode.sharedState.currentState()) === null || _api$editorViewMode === void 0 ? void 0 : _api$editorViewMode.mode) === 'view';
24
27
  var _ref2 = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
25
28
  hoverDecoration = _ref2.hoverDecoration;
26
29
  var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
@@ -90,20 +93,58 @@ export var getToolbarConfig = function getToolbarConfig() {
90
93
  disabled: codeBlockState.isNodeSelected,
91
94
  tabIndex: null
92
95
  }, separator];
93
- var deleteButton = {
94
- id: 'editor.codeBlock.delete',
95
- type: 'button',
96
- appearance: 'danger',
97
- icon: DeleteIcon,
98
- iconFallback: RemoveIcon,
99
- onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
100
- onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
101
- onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
102
- onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
103
- onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI),
104
- title: formatMessage(commonMessages.remove),
105
- tabIndex: null
106
- };
96
+ var copyAndDeleteButtonMenuItems = [];
97
+ if (expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') && fg('platform_editor_controls_patch_13')) {
98
+ var overflowMenuOptions = [{
99
+ title: formatMessage(commonMessages.delete),
100
+ icon: DeleteIcon({
101
+ label: ''
102
+ }),
103
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
104
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
105
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
106
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
107
+ onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI)
108
+ }];
109
+ if (allowCopyToClipboard) {
110
+ overflowMenuOptions.unshift({
111
+ title: formatMessage(commonMessages.copyToClipboard),
112
+ onClick: copyContentToClipboardWithAnalytics(editorAnalyticsAPI),
113
+ icon: CopyIcon({
114
+ label: ''
115
+ }),
116
+ onMouseEnter: provideVisualFeedbackForCopyButton,
117
+ onMouseLeave: resetCopiedState,
118
+ onFocus: provideVisualFeedbackForCopyButton,
119
+ onBlur: removeVisualFeedbackForCopyButton,
120
+ disabled: codeBlockState.isNodeSelected
121
+ });
122
+ }
123
+ copyAndDeleteButtonMenuItems = isViewMode ? [].concat(copyToClipboardItems) : [{
124
+ type: 'separator',
125
+ fullHeight: true
126
+ }, {
127
+ type: 'overflow-dropdown',
128
+ testId: 'code-block-overflow-dropdown-trigger',
129
+ options: overflowMenuOptions
130
+ }];
131
+ } else {
132
+ var deleteButton = {
133
+ id: 'editor.codeBlock.delete',
134
+ type: 'button',
135
+ appearance: 'danger',
136
+ icon: DeleteIcon,
137
+ iconFallback: RemoveIcon,
138
+ onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
139
+ onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
140
+ onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
141
+ onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
142
+ onClick: removeCodeBlockWithAnalytics(editorAnalyticsAPI),
143
+ title: formatMessage(commonMessages.remove),
144
+ tabIndex: null
145
+ };
146
+ copyAndDeleteButtonMenuItems = [separator].concat(copyToClipboardItems, [deleteButton]);
147
+ }
107
148
  var codeBlockWrapButton = {
108
149
  id: 'editor.codeBlock.wrap',
109
150
  type: 'button',
@@ -123,7 +164,7 @@ export var getToolbarConfig = function getToolbarConfig() {
123
164
  return findDomRefAtPos(pos, view.domAtPos.bind(view));
124
165
  },
125
166
  nodeType: nodeType,
126
- items: [languageSelect, separator, codeBlockWrapButton, separator].concat(copyToClipboardItems, [deleteButton]),
167
+ items: [languageSelect].concat(_toConsumableArray(expValEqualsNoExposure('platform_editor_controls', 'cohort', 'variant1') && fg('platform_editor_controls_patch_13') ? [] : [separator]), [codeBlockWrapButton], _toConsumableArray(copyAndDeleteButtonMenuItems)),
127
168
  scrollable: true
128
169
  };
129
170
  };
@@ -4,6 +4,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
5
5
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
6
6
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
7
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
7
8
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
9
  import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
9
10
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
@@ -14,7 +15,8 @@ type CodeBlockDependencies = [
14
15
  OptionalPlugin<AnalyticsPlugin>,
15
16
  OptionalPlugin<EditorDisabledPlugin>,
16
17
  OptionalPlugin<FeatureFlagsPlugin>,
17
- OptionalPlugin<InteractionPlugin>
18
+ OptionalPlugin<InteractionPlugin>,
19
+ OptionalPlugin<EditorViewModePlugin>
18
20
  ];
19
21
  export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
20
22
  pluginConfiguration: CodeBlockPluginOptions | undefined;
@@ -33,7 +33,8 @@ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompo
33
33
  actions: import("@atlaskit/editor-common/analytics").EditorAnalyticsAPI;
34
34
  }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
35
35
  sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
36
- }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
36
+ pluginConfiguration: import("packages/editor/editor-plugin-editor-disabled/dist/types/editorDisabledPluginType").EditorDisabledPluginOptions | undefined;
37
+ }, import("packages/editor/editor-plugin-editor-disabled/dist/types/editorDisabledPluginType").EditorDisabledPluginOptions | undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
37
38
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
38
39
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
39
40
  }, import("@atlaskit/editor-common/types").FeatureFlags>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"interaction", {
@@ -41,7 +42,14 @@ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompo
41
42
  commands: {
42
43
  handleInteraction: import("@atlaskit/editor-common/types").EditorCommand;
43
44
  };
44
- }, undefined>>];
45
+ }, undefined>>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
46
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
47
+ dependencies: [];
48
+ pluginConfiguration?: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginOptions | undefined;
49
+ commands: {
50
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
51
+ };
52
+ }, import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginOptions | undefined>>];
45
53
  sharedState: {
46
54
  copyButtonHoverNode: PMNode;
47
55
  } | undefined;
@@ -4,6 +4,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
4
4
  import type { CompositionPlugin } from '@atlaskit/editor-plugin-composition';
5
5
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
6
6
  import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
7
+ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmode';
7
8
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
8
9
  import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
9
10
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
@@ -14,7 +15,8 @@ type CodeBlockDependencies = [
14
15
  OptionalPlugin<AnalyticsPlugin>,
15
16
  OptionalPlugin<EditorDisabledPlugin>,
16
17
  OptionalPlugin<FeatureFlagsPlugin>,
17
- OptionalPlugin<InteractionPlugin>
18
+ OptionalPlugin<InteractionPlugin>,
19
+ OptionalPlugin<EditorViewModePlugin>
18
20
  ];
19
21
  export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
20
22
  pluginConfiguration: CodeBlockPluginOptions | undefined;
@@ -39,7 +39,8 @@ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompo
39
39
  }, import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions>>,
40
40
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorDisabled", {
41
41
  sharedState: import("@atlaskit/editor-plugin-editor-disabled").EditorDisabledPluginState;
42
- }, undefined>>,
42
+ pluginConfiguration: import("packages/editor/editor-plugin-editor-disabled/dist/types/editorDisabledPluginType").EditorDisabledPluginOptions | undefined;
43
+ }, import("packages/editor/editor-plugin-editor-disabled/dist/types/editorDisabledPluginType").EditorDisabledPluginOptions | undefined>>,
43
44
  import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"featureFlags", {
44
45
  pluginConfiguration: import("@atlaskit/editor-common/types").FeatureFlags;
45
46
  sharedState: import("@atlaskit/editor-common/types").FeatureFlags;
@@ -49,7 +50,16 @@ export declare const createPlugin: ({ useLongPressSelection, getIntl, allowCompo
49
50
  commands: {
50
51
  handleInteraction: import("@atlaskit/editor-common/types").EditorCommand;
51
52
  };
52
- }, undefined>>
53
+ }, undefined>>,
54
+ import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"editorViewMode", {
55
+ sharedState: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginState | null;
56
+ dependencies: [
57
+ ];
58
+ pluginConfiguration?: import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginOptions | undefined;
59
+ commands: {
60
+ updateViewMode: (mode: import("@atlaskit/editor-plugin-editor-viewmode").ViewMode) => import("@atlaskit/editor-common/types").EditorCommand;
61
+ };
62
+ }, import("@atlaskit/editor-plugin-editor-viewmode").EditorViewModePluginOptions | undefined>>
53
63
  ];
54
64
  sharedState: {
55
65
  copyButtonHoverNode: PMNode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "4.4.9",
3
+ "version": "4.4.10",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -38,6 +38,7 @@
38
38
  "@atlaskit/editor-plugin-composition": "^1.3.0",
39
39
  "@atlaskit/editor-plugin-decorations": "^2.0.0",
40
40
  "@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
41
+ "@atlaskit/editor-plugin-editor-viewmode": "^4.0.0",
41
42
  "@atlaskit/editor-plugin-interaction": "^2.0.0",
42
43
  "@atlaskit/editor-prosemirror": "7.0.0",
43
44
  "@atlaskit/icon": "^26.4.0",
@@ -104,6 +105,9 @@
104
105
  "editor_a11y_remove_unwrap_button": {
105
106
  "type": "boolean"
106
107
  },
108
+ "platform_editor_controls_patch_13": {
109
+ "type": "boolean"
110
+ },
107
111
  "platform_editor_interaction_on_code_blocks": {
108
112
  "type": "boolean"
109
113
  }