@ckeditor/ckeditor5-find-and-replace 39.0.2 → 40.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.
- package/build/find-and-replace.js.map +1 -0
- package/build/translations/pt-br.js +1 -1
- package/lang/translations/pt-br.po +6 -6
- package/package.json +3 -3
- package/src/augmentation.d.ts +20 -20
- package/src/augmentation.js +5 -5
- package/src/findandreplace.d.ts +42 -42
- package/src/findandreplace.js +84 -84
- package/src/findandreplaceediting.d.ts +63 -63
- package/src/findandreplaceediting.js +201 -201
- package/src/findandreplacestate.d.ts +69 -69
- package/src/findandreplacestate.js +60 -60
- package/src/findandreplaceui.d.ts +55 -55
- package/src/findandreplaceui.js +132 -132
- package/src/findandreplaceutils.d.ts +67 -67
- package/src/findandreplaceutils.js +143 -143
- package/src/findcommand.d.ts +51 -51
- package/src/findcommand.js +63 -63
- package/src/findnextcommand.d.ts +35 -35
- package/src/findnextcommand.js +47 -47
- package/src/findpreviouscommand.d.ts +19 -19
- package/src/findpreviouscommand.js +25 -25
- package/src/index.d.ts +17 -17
- package/src/index.js +17 -17
- package/src/replaceallcommand.d.ts +35 -35
- package/src/replaceallcommand.js +50 -50
- package/src/replacecommand.d.ts +22 -22
- package/src/replacecommand.js +20 -20
- package/src/replacecommandbase.d.ts +31 -31
- package/src/replacecommandbase.js +56 -56
- package/src/ui/findandreplaceformview.d.ts +288 -288
- package/src/ui/findandreplaceformview.js +453 -453
package/src/findandreplace.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/src/findandreplace.js
CHANGED
|
@@ -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
|
+
}
|