Clicking top bar scrolls to top of page
parent
1ac494765f
commit
aed8bef208
|
@ -30,6 +30,7 @@ export function TopBar({
|
||||||
progressPerc,
|
progressPerc,
|
||||||
completer,
|
completer,
|
||||||
lhs,
|
lhs,
|
||||||
|
onClick,
|
||||||
rhs,
|
rhs,
|
||||||
}: {
|
}: {
|
||||||
pageName?: string;
|
pageName?: string;
|
||||||
|
@ -41,6 +42,7 @@ export function TopBar({
|
||||||
vimMode: boolean;
|
vimMode: boolean;
|
||||||
progressPerc?: number;
|
progressPerc?: number;
|
||||||
onRename: (newName?: string) => Promise<void>;
|
onRename: (newName?: string) => Promise<void>;
|
||||||
|
onClick: () => void;
|
||||||
completer: (context: CompletionContext) => Promise<CompletionResult | null>;
|
completer: (context: CompletionContext) => Promise<CompletionResult | null>;
|
||||||
actionButtons: ActionButton[];
|
actionButtons: ActionButton[];
|
||||||
lhs?: ComponentChildren;
|
lhs?: ComponentChildren;
|
||||||
|
@ -77,7 +79,11 @@ export function TopBar({
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div id="sb-top" className={syncFailures > 1 ? "sb-sync-error" : undefined}>
|
<div
|
||||||
|
id="sb-top"
|
||||||
|
className={syncFailures > 1 ? "sb-sync-error" : undefined}
|
||||||
|
onClick={onClick}
|
||||||
|
>
|
||||||
{lhs}
|
{lhs}
|
||||||
<div className="main">
|
<div className="main">
|
||||||
<div className="inner">
|
<div className="inner">
|
||||||
|
|
|
@ -187,6 +187,9 @@ export class MainUI {
|
||||||
darkMode={viewState.uiOptions.darkMode}
|
darkMode={viewState.uiOptions.darkMode}
|
||||||
progressPerc={viewState.progressPerc}
|
progressPerc={viewState.progressPerc}
|
||||||
completer={editor.miniEditorComplete.bind(editor)}
|
completer={editor.miniEditorComplete.bind(editor)}
|
||||||
|
onClick={() => {
|
||||||
|
editor.editorView.scrollDOM.scrollTop = 0;
|
||||||
|
}}
|
||||||
onRename={async (newName) => {
|
onRename={async (newName) => {
|
||||||
if (!newName) {
|
if (!newName) {
|
||||||
// Always move cursor to the start of the page
|
// Always move cursor to the start of the page
|
||||||
|
|
Loading…
Reference in New Issue