mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -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();
|
let elements = this.getHtmlElements();
|
||||||
if (elements?.length >= range.startLineNumber) {
|
if (elements?.length >= range.startLineNumber) {
|
||||||
let elementContainingText = elements[range.startLineNumber - 1];
|
let elementContainingText = elements[range.startLineNumber - 1];
|
||||||
|
let isCellActive = range.cell.active;
|
||||||
let markCurrent = new Mark(elementContainingText); // to highlight the current item of them all.
|
let markCurrent = new Mark(elementContainingText); // to highlight the current item of them all.
|
||||||
|
|
||||||
markCurrent.markRanges([{
|
markCurrent.markRanges([{
|
||||||
start: range.startColumn - 1, //subtracting 1 since markdown html is 0 indexed.
|
start: range.startColumn - 1, //subtracting 1 since markdown html is 0 indexed.
|
||||||
length: range.endColumn - range.startColumn
|
length: range.endColumn - range.startColumn
|
||||||
}], {
|
}], {
|
||||||
className: findRangeSpecificClass,
|
className: findRangeSpecificClass,
|
||||||
each: function (node, range) {
|
each: function (node, range) {
|
||||||
// node is the marked DOM element
|
if (isCellActive) {
|
||||||
node.scrollIntoView({ block: 'center' });
|
// node is the marked DOM element
|
||||||
|
node.scrollIntoView({ block: 'center' });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
|
|||||||
className: findRangeSpecificClass,
|
className: findRangeSpecificClass,
|
||||||
each: function (node, range) {
|
each: function (node, range) {
|
||||||
// node is the marked DOM element
|
// node is the marked DOM element
|
||||||
node.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
node.scrollIntoView({ block: 'center' });
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (elements?.length >= range.startLineNumber) {
|
} else if (elements?.length >= range.startLineNumber) {
|
||||||
@@ -228,7 +228,7 @@ export class OutputComponent extends CellView implements OnInit, AfterViewInit {
|
|||||||
className: findRangeSpecificClass,
|
className: findRangeSpecificClass,
|
||||||
each: function (node) {
|
each: function (node) {
|
||||||
// node is the marked DOM element
|
// 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._findDecorations.getCount(),
|
||||||
this._currentMatch
|
this._currentMatch
|
||||||
);
|
);
|
||||||
if (this._finder.getDomNode().style.visibility === 'visible' && this._previousMatch !== this._currentMatch) {
|
|
||||||
this._setCurrentFindMatch(this._currentMatch);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user