@atlaskit/editor-plugin-find-replace 1.5.0 → 1.6.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,28 @@
1
1
  # @atlaskit/editor-plugin-find-replace
2
2
 
3
+ ## 1.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#126478](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/126478)
8
+ [`ca1665ebbfe4d`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ca1665ebbfe4d) -
9
+ [ED-23435] Store primary toolbar component registry in a plugin variable instead of in plugin
10
+ state to avoid having to add effects to all plugins and enable SSR for the toolbar. [Breaking
11
+ change] Converted registerComponent from the primary toolbar plugin into an action.
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
17
+ ## 1.5.1
18
+
19
+ ### Patch Changes
20
+
21
+ - [#124134](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/124134)
22
+ [`80147d04d87b6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/80147d04d87b6) -
23
+ Fix bug in React 18 concurrent mode where find input swallows characters
24
+ - Updated dependencies
25
+
3
26
  ## 1.5.0
4
27
 
5
28
  ### Minor Changes
@@ -11,6 +11,7 @@ var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
11
11
  var _main = require("./pm-plugins/main");
12
12
  var _pluginKey = require("./pm-plugins/plugin-key");
13
13
  var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_ref) {
14
+ var _api$primaryToolbar;
14
15
  var props = _ref.config,
15
16
  api = _ref.api;
16
17
  var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
@@ -37,6 +38,10 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
37
38
  });
38
39
  }
39
40
  };
41
+ api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
42
+ name: 'findReplace',
43
+ component: primaryToolbarComponent
44
+ });
40
45
  return {
41
46
  name: 'findReplace',
42
47
  pmPlugins: function pmPlugins() {
@@ -81,13 +86,6 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
81
86
  });
82
87
  }
83
88
  },
84
- usePluginHook: function usePluginHook() {
85
- var _api$core, _api$primaryToolbar;
86
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
87
- name: 'findReplace',
88
- component: primaryToolbarComponent
89
- }));
90
- },
91
89
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
92
90
  };
93
91
  };
@@ -21,6 +21,7 @@ var _analytics = require("@atlaskit/editor-common/analytics");
21
21
  var _messages = require("@atlaskit/editor-common/messages");
22
22
  var _form = require("@atlaskit/form");
23
23
  var _keyboard = _interopRequireDefault(require("@atlaskit/icon/glyph/emoji/keyboard"));
24
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
24
25
  var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
25
26
  var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
26
27
  var _styles = require("./styles");
@@ -178,13 +179,24 @@ var Find = /*#__PURE__*/function (_React$Component) {
178
179
  if (this.props.findText === ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.localFindText)) {
179
180
  this.focusFindTextfield();
180
181
  }
181
- if (this.props.findText !== prevProps.findText) {
182
- this.syncFindText(function () {
183
- // focus after input is synced if find text provided
184
- if (_this3.props.findText) {
185
- _this3.focusFindTextfield();
186
- }
187
- });
182
+ if ((0, _platformFeatureFlags.fg)('react_18_find_replace_concurrent_mode')) {
183
+ if (this.props.findText !== prevProps.findText && this.props.shouldFocus) {
184
+ this.syncFindText(function () {
185
+ // focus after input is synced if find text provided
186
+ if (_this3.props.findText) {
187
+ _this3.focusFindTextfield();
188
+ }
189
+ });
190
+ }
191
+ } else {
192
+ if (this.props.findText !== prevProps.findText) {
193
+ this.syncFindText(function () {
194
+ // focus after input is synced if find text provided
195
+ if (_this3.props.findText) {
196
+ _this3.focusFindTextfield();
197
+ }
198
+ });
199
+ }
188
200
  }
189
201
  }
190
202
  }, {
@@ -7,6 +7,7 @@ export const findReplacePlugin = ({
7
7
  config: props,
8
8
  api
9
9
  }) => {
10
+ var _api$primaryToolbar;
10
11
  const primaryToolbarComponent = ({
11
12
  popupsBoundariesElement,
12
13
  popupsMountPoint,
@@ -32,6 +33,10 @@ export const findReplacePlugin = ({
32
33
  });
33
34
  }
34
35
  };
36
+ api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.actions.registerComponent({
37
+ name: 'findReplace',
38
+ component: primaryToolbarComponent
39
+ });
35
40
  return {
36
41
  name: 'findReplace',
37
42
  pmPlugins() {
@@ -76,13 +81,6 @@ export const findReplacePlugin = ({
76
81
  });
77
82
  }
78
83
  },
79
- usePluginHook: () => {
80
- var _api$core, _api$primaryToolbar;
81
- api === null || api === void 0 ? void 0 : (_api$core = api.core) === null || _api$core === void 0 ? void 0 : _api$core.actions.execute(api === null || api === void 0 ? void 0 : (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
82
- name: 'findReplace',
83
- component: primaryToolbarComponent
84
- }));
85
- },
86
84
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
87
85
  };
88
86
  };
@@ -15,6 +15,7 @@ import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
15
15
  import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
16
16
  import { Label } from '@atlaskit/form';
17
17
  import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
18
+ import { fg } from '@atlaskit/platform-feature-flags';
18
19
  import Textfield from '@atlaskit/textfield';
19
20
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
20
21
  import { afterInputSection, countStyles, countStylesAlternateStyles, matchCaseSection, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
@@ -160,13 +161,24 @@ class Find extends React.Component {
160
161
  if (this.props.findText === ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.localFindText)) {
161
162
  this.focusFindTextfield();
162
163
  }
163
- if (this.props.findText !== prevProps.findText) {
164
- this.syncFindText(() => {
165
- // focus after input is synced if find text provided
166
- if (this.props.findText) {
167
- this.focusFindTextfield();
168
- }
169
- });
164
+ if (fg('react_18_find_replace_concurrent_mode')) {
165
+ if (this.props.findText !== prevProps.findText && this.props.shouldFocus) {
166
+ this.syncFindText(() => {
167
+ // focus after input is synced if find text provided
168
+ if (this.props.findText) {
169
+ this.focusFindTextfield();
170
+ }
171
+ });
172
+ }
173
+ } else {
174
+ if (this.props.findText !== prevProps.findText) {
175
+ this.syncFindText(() => {
176
+ // focus after input is synced if find text provided
177
+ if (this.props.findText) {
178
+ this.focusFindTextfield();
179
+ }
180
+ });
181
+ }
170
182
  }
171
183
  }
172
184
  componentWillUnmount() {
@@ -4,6 +4,7 @@ import keymapPlugin from './pm-plugins/keymap';
4
4
  import { createPlugin } from './pm-plugins/main';
5
5
  import { findReplacePluginKey } from './pm-plugins/plugin-key';
6
6
  export var findReplacePlugin = function findReplacePlugin(_ref) {
7
+ var _api$primaryToolbar;
7
8
  var props = _ref.config,
8
9
  api = _ref.api;
9
10
  var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
@@ -30,6 +31,10 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
30
31
  });
31
32
  }
32
33
  };
34
+ api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 || _api$primaryToolbar.actions.registerComponent({
35
+ name: 'findReplace',
36
+ component: primaryToolbarComponent
37
+ });
33
38
  return {
34
39
  name: 'findReplace',
35
40
  pmPlugins: function pmPlugins() {
@@ -74,13 +79,6 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
74
79
  });
75
80
  }
76
81
  },
77
- usePluginHook: function usePluginHook() {
78
- var _api$core, _api$primaryToolbar;
79
- api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$primaryToolbar = api.primaryToolbar) === null || _api$primaryToolbar === void 0 ? void 0 : _api$primaryToolbar.commands.registerComponent({
80
- name: 'findReplace',
81
- component: primaryToolbarComponent
82
- }));
83
- },
84
82
  primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
85
83
  };
86
84
  };
@@ -23,6 +23,7 @@ import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
23
23
  import { findReplaceMessages as messages } from '@atlaskit/editor-common/messages';
24
24
  import { Label } from '@atlaskit/form';
25
25
  import MatchCaseIcon from '@atlaskit/icon/glyph/emoji/keyboard';
26
+ import { fg } from '@atlaskit/platform-feature-flags';
26
27
  import Textfield from '@atlaskit/textfield';
27
28
  import { FindReplaceTooltipButton } from './FindReplaceTooltipButton';
28
29
  import { afterInputSection, countStyles, countStylesAlternateStyles, matchCaseSection, sectionWrapperStyles, sectionWrapperStylesAlternate, textFieldWrapper } from './styles';
@@ -175,13 +176,24 @@ var Find = /*#__PURE__*/function (_React$Component) {
175
176
  if (this.props.findText === ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.localFindText)) {
176
177
  this.focusFindTextfield();
177
178
  }
178
- if (this.props.findText !== prevProps.findText) {
179
- this.syncFindText(function () {
180
- // focus after input is synced if find text provided
181
- if (_this3.props.findText) {
182
- _this3.focusFindTextfield();
183
- }
184
- });
179
+ if (fg('react_18_find_replace_concurrent_mode')) {
180
+ if (this.props.findText !== prevProps.findText && this.props.shouldFocus) {
181
+ this.syncFindText(function () {
182
+ // focus after input is synced if find text provided
183
+ if (_this3.props.findText) {
184
+ _this3.focusFindTextfield();
185
+ }
186
+ });
187
+ }
188
+ } else {
189
+ if (this.props.findText !== prevProps.findText) {
190
+ this.syncFindText(function () {
191
+ // focus after input is synced if find text provided
192
+ if (_this3.props.findText) {
193
+ _this3.focusFindTextfield();
194
+ }
195
+ });
196
+ }
185
197
  }
186
198
  }
187
199
  }, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-find-replace",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "find replace plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -35,13 +35,14 @@
35
35
  },
36
36
  "dependencies": {
37
37
  "@atlaskit/button": "^19.1.0",
38
- "@atlaskit/editor-common": "^86.8.0",
38
+ "@atlaskit/editor-common": "^87.3.0",
39
39
  "@atlaskit/editor-plugin-analytics": "^1.6.0",
40
- "@atlaskit/editor-plugin-primary-toolbar": "^1.3.0",
40
+ "@atlaskit/editor-plugin-primary-toolbar": "^2.0.0",
41
41
  "@atlaskit/editor-prosemirror": "5.0.1",
42
42
  "@atlaskit/editor-shared-styles": "^2.13.0",
43
43
  "@atlaskit/form": "^10.4.0",
44
- "@atlaskit/icon": "^22.7.0",
44
+ "@atlaskit/icon": "^22.9.0",
45
+ "@atlaskit/platform-feature-flags": "^0.3.0",
45
46
  "@atlaskit/primitives": "^11.1.0",
46
47
  "@atlaskit/textfield": "^6.4.0",
47
48
  "@atlaskit/theme": "^12.11.0",
@@ -54,8 +55,8 @@
54
55
  },
55
56
  "devDependencies": {
56
57
  "@af/visual-regression": "*",
57
- "@atlaskit/editor-plugin-block-type": "^3.10.0",
58
- "@atlaskit/editor-plugin-text-formatting": "^1.11.0",
58
+ "@atlaskit/editor-plugin-block-type": "^3.11.0",
59
+ "@atlaskit/editor-plugin-text-formatting": "^1.12.0",
59
60
  "@testing-library/react": "^12.1.5",
60
61
  "@testing-library/user-event": "^14.4.3",
61
62
  "mockdate": "^3.0.5",
@@ -105,5 +106,10 @@
105
106
  "@atlaskit/editor-plugin-analytics"
106
107
  ]
107
108
  }
109
+ },
110
+ "platform-feature-flags": {
111
+ "react_18_find_replace_concurrent_mode": {
112
+ "type": "boolean"
113
+ }
108
114
  }
109
115
  }