Only include default preview frame styles if no preview styles are provided
This commit is contained in:
parent
8e06fe0fd6
commit
7413483266
@ -9,6 +9,10 @@ BREAKING_CHANGES
|
|||||||
- media path changed from `string | string[]` to `{ path: string | string[], alt?: string }`
|
- media path changed from `string | string[]` to `{ path: string | string[], alt?: string }`
|
||||||
- Nested collections, meta config moved into nested config.
|
- Nested collections, meta config moved into nested config.
|
||||||
|
|
||||||
|
CHANGES
|
||||||
|
|
||||||
|
- Default styles are now provided in the preview frame. If you provide your own via `registerPreviewStyle`, then these default styles will not be included.
|
||||||
|
|
||||||
ADDED
|
ADDED
|
||||||
- `forSingleList` - Allows for changing styles for single list items
|
- `forSingleList` - Allows for changing styles for single list items
|
||||||
|
|
||||||
|
@ -112,18 +112,20 @@ const PreviewPane = (props: TranslatedProps<EditorPreviewPaneProps>) => {
|
|||||||
|
|
||||||
const { widgetFor, widgetsFor } = useWidgetsFor(config, collection, fields, entry);
|
const { widgetFor, widgetsFor } = useWidgetsFor(config, collection, fields, entry);
|
||||||
|
|
||||||
const previewStyles = useMemo(
|
const previewStyles = useMemo(() => {
|
||||||
() => [
|
const styles = getPreviewStyles().map((style, i) => {
|
||||||
...getPreviewStyles().map((style, i) => {
|
if (style.raw) {
|
||||||
if (style.raw) {
|
return <style key={i}>{style.value}</style>;
|
||||||
return <style key={i}>{style.value}</style>;
|
}
|
||||||
}
|
return <link key={i} href={style.value} type="text/css" rel="stylesheet" />;
|
||||||
return <link key={i} href={style.value} type="text/css" rel="stylesheet" />;
|
});
|
||||||
}),
|
|
||||||
<style key="global">{FrameGlobalStyles}</style>,
|
if (styles.length === 0) {
|
||||||
],
|
return <style key="global">{FrameGlobalStyles}</style>;
|
||||||
[],
|
}
|
||||||
);
|
|
||||||
|
return styles;
|
||||||
|
}, []);
|
||||||
|
|
||||||
const previewComponent = useMemo(
|
const previewComponent = useMemo(
|
||||||
() => getPreviewTemplate(selectTemplateName(collection, entry.slug)) ?? EditorPreview,
|
() => getPreviewTemplate(selectTemplateName(collection, entry.slug)) ?? EditorPreview,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user