@ckeditor/ckeditor5-find-and-replace 40.2.0 → 41.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/LICENSE.md +1 -1
  2. package/build/find-and-replace.js +3 -3
  3. package/build/translations/af.js +1 -1
  4. package/build/translations/ar.js +1 -1
  5. package/build/translations/bg.js +1 -1
  6. package/build/translations/bn.js +1 -1
  7. package/build/translations/bs.js +1 -1
  8. package/build/translations/ca.js +1 -1
  9. package/build/translations/cs.js +1 -1
  10. package/build/translations/da.js +1 -1
  11. package/build/translations/de.js +1 -1
  12. package/build/translations/el.js +1 -1
  13. package/build/translations/en-au.js +1 -1
  14. package/build/translations/es.js +1 -1
  15. package/build/translations/et.js +1 -1
  16. package/build/translations/fa.js +1 -1
  17. package/build/translations/fi.js +1 -1
  18. package/build/translations/fr.js +1 -1
  19. package/build/translations/gl.js +1 -1
  20. package/build/translations/he.js +1 -1
  21. package/build/translations/hi.js +1 -1
  22. package/build/translations/hr.js +1 -1
  23. package/build/translations/hu.js +1 -1
  24. package/build/translations/id.js +1 -1
  25. package/build/translations/it.js +1 -1
  26. package/build/translations/ja.js +1 -1
  27. package/build/translations/jv.js +1 -1
  28. package/build/translations/ko.js +1 -1
  29. package/build/translations/lt.js +1 -1
  30. package/build/translations/lv.js +1 -1
  31. package/build/translations/ms.js +1 -1
  32. package/build/translations/nl.js +1 -1
  33. package/build/translations/no.js +1 -1
  34. package/build/translations/pl.js +1 -1
  35. package/build/translations/pt-br.js +1 -1
  36. package/build/translations/pt.js +1 -1
  37. package/build/translations/ro.js +1 -1
  38. package/build/translations/ru.js +1 -1
  39. package/build/translations/sk.js +1 -1
  40. package/build/translations/sr-latn.js +1 -1
  41. package/build/translations/sr.js +1 -1
  42. package/build/translations/sv.js +1 -1
  43. package/build/translations/th.js +1 -1
  44. package/build/translations/tr.js +1 -1
  45. package/build/translations/tt.js +1 -1
  46. package/build/translations/ug.js +1 -1
  47. package/build/translations/uk.js +1 -1
  48. package/build/translations/ur.js +1 -1
  49. package/build/translations/vi.js +1 -1
  50. package/build/translations/zh-cn.js +1 -1
  51. package/build/translations/zh.js +1 -1
  52. package/ckeditor5-metadata.json +1 -1
  53. package/lang/contexts.json +1 -1
  54. package/lang/translations/af.po +4 -4
  55. package/lang/translations/ar.po +4 -4
  56. package/lang/translations/bg.po +4 -4
  57. package/lang/translations/bn.po +4 -4
  58. package/lang/translations/bs.po +4 -4
  59. package/lang/translations/ca.po +4 -4
  60. package/lang/translations/cs.po +4 -4
  61. package/lang/translations/da.po +4 -4
  62. package/lang/translations/de.po +4 -4
  63. package/lang/translations/el.po +4 -4
  64. package/lang/translations/en-au.po +4 -4
  65. package/lang/translations/en.po +4 -4
  66. package/lang/translations/es.po +4 -4
  67. package/lang/translations/et.po +4 -4
  68. package/lang/translations/fa.po +4 -4
  69. package/lang/translations/fi.po +4 -4
  70. package/lang/translations/fr.po +4 -4
  71. package/lang/translations/gl.po +4 -4
  72. package/lang/translations/he.po +4 -4
  73. package/lang/translations/hi.po +4 -4
  74. package/lang/translations/hr.po +4 -4
  75. package/lang/translations/hu.po +4 -4
  76. package/lang/translations/id.po +4 -4
  77. package/lang/translations/it.po +4 -4
  78. package/lang/translations/ja.po +4 -4
  79. package/lang/translations/jv.po +4 -4
  80. package/lang/translations/ko.po +4 -4
  81. package/lang/translations/lt.po +4 -4
  82. package/lang/translations/lv.po +4 -4
  83. package/lang/translations/ms.po +4 -4
  84. package/lang/translations/nl.po +4 -4
  85. package/lang/translations/no.po +4 -4
  86. package/lang/translations/pl.po +4 -4
  87. package/lang/translations/pt-br.po +4 -4
  88. package/lang/translations/pt.po +4 -4
  89. package/lang/translations/ro.po +4 -4
  90. package/lang/translations/ru.po +4 -4
  91. package/lang/translations/sk.po +4 -4
  92. package/lang/translations/sr-latn.po +4 -4
  93. package/lang/translations/sr.po +4 -4
  94. package/lang/translations/sv.po +4 -4
  95. package/lang/translations/th.po +4 -4
  96. package/lang/translations/tr.po +4 -4
  97. package/lang/translations/tt.po +3 -3
  98. package/lang/translations/ug.po +4 -4
  99. package/lang/translations/uk.po +4 -4
  100. package/lang/translations/ur.po +4 -4
  101. package/lang/translations/vi.po +4 -4
  102. package/lang/translations/zh-cn.po +4 -4
  103. package/lang/translations/zh.po +4 -4
  104. package/package.json +4 -3
  105. package/src/augmentation.d.ts +2 -2
  106. package/src/augmentation.js +1 -1
  107. package/src/findandreplace.d.ts +5 -5
  108. package/src/findandreplace.js +4 -4
  109. package/src/findandreplaceconfig.d.ts +31 -0
  110. package/src/findandreplaceconfig.js +5 -0
  111. package/src/findandreplaceediting.d.ts +7 -7
  112. package/src/findandreplaceediting.js +10 -10
  113. package/src/findandreplacestate.d.ts +6 -6
  114. package/src/findandreplacestate.js +2 -2
  115. package/src/findandreplaceui.d.ts +18 -6
  116. package/src/findandreplaceui.js +130 -41
  117. package/src/findandreplaceutils.d.ts +5 -5
  118. package/src/findandreplaceutils.js +3 -3
  119. package/src/findcommand.d.ts +6 -6
  120. package/src/findcommand.js +2 -2
  121. package/src/findnextcommand.d.ts +3 -3
  122. package/src/findnextcommand.js +2 -2
  123. package/src/findpreviouscommand.d.ts +2 -2
  124. package/src/findpreviouscommand.js +2 -2
  125. package/src/index.d.ts +12 -11
  126. package/src/index.js +11 -11
  127. package/src/replaceallcommand.d.ts +4 -4
  128. package/src/replaceallcommand.js +3 -3
  129. package/src/replacecommand.d.ts +3 -3
  130. package/src/replacecommand.js +2 -2
  131. package/src/replacecommandbase.d.ts +4 -4
  132. package/src/replacecommandbase.js +2 -2
  133. package/src/ui/findandreplaceformview.d.ts +38 -17
  134. package/src/ui/findandreplaceformview.js +117 -98
  135. package/theme/findandreplace.css +1 -1
  136. package/theme/findandreplaceform.css +4 -4
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findandreplaceui
7
7
  */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import { createDropdown, CssTransitionDisablerMixin } from 'ckeditor5/src/ui';
10
- import FindAndReplaceFormView from './ui/findandreplaceformview';
8
+ import { Plugin } from 'ckeditor5/src/core.js';
9
+ import { ButtonView, Dialog, DialogViewPosition, createDropdown, DropdownView, FormHeaderView, CssTransitionDisablerMixin } from 'ckeditor5/src/ui.js';
10
+ import FindAndReplaceFormView from './ui/findandreplaceformview.js';
11
11
  import loupeIcon from '../theme/icons/find-replace.svg';
12
12
  /**
13
13
  * The default find and replace UI.
@@ -16,6 +16,12 @@ import loupeIcon from '../theme/icons/find-replace.svg';
16
16
  * that uses the {@link module:find-and-replace/findandreplace~FindAndReplace FindAndReplace} plugin API.
17
17
  */
18
18
  export default class FindAndReplaceUI extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires() {
23
+ return [Dialog];
24
+ }
19
25
  /**
20
26
  * @inheritDoc
21
27
  */
@@ -27,6 +33,7 @@ export default class FindAndReplaceUI extends Plugin {
27
33
  */
28
34
  constructor(editor) {
29
35
  super(editor);
36
+ editor.config.define('findAndReplace.uiType', 'dialog');
30
37
  this.formView = null;
31
38
  }
32
39
  /**
@@ -34,66 +41,138 @@ export default class FindAndReplaceUI extends Plugin {
34
41
  */
35
42
  init() {
36
43
  const editor = this.editor;
37
- // Register the toolbar dropdown component.
38
- editor.ui.componentFactory.add('findAndReplace', locale => {
39
- const dropdown = createDropdown(locale);
40
- // Dropdown should be disabled when in source editing mode. See #10001.
41
- const findCommand = editor.commands.get('find');
42
- dropdown.bind('isEnabled').to(findCommand);
43
- dropdown.once('change:isOpen', () => {
44
- this.formView = new (CssTransitionDisablerMixin(FindAndReplaceFormView))(editor.locale);
45
- dropdown.panelView.children.add(this.formView);
46
- this._setupFormView(this.formView);
47
- });
48
- // Every time a dropdown is opened, the search text field should get focused and selected for better UX.
49
- // Note: Using the low priority here to make sure the following listener starts working after
50
- // the default action of the drop-down is executed (i.e. the panel showed up). Otherwise,
51
- // the invisible form/input cannot be focused/selected.
52
- //
53
- // Each time a dropdown is closed, move the focus back to the find and replace toolbar button
54
- // and let the find and replace editing feature know that all search results can be invalidated
55
- // and no longer should be marked in the content.
56
- dropdown.on('change:isOpen', (event, name, isOpen) => {
57
- if (isOpen) {
58
- this.formView.disableCssTransitions();
59
- this.formView.reset();
60
- this.formView._findInputView.fieldView.select();
61
- this.formView.enableCssTransitions();
44
+ const isUiUsingDropdown = editor.config.get('findAndReplace.uiType') === 'dropdown';
45
+ const findCommand = editor.commands.get('find');
46
+ // Register the toolbar component: dropdown or button (that opens a dialog).
47
+ editor.ui.componentFactory.add('findAndReplace', () => {
48
+ let view;
49
+ if (isUiUsingDropdown) {
50
+ view = this._createDropdown();
51
+ // Button should be disabled when in source editing mode. See #10001.
52
+ view.bind('isEnabled').to(findCommand);
53
+ }
54
+ else {
55
+ view = this._createDialogButton();
56
+ // Button should be disabled when in source editing mode. See #10001.
57
+ view.bind('isEnabled').to(findCommand);
58
+ }
59
+ editor.keystrokes.set('Ctrl+F', (data, cancelEvent) => {
60
+ if (!findCommand.isEnabled) {
61
+ return;
62
+ }
63
+ if (view instanceof DropdownView) {
64
+ const dropdownButtonView = view.buttonView;
65
+ if (!dropdownButtonView.isOn) {
66
+ dropdownButtonView.fire('execute');
67
+ }
62
68
  }
63
69
  else {
64
- this.fire('searchReseted');
70
+ if (view.isOn) {
71
+ // If the dialog is open, do not close it. Instead focus it.
72
+ // Unfortunately we can't simply use:
73
+ // this.formView!.focus();
74
+ // because it would always move focus to the first input field, which we don't want.
75
+ editor.plugins.get('Dialog').view.focus();
76
+ }
77
+ else {
78
+ view.fire('execute');
79
+ }
65
80
  }
66
- }, { priority: 'low' });
67
- this._setupDropdownButton(dropdown);
68
- return dropdown;
81
+ cancelEvent();
82
+ });
83
+ return view;
69
84
  });
70
85
  }
71
86
  /**
72
- * Sets up the find and replace button.
87
+ * Creates a dropdown containing the find and replace form.
73
88
  */
74
- _setupDropdownButton(dropdown) {
89
+ _createDropdown() {
75
90
  const editor = this.editor;
76
91
  const t = editor.locale.t;
77
- dropdown.buttonView.set({
92
+ const dropdownView = createDropdown(editor.locale);
93
+ dropdownView.once('change:isOpen', () => {
94
+ this.formView = this._createFormView();
95
+ this.formView.children.add(new FormHeaderView(editor.locale, {
96
+ label: t('Find and replace')
97
+ }), 0);
98
+ dropdownView.panelView.children.add(this.formView);
99
+ });
100
+ // Every time a dropdown is opened, the search text field should get focused and selected for better UX.
101
+ // Note: Using the low priority here to make sure the following listener starts working after
102
+ // the default action of the drop-down is executed (i.e. the panel showed up). Otherwise,
103
+ // the invisible form/input cannot be focused/selected.
104
+ //
105
+ // Each time a dropdown is closed, move the focus back to the find and replace toolbar button
106
+ // and let the find and replace editing feature know that all search results can be invalidated
107
+ // and no longer should be marked in the content.
108
+ dropdownView.on('change:isOpen', (event, name, isOpen) => {
109
+ if (isOpen) {
110
+ this._setupFormView();
111
+ }
112
+ else {
113
+ this.fire('searchReseted');
114
+ }
115
+ }, { priority: 'low' });
116
+ dropdownView.buttonView.set({
78
117
  icon: loupeIcon,
79
118
  label: t('Find and replace'),
80
119
  keystroke: 'CTRL+F',
81
120
  tooltip: true
82
121
  });
83
- editor.keystrokes.set('Ctrl+F', (data, cancelEvent) => {
84
- if (dropdown.isEnabled) {
85
- dropdown.isOpen = true;
86
- cancelEvent();
122
+ return dropdownView;
123
+ }
124
+ /**
125
+ * Creates a button that opens a dialog with the find and replace form.
126
+ */
127
+ _createDialogButton() {
128
+ const editor = this.editor;
129
+ const buttonView = new ButtonView(editor.locale);
130
+ const dialog = editor.plugins.get('Dialog');
131
+ const t = editor.locale.t;
132
+ buttonView.set({
133
+ icon: loupeIcon,
134
+ label: t('Find and replace'),
135
+ keystroke: 'CTRL+F',
136
+ tooltip: true
137
+ });
138
+ // Button should be on when the find and replace dialog is opened.
139
+ buttonView.bind('isOn').to(dialog, 'id', id => id === 'findAndReplace');
140
+ // Every time a dialog is opened, the search text field should get focused and selected for better UX.
141
+ // Each time a dialog is closed, move the focus back to the find and replace toolbar button
142
+ // and let the find and replace editing feature know that all search results can be invalidated
143
+ // and no longer should be marked in the content.
144
+ buttonView.on('execute', () => {
145
+ if (!this.formView) {
146
+ this.formView = this._createFormView();
147
+ }
148
+ if (buttonView.isOn) {
149
+ dialog.hide();
150
+ }
151
+ else {
152
+ dialog.show({
153
+ id: 'findAndReplace',
154
+ title: t('Find and replace'),
155
+ content: this.formView,
156
+ position: DialogViewPosition.EDITOR_TOP_SIDE,
157
+ onShow: () => {
158
+ this._setupFormView();
159
+ },
160
+ onHide: () => {
161
+ this.fire('searchReseted');
162
+ }
163
+ });
87
164
  }
88
165
  });
166
+ return buttonView;
89
167
  }
90
168
  /**
91
169
  * Sets up the form view for the find and replace.
92
170
  *
93
171
  * @param formView A related form view.
94
172
  */
95
- _setupFormView(formView) {
173
+ _createFormView() {
96
174
  const editor = this.editor;
175
+ const formView = new (CssTransitionDisablerMixin(FindAndReplaceFormView))(editor.locale);
97
176
  const commands = editor.commands;
98
177
  const findAndReplaceEditing = this.editor.plugins.get('FindAndReplaceEditing');
99
178
  const editingState = findAndReplaceEditing.state;
@@ -128,5 +207,15 @@ export default class FindAndReplaceUI extends Plugin {
128
207
  this.fire('searchReseted');
129
208
  }
130
209
  });
210
+ return formView;
211
+ }
212
+ /**
213
+ * Clears the find and replace form and focuses the search text field.
214
+ */
215
+ _setupFormView() {
216
+ this.formView.disableCssTransitions();
217
+ this.formView.reset();
218
+ this.formView._findInputView.fieldView.select();
219
+ this.formView.enableCssTransitions();
131
220
  }
132
221
  }
@@ -1,14 +1,14 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findandreplaceutils
7
7
  */
8
- import type { Item, Model, Range } from 'ckeditor5/src/engine';
9
- import { Plugin } from 'ckeditor5/src/core';
10
- import { Collection } from 'ckeditor5/src/utils';
11
- import type { ResultType } from './findandreplace';
8
+ import type { Item, Model, Range } from 'ckeditor5/src/engine.js';
9
+ import { Plugin } from 'ckeditor5/src/core.js';
10
+ import { Collection } from 'ckeditor5/src/utils.js';
11
+ import type { ResultType } from './findandreplace.js';
12
12
  /**
13
13
  * A set of helpers related to find and replace.
14
14
  */
@@ -1,9 +1,9 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- import { Plugin } from 'ckeditor5/src/core';
6
- import { Collection, uid } from 'ckeditor5/src/utils';
5
+ import { Plugin } from 'ckeditor5/src/core.js';
6
+ import { Collection, uid } from 'ckeditor5/src/utils.js';
7
7
  import { escapeRegExp } from 'lodash-es';
8
8
  /**
9
9
  * A set of helpers related to find and replace.
@@ -1,15 +1,15 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findcommand
7
7
  */
8
- import type { Item } from 'ckeditor5/src/engine';
9
- import { Command, type Editor } from 'ckeditor5/src/core';
10
- import type { Collection } from 'ckeditor5/src/utils';
11
- import type FindAndReplaceState from './findandreplacestate';
12
- import type { ResultType } from './findandreplace';
8
+ import type { Item } from 'ckeditor5/src/engine.js';
9
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
10
+ import type { Collection } from 'ckeditor5/src/utils.js';
11
+ import type FindAndReplaceState from './findandreplacestate.js';
12
+ import type { ResultType } from './findandreplace.js';
13
13
  /**
14
14
  * The find command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.
15
15
  */
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- import { Command } from 'ckeditor5/src/core';
5
+ import { Command } from 'ckeditor5/src/core.js';
6
6
  /**
7
7
  * The find command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.
8
8
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findnextcommand
7
7
  */
8
- import { Command, type Editor } from 'ckeditor5/src/core';
9
- import type FindAndReplaceState from './findandreplacestate';
8
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
9
+ import type FindAndReplaceState from './findandreplacestate.js';
10
10
  /**
11
11
  * The find next command. Moves the highlight to the next search result.
12
12
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findnextcommand
7
7
  */
8
- import { Command } from 'ckeditor5/src/core';
8
+ import { Command } from 'ckeditor5/src/core.js';
9
9
  /**
10
10
  * The find next command. Moves the highlight to the next search result.
11
11
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findpreviouscommand
7
7
  */
8
- import FindNextCommand from './findnextcommand';
8
+ import FindNextCommand from './findnextcommand.js';
9
9
  /**
10
10
  * The find previous command. Moves the highlight to the previous search result.
11
11
  *
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/findpreviouscommand
7
7
  */
8
- import FindNextCommand from './findnextcommand';
8
+ import FindNextCommand from './findnextcommand.js';
9
9
  /**
10
10
  * The find previous command. Moves the highlight to the previous search result.
11
11
  *
package/src/index.d.ts CHANGED
@@ -1,17 +1,18 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace
7
7
  */
8
- export { default as FindAndReplace } from './findandreplace';
9
- export { default as FindAndReplaceEditing } from './findandreplaceediting';
10
- export { default as FindAndReplaceUI } from './findandreplaceui';
11
- export { default as FindAndReplaceUtils } from './findandreplaceutils';
12
- export { default as FindCommand } from './findcommand';
13
- export { default as FindNextCommand } from './findnextcommand';
14
- export { default as FindPreviousCommand } from './findpreviouscommand';
15
- export { default as ReplaceCommand } from './replacecommand';
16
- export { default as ReplaceAllCommand } from './replaceallcommand';
17
- import './augmentation';
8
+ export { default as FindAndReplace } from './findandreplace.js';
9
+ export { default as FindAndReplaceEditing } from './findandreplaceediting.js';
10
+ export { default as FindAndReplaceUI } from './findandreplaceui.js';
11
+ export { default as FindAndReplaceUtils } from './findandreplaceutils.js';
12
+ export { default as FindCommand } from './findcommand.js';
13
+ export { default as FindNextCommand } from './findnextcommand.js';
14
+ export { default as FindPreviousCommand } from './findpreviouscommand.js';
15
+ export { default as ReplaceCommand } from './replacecommand.js';
16
+ export { default as ReplaceAllCommand } from './replaceallcommand.js';
17
+ export { FindAndReplaceConfig } from './findandreplaceconfig.js';
18
+ import './augmentation.js';
package/src/index.js CHANGED
@@ -1,17 +1,17 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace
7
7
  */
8
- export { default as FindAndReplace } from './findandreplace';
9
- export { default as FindAndReplaceEditing } from './findandreplaceediting';
10
- export { default as FindAndReplaceUI } from './findandreplaceui';
11
- export { default as FindAndReplaceUtils } from './findandreplaceutils';
12
- export { default as FindCommand } from './findcommand';
13
- export { default as FindNextCommand } from './findnextcommand';
14
- export { default as FindPreviousCommand } from './findpreviouscommand';
15
- export { default as ReplaceCommand } from './replacecommand';
16
- export { default as ReplaceAllCommand } from './replaceallcommand';
17
- import './augmentation';
8
+ export { default as FindAndReplace } from './findandreplace.js';
9
+ export { default as FindAndReplaceEditing } from './findandreplaceediting.js';
10
+ export { default as FindAndReplaceUI } from './findandreplaceui.js';
11
+ export { default as FindAndReplaceUtils } from './findandreplaceutils.js';
12
+ export { default as FindCommand } from './findcommand.js';
13
+ export { default as FindNextCommand } from './findnextcommand.js';
14
+ export { default as FindPreviousCommand } from './findpreviouscommand.js';
15
+ export { default as ReplaceCommand } from './replacecommand.js';
16
+ export { default as ReplaceAllCommand } from './replaceallcommand.js';
17
+ import './augmentation.js';
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/replaceallcommand
7
7
  */
8
- import { Collection } from 'ckeditor5/src/utils';
9
- import type { ResultType } from './findandreplace';
10
- import { ReplaceCommandBase } from './replacecommandbase';
8
+ import { Collection } from 'ckeditor5/src/utils.js';
9
+ import type { ResultType } from './findandreplace.js';
10
+ import { ReplaceCommandBase } from './replacecommandbase.js';
11
11
  /**
12
12
  * The replace all command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.
13
13
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/replaceallcommand
7
7
  */
8
- import { Collection } from 'ckeditor5/src/utils';
9
- import { ReplaceCommandBase } from './replacecommandbase';
8
+ import { Collection } from 'ckeditor5/src/utils.js';
9
+ import { ReplaceCommandBase } from './replacecommandbase.js';
10
10
  /**
11
11
  * The replace all command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.
12
12
  */
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/replacecommand
7
7
  */
8
- import type { ResultType } from './findandreplace';
9
- import { ReplaceCommandBase } from './replacecommandbase';
8
+ import type { ResultType } from './findandreplace.js';
9
+ import { ReplaceCommandBase } from './replacecommandbase.js';
10
10
  /**
11
11
  * The replace command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.
12
12
  */
@@ -1,8 +1,8 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
- import { ReplaceCommandBase } from './replacecommandbase';
5
+ import { ReplaceCommandBase } from './replacecommandbase.js';
6
6
  /**
7
7
  * The replace command. It is used by the {@link module:find-and-replace/findandreplace~FindAndReplace find and replace feature}.
8
8
  */
@@ -1,13 +1,13 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/replacecommandbase
7
7
  */
8
- import { Command, type Editor } from 'ckeditor5/src/core';
9
- import type { ResultType } from './findandreplace';
10
- import type FindAndReplaceState from './findandreplacestate';
8
+ import { Command, type Editor } from 'ckeditor5/src/core.js';
9
+ import type { ResultType } from './findandreplace.js';
10
+ import type FindAndReplaceState from './findandreplacestate.js';
11
11
  export declare abstract class ReplaceCommandBase extends Command {
12
12
  /**
13
13
  * The find and replace state object used for command operations.
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/replacecommandbase
7
7
  */
8
- import { Command } from 'ckeditor5/src/core';
8
+ import { Command } from 'ckeditor5/src/core.js';
9
9
  export class ReplaceCommandBase extends Command {
10
10
  /**
11
11
  * Creates a new `ReplaceCommand` instance.
@@ -1,12 +1,12 @@
1
1
  /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
2
+ * @license Copyright (c) 2003-2024, CKSource Holding sp. z o.o. All rights reserved.
3
3
  * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
4
  */
5
5
  /**
6
6
  * @module find-and-replace/ui/findandreplaceformview
7
7
  */
8
- import { View, LabeledFieldView, type InputView } from 'ckeditor5/src/ui';
9
- import { type Locale } from 'ckeditor5/src/utils';
8
+ import { View, LabeledFieldView, FocusCycler, ViewCollection, type InputView } from 'ckeditor5/src/ui.js';
9
+ import { type Locale } from 'ckeditor5/src/utils.js';
10
10
  import '@ckeditor/ckeditor5-ui/theme/components/responsive-form/responsiveform.css';
11
11
  import '../../theme/findandreplaceform.css';
12
12
  /**
@@ -15,6 +15,10 @@ import '../../theme/findandreplaceform.css';
15
15
  * See {@link module:find-and-replace/ui/findandreplaceformview~FindAndReplaceFormView}.
16
16
  */
17
17
  export default class FindAndReplaceFormView extends View {
18
+ /**
19
+ * A collection of child views.
20
+ */
21
+ children: ViewCollection;
18
22
  /**
19
23
  * Stores the number of matched search results.
20
24
  *
@@ -115,9 +119,17 @@ export default class FindAndReplaceFormView extends View {
115
119
  */
116
120
  private readonly _findNextButtonView;
117
121
  /**
118
- * The find options dropdown.
122
+ * A collapsible view aggregating the advanced search options.
123
+ */
124
+ private readonly _advancedOptionsCollapsibleView;
125
+ /**
126
+ * A switch button view controlling the "Match case" option.
119
127
  */
120
- private readonly _optionsDropdown;
128
+ private readonly _matchCaseSwitchView;
129
+ /**
130
+ * A switch button view controlling the "Whole words only" option.
131
+ */
132
+ private readonly _wholeWordsOnlySwitchView;
121
133
  /**
122
134
  * The replace button view.
123
135
  */
@@ -127,13 +139,13 @@ export default class FindAndReplaceFormView extends View {
127
139
  */
128
140
  private readonly _replaceAllButtonView;
129
141
  /**
130
- * The fieldset aggregating the find UI.
142
+ * The `div` aggregating the inputs.
131
143
  */
132
- private readonly _findFieldsetView;
144
+ private readonly _inputsDivView;
133
145
  /**
134
- * The fieldset aggregating the replace UI.
146
+ * The `div` aggregating the action buttons.
135
147
  */
136
- private readonly _replaceFieldsetView;
148
+ private readonly _actionButtonsDivView;
137
149
  /**
138
150
  * Tracks information about the DOM focus in the form.
139
151
  */
@@ -149,7 +161,7 @@ export default class FindAndReplaceFormView extends View {
149
161
  /**
150
162
  * Helps cycling over {@link #_focusables} in the form.
151
163
  */
152
- private readonly _focusCycler;
164
+ readonly focusCycler: FocusCycler;
153
165
  locale: Locale;
154
166
  /**
155
167
  * Creates a view of find and replace form.
@@ -166,9 +178,9 @@ export default class FindAndReplaceFormView extends View {
166
178
  */
167
179
  destroy(): void;
168
180
  /**
169
- * Focuses the fist {@link #_focusables} in the form.
181
+ * @inheritDoc
170
182
  */
171
- focus(): void;
183
+ focus(direction?: 1 | -1): void;
172
184
  /**
173
185
  * Resets the form before re-appearing.
174
186
  *
@@ -189,9 +201,9 @@ export default class FindAndReplaceFormView extends View {
189
201
  */
190
202
  private get _textToReplace();
191
203
  /**
192
- * Configures and returns the `<fieldset>` aggregating all find controls.
204
+ * Configures and returns the `<div>` aggregating all form inputs.
193
205
  */
194
- private _createFindFieldset;
206
+ private _createInputsDiv;
195
207
  /**
196
208
  * The action performed when the {@link #_findButtonView} is pressed.
197
209
  */
@@ -201,14 +213,23 @@ export default class FindAndReplaceFormView extends View {
201
213
  */
202
214
  private _injectFindResultsCounter;
203
215
  /**
204
- * Configures and returns the `<fieldset>` aggregating all replace controls.
216
+ * Creates the collapsible view aggregating the advanced search options.
217
+ */
218
+ private _createAdvancedOptionsCollapsible;
219
+ /**
220
+ * Configures and returns the `<div>` element aggregating all form action buttons.
221
+ */
222
+ private _createActionButtonsDiv;
223
+ /**
224
+ * Creates, configures and returns and instance of a dropdown allowing users to narrow
225
+ * the search criteria down. The dropdown has a list with switch buttons for each option.
205
226
  */
206
- private _createReplaceFieldset;
227
+ private _createMatchCaseSwitch;
207
228
  /**
208
229
  * Creates, configures and returns and instance of a dropdown allowing users to narrow
209
230
  * the search criteria down. The dropdown has a list with switch buttons for each option.
210
231
  */
211
- private _createOptionsDropdown;
232
+ private _createWholeWordsOnlySwitch;
212
233
  /**
213
234
  * Initializes the {@link #_focusables} and {@link #_focusTracker} to allow navigation
214
235
  * using <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keystrokes in the right order.