@ckeditor/ckeditor5-find-and-replace 40.0.0 → 40.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.md CHANGED
@@ -1,8 +1,8 @@
1
1
  Software License Agreement
2
2
  ==========================
3
3
 
4
- **CKEditor&nbsp;5 Find and Replace Feature** – https://github.com/ckeditor/ckeditor5-find-and-replace <br>
5
- Copyright (c) 2003-2023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
4
+ **CKEditor&nbsp;5 find and replace feature** – https://github.com/ckeditor/ckeditor5-find-and-replace <br>
5
+ Copyright (c) 20032023, [CKSource Holding sp. z o.o.](https://cksource.com) All rights reserved.
6
6
 
7
7
  Licensed under the terms of [GNU General Public License Version 2 or later](http://www.gnu.org/licenses/gpl.html).
8
8
 
@@ -13,9 +13,9 @@ Where not otherwise indicated, all CKEditor content is authored by CKSource engi
13
13
 
14
14
  The following libraries are included in CKEditor under the [MIT license](https://opensource.org/licenses/MIT):
15
15
 
16
- * lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
16
+ * Lodash - Copyright (c) JS Foundation and other contributors https://js.foundation/. Based on Underscore.js, copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors http://underscorejs.org/.
17
17
 
18
18
  Trademarks
19
19
  ----------
20
20
 
21
- **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks or service marks of their respective holders.
21
+ **CKEditor** is a trademark of [CKSource Holding sp. z o.o.](https://cksource.com) All other brand and product names are trademarks, registered trademarks, or service marks of their respective holders.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ckeditor/ckeditor5-find-and-replace",
3
- "version": "40.0.0",
3
+ "version": "40.1.0",
4
4
  "description": "Find and replace feature for CKEditor 5.",
5
5
  "keywords": [
6
6
  "ckeditor",
@@ -12,8 +12,8 @@
12
12
  ],
13
13
  "main": "src/index.js",
14
14
  "dependencies": {
15
- "@ckeditor/ckeditor5-ui": "40.0.0",
16
- "ckeditor5": "40.0.0",
15
+ "@ckeditor/ckeditor5-ui": "40.1.0",
16
+ "ckeditor5": "40.1.0",
17
17
  "lodash-es": "4.17.21"
18
18
  },
19
19
  "author": "CKSource (http://cksource.com/)",
@@ -1,20 +1,20 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- import type { FindAndReplace, FindAndReplaceEditing, FindAndReplaceUI, FindAndReplaceUtils, FindCommand, FindNextCommand, FindPreviousCommand, ReplaceAllCommand, ReplaceCommand } from './index';
6
- declare module '@ckeditor/ckeditor5-core' {
7
- interface PluginsMap {
8
- [FindAndReplace.pluginName]: FindAndReplace;
9
- [FindAndReplaceEditing.pluginName]: FindAndReplaceEditing;
10
- [FindAndReplaceUI.pluginName]: FindAndReplaceUI;
11
- [FindAndReplaceUtils.pluginName]: FindAndReplaceUtils;
12
- }
13
- interface CommandsMap {
14
- find: FindCommand;
15
- findNext: FindNextCommand;
16
- findPrevious: FindPreviousCommand;
17
- replace: ReplaceCommand;
18
- replaceAll: ReplaceAllCommand;
19
- }
20
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ import type { FindAndReplace, FindAndReplaceEditing, FindAndReplaceUI, FindAndReplaceUtils, FindCommand, FindNextCommand, FindPreviousCommand, ReplaceAllCommand, ReplaceCommand } from './index';
6
+ declare module '@ckeditor/ckeditor5-core' {
7
+ interface PluginsMap {
8
+ [FindAndReplace.pluginName]: FindAndReplace;
9
+ [FindAndReplaceEditing.pluginName]: FindAndReplaceEditing;
10
+ [FindAndReplaceUI.pluginName]: FindAndReplaceUI;
11
+ [FindAndReplaceUtils.pluginName]: FindAndReplaceUtils;
12
+ }
13
+ interface CommandsMap {
14
+ find: FindCommand;
15
+ findNext: FindNextCommand;
16
+ findPrevious: FindPreviousCommand;
17
+ replace: ReplaceCommand;
18
+ replaceAll: ReplaceAllCommand;
19
+ }
20
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- export {};
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ export {};
@@ -1,42 +1,42 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module find-and-replace/findandreplace
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import FindAndReplaceUI from './findandreplaceui';
10
- import FindAndReplaceEditing from './findandreplaceediting';
11
- import type { Marker } from 'ckeditor5/src/engine';
12
- export type ResultType = {
13
- id?: string;
14
- label?: string;
15
- start?: number;
16
- end?: number;
17
- marker?: Marker;
18
- };
19
- /**
20
- * The find and replace plugin.
21
- *
22
- * For a detailed overview, check the {@glink features/find-and-replace Find and replace feature documentation}.
23
- *
24
- * This is a "glue" plugin which loads the following plugins:
25
- *
26
- * * The {@link module:find-and-replace/findandreplaceediting~FindAndReplaceEditing find and replace editing feature},
27
- * * The {@link module:find-and-replace/findandreplaceui~FindAndReplaceUI find and replace UI feature}
28
- */
29
- export default class FindAndReplace extends Plugin {
30
- /**
31
- * @inheritDoc
32
- */
33
- static get requires(): readonly [typeof FindAndReplaceEditing, typeof FindAndReplaceUI];
34
- /**
35
- * @inheritDoc
36
- */
37
- static get pluginName(): "FindAndReplace";
38
- /**
39
- * @inheritDoc
40
- */
41
- init(): void;
42
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module find-and-replace/findandreplace
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import FindAndReplaceUI from './findandreplaceui';
10
+ import FindAndReplaceEditing from './findandreplaceediting';
11
+ import type { Marker } from 'ckeditor5/src/engine';
12
+ export type ResultType = {
13
+ id?: string;
14
+ label?: string;
15
+ start?: number;
16
+ end?: number;
17
+ marker?: Marker;
18
+ };
19
+ /**
20
+ * The find and replace plugin.
21
+ *
22
+ * For a detailed overview, check the {@glink features/find-and-replace Find and replace feature documentation}.
23
+ *
24
+ * This is a "glue" plugin which loads the following plugins:
25
+ *
26
+ * * The {@link module:find-and-replace/findandreplaceediting~FindAndReplaceEditing find and replace editing feature},
27
+ * * The {@link module:find-and-replace/findandreplaceui~FindAndReplaceUI find and replace UI feature}
28
+ */
29
+ export default class FindAndReplace extends Plugin {
30
+ /**
31
+ * @inheritDoc
32
+ */
33
+ static get requires(): readonly [typeof FindAndReplaceEditing, typeof FindAndReplaceUI];
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ static get pluginName(): "FindAndReplace";
38
+ /**
39
+ * @inheritDoc
40
+ */
41
+ init(): void;
42
+ }
@@ -1,84 +1,84 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module find-and-replace/findandreplace
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import FindAndReplaceUI from './findandreplaceui';
10
- import FindAndReplaceEditing from './findandreplaceediting';
11
- /**
12
- * The find and replace plugin.
13
- *
14
- * For a detailed overview, check the {@glink features/find-and-replace Find and replace feature documentation}.
15
- *
16
- * This is a "glue" plugin which loads the following plugins:
17
- *
18
- * * The {@link module:find-and-replace/findandreplaceediting~FindAndReplaceEditing find and replace editing feature},
19
- * * The {@link module:find-and-replace/findandreplaceui~FindAndReplaceUI find and replace UI feature}
20
- */
21
- export default class FindAndReplace extends Plugin {
22
- /**
23
- * @inheritDoc
24
- */
25
- static get requires() {
26
- return [FindAndReplaceEditing, FindAndReplaceUI];
27
- }
28
- /**
29
- * @inheritDoc
30
- */
31
- static get pluginName() {
32
- return 'FindAndReplace';
33
- }
34
- /**
35
- * @inheritDoc
36
- */
37
- init() {
38
- const ui = this.editor.plugins.get('FindAndReplaceUI');
39
- const findAndReplaceEditing = this.editor.plugins.get('FindAndReplaceEditing');
40
- const state = findAndReplaceEditing.state;
41
- ui.on('findNext', (event, data) => {
42
- // Data is contained only for the "find" button.
43
- if (data) {
44
- state.searchText = data.searchText;
45
- this.editor.execute('find', data.searchText, data);
46
- }
47
- else {
48
- // Find next arrow button press.
49
- this.editor.execute('findNext');
50
- }
51
- });
52
- ui.on('findPrevious', (event, data) => {
53
- if (data && state.searchText !== data.searchText) {
54
- this.editor.execute('find', data.searchText);
55
- }
56
- else {
57
- // Subsequent calls.
58
- this.editor.execute('findPrevious');
59
- }
60
- });
61
- ui.on('replace', (event, data) => {
62
- if (state.searchText !== data.searchText) {
63
- this.editor.execute('find', data.searchText);
64
- }
65
- const highlightedResult = state.highlightedResult;
66
- if (highlightedResult) {
67
- this.editor.execute('replace', data.replaceText, highlightedResult);
68
- }
69
- });
70
- ui.on('replaceAll', (event, data) => {
71
- // The state hadn't been yet built for this search text.
72
- if (state.searchText !== data.searchText) {
73
- this.editor.execute('find', data.searchText);
74
- }
75
- this.editor.execute('replaceAll', data.replaceText, state.results);
76
- });
77
- // Reset the state when the user invalidated last search results, for instance,
78
- // by starting typing another search query or changing options.
79
- ui.on('searchReseted', () => {
80
- state.clear(this.editor.model);
81
- findAndReplaceEditing.stop();
82
- });
83
- }
84
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module find-and-replace/findandreplace
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import FindAndReplaceUI from './findandreplaceui';
10
+ import FindAndReplaceEditing from './findandreplaceediting';
11
+ /**
12
+ * The find and replace plugin.
13
+ *
14
+ * For a detailed overview, check the {@glink features/find-and-replace Find and replace feature documentation}.
15
+ *
16
+ * This is a "glue" plugin which loads the following plugins:
17
+ *
18
+ * * The {@link module:find-and-replace/findandreplaceediting~FindAndReplaceEditing find and replace editing feature},
19
+ * * The {@link module:find-and-replace/findandreplaceui~FindAndReplaceUI find and replace UI feature}
20
+ */
21
+ export default class FindAndReplace extends Plugin {
22
+ /**
23
+ * @inheritDoc
24
+ */
25
+ static get requires() {
26
+ return [FindAndReplaceEditing, FindAndReplaceUI];
27
+ }
28
+ /**
29
+ * @inheritDoc
30
+ */
31
+ static get pluginName() {
32
+ return 'FindAndReplace';
33
+ }
34
+ /**
35
+ * @inheritDoc
36
+ */
37
+ init() {
38
+ const ui = this.editor.plugins.get('FindAndReplaceUI');
39
+ const findAndReplaceEditing = this.editor.plugins.get('FindAndReplaceEditing');
40
+ const state = findAndReplaceEditing.state;
41
+ ui.on('findNext', (event, data) => {
42
+ // Data is contained only for the "find" button.
43
+ if (data) {
44
+ state.searchText = data.searchText;
45
+ this.editor.execute('find', data.searchText, data);
46
+ }
47
+ else {
48
+ // Find next arrow button press.
49
+ this.editor.execute('findNext');
50
+ }
51
+ });
52
+ ui.on('findPrevious', (event, data) => {
53
+ if (data && state.searchText !== data.searchText) {
54
+ this.editor.execute('find', data.searchText);
55
+ }
56
+ else {
57
+ // Subsequent calls.
58
+ this.editor.execute('findPrevious');
59
+ }
60
+ });
61
+ ui.on('replace', (event, data) => {
62
+ if (state.searchText !== data.searchText) {
63
+ this.editor.execute('find', data.searchText);
64
+ }
65
+ const highlightedResult = state.highlightedResult;
66
+ if (highlightedResult) {
67
+ this.editor.execute('replace', data.replaceText, highlightedResult);
68
+ }
69
+ });
70
+ ui.on('replaceAll', (event, data) => {
71
+ // The state hadn't been yet built for this search text.
72
+ if (state.searchText !== data.searchText) {
73
+ this.editor.execute('find', data.searchText);
74
+ }
75
+ this.editor.execute('replaceAll', data.replaceText, state.results);
76
+ });
77
+ // Reset the state when the user invalidated last search results, for instance,
78
+ // by starting typing another search query or changing options.
79
+ ui.on('searchReseted', () => {
80
+ state.clear(this.editor.model);
81
+ findAndReplaceEditing.stop();
82
+ });
83
+ }
84
+ }
@@ -1,63 +1,63 @@
1
- /**
2
- * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
- * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
- */
5
- /**
6
- * @module find-and-replace/findandreplaceediting
7
- */
8
- import { Plugin } from 'ckeditor5/src/core';
9
- import type { Item } from 'ckeditor5/src/engine';
10
- import { type Collection } from 'ckeditor5/src/utils';
11
- import FindAndReplaceState from './findandreplacestate';
12
- import FindAndReplaceUtils from './findandreplaceutils';
13
- import type { ResultType } from './findandreplace';
14
- import '../theme/findandreplace.css';
15
- /**
16
- * Implements the editing part for find and replace plugin. For example conversion, commands etc.
17
- */
18
- export default class FindAndReplaceEditing extends Plugin {
19
- /**
20
- * @inheritDoc
21
- */
22
- static get requires(): readonly [typeof FindAndReplaceUtils];
23
- /**
24
- * @inheritDoc
25
- */
26
- static get pluginName(): "FindAndReplaceEditing";
27
- /**
28
- * The collection of currently highlighted search results.
29
- *
30
- * @private
31
- * @member {module:utils/collection~Collection} #_activeResults
32
- */
33
- private _activeResults?;
34
- /**
35
- * An object storing the find and replace state within a given editor instance.
36
- *
37
- * @member {module:find-and-replace/findandreplacestate~FindAndReplaceState} #state
38
- */
39
- state?: FindAndReplaceState;
40
- /**
41
- * @inheritDoc
42
- */
43
- init(): void;
44
- /**
45
- * Initiate a search.
46
- */
47
- find(callbackOrText: string | (({ item, text }: {
48
- item: Item;
49
- text: string;
50
- }) => Array<ResultType>)): Collection<ResultType>;
51
- /**
52
- * Stops active results from updating, and clears out the results.
53
- */
54
- stop(): void;
55
- /**
56
- * Sets up the commands.
57
- */
58
- private _defineCommands;
59
- /**
60
- * Sets up the marker downcast converters for search results highlighting.
61
- */
62
- private _defineConverters;
63
- }
1
+ /**
2
+ * @license Copyright (c) 2003-2023, CKSource Holding sp. z o.o. All rights reserved.
3
+ * For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
4
+ */
5
+ /**
6
+ * @module find-and-replace/findandreplaceediting
7
+ */
8
+ import { Plugin } from 'ckeditor5/src/core';
9
+ import type { Item } from 'ckeditor5/src/engine';
10
+ import { type Collection } from 'ckeditor5/src/utils';
11
+ import FindAndReplaceState from './findandreplacestate';
12
+ import FindAndReplaceUtils from './findandreplaceutils';
13
+ import type { ResultType } from './findandreplace';
14
+ import '../theme/findandreplace.css';
15
+ /**
16
+ * Implements the editing part for find and replace plugin. For example conversion, commands etc.
17
+ */
18
+ export default class FindAndReplaceEditing extends Plugin {
19
+ /**
20
+ * @inheritDoc
21
+ */
22
+ static get requires(): readonly [typeof FindAndReplaceUtils];
23
+ /**
24
+ * @inheritDoc
25
+ */
26
+ static get pluginName(): "FindAndReplaceEditing";
27
+ /**
28
+ * The collection of currently highlighted search results.
29
+ *
30
+ * @private
31
+ * @member {module:utils/collection~Collection} #_activeResults
32
+ */
33
+ private _activeResults?;
34
+ /**
35
+ * An object storing the find and replace state within a given editor instance.
36
+ *
37
+ * @member {module:find-and-replace/findandreplacestate~FindAndReplaceState} #state
38
+ */
39
+ state?: FindAndReplaceState;
40
+ /**
41
+ * @inheritDoc
42
+ */
43
+ init(): void;
44
+ /**
45
+ * Initiate a search.
46
+ */
47
+ find(callbackOrText: string | (({ item, text }: {
48
+ item: Item;
49
+ text: string;
50
+ }) => Array<ResultType>)): Collection<ResultType>;
51
+ /**
52
+ * Stops active results from updating, and clears out the results.
53
+ */
54
+ stop(): void;
55
+ /**
56
+ * Sets up the commands.
57
+ */
58
+ private _defineCommands;
59
+ /**
60
+ * Sets up the marker downcast converters for search results highlighting.
61
+ */
62
+ private _defineConverters;
63
+ }