From d55aeabb3ddb28c4aca1f8ebf794af001bede84f Mon Sep 17 00:00:00 2001 From: Daniel Lautzenheiser Date: Mon, 19 Sep 2022 22:35:58 -0400 Subject: [PATCH] Move sync root --- .../src/components/App/App.js | 156 ++++++++++-------- .../Editor/EditorPreviewPane/EditorPreview.js | 13 +- .../EditorPreviewContent.tsx | 2 +- .../EditorPreviewPane/EditorPreviewPane.js | 13 +- 4 files changed, 97 insertions(+), 87 deletions(-) diff --git a/packages/netlify-cms-core/src/components/App/App.js b/packages/netlify-cms-core/src/components/App/App.js index 28ce42ff..56a1154f 100644 --- a/packages/netlify-cms-core/src/components/App/App.js +++ b/packages/netlify-cms-core/src/components/App/App.js @@ -9,6 +9,7 @@ import { Route, Switch, Redirect } from 'react-router-dom'; import { Notifs } from 'redux-notifications'; import TopBarProgress from 'react-topbar-progress-indicator'; import { Loader, colors } from 'netlify-cms-ui-default'; +import { ScrollSync } from 'react-scroll-sync'; import { loginUser, logoutUser } from '../../actions/auth'; import { currentBackend } from '../../backend'; @@ -33,10 +34,15 @@ TopBarProgress.config({ barThickness: 2, }); +const AppRoot = styled.div` + width: 100%; + min-height: 100%; +`; + const AppWrapper = styled.div` width: 100%; min-height: 100%; -` +`; const AppMainContainer = styled.div` min-width: 1200px; @@ -180,80 +186,84 @@ class App extends React.Component { const hasWorkflow = publishMode === EDITORIAL_WORKFLOW; return ( - - -
- - {isFetching && } - - - - + + + +
} + onCreateEntryClick={createNewEntry} + onLogoutClick={logoutUser} + openMediaLibrary={openMediaLibrary} + hasWorkflow={hasWorkflow} + displayUrl={config.display_url} + isTestRepo={config.backend.name === 'test-repo'} + showMediaButton={showMediaButton} /> - - {hasWorkflow ? : null} - } - /> - } - /> - } - /> - } - /> - } - /> - } - /> - { - const { name, entryName } = match.params; - return ; - }} - /> - - - {useMediaLibrary ? : null} - - + + {isFetching && } + + + + } + /> + + {hasWorkflow ? : null} + } + /> + } + /> + } + /> + } + /> + } + /> + } + /> + { + const { name, entryName } = match.params; + return ; + }} + /> + + + {useMediaLibrary ? : null} + + + + ); } } diff --git a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreview.js b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreview.js index a5d1132c..35bf04d7 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreview.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreview.js @@ -2,6 +2,7 @@ import React from 'react'; import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import styled from '@emotion/styled'; +import { ScrollSyncPane } from 'react-scroll-sync'; function isVisible(field) { return field.get('widget') !== 'hidden'; @@ -26,11 +27,13 @@ export default class Preview extends React.Component { return null; } return ( - - {fields.filter(isVisible).map(field => ( -
{widgetFor(field.get('name'))}
- ))} -
+ + + {fields.filter(isVisible).map(field => ( +
{widgetFor(field.get('name'))}
+ ))} +
+
); } } diff --git a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.tsx b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.tsx index 5fe8d3fc..ec76d328 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.tsx +++ b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewContent.tsx @@ -21,7 +21,7 @@ const StyledPreviewContent = styled.div` `; const PreviewContent = ({ previewComponent, previewProps }: PreviewContentProps) => { - const element = useMemo(() => document.getElementById('nc-root'), []); + const element = useMemo(() => document.getElementById('cms-root'), []); return useMemo(() => { if (!element) { diff --git a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js index 3d9662f9..10915b2f 100644 --- a/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js +++ b/packages/netlify-cms-core/src/components/Editor/EditorPreviewPane/EditorPreviewPane.js @@ -5,7 +5,6 @@ import { List, Map } from 'immutable'; import ImmutablePropTypes from 'react-immutable-proptypes'; import { lengths } from 'netlify-cms-ui-default'; import { connect } from 'react-redux'; -import { ScrollSyncPane } from 'react-scroll-sync'; import { resolveWidget, @@ -232,13 +231,11 @@ export class PreviewPane extends React.Component { return ( - {/* attachTo={document.getElementById('control-pane')}>*/} - - - - + + + ); }