mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-02 09:35: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 previewFeaturesEnabled: boolean = false;
|
||||
public doubleClickEditEnabled: boolean;
|
||||
private _highlightRange: NotebookRange;
|
||||
|
||||
constructor(
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
|
||||
@@ -238,6 +239,7 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
||||
outputElement.style.lineHeight = this.markdownPreviewLineHeight.toString();
|
||||
this.cellModel.renderedOutputTextContent = this.getRenderedTextOutput();
|
||||
outputElement.focus();
|
||||
this.addDecoration();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -345,15 +347,18 @@ export class TextCellComponent extends CellView implements OnInit, OnChanges {
|
||||
|
||||
public deltaDecorations(newDecorationRange: NotebookRange, oldDecorationRange: NotebookRange): void {
|
||||
if (oldDecorationRange) {
|
||||
this._highlightRange = oldDecorationRange === this._highlightRange ? undefined : this._highlightRange;
|
||||
this.removeDecoration(oldDecorationRange);
|
||||
}
|
||||
|
||||
if (newDecorationRange) {
|
||||
this._highlightRange = 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) {
|
||||
let markAllOccurances = new Mark(this.output.nativeElement); // to highlight all occurances in the element.
|
||||
let elements = this.getHtmlElements();
|
||||
|
||||
Reference in New Issue
Block a user