fix: i18n reversion (#860)

This commit is contained in:
Daniel Lautzenheiser 2023-09-01 12:14:34 -04:00 committed by GitHub
parent b3143148ab
commit 42ec8e8252
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4,7 +4,7 @@ import { ScrollSyncPane } from 'react-scroll-sync';
import { EDITOR_SIZE_COMPACT } from '@staticcms/core/constants/views';
import { summaryFormatter } from '@staticcms/core/lib/formatters';
import useBreadcrumbs from '@staticcms/core/lib/hooks/useBreadcrumbs';
import { getI18nInfo, hasI18n } from '@staticcms/core/lib/i18n';
import { getI18nInfo, getPreviewEntry, hasI18n } from '@staticcms/core/lib/i18n';
import classNames from '@staticcms/core/lib/util/classNames.util';
import {
getFileFromSlug,
@ -305,6 +305,10 @@ const EditorInterface = ({
[collection, entry, fields, fieldsErrors, handleLocaleChange, selectedLocale, submitted, t],
);
const previewEntry = collectHasI18n
? getPreviewEntry(entry, selectedLocale, defaultLocale)
: entry;
const mobileLocaleEditor = useMemo(
() => (
<div
@ -351,7 +355,7 @@ const EditorInterface = ({
collection={collection}
previewInFrame={previewInFrame}
livePreviewUrlTemplate={livePreviewUrlTemplate}
entry={entry}
entry={previewEntry}
fields={fields}
editorSize={editorSize}
showMobilePreview={showMobilePreview}