fix: Scroll to document header on page load
This commit is contained in:
@@ -512,9 +512,13 @@ export class Editor extends React.PureComponent<
|
||||
|
||||
try {
|
||||
this.mutationObserver?.disconnect();
|
||||
this.mutationObserver = observe(hash, (element) => {
|
||||
element.scrollIntoView({ behavior: "smooth" });
|
||||
});
|
||||
this.mutationObserver = observe(
|
||||
hash,
|
||||
(element) => {
|
||||
element.scrollIntoView({ behavior: "instant" });
|
||||
},
|
||||
this.elementRef.current || undefined
|
||||
);
|
||||
} catch (err) {
|
||||
// querySelector will throw an error if the hash begins with a number
|
||||
// or contains a period. This is protected against now by safeSlugify
|
||||
|
||||
@@ -284,6 +284,7 @@ function MultiplayerEditor({ onSynced, ...props }: Props, ref: any) {
|
||||
embedsDisabled={props.embedsDisabled}
|
||||
defaultValue={props.defaultValue}
|
||||
extensions={props.extensions}
|
||||
scrollTo={props.scrollTo}
|
||||
readOnly
|
||||
ref={ref}
|
||||
/>
|
||||
|
||||
Reference in New Issue
Block a user