@atlaskit/editor-plugin-find-replace 3.0.1 → 3.0.2
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
|
+
## 3.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#182839](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/182839)
|
|
8
|
+
[`81f1c3383bdab`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/81f1c3383bdab) -
|
|
9
|
+
refactor: use useSharedPluginStateWithSelector instead of useSharedPluginStateSelector
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 3.0.1
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
|
@@ -9,13 +9,11 @@ exports.default = void 0;
|
|
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
10
10
|
var _react = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
-
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
13
12
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
14
13
|
var _commands = require("../pm-plugins/commands");
|
|
15
14
|
var _commandsWithAnalytics = require("../pm-plugins/commands-with-analytics");
|
|
16
15
|
var _FindReplaceDropdown = _interopRequireDefault(require("./FindReplaceDropdown"));
|
|
17
16
|
var _FindReplaceToolbarButton = _interopRequireDefault(require("./FindReplaceToolbarButton"));
|
|
18
|
-
var _useFindReplacePluginStateSelector = require("./hooks/useFindReplacePluginStateSelector");
|
|
19
17
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
18
|
// light implementation of useSharedPluginState(). This is due to findreplace
|
|
21
19
|
// being the only plugin that previously used WithPluginState with
|
|
@@ -42,36 +40,6 @@ var useSharedPluginStateNoDebounce = function useSharedPluginStateNoDebounce(api
|
|
|
42
40
|
findReplaceState: state
|
|
43
41
|
};
|
|
44
42
|
};
|
|
45
|
-
var useSharedState = (0, _hooks.sharedPluginStateHookMigratorFactory)(function (api) {
|
|
46
|
-
var shouldMatchCase = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'shouldMatchCase');
|
|
47
|
-
var isActive = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'isActive');
|
|
48
|
-
var findText = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'findText');
|
|
49
|
-
var replaceText = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'replaceText');
|
|
50
|
-
var index = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'index');
|
|
51
|
-
var matches = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'matches');
|
|
52
|
-
var shouldFocus = (0, _useFindReplacePluginStateSelector.useFindReplacePluginStateSelector)(api, 'shouldFocus');
|
|
53
|
-
return {
|
|
54
|
-
shouldMatchCase: shouldMatchCase,
|
|
55
|
-
isActive: isActive,
|
|
56
|
-
findText: findText,
|
|
57
|
-
replaceText: replaceText,
|
|
58
|
-
index: index,
|
|
59
|
-
matches: matches,
|
|
60
|
-
shouldFocus: shouldFocus
|
|
61
|
-
};
|
|
62
|
-
}, function (api) {
|
|
63
|
-
var _useSharedPluginState = useSharedPluginStateNoDebounce(api),
|
|
64
|
-
findReplaceState = _useSharedPluginState.findReplaceState;
|
|
65
|
-
return {
|
|
66
|
-
shouldMatchCase: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldMatchCase,
|
|
67
|
-
isActive: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.isActive,
|
|
68
|
-
findText: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.findText,
|
|
69
|
-
replaceText: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.replaceText,
|
|
70
|
-
index: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.index,
|
|
71
|
-
matches: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.matches,
|
|
72
|
-
shouldFocus: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldFocus
|
|
73
|
-
};
|
|
74
|
-
});
|
|
75
43
|
var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithState(_ref2) {
|
|
76
44
|
var _api$analytics, _matches$index;
|
|
77
45
|
var popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
@@ -86,14 +54,15 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
86
54
|
isButtonHidden = _ref2.isButtonHidden,
|
|
87
55
|
doesNotHaveButton = _ref2.doesNotHaveButton;
|
|
88
56
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
89
|
-
var
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
57
|
+
var _useSharedPluginState = useSharedPluginStateNoDebounce(api),
|
|
58
|
+
findReplaceState = _useSharedPluginState.findReplaceState;
|
|
59
|
+
var shouldMatchCase = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldMatchCase;
|
|
60
|
+
var isActive = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.isActive;
|
|
61
|
+
var findText = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.findText;
|
|
62
|
+
var replaceText = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.replaceText;
|
|
63
|
+
var index = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.index;
|
|
64
|
+
var matches = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.matches;
|
|
65
|
+
var shouldFocus = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldFocus;
|
|
97
66
|
if (!editorView) {
|
|
98
67
|
return null;
|
|
99
68
|
}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import React, { useLayoutEffect, useState } from 'react';
|
|
2
2
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { blur, toggleMatchCase } from '../pm-plugins/commands';
|
|
6
5
|
import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
|
|
7
6
|
import FindReplaceDropdown from './FindReplaceDropdown';
|
|
8
7
|
import FindReplaceToolbarButton from './FindReplaceToolbarButton';
|
|
9
|
-
import { useFindReplacePluginStateSelector } from './hooks/useFindReplacePluginStateSelector';
|
|
10
8
|
|
|
11
9
|
// light implementation of useSharedPluginState(). This is due to findreplace
|
|
12
10
|
// being the only plugin that previously used WithPluginState with
|
|
@@ -31,37 +29,6 @@ const useSharedPluginStateNoDebounce = api => {
|
|
|
31
29
|
findReplaceState: state
|
|
32
30
|
};
|
|
33
31
|
};
|
|
34
|
-
const useSharedState = sharedPluginStateHookMigratorFactory(api => {
|
|
35
|
-
const shouldMatchCase = useFindReplacePluginStateSelector(api, 'shouldMatchCase');
|
|
36
|
-
const isActive = useFindReplacePluginStateSelector(api, 'isActive');
|
|
37
|
-
const findText = useFindReplacePluginStateSelector(api, 'findText');
|
|
38
|
-
const replaceText = useFindReplacePluginStateSelector(api, 'replaceText');
|
|
39
|
-
const index = useFindReplacePluginStateSelector(api, 'index');
|
|
40
|
-
const matches = useFindReplacePluginStateSelector(api, 'matches');
|
|
41
|
-
const shouldFocus = useFindReplacePluginStateSelector(api, 'shouldFocus');
|
|
42
|
-
return {
|
|
43
|
-
shouldMatchCase,
|
|
44
|
-
isActive,
|
|
45
|
-
findText,
|
|
46
|
-
replaceText,
|
|
47
|
-
index,
|
|
48
|
-
matches,
|
|
49
|
-
shouldFocus
|
|
50
|
-
};
|
|
51
|
-
}, api => {
|
|
52
|
-
const {
|
|
53
|
-
findReplaceState
|
|
54
|
-
} = useSharedPluginStateNoDebounce(api);
|
|
55
|
-
return {
|
|
56
|
-
shouldMatchCase: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldMatchCase,
|
|
57
|
-
isActive: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.isActive,
|
|
58
|
-
findText: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.findText,
|
|
59
|
-
replaceText: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.replaceText,
|
|
60
|
-
index: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.index,
|
|
61
|
-
matches: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.matches,
|
|
62
|
-
shouldFocus: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldFocus
|
|
63
|
-
};
|
|
64
|
-
});
|
|
65
32
|
const FindReplaceToolbarButtonWithState = ({
|
|
66
33
|
popupsBoundariesElement,
|
|
67
34
|
popupsMountPoint,
|
|
@@ -78,14 +45,15 @@ const FindReplaceToolbarButtonWithState = ({
|
|
|
78
45
|
var _api$analytics, _matches$index;
|
|
79
46
|
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
80
47
|
const {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
48
|
+
findReplaceState
|
|
49
|
+
} = useSharedPluginStateNoDebounce(api);
|
|
50
|
+
const shouldMatchCase = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldMatchCase;
|
|
51
|
+
const isActive = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.isActive;
|
|
52
|
+
const findText = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.findText;
|
|
53
|
+
const replaceText = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.replaceText;
|
|
54
|
+
const index = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.index;
|
|
55
|
+
const matches = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.matches;
|
|
56
|
+
const shouldFocus = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldFocus;
|
|
89
57
|
if (!editorView) {
|
|
90
58
|
return null;
|
|
91
59
|
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
2
|
import React, { useLayoutEffect, useState } from 'react';
|
|
3
3
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
5
4
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
6
5
|
import { blur, toggleMatchCase } from '../pm-plugins/commands';
|
|
7
6
|
import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
|
|
8
7
|
import FindReplaceDropdown from './FindReplaceDropdown';
|
|
9
8
|
import FindReplaceToolbarButton from './FindReplaceToolbarButton';
|
|
10
|
-
import { useFindReplacePluginStateSelector } from './hooks/useFindReplacePluginStateSelector';
|
|
11
9
|
|
|
12
10
|
// light implementation of useSharedPluginState(). This is due to findreplace
|
|
13
11
|
// being the only plugin that previously used WithPluginState with
|
|
@@ -34,36 +32,6 @@ var useSharedPluginStateNoDebounce = function useSharedPluginStateNoDebounce(api
|
|
|
34
32
|
findReplaceState: state
|
|
35
33
|
};
|
|
36
34
|
};
|
|
37
|
-
var useSharedState = sharedPluginStateHookMigratorFactory(function (api) {
|
|
38
|
-
var shouldMatchCase = useFindReplacePluginStateSelector(api, 'shouldMatchCase');
|
|
39
|
-
var isActive = useFindReplacePluginStateSelector(api, 'isActive');
|
|
40
|
-
var findText = useFindReplacePluginStateSelector(api, 'findText');
|
|
41
|
-
var replaceText = useFindReplacePluginStateSelector(api, 'replaceText');
|
|
42
|
-
var index = useFindReplacePluginStateSelector(api, 'index');
|
|
43
|
-
var matches = useFindReplacePluginStateSelector(api, 'matches');
|
|
44
|
-
var shouldFocus = useFindReplacePluginStateSelector(api, 'shouldFocus');
|
|
45
|
-
return {
|
|
46
|
-
shouldMatchCase: shouldMatchCase,
|
|
47
|
-
isActive: isActive,
|
|
48
|
-
findText: findText,
|
|
49
|
-
replaceText: replaceText,
|
|
50
|
-
index: index,
|
|
51
|
-
matches: matches,
|
|
52
|
-
shouldFocus: shouldFocus
|
|
53
|
-
};
|
|
54
|
-
}, function (api) {
|
|
55
|
-
var _useSharedPluginState = useSharedPluginStateNoDebounce(api),
|
|
56
|
-
findReplaceState = _useSharedPluginState.findReplaceState;
|
|
57
|
-
return {
|
|
58
|
-
shouldMatchCase: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldMatchCase,
|
|
59
|
-
isActive: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.isActive,
|
|
60
|
-
findText: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.findText,
|
|
61
|
-
replaceText: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.replaceText,
|
|
62
|
-
index: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.index,
|
|
63
|
-
matches: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.matches,
|
|
64
|
-
shouldFocus: findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldFocus
|
|
65
|
-
};
|
|
66
|
-
});
|
|
67
35
|
var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithState(_ref2) {
|
|
68
36
|
var _api$analytics, _matches$index;
|
|
69
37
|
var popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
@@ -78,14 +46,15 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
78
46
|
isButtonHidden = _ref2.isButtonHidden,
|
|
79
47
|
doesNotHaveButton = _ref2.doesNotHaveButton;
|
|
80
48
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
81
|
-
var
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
49
|
+
var _useSharedPluginState = useSharedPluginStateNoDebounce(api),
|
|
50
|
+
findReplaceState = _useSharedPluginState.findReplaceState;
|
|
51
|
+
var shouldMatchCase = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldMatchCase;
|
|
52
|
+
var isActive = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.isActive;
|
|
53
|
+
var findText = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.findText;
|
|
54
|
+
var replaceText = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.replaceText;
|
|
55
|
+
var index = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.index;
|
|
56
|
+
var matches = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.matches;
|
|
57
|
+
var shouldFocus = findReplaceState === null || findReplaceState === void 0 ? void 0 : findReplaceState.shouldFocus;
|
|
89
58
|
if (!editorView) {
|
|
90
59
|
return null;
|
|
91
60
|
}
|