Merge branch 'v2'

This commit is contained in:
Daniel Lautzenheiser 2023-04-25 08:24:04 -04:00
commit 60230872ac
5 changed files with 18 additions and 8 deletions

View File

@ -1,5 +1,5 @@
{
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"useWorkspaces": true,
"version": "2.0.0"
"version": "2.0.1"
}

View File

@ -1,3 +1,7 @@
[[plugins]]
package = "@netlify/plugin-nextjs"
[[redirects]]
from = "https://staticjscms.netlify.app/*"
to = "https://www.staticcms.org/:splat"
status = 301

View File

@ -1,6 +1,6 @@
{
"name": "@staticcms/app",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"description": "Static CMS application.",
"repository": "https://github.com/StaticJsCMS/static-cms",
@ -40,7 +40,7 @@
"@babel/eslint-parser": "7.21.3",
"@babel/runtime": "7.21.0",
"@emotion/babel-preset-css-prop": "11.10.0",
"@staticcms/core": "^2.0.0",
"@staticcms/core": "^2.0.1",
"buffer": "6.0.3",
"react": "18.2.0",
"react-dom": "18.2.0",

View File

@ -1,6 +1,6 @@
{
"name": "@staticcms/core",
"version": "2.0.0",
"version": "2.0.1",
"license": "MIT",
"description": "Static CMS core application.",
"repository": "https://github.com/StaticJsCMS/static-cms",

View File

@ -118,7 +118,10 @@ export function getPreviewStyles() {
/**
* Preview Templates
*/
export function registerPreviewTemplate<T>(name: string, component: TemplatePreviewComponent<T>) {
export function registerPreviewTemplate<T, EF extends BaseField = UnknownField>(
name: string,
component: TemplatePreviewComponent<T, EF>,
) {
registry.templates[name] = component as TemplatePreviewComponent<ObjectValue>;
}
@ -129,7 +132,10 @@ export function getPreviewTemplate(name: string): TemplatePreviewComponent<Objec
/**
* Preview Cards
*/
export function registerPreviewCard<T>(name: string, component: TemplatePreviewCardComponent<T>) {
export function registerPreviewCard<T, EF extends BaseField = UnknownField>(
name: string,
component: TemplatePreviewCardComponent<T, EF>,
) {
registry.cards[name] = component as TemplatePreviewCardComponent<ObjectValue>;
}
@ -140,10 +146,10 @@ export function getPreviewCard(name: string): TemplatePreviewCardComponent<Objec
/**
* Field Previews
*/
export function registerFieldPreview<T>(
export function registerFieldPreview<T, F extends BaseField = UnknownField>(
collectionName: string,
fieldName: string,
component: FieldPreviewComponent<T>,
component: FieldPreviewComponent<T, F>,
) {
if (!(collectionName in registry.fieldPreviews)) {
registry.fieldPreviews[collectionName] = {};