@atlaskit/editor-plugin-code-block 6.0.1 → 6.1.0

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,24 @@
1
1
  # @atlaskit/editor-plugin-code-block
2
2
 
3
+ ## 6.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`c0113eeccb2df`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c0113eeccb2df) -
8
+ [ux] ED-29120 add a new config option for default editor preset
9
+ (`toolbar.enableNewToolbarExperience`) which allows the new toolbar to be disabled. This is needed
10
+ for editors that can't be excluded at the experiment level.
11
+
12
+ ### Patch Changes
13
+
14
+ - Updated dependencies
15
+
16
+ ## 6.0.2
17
+
18
+ ### Patch Changes
19
+
20
+ - Updated dependencies
21
+
3
22
  ## 6.0.1
4
23
 
5
24
  ### Patch Changes
@@ -82,7 +82,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
82
82
  var separator = {
83
83
  type: 'separator'
84
84
  };
85
- var isNewEditorToolbarEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)();
85
+ var areAnyNewToolbarFlagsEnabled = (0, _toolbarFlagCheck.areToolbarFlagsEnabled)(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
86
86
  var copyToClipboardItems = !allowCopyToClipboard ? [] : [{
87
87
  id: 'editor.codeBlock.copy',
88
88
  type: 'button',
@@ -104,7 +104,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
104
104
  tabIndex: null
105
105
  }, separator];
106
106
  var copyAndDeleteButtonMenuItems = [];
107
- if (isNewEditorToolbarEnabled) {
107
+ if (areAnyNewToolbarFlagsEnabled) {
108
108
  var overflowMenuOptions = [{
109
109
  title: formatMessage(_messages.default.delete),
110
110
  icon: (0, _delete.default)({
@@ -174,7 +174,7 @@ var getToolbarConfig = exports.getToolbarConfig = function getToolbarConfig() {
174
174
  return (0, _utils.findDomRefAtPos)(pos, view.domAtPos.bind(view));
175
175
  },
176
176
  nodeType: nodeType,
177
- items: [languageSelect].concat((0, _toConsumableArray2.default)(isNewEditorToolbarEnabled ? [] : [separator]), [codeBlockWrapButton], (0, _toConsumableArray2.default)(copyAndDeleteButtonMenuItems)),
177
+ items: [languageSelect].concat((0, _toConsumableArray2.default)(areAnyNewToolbarFlagsEnabled ? [] : [separator]), [codeBlockWrapButton], (0, _toConsumableArray2.default)(copyAndDeleteButtonMenuItems)),
178
178
  scrollable: true
179
179
  };
180
180
  };
@@ -58,7 +58,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
58
58
  const separator = {
59
59
  type: 'separator'
60
60
  };
61
- const isNewEditorToolbarEnabled = areToolbarFlagsEnabled();
61
+ const areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
62
62
  const copyToClipboardItems = !allowCopyToClipboard ? [] : [{
63
63
  id: 'editor.codeBlock.copy',
64
64
  type: 'button',
@@ -80,7 +80,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
80
80
  tabIndex: null
81
81
  }, separator];
82
82
  let copyAndDeleteButtonMenuItems = [];
83
- if (isNewEditorToolbarEnabled) {
83
+ if (areAnyNewToolbarFlagsEnabled) {
84
84
  const overflowMenuOptions = [{
85
85
  title: formatMessage(commonMessages.delete),
86
86
  icon: DeleteIcon({
@@ -148,7 +148,7 @@ export const getToolbarConfig = (allowCopyToClipboard = false, api, overrideLang
148
148
  // eslint-disable-next-line @atlaskit/editor/no-as-casting
149
149
  getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
150
150
  nodeType,
151
- items: [languageSelect, ...(isNewEditorToolbarEnabled ? [] : [separator]), codeBlockWrapButton, ...copyAndDeleteButtonMenuItems],
151
+ items: [languageSelect, ...(areAnyNewToolbarFlagsEnabled ? [] : [separator]), codeBlockWrapButton, ...copyAndDeleteButtonMenuItems],
152
152
  scrollable: true
153
153
  };
154
154
  };
@@ -73,7 +73,7 @@ export var getToolbarConfig = function getToolbarConfig() {
73
73
  var separator = {
74
74
  type: 'separator'
75
75
  };
76
- var isNewEditorToolbarEnabled = areToolbarFlagsEnabled();
76
+ var areAnyNewToolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
77
77
  var copyToClipboardItems = !allowCopyToClipboard ? [] : [{
78
78
  id: 'editor.codeBlock.copy',
79
79
  type: 'button',
@@ -95,7 +95,7 @@ export var getToolbarConfig = function getToolbarConfig() {
95
95
  tabIndex: null
96
96
  }, separator];
97
97
  var copyAndDeleteButtonMenuItems = [];
98
- if (isNewEditorToolbarEnabled) {
98
+ if (areAnyNewToolbarFlagsEnabled) {
99
99
  var overflowMenuOptions = [{
100
100
  title: formatMessage(commonMessages.delete),
101
101
  icon: DeleteIcon({
@@ -165,7 +165,7 @@ export var getToolbarConfig = function getToolbarConfig() {
165
165
  return findDomRefAtPos(pos, view.domAtPos.bind(view));
166
166
  },
167
167
  nodeType: nodeType,
168
- items: [languageSelect].concat(_toConsumableArray(isNewEditorToolbarEnabled ? [] : [separator]), [codeBlockWrapButton], _toConsumableArray(copyAndDeleteButtonMenuItems)),
168
+ items: [languageSelect].concat(_toConsumableArray(areAnyNewToolbarFlagsEnabled ? [] : [separator]), [codeBlockWrapButton], _toConsumableArray(copyAndDeleteButtonMenuItems)),
169
169
  scrollable: true
170
170
  };
171
171
  };
@@ -9,6 +9,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
9
9
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
10
10
  import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
11
11
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
12
+ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
12
13
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
13
14
  import type { CodeBlockPluginOptions } from './types';
14
15
  type CodeBlockDependencies = [
@@ -20,7 +21,8 @@ type CodeBlockDependencies = [
20
21
  OptionalPlugin<InteractionPlugin>,
21
22
  OptionalPlugin<EditorViewModePlugin>,
22
23
  OptionalPlugin<BlockMenuPlugin>,
23
- OptionalPlugin<SelectionPlugin>
24
+ OptionalPlugin<SelectionPlugin>,
25
+ OptionalPlugin<ToolbarPlugin>
24
26
  ];
25
27
  export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
26
28
  actions: {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { CodeBlockPlugin } from '../codeBlockPluginType';
4
- export declare const createCodeBlockMenuItem: (api: ExtractInjectionAPI<CodeBlockPlugin>) => () => React.JSX.Element;
4
+ export declare const createCodeBlockMenuItem: (api: ExtractInjectionAPI<CodeBlockPlugin> | undefined) => () => React.JSX.Element;
@@ -9,6 +9,7 @@ import type { EditorViewModePlugin } from '@atlaskit/editor-plugin-editor-viewmo
9
9
  import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
10
10
  import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
11
11
  import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
12
+ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
12
13
  import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
13
14
  import type { CodeBlockPluginOptions } from './types';
14
15
  type CodeBlockDependencies = [
@@ -20,7 +21,8 @@ type CodeBlockDependencies = [
20
21
  OptionalPlugin<InteractionPlugin>,
21
22
  OptionalPlugin<EditorViewModePlugin>,
22
23
  OptionalPlugin<BlockMenuPlugin>,
23
- OptionalPlugin<SelectionPlugin>
24
+ OptionalPlugin<SelectionPlugin>,
25
+ OptionalPlugin<ToolbarPlugin>
24
26
  ];
25
27
  export type CodeBlockPlugin = NextEditorPlugin<'codeBlock', {
26
28
  actions: {
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { CodeBlockPlugin } from '../codeBlockPluginType';
4
- export declare const createCodeBlockMenuItem: (api: ExtractInjectionAPI<CodeBlockPlugin>) => () => React.JSX.Element;
4
+ export declare const createCodeBlockMenuItem: (api: ExtractInjectionAPI<CodeBlockPlugin> | undefined) => () => React.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-code-block",
3
- "version": "6.0.1",
3
+ "version": "6.1.0",
4
4
  "description": "Code block plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -37,16 +37,17 @@
37
37
  "@atlaskit/editor-plugin-editor-viewmode": "^6.0.0",
38
38
  "@atlaskit/editor-plugin-interaction": "^6.0.0",
39
39
  "@atlaskit/editor-plugin-selection": "^4.0.0",
40
+ "@atlaskit/editor-plugin-toolbar": "^1.2.0",
40
41
  "@atlaskit/editor-prosemirror": "7.0.0",
41
- "@atlaskit/editor-toolbar": "^0.7.0",
42
+ "@atlaskit/editor-toolbar": "^0.8.0",
42
43
  "@atlaskit/icon": "^28.1.0",
43
44
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
45
  "@atlaskit/prosemirror-input-rules": "^3.4.0",
45
- "@atlaskit/tmp-editor-statsig": "^12.2.0",
46
+ "@atlaskit/tmp-editor-statsig": "^12.8.0",
46
47
  "@babel/runtime": "^7.0.0"
47
48
  },
48
49
  "peerDependencies": {
49
- "@atlaskit/editor-common": "^108.1.0",
50
+ "@atlaskit/editor-common": "^108.6.0",
50
51
  "react": "^18.2.0",
51
52
  "react-intl-next": "npm:react-intl@^5.18.1"
52
53
  },