@atlaskit/editor-plugin-primary-toolbar 3.2.0 → 3.2.1

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-primary-toolbar
2
2
 
3
+ ## 3.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#140839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/140839)
8
+ [`8c413615979d2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/8c413615979d2) -
9
+ [ux] Include element insert plus button on Editor primary toolbar
10
+ - Updated dependencies
11
+
3
12
  ## 3.2.0
4
13
 
5
14
  ### Minor Changes
@@ -16,11 +16,9 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
16
16
  if (contextualFormattingEnabled && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
17
17
  exposure: true
18
18
  })) {
19
- if ((0, _platformFeatureFlags.fg)('platform_editor_controls_move_actions')) {
20
- configuration = toolbarConfigurationV2;
21
- } else {
22
- configuration = toolbarConfigurationV2WithUndoRedoAndFindReplace;
23
- }
19
+ var shouldShowInsertBlock = (0, _platformFeatureFlags.fg)('platform_editor_insert_button_on_primary_toolbar');
20
+ var shouldShowUndoRedoFindGroup = (0, _platformFeatureFlags.fg)('platform_editor_controls_move_actions');
21
+ configuration = toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoFindGroup);
24
22
  } else {
25
23
  configuration = toolbarConfiguration;
26
24
  }
@@ -123,9 +121,12 @@ var findGroup = [{
123
121
  name: 'findReplace'
124
122
  }];
125
123
  var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, others);
126
- var toolbarConfigurationV2 = [].concat(blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, [{
127
- name: 'overflowMenu'
128
- }, {
129
- name: 'beforePrimaryToolbar'
130
- }]);
131
- var toolbarConfigurationV2WithUndoRedoAndFindReplace = [].concat(undoRedoGroup, (0, _toConsumableArray2.default)(toolbarConfigurationV2), findGroup);
124
+ var toolbarConfigurationV2 = function toolbarConfigurationV2() {
125
+ var shouldShowInsertBlock = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
126
+ var shouldShowMoveActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
127
+ return [].concat((0, _toConsumableArray2.default)(shouldShowMoveActions ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, (0, _toConsumableArray2.default)(shouldShowInsertBlock ? insertBlockGroup : []), [{
128
+ name: 'overflowMenu'
129
+ }, {
130
+ name: 'beforePrimaryToolbar'
131
+ }], (0, _toConsumableArray2.default)(shouldShowMoveActions ? findGroup : []));
132
+ };
@@ -9,11 +9,9 @@ export const getToolbarComponents = ({
9
9
  if (contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1', {
10
10
  exposure: true
11
11
  })) {
12
- if (fg('platform_editor_controls_move_actions')) {
13
- configuration = toolbarConfigurationV2;
14
- } else {
15
- configuration = toolbarConfigurationV2WithUndoRedoAndFindReplace;
16
- }
12
+ const shouldShowInsertBlock = fg('platform_editor_insert_button_on_primary_toolbar');
13
+ const shouldShowUndoRedoFindGroup = fg('platform_editor_controls_move_actions');
14
+ configuration = toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoFindGroup);
17
15
  } else {
18
16
  configuration = toolbarConfiguration;
19
17
  }
@@ -98,9 +96,8 @@ const findGroup = [{
98
96
  name: 'findReplace'
99
97
  }];
100
98
  const toolbarConfiguration = [...undoRedoGroup, ...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormattingGroup, ...insertBlockGroup, ...others];
101
- const toolbarConfigurationV2 = [...blockTypeGroup, ...textFormattingGroup, ...textColorGroup, ...alignmentGroup, ...listFormattingGroup, ...hyperlinkGroup, {
99
+ const toolbarConfigurationV2 = (shouldShowInsertBlock = false, shouldShowMoveActions = false) => [...(shouldShowMoveActions ? undoRedoGroup : []), ...blockTypeGroup, ...textFormattingGroup, ...textColorGroup, ...alignmentGroup, ...listFormattingGroup, ...hyperlinkGroup, ...(shouldShowInsertBlock ? insertBlockGroup : []), {
102
100
  name: 'overflowMenu'
103
101
  }, {
104
102
  name: 'beforePrimaryToolbar'
105
- }];
106
- const toolbarConfigurationV2WithUndoRedoAndFindReplace = [...undoRedoGroup, ...toolbarConfigurationV2, ...findGroup];
103
+ }, ...(shouldShowMoveActions ? findGroup : [])];
@@ -9,11 +9,9 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
9
9
  if (contextualFormattingEnabled && editorExperiment('platform_editor_controls', 'variant1', {
10
10
  exposure: true
11
11
  })) {
12
- if (fg('platform_editor_controls_move_actions')) {
13
- configuration = toolbarConfigurationV2;
14
- } else {
15
- configuration = toolbarConfigurationV2WithUndoRedoAndFindReplace;
16
- }
12
+ var shouldShowInsertBlock = fg('platform_editor_insert_button_on_primary_toolbar');
13
+ var shouldShowUndoRedoFindGroup = fg('platform_editor_controls_move_actions');
14
+ configuration = toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoFindGroup);
17
15
  } else {
18
16
  configuration = toolbarConfiguration;
19
17
  }
@@ -116,9 +114,12 @@ var findGroup = [{
116
114
  name: 'findReplace'
117
115
  }];
118
116
  var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, others);
119
- var toolbarConfigurationV2 = [].concat(blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, [{
120
- name: 'overflowMenu'
121
- }, {
122
- name: 'beforePrimaryToolbar'
123
- }]);
124
- var toolbarConfigurationV2WithUndoRedoAndFindReplace = [].concat(undoRedoGroup, _toConsumableArray(toolbarConfigurationV2), findGroup);
117
+ var toolbarConfigurationV2 = function toolbarConfigurationV2() {
118
+ var shouldShowInsertBlock = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
119
+ var shouldShowMoveActions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
120
+ return [].concat(_toConsumableArray(shouldShowMoveActions ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, _toConsumableArray(shouldShowInsertBlock ? insertBlockGroup : []), [{
121
+ name: 'overflowMenu'
122
+ }, {
123
+ name: 'beforePrimaryToolbar'
124
+ }], _toConsumableArray(shouldShowMoveActions ? findGroup : []));
125
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-primary-toolbar",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "Primary toolbar plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,10 +36,10 @@
36
36
  ".": "./src/index.ts"
37
37
  },
38
38
  "dependencies": {
39
- "@atlaskit/editor-common": "^103.4.0",
39
+ "@atlaskit/editor-common": "^103.14.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^4.6.0",
42
+ "@atlaskit/tmp-editor-statsig": "^4.13.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1"
45
45
  },
@@ -87,6 +87,9 @@
87
87
  "platform-feature-flags": {
88
88
  "platform_editor_controls_move_actions": {
89
89
  "type": "boolean"
90
+ },
91
+ "platform_editor_insert_button_on_primary_toolbar": {
92
+ "type": "boolean"
90
93
  }
91
94
  }
92
95
  }