@atlaskit/editor-plugin-primary-toolbar 3.2.5 → 3.2.6

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,13 @@
1
1
  # @atlaskit/editor-plugin-primary-toolbar
2
2
 
3
+ ## 3.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#153512](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/153512)
8
+ [`795799207e556`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/795799207e556) -
9
+ ED-27817 Hide find button on primary toolbar when contextualFormattingEnabled option is false
10
+
3
11
  ## 3.2.5
4
12
 
5
13
  ### Patch Changes
@@ -20,7 +20,8 @@ var getToolbarComponents = exports.getToolbarComponents = function getToolbarCom
20
20
  var shouldShowUndoRedoGroup = (0, _platformFeatureFlags.fg)('platform_editor_undo_redo_find_on_primary_toolbar');
21
21
  configuration = toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup);
22
22
  } else {
23
- configuration = toolbarConfiguration;
23
+ var shouldShowFindGroup = !(!contextualFormattingEnabled && (0, _platformFeatureFlags.fg)('platform_editor_controls_fix_toolbar_config_embeds'));
24
+ configuration = toolbarConfiguration(shouldShowFindGroup);
24
25
  }
25
26
  return configuration.filter(function (toolbarElement) {
26
27
  return typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState);
@@ -117,10 +118,22 @@ var others = [{
117
118
  }, {
118
119
  name: 'loom'
119
120
  }];
121
+ var othersGroupNoFind = [{
122
+ name: 'beforePrimaryToolbar'
123
+ }, {
124
+ name: 'avatarGroup'
125
+ }, {
126
+ // TODO: ED-26962 - Should likely be split into three: spelling & grammar, separator, and AI trigger
127
+ name: 'aiExperience'
128
+ }, {
129
+ name: 'loom'
130
+ }];
120
131
  var findGroup = [{
121
132
  name: 'findReplace'
122
133
  }];
123
- var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, others);
134
+ var toolbarConfiguration = function toolbarConfiguration(shouldShowFindGroup) {
135
+ return [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, (0, _toConsumableArray2.default)(shouldShowFindGroup ? others : othersGroupNoFind));
136
+ };
124
137
  var toolbarConfigurationV2 = function toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup) {
125
138
  var shouldShowFindGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
126
139
  return [].concat((0, _toConsumableArray2.default)(shouldShowUndoRedoGroup ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, (0, _toConsumableArray2.default)(shouldShowInsertBlock ? insertBlockGroup : []), [{
@@ -13,7 +13,8 @@ export const getToolbarComponents = ({
13
13
  const shouldShowUndoRedoGroup = fg('platform_editor_undo_redo_find_on_primary_toolbar');
14
14
  configuration = toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup);
15
15
  } else {
16
- configuration = toolbarConfiguration;
16
+ const shouldShowFindGroup = !(!contextualFormattingEnabled && fg('platform_editor_controls_fix_toolbar_config_embeds'));
17
+ configuration = toolbarConfiguration(shouldShowFindGroup);
17
18
  }
18
19
  return configuration.filter(toolbarElement => typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState)).reduce((acc, toolbarElement) => {
19
20
  if (componentRegistry.has(toolbarElement.name)) {
@@ -92,10 +93,20 @@ const others = [{
92
93
  }, {
93
94
  name: 'loom'
94
95
  }];
96
+ const othersGroupNoFind = [{
97
+ name: 'beforePrimaryToolbar'
98
+ }, {
99
+ name: 'avatarGroup'
100
+ }, {
101
+ // TODO: ED-26962 - Should likely be split into three: spelling & grammar, separator, and AI trigger
102
+ name: 'aiExperience'
103
+ }, {
104
+ name: 'loom'
105
+ }];
95
106
  const findGroup = [{
96
107
  name: 'findReplace'
97
108
  }];
98
- const toolbarConfiguration = [...undoRedoGroup, ...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormattingGroup, ...insertBlockGroup, ...others];
109
+ const toolbarConfiguration = shouldShowFindGroup => [...undoRedoGroup, ...spellCheckGroup, ...blockTypeGroup, ...textFormattingGroup, ...alignmentGroup, ...textColorGroup, ...listFormattingGroup, ...insertBlockGroup, ...(shouldShowFindGroup ? others : othersGroupNoFind)];
99
110
  const toolbarConfigurationV2 = (shouldShowInsertBlock, shouldShowUndoRedoGroup, shouldShowFindGroup = false) => [...(shouldShowUndoRedoGroup ? undoRedoGroup : []), ...blockTypeGroup, ...textFormattingGroup, ...textColorGroup, ...alignmentGroup, ...listFormattingGroup, ...hyperlinkGroup, ...(shouldShowInsertBlock ? insertBlockGroup : []), {
100
111
  name: 'overflowMenu'
101
112
  }, {
@@ -13,7 +13,8 @@ export var getToolbarComponents = function getToolbarComponents(_ref) {
13
13
  var shouldShowUndoRedoGroup = fg('platform_editor_undo_redo_find_on_primary_toolbar');
14
14
  configuration = toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup);
15
15
  } else {
16
- configuration = toolbarConfiguration;
16
+ var shouldShowFindGroup = !(!contextualFormattingEnabled && fg('platform_editor_controls_fix_toolbar_config_embeds'));
17
+ configuration = toolbarConfiguration(shouldShowFindGroup);
17
18
  }
18
19
  return configuration.filter(function (toolbarElement) {
19
20
  return typeof toolbarElement.enabled === 'undefined' || toolbarElement.enabled(componentRegistry, editorState);
@@ -110,10 +111,22 @@ var others = [{
110
111
  }, {
111
112
  name: 'loom'
112
113
  }];
114
+ var othersGroupNoFind = [{
115
+ name: 'beforePrimaryToolbar'
116
+ }, {
117
+ name: 'avatarGroup'
118
+ }, {
119
+ // TODO: ED-26962 - Should likely be split into three: spelling & grammar, separator, and AI trigger
120
+ name: 'aiExperience'
121
+ }, {
122
+ name: 'loom'
123
+ }];
113
124
  var findGroup = [{
114
125
  name: 'findReplace'
115
126
  }];
116
- var toolbarConfiguration = [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, others);
127
+ var toolbarConfiguration = function toolbarConfiguration(shouldShowFindGroup) {
128
+ return [].concat(undoRedoGroup, spellCheckGroup, blockTypeGroup, textFormattingGroup, alignmentGroup, textColorGroup, listFormattingGroup, insertBlockGroup, _toConsumableArray(shouldShowFindGroup ? others : othersGroupNoFind));
129
+ };
117
130
  var toolbarConfigurationV2 = function toolbarConfigurationV2(shouldShowInsertBlock, shouldShowUndoRedoGroup) {
118
131
  var shouldShowFindGroup = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
119
132
  return [].concat(_toConsumableArray(shouldShowUndoRedoGroup ? undoRedoGroup : []), blockTypeGroup, textFormattingGroup, textColorGroup, alignmentGroup, listFormattingGroup, hyperlinkGroup, _toConsumableArray(shouldShowInsertBlock ? insertBlockGroup : []), [{
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-primary-toolbar",
3
- "version": "3.2.5",
3
+ "version": "3.2.6",
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": "^105.0.0",
39
+ "@atlaskit/editor-common": "^105.2.0",
40
40
  "@atlaskit/editor-prosemirror": "7.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^4.19.0",
42
+ "@atlaskit/tmp-editor-statsig": "^4.21.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "@emotion/react": "^11.7.1"
45
45
  },
@@ -93,6 +93,9 @@
93
93
  },
94
94
  "platform_editor_undo_redo_find_on_primary_toolbar": {
95
95
  "type": "boolean"
96
+ },
97
+ "platform_editor_controls_fix_toolbar_config_embeds": {
98
+ "type": "boolean"
96
99
  }
97
100
  }
98
101
  }