From 221e7e94fd169e91b860b2575389feea78113aa4 Mon Sep 17 00:00:00 2001 From: Tanmay Deshmukh Date: Thu, 11 Apr 2024 21:31:02 +0000 Subject: [PATCH 1/3] Removed broken gif links in README.md files --- packages/json-extension/README.md | 2 -- packages/statusbar-extension/README.md | 2 -- packages/vega5-extension/README.md | 2 -- 3 files changed, 6 deletions(-) diff --git a/packages/json-extension/README.md b/packages/json-extension/README.md index 81c247901c76..79926552fe21 100644 --- a/packages/json-extension/README.md +++ b/packages/json-extension/README.md @@ -2,8 +2,6 @@ A JupyterLab extension for rendering JSON as a tree -![demo](http://g.recordit.co/mqve0QPqyM.gif) - This extension is in the official JupyterLab distribution. ## Usage diff --git a/packages/statusbar-extension/README.md b/packages/statusbar-extension/README.md index 93578ab411e2..b1d41ab1ad43 100644 --- a/packages/statusbar-extension/README.md +++ b/packages/statusbar-extension/README.md @@ -4,10 +4,8 @@ This extension creates a generic statusbar to showcase the various states of Jup extensions to add custom elements into the statusbar. Changing Contexts -![Context Changes](http://g.recordit.co/OndGalRjws.gif) Component Interactions -![Component Previews](http://g.recordit.co/jT0NA6D9c9.gif) ## Dependencies diff --git a/packages/vega5-extension/README.md b/packages/vega5-extension/README.md index 3be91d7db821..92e33957d3a6 100644 --- a/packages/vega5-extension/README.md +++ b/packages/vega5-extension/README.md @@ -2,8 +2,6 @@ A JupyterLab extension for rendering [Vega](https://vega.github.io/vega) 5 and [Vega-Lite](https://vega.github.io/vega-lite) 3. -![demo](http://g.recordit.co/USoTkuCOfR.gif) - This extension is in the official JupyterLab distribution. ## Usage From 7b9554212ac9fd8ef7396c7228dd02a1961333f0 Mon Sep 17 00:00:00 2001 From: Tanmay Deshmukh Date: Thu, 11 Apr 2024 23:39:39 +0000 Subject: [PATCH 2/3] Removed unnecessary lines from statusbar-extension's README.md --- packages/statusbar-extension/README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/statusbar-extension/README.md b/packages/statusbar-extension/README.md index b1d41ab1ad43..db78bcbd3eb4 100644 --- a/packages/statusbar-extension/README.md +++ b/packages/statusbar-extension/README.md @@ -3,10 +3,6 @@ This extension creates a generic statusbar to showcase the various states of JupyterLab. Different components will render depending on the active context: notebook, console, file editor, and terminal. This extension can be used by other extensions to add custom elements into the statusbar. -Changing Contexts - -Component Interactions - ## Dependencies - JupyterLab From 2b07cbba077dd13c7643208d00eef998a3a70b9b Mon Sep 17 00:00:00 2001 From: Tanmay Deshmukh Date: Sat, 13 Apr 2024 17:15:03 +0000 Subject: [PATCH 3/3] Fix for issue #15966. Cell outputs searched even when replace is active, replace button is disabled when highlighting an output, and replace all only replaces editable strings. --- packages/documentsearch/src/searchmodel.ts | 18 ++++++++++++++++-- packages/documentsearch/src/searchview.tsx | 10 +++++++++- packages/documentsearch/src/tokens.ts | 5 +++++ packages/notebook/src/searchprovider.ts | 2 +- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/packages/documentsearch/src/searchmodel.ts b/packages/documentsearch/src/searchmodel.ts index 6b12c790091c..bfbf901fde11 100644 --- a/packages/documentsearch/src/searchmodel.ts +++ b/packages/documentsearch/src/searchmodel.ts @@ -182,6 +182,13 @@ export class SearchDocumentModel } } + /** + * Whether the replace button is enabled or not. + */ + get replaceEnabled(): boolean { + return this._replaceEnabled; + } + /** * Search expression */ @@ -270,7 +277,10 @@ export class SearchDocumentModel * Highlight the next match. */ async highlightNext(): Promise { - await this.searchProvider.highlightNext(); + const match = await this.searchProvider.highlightNext(); + if (match) { + this._replaceEnabled = match.node == undefined; + } // Emit state change as the index needs to be updated this.stateChanged.emit(); } @@ -279,7 +289,10 @@ export class SearchDocumentModel * Highlight the previous match */ async highlightPrevious(): Promise { - await this.searchProvider.highlightPrevious(); + const match = await this.searchProvider.highlightPrevious(); + if (match) { + this._replaceEnabled = match.node == undefined; + } // Emit state change as the index needs to be updated this.stateChanged.emit(); } @@ -386,6 +399,7 @@ export class SearchDocumentModel private _initialQuery = ''; private _filters: IFilters = {}; private _replaceText: string = ''; + private _replaceEnabled = true; private _searchActive = false; private _searchDebouncer: Debouncer; private _searchExpression = ''; diff --git a/packages/documentsearch/src/searchview.tsx b/packages/documentsearch/src/searchview.tsx index 4f772a7e9217..409ff6b26b62 100644 --- a/packages/documentsearch/src/searchview.tsx +++ b/packages/documentsearch/src/searchview.tsx @@ -218,6 +218,7 @@ interface IReplaceEntryProps { preserveCase: boolean; replaceOptionsSupport: IReplaceOptionsSupport | undefined; replaceText: string; + replaceEnabled: boolean; translator?: ITranslator; } @@ -259,6 +260,7 @@ function ReplaceEntry(props: IReplaceEntryProps): JSX.Element { className={REPLACE_BUTTON_WRAPPER_CLASS} onClick={() => props.onReplaceCurrent()} tabIndex={0} + disabled={!props.replaceEnabled} > { onReplaceAll={() => this.props.onReplaceAll()} replaceOptionsSupport={this.props.replaceOptionsSupport} replaceText={this.props.replaceText} + replaceEnabled={this.props.replaceEnabled} preserveCase={this.props.preserveCase} translator={this.translator} /> @@ -912,6 +919,7 @@ export class SearchDocumentView extends VDomRenderer { filtersVisible={this._showFilters} replaceOptionsSupport={this.model.replaceOptionsSupport} replaceText={this.model.replaceText} + replaceEnabled={this.model.replaceEnabled} initialSearchText={this.model.initialQuery} searchInputRef={ this._searchInput as React.RefObject diff --git a/packages/documentsearch/src/tokens.ts b/packages/documentsearch/src/tokens.ts index 3d6359763c97..9dd66e7ebb39 100644 --- a/packages/documentsearch/src/tokens.ts +++ b/packages/documentsearch/src/tokens.ts @@ -174,6 +174,11 @@ export interface ISearchMatch { * Start location of the match (in a text, this is the column) */ position: number; + + /** + * Node containing the match + */ + node?: Text; } /** diff --git a/packages/notebook/src/searchprovider.ts b/packages/notebook/src/searchprovider.ts index 8b7f3ea9a1ad..03b1eb69d0a0 100644 --- a/packages/notebook/src/searchprovider.ts +++ b/packages/notebook/src/searchprovider.ts @@ -237,7 +237,7 @@ export class NotebookSearchProvider extends SearchProvider { 'Search in the cell outputs (not available when replace options are shown).' ), default: false, - supportReplace: false + supportReplace: true }, selection: { title: