Fix scrollbar position for no-preview editor

This commit is contained in:
Daniel Lautzenheiser 2023-04-17 14:14:00 -04:00
parent 213b2336b6
commit 3112acff9b
2 changed files with 15 additions and 9 deletions

View File

@ -2,13 +2,13 @@ import SelectUnstyled from '@mui/base/SelectUnstyled';
import { KeyboardArrowDown as KeyboardArrowDownIcon } from '@styled-icons/material/KeyboardArrowDown';
import React, { forwardRef, useCallback, useState } from 'react';
import useDebounce from '@staticcms/core/lib/hooks/useDebounce';
import useElementSize from '@staticcms/core/lib/hooks/useElementSize';
import classNames from '@staticcms/core/lib/util/classNames.util';
import { isNotEmpty } from '@staticcms/core/lib/util/string.util';
import Option from './Option';
import type { FocusEvent, KeyboardEvent, MouseEvent, ReactNode, Ref } from 'react';
import useDebounce from '@staticcms/core/lib/hooks/useDebounce';
export interface Option {
label: string;

View File

@ -3,6 +3,7 @@ import { ScrollSyncPane } from 'react-scroll-sync';
import useBreadcrumbs from '@staticcms/core/lib/hooks/useBreadcrumbs';
import { getI18nInfo, getPreviewEntry, hasI18n } from '@staticcms/core/lib/i18n';
import classNames from '@staticcms/core/lib/util/classNames.util';
import {
getFileFromSlug,
selectEntryCollectionTitle,
@ -47,7 +48,7 @@ const EditorContent = ({
} else {
return (
<div className="flex justify-center">
<div className="w-editor-only max-w-full h-main">{editor}</div>
<div className="w-editor-only max-w-full">{editor}</div>
</div>
);
}
@ -166,12 +167,17 @@ const EditorInterface = ({
<div
key={defaultLocale}
id="control-pane"
className="
w-full
overflow-y-auto
styled-scrollbars
h-main
"
className={classNames(
`
w-full
`,
(finalPreviewActive || i18nActive) &&
`
overflow-y-auto
styled-scrollbars
h-main
`,
)}
>
<EditorControlPane
collection={collection}
@ -251,7 +257,7 @@ const EditorInterface = ({
<MainView
breadcrumbs={breadcrumbs}
noMargin
noScroll
noScroll={finalPreviewActive || i18nActive}
navbarActions={
<EditorToolbar
isPersisting={entry.isPersisting}