@jupyterlab/fileeditor 4.1.0-alpha.4 → 4.1.0-beta.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/lib/searchprovider.d.ts +13 -0
- package/lib/searchprovider.js +20 -0
- package/lib/searchprovider.js.map +1 -1
- package/package.json +14 -13
- package/src/searchprovider.ts +27 -0
package/lib/searchprovider.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import { IFilters, IReplaceOptionsSupport, ISearchProvider } from '@jupyterlab/d
|
|
|
5
5
|
import { ITranslator } from '@jupyterlab/translation';
|
|
6
6
|
import { Widget } from '@lumino/widgets';
|
|
7
7
|
import { FileEditor } from './widget';
|
|
8
|
+
import { ISharedText, SourceChange } from '@jupyter/ydoc';
|
|
8
9
|
/**
|
|
9
10
|
* Helper type
|
|
10
11
|
*/
|
|
@@ -33,6 +34,17 @@ export declare class FileEditorSearchProvider extends EditorSearchProvider<CodeE
|
|
|
33
34
|
*/
|
|
34
35
|
get model(): CodeEditor.IModel;
|
|
35
36
|
startQuery(query: RegExp, filters: IFilters | undefined): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Stop the search and clean any UI elements.
|
|
39
|
+
*/
|
|
40
|
+
endQuery(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Callback on source change
|
|
43
|
+
*
|
|
44
|
+
* @param emitter Source of the change
|
|
45
|
+
* @param changes Source change
|
|
46
|
+
*/
|
|
47
|
+
protected onSharedModelChanged(emitter: ISharedText, changes: SourceChange): Promise<void>;
|
|
36
48
|
/**
|
|
37
49
|
* Instantiate a search provider for the widget.
|
|
38
50
|
*
|
|
@@ -57,4 +69,5 @@ export declare class FileEditorSearchProvider extends EditorSearchProvider<CodeE
|
|
|
57
69
|
* @returns Initial value used to populate the search box.
|
|
58
70
|
*/
|
|
59
71
|
getInitialQuery(): string;
|
|
72
|
+
private _searchActive;
|
|
60
73
|
}
|
package/lib/searchprovider.js
CHANGED
|
@@ -14,6 +14,7 @@ export class FileEditorSearchProvider extends EditorSearchProvider {
|
|
|
14
14
|
constructor(widget) {
|
|
15
15
|
super();
|
|
16
16
|
this.widget = widget;
|
|
17
|
+
this._searchActive = false;
|
|
17
18
|
}
|
|
18
19
|
get isReadOnly() {
|
|
19
20
|
return this.editor.getOption('readOnly');
|
|
@@ -39,6 +40,7 @@ export class FileEditorSearchProvider extends EditorSearchProvider {
|
|
|
39
40
|
return this.widget.content.model;
|
|
40
41
|
}
|
|
41
42
|
async startQuery(query, filters) {
|
|
43
|
+
this._searchActive = true;
|
|
42
44
|
await super.startQuery(query, filters);
|
|
43
45
|
await this.highlightNext(true, {
|
|
44
46
|
from: 'selection-start',
|
|
@@ -46,6 +48,24 @@ export class FileEditorSearchProvider extends EditorSearchProvider {
|
|
|
46
48
|
select: false
|
|
47
49
|
});
|
|
48
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Stop the search and clean any UI elements.
|
|
53
|
+
*/
|
|
54
|
+
async endQuery() {
|
|
55
|
+
this._searchActive = false;
|
|
56
|
+
await super.endQuery();
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Callback on source change
|
|
60
|
+
*
|
|
61
|
+
* @param emitter Source of the change
|
|
62
|
+
* @param changes Source change
|
|
63
|
+
*/
|
|
64
|
+
async onSharedModelChanged(emitter, changes) {
|
|
65
|
+
if (this._searchActive) {
|
|
66
|
+
return super.onSharedModelChanged(emitter, changes);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
49
69
|
/**
|
|
50
70
|
* Instantiate a search provider for the widget.
|
|
51
71
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"searchprovider.js","sourceRoot":"","sources":["../src/searchprovider.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,2DAA2D;AAE3D,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAA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ACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;QAC3B,MAAM,KAAK,CAAC,QAAQ,EAAE,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACO,KAAK,CAAC,oBAAoB,CAClC,OAAoB,EACpB,OAAqB;QAErB,IAAI,IAAI,CAAC,aAAa,EAAE;YACtB,OAAO,KAAK,CAAC,oBAAoB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;SACrD;IACH,CAAC;IAED;;;;;;;;;;;OAWG;IACH,MAAM,CAAC,SAAS,CACd,MAAuB,EACvB,UAAwB;QAExB,OAAO,IAAI,wBAAwB,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,MAAc;QAChC,OAAO,CACL,MAAM,YAAY,cAAc;YAChC,MAAM,CAAC,OAAO,YAAY,UAAU;YACpC,MAAM,CAAC,OAAO,CAAC,MAAM,YAAY,gBAAgB,CAClD,CAAC;IACJ,CAAC;IAED;;;;;OAKG;IACH,eAAe;QACb,MAAM,EAAE,GAAG,IAAI,CAAC,MAA0B,CAAC;QAC3C,MAAM,SAAS,GAAG,EAAE,CAAC,KAAK,CAAC,QAAQ,CACjC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAC5B,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAC3B,CAAC;QACF,OAAO,SAAS,CAAC;IACnB,CAAC;CAGF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/fileeditor",
|
|
3
|
-
"version": "4.1.0-
|
|
3
|
+
"version": "4.1.0-beta.0",
|
|
4
4
|
"description": "JupyterLab - Editor Widget",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -40,17 +40,18 @@
|
|
|
40
40
|
"watch": "tsc -b --watch"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@
|
|
44
|
-
"@jupyterlab/
|
|
45
|
-
"@jupyterlab/
|
|
46
|
-
"@jupyterlab/
|
|
47
|
-
"@jupyterlab/
|
|
48
|
-
"@jupyterlab/
|
|
49
|
-
"@jupyterlab/
|
|
50
|
-
"@jupyterlab/
|
|
51
|
-
"@jupyterlab/
|
|
52
|
-
"@jupyterlab/
|
|
53
|
-
"@jupyterlab/
|
|
43
|
+
"@jupyter/ydoc": "^1.1.1",
|
|
44
|
+
"@jupyterlab/apputils": "^4.2.0-beta.0",
|
|
45
|
+
"@jupyterlab/codeeditor": "^4.1.0-beta.0",
|
|
46
|
+
"@jupyterlab/codemirror": "^4.1.0-beta.0",
|
|
47
|
+
"@jupyterlab/coreutils": "^6.1.0-beta.0",
|
|
48
|
+
"@jupyterlab/docregistry": "^4.1.0-beta.0",
|
|
49
|
+
"@jupyterlab/documentsearch": "^4.1.0-beta.0",
|
|
50
|
+
"@jupyterlab/lsp": "^4.1.0-beta.0",
|
|
51
|
+
"@jupyterlab/statusbar": "^4.1.0-beta.0",
|
|
52
|
+
"@jupyterlab/toc": "^6.1.0-beta.0",
|
|
53
|
+
"@jupyterlab/translation": "^4.1.0-beta.0",
|
|
54
|
+
"@jupyterlab/ui-components": "^4.1.0-beta.0",
|
|
54
55
|
"@lumino/commands": "^2.2.0",
|
|
55
56
|
"@lumino/coreutils": "^2.1.2",
|
|
56
57
|
"@lumino/messaging": "^2.0.1",
|
|
@@ -59,7 +60,7 @@
|
|
|
59
60
|
"regexp-match-indices": "^1.0.2"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
|
-
"@jupyterlab/testing": "^4.1.0-
|
|
63
|
+
"@jupyterlab/testing": "^4.1.0-beta.0",
|
|
63
64
|
"@types/jest": "^29.2.0",
|
|
64
65
|
"jest": "^29.2.0",
|
|
65
66
|
"rimraf": "~5.0.5",
|
package/src/searchprovider.ts
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
import { ITranslator } from '@jupyterlab/translation';
|
|
13
13
|
import { Widget } from '@lumino/widgets';
|
|
14
14
|
import { FileEditor } from './widget';
|
|
15
|
+
import { ISharedText, SourceChange } from '@jupyter/ydoc';
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
18
|
* Helper type
|
|
@@ -64,6 +65,7 @@ export class FileEditorSearchProvider
|
|
|
64
65
|
query: RegExp,
|
|
65
66
|
filters: IFilters | undefined
|
|
66
67
|
): Promise<void> {
|
|
68
|
+
this._searchActive = true;
|
|
67
69
|
await super.startQuery(query, filters);
|
|
68
70
|
await this.highlightNext(true, {
|
|
69
71
|
from: 'selection-start',
|
|
@@ -72,6 +74,29 @@ export class FileEditorSearchProvider
|
|
|
72
74
|
});
|
|
73
75
|
}
|
|
74
76
|
|
|
77
|
+
/**
|
|
78
|
+
* Stop the search and clean any UI elements.
|
|
79
|
+
*/
|
|
80
|
+
async endQuery(): Promise<void> {
|
|
81
|
+
this._searchActive = false;
|
|
82
|
+
await super.endQuery();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* Callback on source change
|
|
87
|
+
*
|
|
88
|
+
* @param emitter Source of the change
|
|
89
|
+
* @param changes Source change
|
|
90
|
+
*/
|
|
91
|
+
protected async onSharedModelChanged(
|
|
92
|
+
emitter: ISharedText,
|
|
93
|
+
changes: SourceChange
|
|
94
|
+
): Promise<void> {
|
|
95
|
+
if (this._searchActive) {
|
|
96
|
+
return super.onSharedModelChanged(emitter, changes);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
75
100
|
/**
|
|
76
101
|
* Instantiate a search provider for the widget.
|
|
77
102
|
*
|
|
@@ -116,4 +141,6 @@ export class FileEditorSearchProvider
|
|
|
116
141
|
);
|
|
117
142
|
return selection;
|
|
118
143
|
}
|
|
144
|
+
|
|
145
|
+
private _searchActive = false;
|
|
119
146
|
}
|