@atlaskit/editor-plugin-find-replace 2.0.4 → 2.0.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 +18 -0
- package/dist/cjs/findReplacePlugin.js +76 -5
- package/dist/cjs/ui/{FindReplaceToolbarButtonWithState.js → FindReplaceDropDownOrToolbarButtonWithState.js} +5 -2
- package/dist/cjs/ui/FindReplaceDropdown.js +68 -0
- package/dist/es2019/findReplacePlugin.js +78 -5
- package/dist/es2019/ui/{FindReplaceToolbarButtonWithState.js → FindReplaceDropDownOrToolbarButtonWithState.js} +5 -2
- package/dist/es2019/ui/FindReplaceDropdown.js +63 -0
- package/dist/esm/findReplacePlugin.js +76 -5
- package/dist/esm/ui/{FindReplaceToolbarButtonWithState.js → FindReplaceDropDownOrToolbarButtonWithState.js} +5 -2
- package/dist/esm/ui/FindReplaceDropdown.js +61 -0
- package/dist/types/findReplacePluginType.d.ts +2 -0
- package/dist/types/pm-plugins/commands-with-analytics.d.ts +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/{types-ts4.5/ui/FindReplaceToolbarButtonWithState.d.ts → types/ui/FindReplaceDropDownOrToolbarButtonWithState.d.ts} +1 -1
- package/dist/types/ui/FindReplaceDropdown.d.ts +15 -0
- package/dist/types-ts4.5/findReplacePluginType.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/commands-with-analytics.d.ts +1 -1
- package/dist/types-ts4.5/types/index.d.ts +1 -0
- package/dist/{types/ui/FindReplaceToolbarButtonWithState.d.ts → types-ts4.5/ui/FindReplaceDropDownOrToolbarButtonWithState.d.ts} +1 -1
- package/dist/types-ts4.5/ui/FindReplaceDropdown.d.ts +15 -0
- package/package.json +7 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-find-replace
|
|
2
2
|
|
|
3
|
+
## 2.0.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#131023](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/131023)
|
|
8
|
+
[`05f7d6e19eb6d`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/05f7d6e19eb6d) -
|
|
9
|
+
Added activateFindReplace action to findReplacePlugin to activate Find and Replace popup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.0.5
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#130689](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/130689)
|
|
17
|
+
[`d8c4b9bdc0075`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d8c4b9bdc0075) -
|
|
18
|
+
Fixed mount point for find and replace popup
|
|
19
|
+
- Updated dependencies
|
|
20
|
+
|
|
3
21
|
## 2.0.4
|
|
4
22
|
|
|
5
23
|
### Patch Changes
|
|
@@ -6,16 +6,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.findReplacePlugin = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
|
+
var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
|
|
9
11
|
var _types = require("@atlaskit/editor-common/types");
|
|
10
12
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
13
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
14
|
+
var _commands = require("./pm-plugins/commands");
|
|
15
|
+
var _commandsWithAnalytics = require("./pm-plugins/commands-with-analytics");
|
|
11
16
|
var _keymap = _interopRequireDefault(require("./pm-plugins/keymap"));
|
|
12
17
|
var _main = require("./pm-plugins/main");
|
|
13
18
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
14
|
-
var
|
|
19
|
+
var _FindReplaceDropDownOrToolbarButtonWithState = _interopRequireDefault(require("./ui/FindReplaceDropDownOrToolbarButtonWithState"));
|
|
15
20
|
var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_ref) {
|
|
16
21
|
var _api$primaryToolbar;
|
|
17
22
|
var props = _ref.config,
|
|
18
23
|
api = _ref.api;
|
|
24
|
+
var editorViewRef = {
|
|
25
|
+
current: null
|
|
26
|
+
};
|
|
19
27
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
20
28
|
var popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
21
29
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
@@ -29,7 +37,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
|
|
|
29
37
|
if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
|
|
30
38
|
return null;
|
|
31
39
|
} else {
|
|
32
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
40
|
+
return /*#__PURE__*/_react.default.createElement(_FindReplaceDropDownOrToolbarButtonWithState.default, {
|
|
33
41
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
34
42
|
popupsMountPoint: popupsMountPoint,
|
|
35
43
|
popupsScrollableElement: popupsScrollableElement,
|
|
@@ -50,7 +58,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
|
|
|
50
58
|
return {
|
|
51
59
|
name: 'findReplace',
|
|
52
60
|
pmPlugins: function pmPlugins() {
|
|
53
|
-
|
|
61
|
+
var plugins = [{
|
|
54
62
|
name: 'findReplace',
|
|
55
63
|
plugin: function plugin(_ref3) {
|
|
56
64
|
var dispatch = _ref3.dispatch;
|
|
@@ -63,6 +71,26 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
|
|
|
63
71
|
return (0, _keymap.default)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
64
72
|
}
|
|
65
73
|
}];
|
|
74
|
+
if ((0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
75
|
+
exposure: false
|
|
76
|
+
})) {
|
|
77
|
+
plugins.push({
|
|
78
|
+
name: 'findReplaceEditorViewReferencePlugin',
|
|
79
|
+
plugin: function plugin() {
|
|
80
|
+
return new _safePlugin.SafePlugin({
|
|
81
|
+
view: function view(editorView) {
|
|
82
|
+
editorViewRef.current = editorView;
|
|
83
|
+
return {
|
|
84
|
+
destroy: function destroy() {
|
|
85
|
+
editorViewRef.current = null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
return plugins;
|
|
66
94
|
},
|
|
67
95
|
getSharedState: function getSharedState(editorState) {
|
|
68
96
|
if (!editorState) {
|
|
@@ -79,7 +107,7 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
|
|
|
79
107
|
containerElement = _ref4.containerElement,
|
|
80
108
|
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
|
|
81
109
|
isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
|
|
82
|
-
return /*#__PURE__*/_react.default.createElement(
|
|
110
|
+
return /*#__PURE__*/_react.default.createElement(_FindReplaceDropDownOrToolbarButtonWithState.default, {
|
|
83
111
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
84
112
|
popupsMountPoint: popupsMountPoint,
|
|
85
113
|
popupsScrollableElement: popupsScrollableElement,
|
|
@@ -89,8 +117,51 @@ var findReplacePlugin = exports.findReplacePlugin = function findReplacePlugin(_
|
|
|
89
117
|
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
90
118
|
api: api
|
|
91
119
|
});
|
|
120
|
+
},
|
|
121
|
+
activateFindReplace: function activateFindReplace(triggerMethod) {
|
|
122
|
+
var _api$analytics2;
|
|
123
|
+
if (!editorViewRef.current) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
var _editorViewRef$curren = editorViewRef.current,
|
|
127
|
+
state = _editorViewRef$curren.state,
|
|
128
|
+
dispatch = _editorViewRef$curren.dispatch;
|
|
129
|
+
if (api !== null && api !== void 0 && (_api$analytics2 = api.analytics) !== null && _api$analytics2 !== void 0 && _api$analytics2.actions) {
|
|
130
|
+
var _api$analytics3;
|
|
131
|
+
(0, _commandsWithAnalytics.activateWithAnalytics)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)({
|
|
132
|
+
triggerMethod: triggerMethod || _analytics.TRIGGER_METHOD.EXTERNAL
|
|
133
|
+
})(state, dispatch);
|
|
134
|
+
} else {
|
|
135
|
+
(0, _commands.activate)()(state, dispatch);
|
|
136
|
+
}
|
|
137
|
+
return true;
|
|
92
138
|
}
|
|
93
139
|
},
|
|
94
|
-
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
|
|
140
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
141
|
+
contentComponent: (0, _experiments.editorExperiment)('platform_editor_controls', 'variant1', {
|
|
142
|
+
exposure: true
|
|
143
|
+
}) ? function (_ref5) {
|
|
144
|
+
var editorView = _ref5.editorView,
|
|
145
|
+
containerElement = _ref5.containerElement,
|
|
146
|
+
popupsMountPoint = _ref5.popupsMountPoint,
|
|
147
|
+
popupsBoundariesElement = _ref5.popupsBoundariesElement,
|
|
148
|
+
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
149
|
+
wrapperElement = _ref5.wrapperElement,
|
|
150
|
+
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
151
|
+
var popupsMountPointEl = popupsMountPoint || ( // eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
152
|
+
wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector("[data-editor-container='true']"));
|
|
153
|
+
return /*#__PURE__*/_react.default.createElement(_FindReplaceDropDownOrToolbarButtonWithState.default, {
|
|
154
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
155
|
+
popupsMountPoint: popupsMountPointEl,
|
|
156
|
+
popupsScrollableElement: popupsScrollableElement || containerElement || undefined,
|
|
157
|
+
isToolbarReducedSpacing: false,
|
|
158
|
+
editorView: editorView,
|
|
159
|
+
containerElement: containerElement,
|
|
160
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
161
|
+
takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
|
|
162
|
+
api: api,
|
|
163
|
+
doesNotHaveButton: true
|
|
164
|
+
});
|
|
165
|
+
} : undefined
|
|
95
166
|
};
|
|
96
167
|
};
|
|
@@ -11,6 +11,7 @@ var _react = _interopRequireWildcard(require("react"));
|
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _commands = require("../pm-plugins/commands");
|
|
13
13
|
var _commandsWithAnalytics = require("../pm-plugins/commands-with-analytics");
|
|
14
|
+
var _FindReplaceDropdown = _interopRequireDefault(require("./FindReplaceDropdown"));
|
|
14
15
|
var _FindReplaceToolbarButton = _interopRequireDefault(require("./FindReplaceToolbarButton"));
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -50,7 +51,8 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
50
51
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
51
52
|
takeFullWidth = _ref2.takeFullWidth,
|
|
52
53
|
api = _ref2.api,
|
|
53
|
-
isButtonHidden = _ref2.isButtonHidden
|
|
54
|
+
isButtonHidden = _ref2.isButtonHidden,
|
|
55
|
+
doesNotHaveButton = _ref2.doesNotHaveButton;
|
|
54
56
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
55
57
|
var _useSharedPluginState = useSharedPluginStateNoDebounce(api),
|
|
56
58
|
findReplaceState = _useSharedPluginState.findReplaceState;
|
|
@@ -138,7 +140,8 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
138
140
|
if (!findReplaceState) {
|
|
139
141
|
return null;
|
|
140
142
|
}
|
|
141
|
-
|
|
143
|
+
var DropDownComponent = doesNotHaveButton ? _FindReplaceDropdown.default : _FindReplaceToolbarButton.default;
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement(DropDownComponent, {
|
|
142
145
|
shouldMatchCase: findReplaceState.shouldMatchCase,
|
|
143
146
|
onToggleMatchCase: handleToggleMatchCase,
|
|
144
147
|
isActive: findReplaceState.isActive,
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _react = _interopRequireDefault(require("react"));
|
|
10
|
+
var _reactIntlNext = require("react-intl-next");
|
|
11
|
+
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
|
+
var _uiMenu = require("@atlaskit/editor-common/ui-menu");
|
|
13
|
+
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
14
|
+
var _primitives = require("@atlaskit/primitives");
|
|
15
|
+
var _FindReplace = _interopRequireDefault(require("./FindReplace"));
|
|
16
|
+
var findReplaceWrapperStyles = (0, _primitives.xcss)({
|
|
17
|
+
display: 'flex',
|
|
18
|
+
flexDirection: 'column'
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
// Magic number taken from ../FindReplaceToolbarButton.tsx
|
|
22
|
+
var dropdownWidthNewDesign = 382;
|
|
23
|
+
var FindReplaceDropdown = function FindReplaceDropdown(props) {
|
|
24
|
+
var findText = props.findText,
|
|
25
|
+
replaceText = props.replaceText,
|
|
26
|
+
isActive = props.isActive,
|
|
27
|
+
index = props.index,
|
|
28
|
+
numMatches = props.numMatches,
|
|
29
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
30
|
+
onCancel = props.onCancel;
|
|
31
|
+
if (!popupsMountPoint) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return /*#__PURE__*/_react.default.createElement(_uiMenu.Dropdown, {
|
|
35
|
+
target: popupsMountPoint,
|
|
36
|
+
mountTo: popupsMountPoint,
|
|
37
|
+
forcePlacement: true,
|
|
38
|
+
alignX: 'right',
|
|
39
|
+
alignY: 'start',
|
|
40
|
+
offset: [4, 0],
|
|
41
|
+
isOpen: isActive,
|
|
42
|
+
handleEscapeKeydown: function handleEscapeKeydown() {
|
|
43
|
+
if (isActive) {
|
|
44
|
+
onCancel({
|
|
45
|
+
triggerMethod: _analytics.TRIGGER_METHOD.KEYBOARD
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
fitWidth: dropdownWidthNewDesign,
|
|
50
|
+
zIndex: _editorSharedStyles.akEditorFloatingPanelZIndex,
|
|
51
|
+
arrowKeyNavigationProviderOptions: {
|
|
52
|
+
type: _uiMenu.ArrowKeyNavigationType.MENU,
|
|
53
|
+
disableArrowKeyNavigation: true
|
|
54
|
+
}
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_primitives.Box, {
|
|
56
|
+
xcss: findReplaceWrapperStyles
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(_FindReplace.default, (0, _extends2.default)({
|
|
58
|
+
findText: findText,
|
|
59
|
+
replaceText: replaceText,
|
|
60
|
+
count: {
|
|
61
|
+
index: index,
|
|
62
|
+
total: numMatches
|
|
63
|
+
}
|
|
64
|
+
// Ignored via go/ees005
|
|
65
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
66
|
+
}, props))));
|
|
67
|
+
};
|
|
68
|
+
var _default = exports.default = (0, _reactIntlNext.injectIntl)(FindReplaceDropdown);
|
|
@@ -1,15 +1,23 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
4
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
3
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
|
+
import { activate } from './pm-plugins/commands';
|
|
8
|
+
import { activateWithAnalytics } from './pm-plugins/commands-with-analytics';
|
|
4
9
|
import keymapPlugin from './pm-plugins/keymap';
|
|
5
10
|
import { createPlugin } from './pm-plugins/main';
|
|
6
11
|
import { findReplacePluginKey } from './pm-plugins/plugin-key';
|
|
7
|
-
import
|
|
12
|
+
import FindReplaceDropDownOrToolbarButtonWithState from './ui/FindReplaceDropDownOrToolbarButtonWithState';
|
|
8
13
|
export const findReplacePlugin = ({
|
|
9
14
|
config: props,
|
|
10
15
|
api
|
|
11
16
|
}) => {
|
|
12
17
|
var _api$primaryToolbar;
|
|
18
|
+
const editorViewRef = {
|
|
19
|
+
current: null
|
|
20
|
+
};
|
|
13
21
|
const primaryToolbarComponent = ({
|
|
14
22
|
popupsBoundariesElement,
|
|
15
23
|
popupsMountPoint,
|
|
@@ -24,7 +32,7 @@ export const findReplacePlugin = ({
|
|
|
24
32
|
if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
|
|
25
33
|
return null;
|
|
26
34
|
} else {
|
|
27
|
-
return /*#__PURE__*/React.createElement(
|
|
35
|
+
return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
|
|
28
36
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
29
37
|
popupsMountPoint: popupsMountPoint,
|
|
30
38
|
popupsScrollableElement: popupsScrollableElement,
|
|
@@ -45,7 +53,7 @@ export const findReplacePlugin = ({
|
|
|
45
53
|
return {
|
|
46
54
|
name: 'findReplace',
|
|
47
55
|
pmPlugins() {
|
|
48
|
-
|
|
56
|
+
const plugins = [{
|
|
49
57
|
name: 'findReplace',
|
|
50
58
|
plugin: ({
|
|
51
59
|
dispatch
|
|
@@ -57,6 +65,26 @@ export const findReplacePlugin = ({
|
|
|
57
65
|
return keymapPlugin(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
58
66
|
}
|
|
59
67
|
}];
|
|
68
|
+
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
69
|
+
exposure: false
|
|
70
|
+
})) {
|
|
71
|
+
plugins.push({
|
|
72
|
+
name: 'findReplaceEditorViewReferencePlugin',
|
|
73
|
+
plugin: () => {
|
|
74
|
+
return new SafePlugin({
|
|
75
|
+
view: editorView => {
|
|
76
|
+
editorViewRef.current = editorView;
|
|
77
|
+
return {
|
|
78
|
+
destroy: () => {
|
|
79
|
+
editorViewRef.current = null;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
return plugins;
|
|
60
88
|
},
|
|
61
89
|
getSharedState(editorState) {
|
|
62
90
|
if (!editorState) {
|
|
@@ -74,7 +102,7 @@ export const findReplacePlugin = ({
|
|
|
74
102
|
dispatchAnalyticsEvent,
|
|
75
103
|
isToolbarReducedSpacing
|
|
76
104
|
}) => {
|
|
77
|
-
return /*#__PURE__*/React.createElement(
|
|
105
|
+
return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
|
|
78
106
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
79
107
|
popupsMountPoint: popupsMountPoint,
|
|
80
108
|
popupsScrollableElement: popupsScrollableElement,
|
|
@@ -84,8 +112,53 @@ export const findReplacePlugin = ({
|
|
|
84
112
|
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
85
113
|
api: api
|
|
86
114
|
});
|
|
115
|
+
},
|
|
116
|
+
activateFindReplace: triggerMethod => {
|
|
117
|
+
var _api$analytics2;
|
|
118
|
+
if (!editorViewRef.current) {
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
const {
|
|
122
|
+
state,
|
|
123
|
+
dispatch
|
|
124
|
+
} = editorViewRef.current;
|
|
125
|
+
if (api !== null && api !== void 0 && (_api$analytics2 = api.analytics) !== null && _api$analytics2 !== void 0 && _api$analytics2.actions) {
|
|
126
|
+
var _api$analytics3;
|
|
127
|
+
activateWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)({
|
|
128
|
+
triggerMethod: triggerMethod || TRIGGER_METHOD.EXTERNAL
|
|
129
|
+
})(state, dispatch);
|
|
130
|
+
} else {
|
|
131
|
+
activate()(state, dispatch);
|
|
132
|
+
}
|
|
133
|
+
return true;
|
|
87
134
|
}
|
|
88
135
|
},
|
|
89
|
-
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
|
|
136
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
137
|
+
contentComponent: editorExperiment('platform_editor_controls', 'variant1', {
|
|
138
|
+
exposure: true
|
|
139
|
+
}) ? ({
|
|
140
|
+
editorView,
|
|
141
|
+
containerElement,
|
|
142
|
+
popupsMountPoint,
|
|
143
|
+
popupsBoundariesElement,
|
|
144
|
+
popupsScrollableElement,
|
|
145
|
+
wrapperElement,
|
|
146
|
+
dispatchAnalyticsEvent
|
|
147
|
+
}) => {
|
|
148
|
+
const popupsMountPointEl = popupsMountPoint || ( // eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
149
|
+
wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector("[data-editor-container='true']"));
|
|
150
|
+
return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
|
|
151
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
152
|
+
popupsMountPoint: popupsMountPointEl,
|
|
153
|
+
popupsScrollableElement: popupsScrollableElement || containerElement || undefined,
|
|
154
|
+
isToolbarReducedSpacing: false,
|
|
155
|
+
editorView: editorView,
|
|
156
|
+
containerElement: containerElement,
|
|
157
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
158
|
+
takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
|
|
159
|
+
api: api,
|
|
160
|
+
doesNotHaveButton: true
|
|
161
|
+
});
|
|
162
|
+
} : undefined
|
|
90
163
|
};
|
|
91
164
|
};
|
|
@@ -2,6 +2,7 @@ import React, { useLayoutEffect, useState } from 'react';
|
|
|
2
2
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
3
|
import { blur, toggleMatchCase } from '../pm-plugins/commands';
|
|
4
4
|
import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
|
|
5
|
+
import FindReplaceDropdown from './FindReplaceDropdown';
|
|
5
6
|
import FindReplaceToolbarButton from './FindReplaceToolbarButton';
|
|
6
7
|
|
|
7
8
|
// light implementation of useSharedPluginState(). This is due to findreplace
|
|
@@ -37,7 +38,8 @@ const FindReplaceToolbarButtonWithState = ({
|
|
|
37
38
|
dispatchAnalyticsEvent,
|
|
38
39
|
takeFullWidth,
|
|
39
40
|
api,
|
|
40
|
-
isButtonHidden
|
|
41
|
+
isButtonHidden,
|
|
42
|
+
doesNotHaveButton
|
|
41
43
|
}) => {
|
|
42
44
|
var _api$analytics;
|
|
43
45
|
const editorAnalyticsAPI = api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
@@ -123,7 +125,8 @@ const FindReplaceToolbarButtonWithState = ({
|
|
|
123
125
|
if (!findReplaceState) {
|
|
124
126
|
return null;
|
|
125
127
|
}
|
|
126
|
-
|
|
128
|
+
const DropDownComponent = doesNotHaveButton ? FindReplaceDropdown : FindReplaceToolbarButton;
|
|
129
|
+
return /*#__PURE__*/React.createElement(DropDownComponent, {
|
|
127
130
|
shouldMatchCase: findReplaceState.shouldMatchCase,
|
|
128
131
|
onToggleMatchCase: handleToggleMatchCase,
|
|
129
132
|
isActive: findReplaceState.isActive,
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { ArrowKeyNavigationType, Dropdown } from '@atlaskit/editor-common/ui-menu';
|
|
6
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
|
+
import FindReplace from './FindReplace';
|
|
9
|
+
const findReplaceWrapperStyles = xcss({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Magic number taken from ../FindReplaceToolbarButton.tsx
|
|
15
|
+
const dropdownWidthNewDesign = 382;
|
|
16
|
+
const FindReplaceDropdown = props => {
|
|
17
|
+
const {
|
|
18
|
+
findText,
|
|
19
|
+
replaceText,
|
|
20
|
+
isActive,
|
|
21
|
+
index,
|
|
22
|
+
numMatches,
|
|
23
|
+
popupsMountPoint,
|
|
24
|
+
onCancel
|
|
25
|
+
} = props;
|
|
26
|
+
if (!popupsMountPoint) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
30
|
+
target: popupsMountPoint,
|
|
31
|
+
mountTo: popupsMountPoint,
|
|
32
|
+
forcePlacement: true,
|
|
33
|
+
alignX: 'right',
|
|
34
|
+
alignY: 'start',
|
|
35
|
+
offset: [4, 0],
|
|
36
|
+
isOpen: isActive,
|
|
37
|
+
handleEscapeKeydown: () => {
|
|
38
|
+
if (isActive) {
|
|
39
|
+
onCancel({
|
|
40
|
+
triggerMethod: TRIGGER_METHOD.KEYBOARD
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
fitWidth: dropdownWidthNewDesign,
|
|
45
|
+
zIndex: akEditorFloatingPanelZIndex,
|
|
46
|
+
arrowKeyNavigationProviderOptions: {
|
|
47
|
+
type: ArrowKeyNavigationType.MENU,
|
|
48
|
+
disableArrowKeyNavigation: true
|
|
49
|
+
}
|
|
50
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
51
|
+
xcss: findReplaceWrapperStyles
|
|
52
|
+
}, /*#__PURE__*/React.createElement(FindReplace, _extends({
|
|
53
|
+
findText: findText,
|
|
54
|
+
replaceText: replaceText,
|
|
55
|
+
count: {
|
|
56
|
+
index,
|
|
57
|
+
total: numMatches
|
|
58
|
+
}
|
|
59
|
+
// Ignored via go/ees005
|
|
60
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
61
|
+
}, props))));
|
|
62
|
+
};
|
|
63
|
+
export default injectIntl(FindReplaceDropdown);
|
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
4
|
import { ToolbarSize } from '@atlaskit/editor-common/types';
|
|
3
5
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
6
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
7
|
+
import { activate } from './pm-plugins/commands';
|
|
8
|
+
import { activateWithAnalytics } from './pm-plugins/commands-with-analytics';
|
|
4
9
|
import keymapPlugin from './pm-plugins/keymap';
|
|
5
10
|
import { createPlugin } from './pm-plugins/main';
|
|
6
11
|
import { findReplacePluginKey } from './pm-plugins/plugin-key';
|
|
7
|
-
import
|
|
12
|
+
import FindReplaceDropDownOrToolbarButtonWithState from './ui/FindReplaceDropDownOrToolbarButtonWithState';
|
|
8
13
|
export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
9
14
|
var _api$primaryToolbar;
|
|
10
15
|
var props = _ref.config,
|
|
11
16
|
api = _ref.api;
|
|
17
|
+
var editorViewRef = {
|
|
18
|
+
current: null
|
|
19
|
+
};
|
|
12
20
|
var primaryToolbarComponent = function primaryToolbarComponent(_ref2) {
|
|
13
21
|
var popupsBoundariesElement = _ref2.popupsBoundariesElement,
|
|
14
22
|
popupsMountPoint = _ref2.popupsMountPoint,
|
|
@@ -22,7 +30,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
|
22
30
|
if (props !== null && props !== void 0 && props.twoLineEditorToolbar) {
|
|
23
31
|
return null;
|
|
24
32
|
} else {
|
|
25
|
-
return /*#__PURE__*/React.createElement(
|
|
33
|
+
return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
|
|
26
34
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
27
35
|
popupsMountPoint: popupsMountPoint,
|
|
28
36
|
popupsScrollableElement: popupsScrollableElement,
|
|
@@ -43,7 +51,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
|
43
51
|
return {
|
|
44
52
|
name: 'findReplace',
|
|
45
53
|
pmPlugins: function pmPlugins() {
|
|
46
|
-
|
|
54
|
+
var plugins = [{
|
|
47
55
|
name: 'findReplace',
|
|
48
56
|
plugin: function plugin(_ref3) {
|
|
49
57
|
var dispatch = _ref3.dispatch;
|
|
@@ -56,6 +64,26 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
|
56
64
|
return keymapPlugin(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions);
|
|
57
65
|
}
|
|
58
66
|
}];
|
|
67
|
+
if (editorExperiment('platform_editor_controls', 'variant1', {
|
|
68
|
+
exposure: false
|
|
69
|
+
})) {
|
|
70
|
+
plugins.push({
|
|
71
|
+
name: 'findReplaceEditorViewReferencePlugin',
|
|
72
|
+
plugin: function plugin() {
|
|
73
|
+
return new SafePlugin({
|
|
74
|
+
view: function view(editorView) {
|
|
75
|
+
editorViewRef.current = editorView;
|
|
76
|
+
return {
|
|
77
|
+
destroy: function destroy() {
|
|
78
|
+
editorViewRef.current = null;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
return plugins;
|
|
59
87
|
},
|
|
60
88
|
getSharedState: function getSharedState(editorState) {
|
|
61
89
|
if (!editorState) {
|
|
@@ -72,7 +100,7 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
|
72
100
|
containerElement = _ref4.containerElement,
|
|
73
101
|
dispatchAnalyticsEvent = _ref4.dispatchAnalyticsEvent,
|
|
74
102
|
isToolbarReducedSpacing = _ref4.isToolbarReducedSpacing;
|
|
75
|
-
return /*#__PURE__*/React.createElement(
|
|
103
|
+
return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
|
|
76
104
|
popupsBoundariesElement: popupsBoundariesElement,
|
|
77
105
|
popupsMountPoint: popupsMountPoint,
|
|
78
106
|
popupsScrollableElement: popupsScrollableElement,
|
|
@@ -82,8 +110,51 @@ export var findReplacePlugin = function findReplacePlugin(_ref) {
|
|
|
82
110
|
isToolbarReducedSpacing: isToolbarReducedSpacing,
|
|
83
111
|
api: api
|
|
84
112
|
});
|
|
113
|
+
},
|
|
114
|
+
activateFindReplace: function activateFindReplace(triggerMethod) {
|
|
115
|
+
var _api$analytics2;
|
|
116
|
+
if (!editorViewRef.current) {
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
var _editorViewRef$curren = editorViewRef.current,
|
|
120
|
+
state = _editorViewRef$curren.state,
|
|
121
|
+
dispatch = _editorViewRef$curren.dispatch;
|
|
122
|
+
if (api !== null && api !== void 0 && (_api$analytics2 = api.analytics) !== null && _api$analytics2 !== void 0 && _api$analytics2.actions) {
|
|
123
|
+
var _api$analytics3;
|
|
124
|
+
activateWithAnalytics(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions)({
|
|
125
|
+
triggerMethod: triggerMethod || TRIGGER_METHOD.EXTERNAL
|
|
126
|
+
})(state, dispatch);
|
|
127
|
+
} else {
|
|
128
|
+
activate()(state, dispatch);
|
|
129
|
+
}
|
|
130
|
+
return true;
|
|
85
131
|
}
|
|
86
132
|
},
|
|
87
|
-
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined
|
|
133
|
+
primaryToolbarComponent: !(api !== null && api !== void 0 && api.primaryToolbar) ? primaryToolbarComponent : undefined,
|
|
134
|
+
contentComponent: editorExperiment('platform_editor_controls', 'variant1', {
|
|
135
|
+
exposure: true
|
|
136
|
+
}) ? function (_ref5) {
|
|
137
|
+
var editorView = _ref5.editorView,
|
|
138
|
+
containerElement = _ref5.containerElement,
|
|
139
|
+
popupsMountPoint = _ref5.popupsMountPoint,
|
|
140
|
+
popupsBoundariesElement = _ref5.popupsBoundariesElement,
|
|
141
|
+
popupsScrollableElement = _ref5.popupsScrollableElement,
|
|
142
|
+
wrapperElement = _ref5.wrapperElement,
|
|
143
|
+
dispatchAnalyticsEvent = _ref5.dispatchAnalyticsEvent;
|
|
144
|
+
var popupsMountPointEl = popupsMountPoint || ( // eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
145
|
+
wrapperElement === null || wrapperElement === void 0 ? void 0 : wrapperElement.querySelector("[data-editor-container='true']"));
|
|
146
|
+
return /*#__PURE__*/React.createElement(FindReplaceDropDownOrToolbarButtonWithState, {
|
|
147
|
+
popupsBoundariesElement: popupsBoundariesElement,
|
|
148
|
+
popupsMountPoint: popupsMountPointEl,
|
|
149
|
+
popupsScrollableElement: popupsScrollableElement || containerElement || undefined,
|
|
150
|
+
isToolbarReducedSpacing: false,
|
|
151
|
+
editorView: editorView,
|
|
152
|
+
containerElement: containerElement,
|
|
153
|
+
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
154
|
+
takeFullWidth: props === null || props === void 0 ? void 0 : props.takeFullWidth,
|
|
155
|
+
api: api,
|
|
156
|
+
doesNotHaveButton: true
|
|
157
|
+
});
|
|
158
|
+
} : undefined
|
|
88
159
|
};
|
|
89
160
|
};
|
|
@@ -3,6 +3,7 @@ import React, { useLayoutEffect, useState } from 'react';
|
|
|
3
3
|
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { blur, toggleMatchCase } from '../pm-plugins/commands';
|
|
5
5
|
import { activateWithAnalytics, cancelSearchWithAnalytics, findNextWithAnalytics, findPrevWithAnalytics, findWithAnalytics, replaceAllWithAnalytics, replaceWithAnalytics } from '../pm-plugins/commands-with-analytics';
|
|
6
|
+
import FindReplaceDropdown from './FindReplaceDropdown';
|
|
6
7
|
import FindReplaceToolbarButton from './FindReplaceToolbarButton';
|
|
7
8
|
|
|
8
9
|
// light implementation of useSharedPluginState(). This is due to findreplace
|
|
@@ -41,7 +42,8 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
41
42
|
dispatchAnalyticsEvent = _ref2.dispatchAnalyticsEvent,
|
|
42
43
|
takeFullWidth = _ref2.takeFullWidth,
|
|
43
44
|
api = _ref2.api,
|
|
44
|
-
isButtonHidden = _ref2.isButtonHidden
|
|
45
|
+
isButtonHidden = _ref2.isButtonHidden,
|
|
46
|
+
doesNotHaveButton = _ref2.doesNotHaveButton;
|
|
45
47
|
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
46
48
|
var _useSharedPluginState = useSharedPluginStateNoDebounce(api),
|
|
47
49
|
findReplaceState = _useSharedPluginState.findReplaceState;
|
|
@@ -129,7 +131,8 @@ var FindReplaceToolbarButtonWithState = function FindReplaceToolbarButtonWithSta
|
|
|
129
131
|
if (!findReplaceState) {
|
|
130
132
|
return null;
|
|
131
133
|
}
|
|
132
|
-
|
|
134
|
+
var DropDownComponent = doesNotHaveButton ? FindReplaceDropdown : FindReplaceToolbarButton;
|
|
135
|
+
return /*#__PURE__*/React.createElement(DropDownComponent, {
|
|
133
136
|
shouldMatchCase: findReplaceState.shouldMatchCase,
|
|
134
137
|
onToggleMatchCase: handleToggleMatchCase,
|
|
135
138
|
isActive: findReplaceState.isActive,
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { injectIntl } from 'react-intl-next';
|
|
4
|
+
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
|
+
import { ArrowKeyNavigationType, Dropdown } from '@atlaskit/editor-common/ui-menu';
|
|
6
|
+
import { akEditorFloatingPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
|
+
import { Box, xcss } from '@atlaskit/primitives';
|
|
8
|
+
import FindReplace from './FindReplace';
|
|
9
|
+
var findReplaceWrapperStyles = xcss({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column'
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
// Magic number taken from ../FindReplaceToolbarButton.tsx
|
|
15
|
+
var dropdownWidthNewDesign = 382;
|
|
16
|
+
var FindReplaceDropdown = function FindReplaceDropdown(props) {
|
|
17
|
+
var findText = props.findText,
|
|
18
|
+
replaceText = props.replaceText,
|
|
19
|
+
isActive = props.isActive,
|
|
20
|
+
index = props.index,
|
|
21
|
+
numMatches = props.numMatches,
|
|
22
|
+
popupsMountPoint = props.popupsMountPoint,
|
|
23
|
+
onCancel = props.onCancel;
|
|
24
|
+
if (!popupsMountPoint) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return /*#__PURE__*/React.createElement(Dropdown, {
|
|
28
|
+
target: popupsMountPoint,
|
|
29
|
+
mountTo: popupsMountPoint,
|
|
30
|
+
forcePlacement: true,
|
|
31
|
+
alignX: 'right',
|
|
32
|
+
alignY: 'start',
|
|
33
|
+
offset: [4, 0],
|
|
34
|
+
isOpen: isActive,
|
|
35
|
+
handleEscapeKeydown: function handleEscapeKeydown() {
|
|
36
|
+
if (isActive) {
|
|
37
|
+
onCancel({
|
|
38
|
+
triggerMethod: TRIGGER_METHOD.KEYBOARD
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
fitWidth: dropdownWidthNewDesign,
|
|
43
|
+
zIndex: akEditorFloatingPanelZIndex,
|
|
44
|
+
arrowKeyNavigationProviderOptions: {
|
|
45
|
+
type: ArrowKeyNavigationType.MENU,
|
|
46
|
+
disableArrowKeyNavigation: true
|
|
47
|
+
}
|
|
48
|
+
}, /*#__PURE__*/React.createElement(Box, {
|
|
49
|
+
xcss: findReplaceWrapperStyles
|
|
50
|
+
}, /*#__PURE__*/React.createElement(FindReplace, _extends({
|
|
51
|
+
findText: findText,
|
|
52
|
+
replaceText: replaceText,
|
|
53
|
+
count: {
|
|
54
|
+
index: index,
|
|
55
|
+
total: numMatches
|
|
56
|
+
}
|
|
57
|
+
// Ignored via go/ees005
|
|
58
|
+
// eslint-disable-next-line react/jsx-props-no-spreading
|
|
59
|
+
}, props))));
|
|
60
|
+
};
|
|
61
|
+
export default injectIntl(FindReplaceDropdown);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
5
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
@@ -17,6 +18,7 @@ export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
|
|
|
17
18
|
dependencies: FindReplacePluginDependencies;
|
|
18
19
|
actions: {
|
|
19
20
|
getToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
|
|
21
|
+
activateFindReplace: (triggerMethod?: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL) => boolean;
|
|
20
22
|
};
|
|
21
23
|
}>;
|
|
22
24
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { EditorAnalyticsAPI, TRIGGER_METHOD } from '@atlaskit/editor-common
|
|
|
2
2
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
export declare const activateWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ triggerMethod, }: {
|
|
5
|
-
triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR;
|
|
5
|
+
triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL;
|
|
6
6
|
}) => Command;
|
|
7
7
|
export declare const findWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ editorView, containerElement, keyword, }: {
|
|
8
8
|
editorView: EditorView;
|
|
@@ -34,6 +34,7 @@ export type FindReplaceToolbarButtonWithStateProps = {
|
|
|
34
34
|
takeFullWidth?: boolean;
|
|
35
35
|
api: ExtractInjectionAPI<FindReplacePlugin> | undefined;
|
|
36
36
|
isButtonHidden?: boolean;
|
|
37
|
+
doesNotHaveButton?: boolean;
|
|
37
38
|
};
|
|
38
39
|
export type FindReplaceToolbarButtonActionProps = Omit<FindReplaceToolbarButtonWithStateProps, 'api'>;
|
|
39
40
|
export type Match = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FindReplaceToolbarButtonWithStateProps } from '../types';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, isToolbarReducedSpacing, editorView, containerElement, dispatchAnalyticsEvent, takeFullWidth, api, isButtonHidden, }: FindReplaceToolbarButtonWithStateProps) => React.JSX.Element | null>;
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, isToolbarReducedSpacing, editorView, containerElement, dispatchAnalyticsEvent, takeFullWidth, api, isButtonHidden, doesNotHaveButton, }: FindReplaceToolbarButtonWithStateProps) => React.JSX.Element | null>;
|
|
4
4
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { FindReplaceProps } from './FindReplace';
|
|
5
|
+
export interface FindReplaceDropdownProps extends Omit<FindReplaceProps, 'count'> {
|
|
6
|
+
index: number;
|
|
7
|
+
numMatches: number;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
popupsMountPoint?: HTMLElement;
|
|
10
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<FindReplaceDropdownProps & WrappedComponentProps>> & {
|
|
13
|
+
WrappedComponent: React.ComponentType<FindReplaceDropdownProps & WrappedComponentProps>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { TRIGGER_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
5
|
import type { PrimaryToolbarPlugin } from '@atlaskit/editor-plugin-primary-toolbar';
|
|
@@ -17,6 +18,7 @@ export type FindReplacePlugin = NextEditorPlugin<'findReplace', {
|
|
|
17
18
|
dependencies: FindReplacePluginDependencies;
|
|
18
19
|
actions: {
|
|
19
20
|
getToolbarButton: (params: FindReplaceToolbarButtonActionProps) => React.ReactNode;
|
|
21
|
+
activateFindReplace: (triggerMethod?: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL) => boolean;
|
|
20
22
|
};
|
|
21
23
|
}>;
|
|
22
24
|
export {};
|
|
@@ -2,7 +2,7 @@ import type { EditorAnalyticsAPI, TRIGGER_METHOD } from '@atlaskit/editor-common
|
|
|
2
2
|
import type { Command } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
4
|
export declare const activateWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ triggerMethod, }: {
|
|
5
|
-
triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR;
|
|
5
|
+
triggerMethod: TRIGGER_METHOD.SHORTCUT | TRIGGER_METHOD.TOOLBAR | TRIGGER_METHOD.EXTERNAL;
|
|
6
6
|
}) => Command;
|
|
7
7
|
export declare const findWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ editorView, containerElement, keyword, }: {
|
|
8
8
|
editorView: EditorView;
|
|
@@ -34,6 +34,7 @@ export type FindReplaceToolbarButtonWithStateProps = {
|
|
|
34
34
|
takeFullWidth?: boolean;
|
|
35
35
|
api: ExtractInjectionAPI<FindReplacePlugin> | undefined;
|
|
36
36
|
isButtonHidden?: boolean;
|
|
37
|
+
doesNotHaveButton?: boolean;
|
|
37
38
|
};
|
|
38
39
|
export type FindReplaceToolbarButtonActionProps = Omit<FindReplaceToolbarButtonWithStateProps, 'api'>;
|
|
39
40
|
export type Match = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FindReplaceToolbarButtonWithStateProps } from '../types';
|
|
3
|
-
declare const _default: React.MemoExoticComponent<({ popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, isToolbarReducedSpacing, editorView, containerElement, dispatchAnalyticsEvent, takeFullWidth, api, isButtonHidden, }: FindReplaceToolbarButtonWithStateProps) => React.JSX.Element | null>;
|
|
3
|
+
declare const _default: React.MemoExoticComponent<({ popupsBoundariesElement, popupsMountPoint, popupsScrollableElement, isToolbarReducedSpacing, editorView, containerElement, dispatchAnalyticsEvent, takeFullWidth, api, isButtonHidden, doesNotHaveButton, }: FindReplaceToolbarButtonWithStateProps) => React.JSX.Element | null>;
|
|
4
4
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type WrappedComponentProps } from 'react-intl-next';
|
|
3
|
+
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
4
|
+
import type { FindReplaceProps } from './FindReplace';
|
|
5
|
+
export interface FindReplaceDropdownProps extends Omit<FindReplaceProps, 'count'> {
|
|
6
|
+
index: number;
|
|
7
|
+
numMatches: number;
|
|
8
|
+
isActive: boolean;
|
|
9
|
+
popupsMountPoint?: HTMLElement;
|
|
10
|
+
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
|
+
}
|
|
12
|
+
declare const _default: React.FC<import("react-intl-next").WithIntlProps<FindReplaceDropdownProps & WrappedComponentProps>> & {
|
|
13
|
+
WrappedComponent: React.ComponentType<FindReplaceDropdownProps & WrappedComponentProps>;
|
|
14
|
+
};
|
|
15
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-find-replace",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.6",
|
|
4
4
|
"description": "find replace plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,18 +33,19 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/button": "^21.1.0",
|
|
36
|
-
"@atlaskit/editor-common": "^102.
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
38
|
-
"@atlaskit/editor-plugin-primary-toolbar": "^3.
|
|
36
|
+
"@atlaskit/editor-common": "^102.13.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.2.0",
|
|
38
|
+
"@atlaskit/editor-plugin-primary-toolbar": "^3.1.0",
|
|
39
39
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
40
40
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
41
41
|
"@atlaskit/form": "^12.0.0",
|
|
42
42
|
"@atlaskit/icon": "^25.0.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
-
"@atlaskit/primitives": "^14.
|
|
44
|
+
"@atlaskit/primitives": "^14.2.0",
|
|
45
45
|
"@atlaskit/textfield": "^8.0.0",
|
|
46
46
|
"@atlaskit/theme": "^18.0.0",
|
|
47
|
-
"@atlaskit/
|
|
47
|
+
"@atlaskit/tmp-editor-statsig": "^4.3.0",
|
|
48
|
+
"@atlaskit/tokens": "^4.5.0",
|
|
48
49
|
"@atlaskit/tooltip": "^20.0.0",
|
|
49
50
|
"@babel/runtime": "^7.0.0",
|
|
50
51
|
"@emotion/react": "^11.7.1",
|