Skip to content

Commit

Permalink
feat: add loader skeleton for rich text field (#530)
Browse files Browse the repository at this point in the history
* feat: add loader skeleton for rich text field

* fix corepack on CI
  • Loading branch information
foyarash authored Feb 3, 2025
1 parent 5989807 commit 5854cce
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 14 deletions.
5 changes: 5 additions & 0 deletions .changeset/silver-emus-hammer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@premieroctet/next-admin": patch
---

feat: add loader skeleton for rich text (#462)
2 changes: 1 addition & 1 deletion .github/workflows/check-changeset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
with:
fetch-depth: 0
- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate
- name: Set up Node.js
uses: actions/setup-node@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
steps:
- uses: actions/checkout@v3
- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate
- uses: actions/setup-node@v3
with:
node-version: 20
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
- name: Run tests
run: |
pnpm test
pnpm turbo test:e2e
pnpm turbo test:e2e
cd apps/example && pnpm prisma db seed && cd -
BASE_URL=http://localhost:3000/pagerouter/admin pnpm test:e2e
- uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
uses: actions/checkout@v3

- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reset-database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v2
- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate
- name: Install dependencies
run: pnpm install
- name: Reset database
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/vercel-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
- uses: actions/checkout@v2

- name: Enable corepack
run: corepack enable
run: corepack enable && corepack prepare [email protected] --activate

- name: Setup Node.js
uses: actions/setup-node@v3
Expand Down
19 changes: 11 additions & 8 deletions packages/next-admin/src/components/Form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
FieldTemplateProps,
getSubmitButtonOptions,
ObjectFieldTemplateProps,
SubmitButtonProps
SubmitButtonProps,
} from "@rjsf/utils";
import validator from "@rjsf/validator-ajv8";
import clsx from "clsx";
Expand All @@ -26,7 +26,7 @@ import React, {
useEffect,
useMemo,
useRef,
useState
useState,
} from "react";
import { twMerge } from "tailwind-merge";
import ClientActionDialogProvider from "../context/ClientActionDialogContext";
Expand Down Expand Up @@ -70,6 +70,7 @@ import {

const RichTextField = dynamic(() => import("./inputs/RichText/RichTextField"), {
ssr: false,
loading: () => <div className="h-48 animate-pulse rounded bg-gray-500" />,
});

const widgets: RjsfForm["props"]["widgets"] = {
Expand Down Expand Up @@ -307,12 +308,14 @@ const Form = ({

const fields: RjsfForm["props"]["fields"] = {
ArrayField: (props: FieldProps) => {
const customInput = customInputs?.[props.name as Field<ModelName>]
const improvedCustomInput = customInput ? cloneElement(customInput, {
...customInput.props,
mode: edit ? "edit" : "create",
}) : undefined;
return ArrayField({ ...props, customInput: improvedCustomInput })
const customInput = customInputs?.[props.name as Field<ModelName>];
const improvedCustomInput = customInput
? cloneElement(customInput, {
...customInput.props,
mode: edit ? "edit" : "create",
})
: undefined;
return ArrayField({ ...props, customInput: improvedCustomInput });
},
NullField,
};
Expand Down

0 comments on commit 5854cce

Please sign in to comment.