mirror of
https://github.com/siyuan-note/siyuan.git
synced 2025-12-19 16:10:12 +01:00
This commit is contained in:
parent
31b98aaaa0
commit
8a70820cc5
1 changed files with 3 additions and 2 deletions
|
|
@ -388,11 +388,12 @@ const switchEditor = (editor: Editor, options: IOpenFileOptions, allModels: IMod
|
||||||
highlightById(editor.editor.protyle, options.id, "start");
|
highlightById(editor.editor.protyle, options.id, "start");
|
||||||
} else if (options.action?.includes(Constants.CB_GET_FOCUS)) {
|
} else if (options.action?.includes(Constants.CB_GET_FOCUS)) {
|
||||||
if (nodeElement) {
|
if (nodeElement) {
|
||||||
const newRange = focusBlock(nodeElement, undefined, !options.action?.includes(Constants.CB_GET_OUTLINE));
|
const isFromOutline = options.action?.includes(Constants.CB_GET_OUTLINE);
|
||||||
|
const newRange = focusBlock(nodeElement, undefined, !isFromOutline);
|
||||||
if (newRange) {
|
if (newRange) {
|
||||||
editor.editor.protyle.toolbar.range = newRange;
|
editor.editor.protyle.toolbar.range = newRange;
|
||||||
}
|
}
|
||||||
scrollCenter(editor.editor.protyle, editor.editor.protyle.disabled ? nodeElement : null);
|
scrollCenter(editor.editor.protyle, (editor.editor.protyle.disabled || isFromOutline) ? nodeElement : null, isFromOutline ? "start" : "nearest");
|
||||||
editor.editor.protyle.observerLoad = new ResizeObserver(() => {
|
editor.editor.protyle.observerLoad = new ResizeObserver(() => {
|
||||||
if (document.contains(nodeElement)) {
|
if (document.contains(nodeElement)) {
|
||||||
scrollCenter(editor.editor.protyle);
|
scrollCenter(editor.editor.protyle);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue