fix: further fixes for live preview
This commit is contained in:
@@ -138,7 +138,8 @@ const PreviewView: React.FC = (props) => {
|
||||
>
|
||||
{((collectionConfig &&
|
||||
!(collectionConfig.versions?.drafts && collectionConfig.versions?.drafts?.autosave)) ||
|
||||
(global && !(global.versions?.drafts && global.versions?.drafts?.autosave))) &&
|
||||
(globalConfig &&
|
||||
!(globalConfig.versions?.drafts && globalConfig.versions?.drafts?.autosave))) &&
|
||||
!disableLeaveWithoutSaving && <LeaveWithoutSaving />}
|
||||
<SetStepNav
|
||||
collectionSlug={collectionSlug}
|
||||
@@ -188,7 +189,7 @@ const PreviewView: React.FC = (props) => {
|
||||
/>
|
||||
{AfterDocument}
|
||||
</div>
|
||||
<LivePreview {...props} />
|
||||
<LivePreview collectionSlug={collectionSlug} globalSlug={globalSlug} />
|
||||
</div>
|
||||
</Form>
|
||||
</OperationProvider>
|
||||
@@ -199,7 +200,6 @@ const PreviewView: React.FC = (props) => {
|
||||
export const LivePreviewClient: React.FC<{
|
||||
breakpoints: LivePreviewConfig['breakpoints']
|
||||
initialData: Data
|
||||
livePreviewConfig: LivePreviewConfig
|
||||
url: string
|
||||
}> = (props) => {
|
||||
const { breakpoints, url } = props
|
||||
|
||||
@@ -61,12 +61,5 @@ export const LivePreviewView: EditViewComponent = async (props) => {
|
||||
})
|
||||
: livePreviewConfig?.url
|
||||
|
||||
return (
|
||||
<LivePreviewClient
|
||||
breakpoints={breakpoints}
|
||||
initialData={data}
|
||||
livePreviewConfig={livePreviewConfig}
|
||||
url={url}
|
||||
/>
|
||||
)
|
||||
return <LivePreviewClient breakpoints={breakpoints} initialData={data} url={url} />
|
||||
}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { Block } from '../../../../packages/payload/src/fields/config/types.js'
|
||||
|
||||
import { slateEditor } from '../../../../packages/richtext-slate/src/index.js'
|
||||
|
||||
export const Archive: Block = {
|
||||
slug: 'archive',
|
||||
labels: {
|
||||
@@ -11,6 +13,7 @@ export const Archive: Block = {
|
||||
name: 'introContent',
|
||||
label: 'Intro Content',
|
||||
type: 'richText',
|
||||
editor: slateEditor({}),
|
||||
},
|
||||
{
|
||||
name: 'populateBy',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Block } from '../../../../packages/payload/src/fields/config/types.js'
|
||||
|
||||
import { slateEditor } from '../../../../packages/richtext-slate/src/index.js'
|
||||
import { invertBackground } from '../../fields/invertBackground.js'
|
||||
import linkGroup from '../../fields/linkGroup.js'
|
||||
|
||||
@@ -15,6 +16,7 @@ export const CallToAction: Block = {
|
||||
name: 'richText',
|
||||
label: 'Rich Text',
|
||||
type: 'richText',
|
||||
editor: slateEditor({}),
|
||||
},
|
||||
linkGroup({
|
||||
appearances: ['primary', 'secondary'],
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { Block, Field } from '../../../../packages/payload/src/fields/config/types.js'
|
||||
|
||||
import { slateEditor } from '../../../../packages/richtext-slate/src/index.js'
|
||||
import { invertBackground } from '../../fields/invertBackground.js'
|
||||
import link from '../../fields/link.js'
|
||||
|
||||
@@ -31,6 +32,7 @@ const columnFields: Field[] = [
|
||||
name: 'richText',
|
||||
label: 'Rich Text',
|
||||
type: 'richText',
|
||||
editor: slateEditor({}),
|
||||
},
|
||||
{
|
||||
name: 'enableLink',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { CollectionConfig } from '../../../packages/payload/src/collections/config/types.js'
|
||||
|
||||
import { lexicalEditor } from '../../../packages/richtext-lexical/src/index.js'
|
||||
import { slateEditor } from '../../../packages/richtext-slate/src/index.js'
|
||||
import { Archive } from '../blocks/ArchiveBlock/index.js'
|
||||
import { CallToAction } from '../blocks/CallToAction/index.js'
|
||||
import { Content } from '../blocks/Content/index.js'
|
||||
@@ -76,6 +77,7 @@ export const Pages: CollectionConfig = {
|
||||
label: 'Rich Text — Slate',
|
||||
type: 'richText',
|
||||
name: 'richTextSlate',
|
||||
editor: slateEditor({}),
|
||||
},
|
||||
{
|
||||
label: 'Rich Text — Lexical',
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import type { Field } from '../../../packages/payload/src/fields/config/types.js'
|
||||
|
||||
import { slateEditor } from '../../../packages/richtext-slate/src/index.js'
|
||||
|
||||
export const hero: Field = {
|
||||
name: 'hero',
|
||||
label: false,
|
||||
@@ -30,6 +32,7 @@ export const hero: Field = {
|
||||
name: 'richText',
|
||||
label: 'Rich Text',
|
||||
type: 'richText',
|
||||
editor: slateEditor({}),
|
||||
},
|
||||
{
|
||||
name: 'media',
|
||||
|
||||
Reference in New Issue
Block a user