mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-28 17:23:19 -05:00
Notebook scrolling to search result instead of selected cell (#20580)
* do not scroll to current result if there's other cell active Co-authored-by: Charles Gagnon <chgagnon@microsoft.com>
This commit is contained in:
@@ -73,16 +73,18 @@ export abstract class CellView extends AngularDisposable implements OnDestroy, I
|
||||
let elements = this.getHtmlElements();
|
||||
if (elements?.length >= range.startLineNumber) {
|
||||
let elementContainingText = elements[range.startLineNumber - 1];
|
||||
let isCellActive = range.cell.active;
|
||||
let markCurrent = new Mark(elementContainingText); // to highlight the current item of them all.
|
||||
|
||||
markCurrent.markRanges([{
|
||||
start: range.startColumn - 1, //subtracting 1 since markdown html is 0 indexed.
|
||||
length: range.endColumn - range.startColumn
|
||||
}], {
|
||||
className: findRangeSpecificClass,
|
||||
each: function (node, range) {
|
||||
// node is the marked DOM element
|
||||
node.scrollIntoView({ block: 'center' });
|
||||
if (isCellActive) {
|
||||
// node is the marked DOM element
|
||||
node.scrollIntoView({ block: 'center' });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
|
||||
className: findRangeSpecificClass,
|
||||
each: function (node, range) {
|
||||
// node is the marked DOM element
|
||||
node.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
node.scrollIntoView({ block: 'center' });
|
||||
}
|
||||
});
|
||||
} else if (elements?.length >= range.startLineNumber) {
|
||||
@@ -228,7 +228,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
|
||||
className: findRangeSpecificClass,
|
||||
each: function (node) {
|
||||
// node is the marked DOM element
|
||||
node.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
node.scrollIntoView({ block: 'center' });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -350,9 +350,6 @@ export class NotebookEditor extends EditorPane implements IFindNotebookControlle
|
||||
this._findDecorations.getCount(),
|
||||
this._currentMatch
|
||||
);
|
||||
if (this._finder.getDomNode().style.visibility === 'visible' && this._previousMatch !== this._currentMatch) {
|
||||
this._setCurrentFindMatch(this._currentMatch);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user