@atlaskit/editor-core 191.0.7 → 191.0.9

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.
Files changed (127) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/afm-cc/tsconfig.json +3 -3
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/presets/universal.js +2 -1
  5. package/dist/cjs/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  6. package/dist/cjs/ui/ContentStyles/index.js +1 -1
  7. package/dist/cjs/version-wrapper.js +1 -1
  8. package/dist/es2019/plugins/index.js +0 -1
  9. package/dist/es2019/presets/universal.js +2 -1
  10. package/dist/es2019/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  11. package/dist/es2019/ui/ContentStyles/index.js +1 -1
  12. package/dist/es2019/version-wrapper.js +1 -1
  13. package/dist/esm/plugins/index.js +0 -1
  14. package/dist/esm/presets/universal.js +2 -1
  15. package/dist/esm/ui/Appearance/FullPage/FullPageToolbar.js +1 -1
  16. package/dist/esm/ui/ContentStyles/index.js +1 -1
  17. package/dist/esm/version-wrapper.js +1 -1
  18. package/dist/types/plugins/index.d.ts +0 -1
  19. package/dist/types/types/editor-props.d.ts +1 -1
  20. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  21. package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
  22. package/package.json +9 -9
  23. package/dist/cjs/plugins/find-replace/FindReplaceToolbarButtonWithState.js +0 -166
  24. package/dist/cjs/plugins/find-replace/actions.js +0 -19
  25. package/dist/cjs/plugins/find-replace/commands-with-analytics.js +0 -101
  26. package/dist/cjs/plugins/find-replace/commands.js +0 -255
  27. package/dist/cjs/plugins/find-replace/index.js +0 -94
  28. package/dist/cjs/plugins/find-replace/keymap.js +0 -24
  29. package/dist/cjs/plugins/find-replace/plugin-key.js +0 -8
  30. package/dist/cjs/plugins/find-replace/plugin.js +0 -138
  31. package/dist/cjs/plugins/find-replace/reducer.js +0 -61
  32. package/dist/cjs/plugins/find-replace/styles.js +0 -16
  33. package/dist/cjs/plugins/find-replace/types.js +0 -5
  34. package/dist/cjs/plugins/find-replace/ui/Find.js +0 -308
  35. package/dist/cjs/plugins/find-replace/ui/FindReplace.js +0 -103
  36. package/dist/cjs/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -132
  37. package/dist/cjs/plugins/find-replace/ui/FindReplaceTooltipButton.js +0 -76
  38. package/dist/cjs/plugins/find-replace/ui/Replace.js +0 -174
  39. package/dist/cjs/plugins/find-replace/ui/styles.js +0 -44
  40. package/dist/cjs/plugins/find-replace/utils/batch-decorations.js +0 -310
  41. package/dist/cjs/plugins/find-replace/utils/commands.js +0 -16
  42. package/dist/cjs/plugins/find-replace/utils/index.js +0 -290
  43. package/dist/cjs/utils/array.js +0 -13
  44. package/dist/es2019/plugins/find-replace/FindReplaceToolbarButtonWithState.js +0 -153
  45. package/dist/es2019/plugins/find-replace/actions.js +0 -13
  46. package/dist/es2019/plugins/find-replace/commands-with-analytics.js +0 -72
  47. package/dist/es2019/plugins/find-replace/commands.js +0 -240
  48. package/dist/es2019/plugins/find-replace/index.js +0 -89
  49. package/dist/es2019/plugins/find-replace/keymap.js +0 -16
  50. package/dist/es2019/plugins/find-replace/plugin-key.js +0 -2
  51. package/dist/es2019/plugins/find-replace/plugin.js +0 -117
  52. package/dist/es2019/plugins/find-replace/reducer.js +0 -56
  53. package/dist/es2019/plugins/find-replace/styles.js +0 -17
  54. package/dist/es2019/plugins/find-replace/types.js +0 -1
  55. package/dist/es2019/plugins/find-replace/ui/Find.js +0 -284
  56. package/dist/es2019/plugins/find-replace/ui/FindReplace.js +0 -78
  57. package/dist/es2019/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -122
  58. package/dist/es2019/plugins/find-replace/ui/FindReplaceTooltipButton.js +0 -50
  59. package/dist/es2019/plugins/find-replace/ui/Replace.js +0 -152
  60. package/dist/es2019/plugins/find-replace/ui/styles.js +0 -48
  61. package/dist/es2019/plugins/find-replace/utils/batch-decorations.js +0 -189
  62. package/dist/es2019/plugins/find-replace/utils/commands.js +0 -6
  63. package/dist/es2019/plugins/find-replace/utils/index.js +0 -249
  64. package/dist/es2019/utils/array.js +0 -3
  65. package/dist/esm/plugins/find-replace/FindReplaceToolbarButtonWithState.js +0 -157
  66. package/dist/esm/plugins/find-replace/actions.js +0 -13
  67. package/dist/esm/plugins/find-replace/commands-with-analytics.js +0 -95
  68. package/dist/esm/plugins/find-replace/commands.js +0 -248
  69. package/dist/esm/plugins/find-replace/index.js +0 -87
  70. package/dist/esm/plugins/find-replace/keymap.js +0 -18
  71. package/dist/esm/plugins/find-replace/plugin-key.js +0 -2
  72. package/dist/esm/plugins/find-replace/plugin.js +0 -133
  73. package/dist/esm/plugins/find-replace/reducer.js +0 -54
  74. package/dist/esm/plugins/find-replace/styles.js +0 -10
  75. package/dist/esm/plugins/find-replace/types.js +0 -1
  76. package/dist/esm/plugins/find-replace/ui/Find.js +0 -302
  77. package/dist/esm/plugins/find-replace/ui/FindReplace.js +0 -97
  78. package/dist/esm/plugins/find-replace/ui/FindReplaceToolbarButton.js +0 -126
  79. package/dist/esm/plugins/find-replace/ui/FindReplaceTooltipButton.js +0 -69
  80. package/dist/esm/plugins/find-replace/ui/Replace.js +0 -168
  81. package/dist/esm/plugins/find-replace/ui/styles.js +0 -37
  82. package/dist/esm/plugins/find-replace/utils/batch-decorations.js +0 -304
  83. package/dist/esm/plugins/find-replace/utils/commands.js +0 -10
  84. package/dist/esm/plugins/find-replace/utils/index.js +0 -280
  85. package/dist/esm/utils/array.js +0 -7
  86. package/dist/types/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +0 -4
  87. package/dist/types/plugins/find-replace/actions.d.ts +0 -64
  88. package/dist/types/plugins/find-replace/commands-with-analytics.d.ts +0 -27
  89. package/dist/types/plugins/find-replace/commands.d.ts +0 -12
  90. package/dist/types/plugins/find-replace/index.d.ts +0 -3
  91. package/dist/types/plugins/find-replace/keymap.d.ts +0 -4
  92. package/dist/types/plugins/find-replace/plugin-key.d.ts +0 -3
  93. package/dist/types/plugins/find-replace/plugin.d.ts +0 -6
  94. package/dist/types/plugins/find-replace/reducer.d.ts +0 -4
  95. package/dist/types/plugins/find-replace/styles.d.ts +0 -3
  96. package/dist/types/plugins/find-replace/types.d.ts +0 -79
  97. package/dist/types/plugins/find-replace/ui/Find.d.ts +0 -71
  98. package/dist/types/plugins/find-replace/ui/FindReplace.d.ts +0 -43
  99. package/dist/types/plugins/find-replace/ui/FindReplaceToolbarButton.d.ts +0 -21
  100. package/dist/types/plugins/find-replace/ui/FindReplaceTooltipButton.d.ts +0 -18
  101. package/dist/types/plugins/find-replace/ui/Replace.d.ts +0 -27
  102. package/dist/types/plugins/find-replace/ui/styles.d.ts +0 -6
  103. package/dist/types/plugins/find-replace/utils/batch-decorations.d.ts +0 -36
  104. package/dist/types/plugins/find-replace/utils/commands.d.ts +0 -2
  105. package/dist/types/plugins/find-replace/utils/index.d.ts +0 -49
  106. package/dist/types/utils/array.d.ts +0 -1
  107. package/dist/types-ts4.5/plugins/find-replace/FindReplaceToolbarButtonWithState.d.ts +0 -4
  108. package/dist/types-ts4.5/plugins/find-replace/actions.d.ts +0 -64
  109. package/dist/types-ts4.5/plugins/find-replace/commands-with-analytics.d.ts +0 -27
  110. package/dist/types-ts4.5/plugins/find-replace/commands.d.ts +0 -12
  111. package/dist/types-ts4.5/plugins/find-replace/index.d.ts +0 -3
  112. package/dist/types-ts4.5/plugins/find-replace/keymap.d.ts +0 -4
  113. package/dist/types-ts4.5/plugins/find-replace/plugin-key.d.ts +0 -3
  114. package/dist/types-ts4.5/plugins/find-replace/plugin.d.ts +0 -6
  115. package/dist/types-ts4.5/plugins/find-replace/reducer.d.ts +0 -4
  116. package/dist/types-ts4.5/plugins/find-replace/styles.d.ts +0 -3
  117. package/dist/types-ts4.5/plugins/find-replace/types.d.ts +0 -79
  118. package/dist/types-ts4.5/plugins/find-replace/ui/Find.d.ts +0 -71
  119. package/dist/types-ts4.5/plugins/find-replace/ui/FindReplace.d.ts +0 -43
  120. package/dist/types-ts4.5/plugins/find-replace/ui/FindReplaceToolbarButton.d.ts +0 -21
  121. package/dist/types-ts4.5/plugins/find-replace/ui/FindReplaceTooltipButton.d.ts +0 -18
  122. package/dist/types-ts4.5/plugins/find-replace/ui/Replace.d.ts +0 -27
  123. package/dist/types-ts4.5/plugins/find-replace/ui/styles.d.ts +0 -6
  124. package/dist/types-ts4.5/plugins/find-replace/utils/batch-decorations.d.ts +0 -36
  125. package/dist/types-ts4.5/plugins/find-replace/utils/commands.d.ts +0 -2
  126. package/dist/types-ts4.5/plugins/find-replace/utils/index.d.ts +0 -49
  127. package/dist/types-ts4.5/utils/array.d.ts +0 -1
@@ -1,308 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.FIND_DEBOUNCE_MS = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _react = _interopRequireDefault(require("react"));
16
- var _react2 = require("@emotion/react");
17
- var _reactIntlNext = require("react-intl-next");
18
- var _debounce = _interopRequireDefault(require("lodash/debounce"));
19
- var _close = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/close"));
20
- var _chevronDown = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-down"));
21
- var _chevronUp = _interopRequireDefault(require("@atlaskit/icon/glyph/hipchat/chevron-up"));
22
- var _keyboard = _interopRequireDefault(require("@atlaskit/icon/glyph/emoji/keyboard"));
23
- var _textfield = _interopRequireDefault(require("@atlaskit/textfield"));
24
- var _styles = require("./styles");
25
- var _analytics = require("@atlaskit/editor-common/analytics");
26
- var _FindReplaceTooltipButton = require("./FindReplaceTooltipButton");
27
- var _rafSchd = _interopRequireDefault(require("raf-schd"));
28
- var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
29
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
31
- var FIND_DEBOUNCE_MS = exports.FIND_DEBOUNCE_MS = 100;
32
- var messages = (0, _reactIntlNext.defineMessages)({
33
- find: {
34
- id: 'fabric.editor.find',
35
- defaultMessage: 'Find',
36
- description: 'The word or phrase to search for on the document'
37
- },
38
- matchCase: {
39
- id: 'fabric.editor.matchCase',
40
- defaultMessage: 'Match case',
41
- description: 'Toggle whether should also match case when searching for text'
42
- },
43
- findNext: {
44
- id: 'fabric.editor.findNext',
45
- defaultMessage: 'Find next',
46
- description: 'Locate the next occurrence of the word or phrase that was searched for'
47
- },
48
- findPrevious: {
49
- id: 'fabric.editor.findPrevious',
50
- defaultMessage: 'Find previous',
51
- description: 'Locate the previous occurrence of the word or phrase that was searched for'
52
- },
53
- closeFindReplaceDialog: {
54
- id: 'fabric.editor.closeFindReplaceDialog',
55
- defaultMessage: 'Close',
56
- description: 'Cancel search and close the "Find and Replace" dialog'
57
- },
58
- noResultsFound: {
59
- id: 'fabric.editor.noResultsFound',
60
- defaultMessage: 'No results',
61
- description: 'No matches were found for the word or phrase that was searched for'
62
- },
63
- resultsCount: {
64
- id: 'fabric.editor.resultsCount',
65
- description: 'Text for selected search match position and total results count',
66
- defaultMessage: '{selectedMatchPosition} of {totalResultsCount}'
67
- }
68
- });
69
- var Find = /*#__PURE__*/function (_React$Component) {
70
- (0, _inherits2.default)(Find, _React$Component);
71
- var _super = _createSuper(Find);
72
- function Find(props) {
73
- var _this;
74
- (0, _classCallCheck2.default)(this, Find);
75
- _this = _super.call(this, props);
76
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "findTextfieldRef", /*#__PURE__*/_react.default.createRef());
77
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "isComposing", false);
78
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "syncFindText", function (onSynced) {
79
- var _this$state;
80
- // If the external prop findText changes and we aren't in a composition we should update to
81
- // use the external prop value.
82
- //
83
- // An example of where this may happen is when a find occurs through the user selecting some text
84
- // and pressing Mod-f.
85
- if (!_this.isComposing && _this.props.findText !== ((_this$state = _this.state) === null || _this$state === void 0 ? void 0 : _this$state.localFindText)) {
86
- _this.updateFindValue(_this.props.findText || '', onSynced);
87
- }
88
- });
89
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "focusFindTextfield", function () {
90
- var input = _this.findTextfieldRef.current;
91
- if (_this.props.shouldFocus && input) {
92
- input.select();
93
- }
94
- });
95
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindChange", function (event) {
96
- _this.updateFindValue(event.target.value);
97
- });
98
- // debounce (vs throttle) to not block typing inside find input while onFind runs
99
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "debouncedFind", (0, _debounce.default)(function (value) {
100
- _this.props.onFind(value);
101
- }, FIND_DEBOUNCE_MS));
102
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "updateFindValue", function (value, onSynced) {
103
- _this.setState({
104
- localFindText: value
105
- }, function () {
106
- if (_this.isComposing) {
107
- return;
108
- }
109
- onSynced && onSynced();
110
- _this.debouncedFind(value);
111
- });
112
- });
113
- // throtlle between animation frames gives better experience on Enter compared to arbitrary value
114
- // it adjusts based on performance (and document size)
115
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindKeyDownThrottled", (0, _rafSchd.default)(function (event) {
116
- if (event.key === 'Enter') {
117
- if (event.shiftKey) {
118
- _this.props.onFindPrev({
119
- triggerMethod: _analytics.TRIGGER_METHOD.KEYBOARD
120
- });
121
- } else {
122
- _this.props.onFindNext({
123
- triggerMethod: _analytics.TRIGGER_METHOD.KEYBOARD
124
- });
125
- }
126
- } else if (event.key === 'ArrowDown') {
127
- // we want to move focus between find & replace texfields when user hits up/down arrows
128
- _this.props.onArrowDown();
129
- }
130
- }));
131
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindKeyDown", function (event) {
132
- if (_this.isComposing) {
133
- return;
134
- }
135
- event.persist();
136
- _this.handleFindKeyDownThrottled(event);
137
- });
138
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindKeyUp", function () {
139
- _this.handleFindKeyDownThrottled.cancel();
140
- });
141
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindNextClick", function (ref) {
142
- if (_this.isComposing) {
143
- return;
144
- }
145
- _this.props.onFindNext({
146
- triggerMethod: _analytics.TRIGGER_METHOD.BUTTON
147
- });
148
- });
149
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleFindPrevClick", function (ref) {
150
- if (_this.isComposing) {
151
- return;
152
- }
153
- _this.props.onFindPrev({
154
- triggerMethod: _analytics.TRIGGER_METHOD.BUTTON
155
- });
156
- });
157
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCompositionStart", function () {
158
- _this.isComposing = true;
159
- });
160
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleCompositionEnd", function (event) {
161
- _this.isComposing = false;
162
- // type for React.CompositionEvent doesn't set type for target correctly
163
- _this.updateFindValue(event.target.value);
164
- });
165
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "clearSearch", function () {
166
- _this.props.onCancel({
167
- triggerMethod: _analytics.TRIGGER_METHOD.BUTTON
168
- });
169
- });
170
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleMatchCaseClick", function (buttonRef) {
171
- if (_this.props.allowMatchCase && _this.props.onToggleMatchCase) {
172
- _this.props.onToggleMatchCase();
173
- _this.props.onFind(_this.props.findText);
174
- }
175
- });
176
- var formatMessage = props.intl.formatMessage;
177
- _this.find = formatMessage(messages.find);
178
- _this.closeFindReplaceDialog = formatMessage(messages.closeFindReplaceDialog);
179
- _this.noResultsFound = formatMessage(messages.noResultsFound);
180
- _this.findNext = formatMessage(messages.findNext);
181
- _this.findPrevious = formatMessage(messages.findPrevious);
182
- _this.matchCase = formatMessage(messages.matchCase);
183
- _this.matchCaseIcon = (0, _react2.jsx)(_keyboard.default, {
184
- label: _this.matchCase
185
- });
186
- _this.findNextIcon = (0, _react2.jsx)(_chevronDown.default, {
187
- label: _this.findNext
188
- });
189
- _this.findPrevIcon = (0, _react2.jsx)(_chevronUp.default, {
190
- label: _this.findPrevious
191
- });
192
- _this.closeIcon = (0, _react2.jsx)(_close.default, {
193
- label: _this.closeFindReplaceDialog
194
- });
195
-
196
- // We locally manage the value of the input inside this component in order to support compositions.
197
- // This requires some additional work inside componentDidUpdate to ensure we support changes that
198
- // occur to this value which do not originate from this component.
199
- _this.state = {
200
- localFindText: ''
201
- };
202
- return _this;
203
- }
204
- (0, _createClass2.default)(Find, [{
205
- key: "componentDidMount",
206
- value: function componentDidMount() {
207
- var _this2 = this;
208
- this.props.onFindTextfieldRefSet(this.findTextfieldRef);
209
-
210
- // focus initially on dialog mount if there is no find text provided
211
- if (!this.props.findText) {
212
- this.focusFindTextfield();
213
- }
214
- this.syncFindText(function () {
215
- // focus after input is synced if find text provided
216
- if (_this2.props.findText) {
217
- _this2.focusFindTextfield();
218
- }
219
- });
220
- }
221
- }, {
222
- key: "componentDidUpdate",
223
- value: function componentDidUpdate(prevProps) {
224
- var _this3 = this;
225
- // focus on update if find text did not change
226
- if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.a11y-find-replace')) {
227
- var _this$state2;
228
- if (this.props.findText === ((_this$state2 = this.state) === null || _this$state2 === void 0 ? void 0 : _this$state2.localFindText)) {
229
- this.focusFindTextfield();
230
- }
231
- if (this.props.findText !== prevProps.findText) {
232
- this.syncFindText(function () {
233
- // focus after input is synced if find text provided
234
- if (_this3.props.findText) {
235
- _this3.focusFindTextfield();
236
- }
237
- });
238
- }
239
- }
240
- }
241
- }, {
242
- key: "componentWillUnmount",
243
- value: function componentWillUnmount() {
244
- this.debouncedFind.cancel();
245
- this.handleFindKeyDownThrottled.cancel();
246
- }
247
- }, {
248
- key: "render",
249
- value: function render() {
250
- var _this$props = this.props,
251
- findText = _this$props.findText,
252
- count = _this$props.count,
253
- allowMatchCase = _this$props.allowMatchCase,
254
- shouldMatchCase = _this$props.shouldMatchCase,
255
- formatMessage = _this$props.intl.formatMessage;
256
- var resultsCount = formatMessage(messages.resultsCount, {
257
- selectedMatchPosition: count.index + 1,
258
- totalResultsCount: count.total
259
- });
260
- return (0, _react2.jsx)("div", {
261
- css: _styles.sectionWrapperStyles
262
- }, (0, _react2.jsx)(_textfield.default, {
263
- name: "find",
264
- appearance: "none",
265
- placeholder: this.find,
266
- value: this.state.localFindText,
267
- ref: this.findTextfieldRef,
268
- autoComplete: "off",
269
- onChange: this.handleFindChange,
270
- onKeyDown: this.handleFindKeyDown,
271
- onKeyUp: this.handleFindKeyUp,
272
- onBlur: this.props.onFindBlur,
273
- onCompositionStart: this.handleCompositionStart,
274
- onCompositionEnd: this.handleCompositionEnd
275
- }), (0, _react2.jsx)("div", {
276
- css: _styles.countWrapperStyles,
277
- "aria-live": "polite"
278
- }, findText && (0, _react2.jsx)("span", {
279
- "data-testid": "textfield-count",
280
- css: _styles.countStyles
281
- }, count.total === 0 ? this.noResultsFound : resultsCount)), allowMatchCase && (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
282
- title: this.matchCase,
283
- icon: this.matchCaseIcon,
284
- onClick: this.handleMatchCaseClick,
285
- isPressed: shouldMatchCase
286
- }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
287
- title: this.findNext,
288
- icon: this.findNextIcon,
289
- keymapDescription: 'Enter',
290
- onClick: this.handleFindNextClick,
291
- disabled: count.total <= 1
292
- }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
293
- title: this.findPrevious,
294
- icon: this.findPrevIcon,
295
- keymapDescription: 'Shift Enter',
296
- onClick: this.handleFindPrevClick,
297
- disabled: count.total <= 1
298
- }), (0, _react2.jsx)(_FindReplaceTooltipButton.FindReplaceTooltipButton, {
299
- title: this.closeFindReplaceDialog,
300
- icon: this.closeIcon,
301
- keymapDescription: 'Escape',
302
- onClick: this.clearSearch
303
- }));
304
- }
305
- }]);
306
- return Find;
307
- }(_react.default.Component);
308
- var _default = exports.default = (0, _reactIntlNext.injectIntl)(Find);
@@ -1,103 +0,0 @@
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
11
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
12
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
13
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
14
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
15
- var _react = _interopRequireDefault(require("react"));
16
- var _react2 = require("@emotion/react");
17
- var _Find = _interopRequireDefault(require("./Find"));
18
- var _Replace = _interopRequireDefault(require("./Replace"));
19
- var _styles = require("./styles");
20
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
21
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
22
- var FindReplace = /*#__PURE__*/function (_React$PureComponent) {
23
- (0, _inherits2.default)(FindReplace, _React$PureComponent);
24
- var _super = _createSuper(FindReplace);
25
- function FindReplace() {
26
- var _this;
27
- (0, _classCallCheck2.default)(this, FindReplace);
28
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
29
- args[_key] = arguments[_key];
30
- }
31
- _this = _super.call.apply(_super, [this].concat(args));
32
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "findTextfield", null);
33
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "replaceTextfield", null);
34
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFindTextfieldRef", function (findTextfieldRef) {
35
- _this.findTextfield = findTextfieldRef.current;
36
- });
37
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setReplaceTextfieldRef", function (replaceTextfieldRef) {
38
- _this.replaceTextfield = replaceTextfieldRef.current;
39
- });
40
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFocusToFind", function () {
41
- if (_this.findTextfield) {
42
- _this.findTextfield.focus();
43
- }
44
- });
45
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "setFocusToReplace", function () {
46
- if (_this.replaceTextfield) {
47
- _this.replaceTextfield.focus();
48
- }
49
- });
50
- return _this;
51
- }
52
- (0, _createClass2.default)(FindReplace, [{
53
- key: "render",
54
- value: function render() {
55
- var _this$props = this.props,
56
- findText = _this$props.findText,
57
- count = _this$props.count,
58
- shouldFocus = _this$props.shouldFocus,
59
- onFind = _this$props.onFind,
60
- onFindBlur = _this$props.onFindBlur,
61
- onFindNext = _this$props.onFindNext,
62
- onFindPrev = _this$props.onFindPrev,
63
- onCancel = _this$props.onCancel,
64
- replaceText = _this$props.replaceText,
65
- onReplace = _this$props.onReplace,
66
- onReplaceAll = _this$props.onReplaceAll,
67
- dispatchAnalyticsEvent = _this$props.dispatchAnalyticsEvent,
68
- allowMatchCase = _this$props.allowMatchCase,
69
- shouldMatchCase = _this$props.shouldMatchCase,
70
- onToggleMatchCase = _this$props.onToggleMatchCase;
71
- return (0, _react2.jsx)("div", {
72
- css: _styles.wrapperStyles
73
- }, (0, _react2.jsx)(_Find.default, {
74
- allowMatchCase: allowMatchCase,
75
- shouldMatchCase: shouldMatchCase,
76
- onToggleMatchCase: onToggleMatchCase,
77
- findText: findText,
78
- count: count,
79
- shouldFocus: shouldFocus,
80
- onFind: onFind,
81
- onFindBlur: onFindBlur,
82
- onFindPrev: onFindPrev,
83
- onFindNext: onFindNext,
84
- onFindTextfieldRefSet: this.setFindTextfieldRef,
85
- onCancel: onCancel,
86
- onArrowDown: this.setFocusToReplace
87
- }), (0, _react2.jsx)("hr", {
88
- css: _styles.ruleStyles,
89
- id: "replace-hr-element"
90
- }), (0, _react2.jsx)(_Replace.default, {
91
- canReplace: count.total > 0,
92
- replaceText: replaceText,
93
- onReplace: onReplace,
94
- onReplaceAll: onReplaceAll,
95
- onReplaceTextfieldRefSet: this.setReplaceTextfieldRef,
96
- onArrowUp: this.setFocusToFind,
97
- dispatchAnalyticsEvent: dispatchAnalyticsEvent
98
- }));
99
- }
100
- }]);
101
- return FindReplace;
102
- }(_react.default.PureComponent);
103
- var _default = exports.default = FindReplace;
@@ -1,132 +0,0 @@
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 _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
17
- var _react = _interopRequireDefault(require("react"));
18
- var _react2 = require("@emotion/react");
19
- var _reactIntlNext = require("react-intl-next");
20
- var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
21
- var _uiMenu = require("@atlaskit/editor-common/ui-menu");
22
- var _search = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/search"));
23
- var _FindReplace = _interopRequireDefault(require("./FindReplace"));
24
- var _analytics = require("@atlaskit/editor-common/analytics");
25
- var _keymaps = require("../../../keymaps");
26
- var _keymaps2 = require("@atlaskit/editor-common/keymaps");
27
- var _templateObject, _templateObject2, _templateObject3;
28
- /** @jsx jsx */
29
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
30
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
31
- var toolbarButtonWrapper = (0, _react2.css)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex: 1 1 auto;\n flex-grow: 0;\n justify-content: flex-end;\n align-items: center;\n padding: 0 ", ";\n @media (max-width: ", "px) {\n justify-content: center;\n padding: 0;\n }\n"])), "var(--ds-space-100, 8px)", _editorSharedStyles.akEditorMobileMaxWidth);
32
- var toolbarButtonWrapperFullWith = (0, _react2.css)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-grow: 1;\n"])));
33
- var wrapper = (0, _react2.css)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n"])));
34
- var messages = (0, _reactIntlNext.defineMessages)({
35
- findReplaceToolbarButton: {
36
- id: 'fabric.editor.findReplaceToolbarButton',
37
- defaultMessage: 'Find and replace',
38
- description: '"Find" highlights all instances of a word or phrase on the document, and "Replace" changes one or all of those instances to something else'
39
- }
40
- });
41
- var FindReplaceToolbarButton = /*#__PURE__*/function (_React$PureComponent) {
42
- (0, _inherits2.default)(FindReplaceToolbarButton, _React$PureComponent);
43
- var _super = _createSuper(FindReplaceToolbarButton);
44
- function FindReplaceToolbarButton() {
45
- var _this;
46
- (0, _classCallCheck2.default)(this, FindReplaceToolbarButton);
47
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
48
- args[_key] = arguments[_key];
49
- }
50
- _this = _super.call.apply(_super, [this].concat(args));
51
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "toggleOpen", function () {
52
- if (_this.props.isActive) {
53
- _this.props.onCancel({
54
- triggerMethod: _analytics.TRIGGER_METHOD.TOOLBAR
55
- });
56
- } else {
57
- _this.props.onActivate();
58
- }
59
- });
60
- return _this;
61
- }
62
- (0, _createClass2.default)(FindReplaceToolbarButton, [{
63
- key: "render",
64
- value: function render() {
65
- var _this2 = this;
66
- var _this$props = this.props,
67
- popupsMountPoint = _this$props.popupsMountPoint,
68
- popupsBoundariesElement = _this$props.popupsBoundariesElement,
69
- popupsScrollableElement = _this$props.popupsScrollableElement,
70
- isReducedSpacing = _this$props.isReducedSpacing,
71
- findText = _this$props.findText,
72
- replaceText = _this$props.replaceText,
73
- isActive = _this$props.isActive,
74
- index = _this$props.index,
75
- numMatches = _this$props.numMatches,
76
- formatMessage = _this$props.intl.formatMessage,
77
- takeFullWidth = _this$props.takeFullWidth;
78
- var title = formatMessage(messages.findReplaceToolbarButton);
79
- var stackBelowOtherEditorFloatingPanels = _editorSharedStyles.akEditorFloatingPanelZIndex - 1;
80
- var keymap = (0, _keymaps.findKeymapByDescription)('Find');
81
- return (0, _react2.jsx)("div", {
82
- css: [toolbarButtonWrapper, takeFullWidth && toolbarButtonWrapperFullWith]
83
- }, (0, _react2.jsx)(_uiMenu.Dropdown, {
84
- mountTo: popupsMountPoint,
85
- boundariesElement: popupsBoundariesElement,
86
- scrollableElement: popupsScrollableElement,
87
- isOpen: isActive,
88
- handleEscapeKeydown: function handleEscapeKeydown() {
89
- if (isActive) {
90
- _this2.props.onCancel({
91
- triggerMethod: _analytics.TRIGGER_METHOD.KEYBOARD
92
- });
93
- }
94
- },
95
- fitWidth: 352,
96
- zIndex: stackBelowOtherEditorFloatingPanels,
97
- arrowKeyNavigationProviderOptions: {
98
- type: _uiMenu.ArrowKeyNavigationType.MENU,
99
- disableArrowKeyNavigation: true
100
- },
101
- trigger: (0, _react2.jsx)(_uiMenu.ToolbarButton, {
102
- buttonId: _uiMenu.TOOLBAR_BUTTON.FIND_REPLACE,
103
- spacing: isReducedSpacing ? 'none' : 'default',
104
- selected: isActive,
105
- title: (0, _react2.jsx)(_keymaps.ToolTipContent, {
106
- description: title,
107
- keymap: keymap
108
- }),
109
- iconBefore: (0, _react2.jsx)(_search.default, {
110
- label: title
111
- }),
112
- onClick: this.toggleOpen,
113
- "aria-expanded": isActive,
114
- "aria-haspopup": true,
115
- "aria-label": keymap ? (0, _keymaps.tooltip)(keymap, title) : title,
116
- "aria-keyshortcuts": (0, _keymaps2.getAriaKeyshortcuts)(keymap)
117
- })
118
- }, (0, _react2.jsx)("div", {
119
- css: wrapper
120
- }, (0, _react2.jsx)(_FindReplace.default, (0, _extends2.default)({
121
- findText: findText,
122
- replaceText: replaceText,
123
- count: {
124
- index: index,
125
- total: numMatches
126
- }
127
- }, this.props)))));
128
- }
129
- }]);
130
- return FindReplaceToolbarButton;
131
- }(_react.default.PureComponent);
132
- var _default = exports.default = (0, _reactIntlNext.injectIntl)(FindReplaceToolbarButton);
@@ -1,76 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.FindReplaceTooltipButton = void 0;
8
- var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
10
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
11
- var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
12
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
13
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
14
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
15
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
16
- var _react = _interopRequireDefault(require("react"));
17
- var _tooltip = _interopRequireDefault(require("@atlaskit/tooltip"));
18
- var _keymaps = require("@atlaskit/editor-common/keymaps");
19
- var _standardButton = _interopRequireDefault(require("@atlaskit/button/standard-button"));
20
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
23
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
24
- var FindReplaceTooltipButton = exports.FindReplaceTooltipButton = /*#__PURE__*/function (_React$PureComponent) {
25
- (0, _inherits2.default)(FindReplaceTooltipButton, _React$PureComponent);
26
- var _super = _createSuper(FindReplaceTooltipButton);
27
- function FindReplaceTooltipButton() {
28
- var _this;
29
- (0, _classCallCheck2.default)(this, FindReplaceTooltipButton);
30
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
31
- args[_key] = arguments[_key];
32
- }
33
- _this = _super.call.apply(_super, [this].concat(args));
34
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "buttonRef", /*#__PURE__*/_react.default.createRef());
35
- (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleClick", function () {
36
- _this.props.onClick(_this.buttonRef);
37
- });
38
- return _this;
39
- }
40
- (0, _createClass2.default)(FindReplaceTooltipButton, [{
41
- key: "render",
42
- value: function render() {
43
- var _this$props = this.props,
44
- title = _this$props.title,
45
- icon = _this$props.icon,
46
- keymapDescription = _this$props.keymapDescription,
47
- disabled = _this$props.disabled,
48
- isPressed = _this$props.isPressed;
49
- var pressedProps = _objectSpread({}, typeof isPressed === 'boolean' && {
50
- 'aria-pressed': isPressed
51
- });
52
- return /*#__PURE__*/_react.default.createElement(_tooltip.default, {
53
- content: /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
54
- description: title,
55
- keymap: (0, _keymaps.findKeymapByDescription)(keymapDescription)
56
- }),
57
- hideTooltipOnClick: true,
58
- position: 'top'
59
- }, /*#__PURE__*/_react.default.createElement(_standardButton.default, (0, _extends2.default)({
60
- label: title,
61
- appearance: "subtle",
62
- testId: title,
63
- ref: this.buttonRef,
64
- iconBefore: icon,
65
- isDisabled: disabled,
66
- onClick: this.handleClick,
67
- isSelected: isPressed,
68
- shouldFitContainer: true
69
- }, pressedProps)));
70
- }
71
- }]);
72
- return FindReplaceTooltipButton;
73
- }(_react.default.PureComponent);
74
- (0, _defineProperty2.default)(FindReplaceTooltipButton, "defaultProps", {
75
- keymapDescription: 'no-keymap'
76
- });