mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
fix: find highlight disappears on clicking the cell (#14342)
* update content only when changed * maintain thr highlight on rerenders * pr comments
This commit is contained in:
@@ -93,6 +93,7 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
public readonly onDidClickLink = this._onDidClickLink.event;
|
public readonly onDidClickLink = this._onDidClickLink.event;
|
||||||
public previewFeaturesEnabled: boolean = false;
|
public previewFeaturesEnabled: boolean = false;
|
||||||
public doubleClickEditEnabled: boolean;
|
public doubleClickEditEnabled: boolean;
|
||||||
|
private _highlightRange: NotebookRange;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||||
@@ -238,6 +239,7 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
outputElement.style.lineHeight = this.markdownPreviewLineHeight.toString();
|
outputElement.style.lineHeight = this.markdownPreviewLineHeight.toString();
|
||||||
this.cellModel.renderedOutputTextContent = this.getRenderedTextOutput();
|
this.cellModel.renderedOutputTextContent = this.getRenderedTextOutput();
|
||||||
outputElement.focus();
|
outputElement.focus();
|
||||||
|
this.addDecoration();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -345,15 +347,18 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
|||||||
|
|
||||||
public deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void {
|
public deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void {
|
||||||
if (oldDecorationRange) {
|
if (oldDecorationRange) {
|
||||||
|
this._highlightRange = oldDecorationRange === this._highlightRange ? undefined : this._highlightRange;
|
||||||
this.removeDecoration(oldDecorationRange);
|
this.removeDecoration(oldDecorationRange);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newDecorationRange) {
|
if (newDecorationRange) {
|
||||||
|
this._highlightRange = newDecorationRange;
|
||||||
this.addDecoration(newDecorationRange);
|
this.addDecoration(newDecorationRange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private addDecoration(range: NotebookRange): void {
|
private addDecoration(range?: NotebookRange): void {
|
||||||
|
range = range ?? this._highlightRange;
|
||||||
if (range && this.output && this.output.nativeElement) {
|
if (range && this.output && this.output.nativeElement) {
|
||||||
let markAllOccurances = new Mark(this.output.nativeElement); // to highlight all occurances in the element.
|
let markAllOccurances = new Mark(this.output.nativeElement); // to highlight all occurances in the element.
|
||||||
let elements = this.getHtmlElements();
|
let elements = this.getHtmlElements();
|
||||||
|
|||||||
Reference in New Issue
Block a user