@atlaskit/editor-plugin-find-replace 2.0.9 → 2.0.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-find-replace
2
2
 
3
+ ## 2.0.10
4
+
5
+ ### Patch Changes
6
+
7
+ - [#137151](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/137151)
8
+ [`724daf91c62db`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/724daf91c62db) -
9
+ [ux] Put move of the redo/undo/find behind its own FG. Fix double Find & Replace popup
10
+ - Updated dependencies
11
+
3
12
  ## 2.0.9
4
13
 
5
14
  ### Patch Changes
@@ -24,6 +24,9 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
24
24
  var editorViewRef = {
25
25
  current: null
26
26
  };
27
+ var toolbarButtonRegisteredExternally = {
28
+ current: false
29
+ };
27
30
  var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
28
31
  var popupsBoundariesElement = _ref2.popupsBoundariesElement,
29
32
  popupsMountPoint = _ref2.popupsMountPoint,
@@ -36,6 +39,8 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
36
39
  var isButtonHidden = (0, _platformFeatureFlags.fg)('platform_editor_toolbar_responsive_fixes') ? toolbarSize < _types.ToolbarSize.XL : false;
37
40
  if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
38
41
  return null;
42
+ } else if (toolbarButtonRegisteredExternally.current && (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1')) {
43
+ return null;
39
44
  } else {
40
45
  return /*#__PURE__*/_react.default.createElement(_FindReplaceDropDownOrToolbarButtonWithState.default, {
41
46
  popupsBoundariesElement: popupsBoundariesElement,
@@ -99,7 +104,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
99
104
  return _pluginKey.findReplacePluginKey.getState(editorState) || undefined;
100
105
  },
101
106
  actions: {
102
- getToolbarButton: function getToolbarButton(_ref4) {
107
+ registerToolbarButton: function registerToolbarButton(_ref4) {
103
108
  var popupsBoundariesElement = _ref4.popupsBoundariesElement,
104
109
  popupsMountPoint = _ref4.popupsMountPoint,
105
110
  popupsScrollableElement = _ref4.popupsScrollableElement,
@@ -107,6 +112,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
107
112
  containerElement = _ref4.containerElement,
108
113
  dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
109
114
  isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
115
+ toolbarButtonRegisteredExternally.current = (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1');
110
116
  return /*#__PURE__*/_react.default.createElement(_FindReplaceDropDownOrToolbarButtonWithState.default, {
111
117
  popupsBoundariesElement: popupsBoundariesElement,
112
118
  popupsMountPoint: popupsMountPoint,
@@ -140,7 +146,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
140
146
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
141
147
  contentComponent: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
142
148
  exposure: true
143
- }) ? function (_ref5) {
149
+ }) && (0, _platformFeatureFlags.fg)('platform_editor_controls_move_actions') ? function (_ref5) {
144
150
  var editorView = _ref5.editorView,
145
151
  containerElement = _ref5.containerElement,
146
152
  popupsMountPoint = _ref5.popupsMountPoint,
@@ -148,6 +154,9 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
148
154
  popupsScrollableElement = _ref5.popupsScrollableElement,
149
155
  wrapperElement = _ref5.wrapperElement,
150
156
  dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
157
+ if (toolbarButtonRegisteredExternally.current) {
158
+ return null;
159
+ }
151
160
  var popupsMountPointEl = popupsMountPoint || ( // eslint-disable-next-line @atlaskit/editor/no-as-casting
152
161
  wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector("[data-editor-container='true']"));
153
162
  return /*#__PURE__*/_react.default.createElement(_FindReplaceDropDownOrToolbarButtonWithState.default, {
@@ -18,6 +18,9 @@ export const findReplacePlugin = ({
18
18
  const editorViewRef = {
19
19
  current: null
20
20
  };
21
+ const toolbarButtonRegisteredExternally = {
22
+ current: false
23
+ };
21
24
  const primaryToolbarComponent = ({
22
25
  popupsBoundariesElement,
23
26
  popupsMountPoint,
@@ -31,6 +34,8 @@ export const findReplacePlugin = ({
31
34
  const isButtonHidden = fg('platform_editor_toolbar_responsive_fixes') ? toolbarSize < ToolbarSize.XL : false;
32
35
  if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
33
36
  return null;
37
+ } else if (toolbarButtonRegisteredExternally.current && editorExperiment('platform_editor_controls', 'variant1')) {
38
+ return null;
34
39
  } else {
35
40
  return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
36
41
  popupsBoundariesElement: popupsBoundariesElement,
@@ -93,7 +98,7 @@ export const findReplacePlugin = ({
93
98
  return findReplacePluginKey.getState(editorState) || undefined;
94
99
  },
95
100
  actions: {
96
- getToolbarButton: ({
101
+ registerToolbarButton: ({
97
102
  popupsBoundariesElement,
98
103
  popupsMountPoint,
99
104
  popupsScrollableElement,
@@ -102,6 +107,7 @@ export const findReplacePlugin = ({
102
107
  dispatchAnalyticsEvent,
103
108
  isToolbarReducedSpacing
104
109
  }) => {
110
+ toolbarButtonRegisteredExternally.current = editorExperiment('platform_editor_controls', 'variant1');
105
111
  return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
106
112
  popupsBoundariesElement: popupsBoundariesElement,
107
113
  popupsMountPoint: popupsMountPoint,
@@ -136,7 +142,7 @@ export const findReplacePlugin = ({
136
142
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
137
143
  contentComponent: editorExperiment('platform_editor_controls', 'variant1', {
138
144
  exposure: true
139
- }) ? ({
145
+ }) && fg('platform_editor_controls_move_actions') ? ({
140
146
  editorView,
141
147
  containerElement,
142
148
  popupsMountPoint,
@@ -145,6 +151,9 @@ export const findReplacePlugin = ({
145
151
  wrapperElement,
146
152
  dispatchAnalyticsEvent
147
153
  }) => {
154
+ if (toolbarButtonRegisteredExternally.current) {
155
+ return null;
156
+ }
148
157
  const popupsMountPointEl = popupsMountPoint || ( // eslint-disable-next-line @atlaskit/editor/no-as-casting
149
158
  wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector("[data-editor-container='true']"));
150
159
  return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
@@ -17,6 +17,9 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
17
17
  var editorViewRef = {
18
18
  current: null
19
19
  };
20
+ var toolbarButtonRegisteredExternally = {
21
+ current: false
22
+ };
20
23
  var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
21
24
  var popupsBoundariesElement = _ref2.popupsBoundariesElement,
22
25
  popupsMountPoint = _ref2.popupsMountPoint,
@@ -29,6 +32,8 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
29
32
  var isButtonHidden = fg('platform_editor_toolbar_responsive_fixes') ? toolbarSize < ToolbarSize.XL : false;
30
33
  if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
31
34
  return null;
35
+ } else if (toolbarButtonRegisteredExternally.current && editorExperiment('platform_editor_controls', 'variant1')) {
36
+ return null;
32
37
  } else {
33
38
  return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
34
39
  popupsBoundariesElement: popupsBoundariesElement,
@@ -92,7 +97,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
92
97
  return findReplacePluginKey.getState(editorState) || undefined;
93
98
  },
94
99
  actions: {
95
- getToolbarButton: function getToolbarButton(_ref4) {
100
+ registerToolbarButton: function registerToolbarButton(_ref4) {
96
101
  var popupsBoundariesElement = _ref4.popupsBoundariesElement,
97
102
  popupsMountPoint = _ref4.popupsMountPoint,
98
103
  popupsScrollableElement = _ref4.popupsScrollableElement,
@@ -100,6 +105,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
100
105
  containerElement = _ref4.containerElement,
101
106
  dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
102
107
  isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
108
+ toolbarButtonRegisteredExternally.current = editorExperiment('platform_editor_controls', 'variant1');
103
109
  return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
104
110
  popupsBoundariesElement: popupsBoundariesElement,
105
111
  popupsMountPoint: popupsMountPoint,
@@ -133,7 +139,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
133
139
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
134
140
  contentComponent: editorExperiment('platform_editor_controls', 'variant1', {
135
141
  exposure: true
136
- }) ? function (_ref5) {
142
+ }) && fg('platform_editor_controls_move_actions') ? function (_ref5) {
137
143
  var editorView = _ref5.editorView,
138
144
  containerElement = _ref5.containerElement,
139
145
  popupsMountPoint = _ref5.popupsMountPoint,
@@ -141,6 +147,9 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
141
147
  popupsScrollableElement = _ref5.popupsScrollableElement,
142
148
  wrapperElement = _ref5.wrapperElement,
143
149
  dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
150
+ if (toolbarButtonRegisteredExternally.current) {
151
+ return null;
152
+ }
144
153
  var popupsMountPointEl = popupsMountPoint || ( // eslint-disable-next-line @atlaskit/editor/no-as-casting
145
154
  wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector("[data-editor-container='true']"));
146
155
  return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
@@ -17,7 +17,7 @@ export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
17
17
  sharedState: FindReplacePluginState | undefined;
18
18
  dependencies: FindReplacePluginDependencies;
19
19
  actions: {
20
- getToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
20
+ registerToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
21
21
  activateFindReplace: (triggerMethod?: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL) => boolean;
22
22
  };
23
23
  }>;
@@ -17,7 +17,7 @@ export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
17
17
  sharedState: FindReplacePluginState | undefined;
18
18
  dependencies: FindReplacePluginDependencies;
19
19
  actions: {
20
- getToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
20
+ registerToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
21
21
  activateFindReplace: (triggerMethod?: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL) => boolean;
22
22
  };
23
23
  }>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@atlaskit/button": "^23.0.0",
36
- "@atlaskit/editor-common": "^103.0.0",
36
+ "@atlaskit/editor-common": "^103.1.0",
37
37
  "@atlaskit/editor-plugin-analytics": "^2.2.0",
38
38
  "@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
39
39
  "@atlaskit/editor-prosemirror": "7.0.0",
@@ -112,6 +112,9 @@
112
112
  "platform-feature-flags": {
113
113
  "platform_editor_toolbar_responsive_fixes": {
114
114
  "type": "boolean"
115
+ },
116
+ "platform_editor_controls_move_actions": {
117
+ "type": "boolean"
115
118
  }
116
119
  }
117
120
  }