File tree Expand file tree Collapse file tree
registry/new-york/blocks/editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ A **Pagination Table** & **Scroll List** component suite for [CRUD operation][1]
242414 . [ Scroll Boundary] ( https://mobx-restful-shadcn.idea2.app/ )
252515 . [ Scroll List] ( https://mobx-restful-shadcn.idea2.app/ )
262616 . [ Searchable Input] ( https://mobx-restful-shadcn.idea2.app/ )
27+ 17 . [ Editor] ( https://mobx-restful-shadcn.idea2.app/ )
2728
2829## Installation
2930
@@ -195,6 +196,34 @@ export const EditorPage = () => (
195196);
196197```
197198
199+ ### Editor
200+
201+ ``` tsx
202+ import { configure } from " mobx" ;
203+ import { formToJSON } from " web-utility" ;
204+ import { Editor , OriginalTools , ExtraTools } from " @/components/ui/editor" ;
205+
206+ configure ({ enforceActions: " never" });
207+
208+ export const EditorPage = () => (
209+ <form
210+ onSubmit = { (event ) => {
211+ event .preventDefault ();
212+ const { content } = formToJSON (event .currentTarget );
213+ alert (content );
214+ }}
215+ >
216+ <Editor
217+ tools = { [... OriginalTools , ... ExtraTools ]}
218+ name = " content"
219+ defaultValue = " Hello <b>Edkit</b>!"
220+ onChange = { console .log }
221+ />
222+ <button type = " submit" >Submit</button >
223+ </form >
224+ );
225+ ```
226+
198227## Development
199228
200229This is a custom component registry built with Next.js and compatible with the ` shadcn ` CLI.
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { RangeInputExample } from "@/registry/new-york/blocks/range-input/exampl
1515import { FilePickerExample } from "@/registry/new-york/blocks/file-picker/example" ;
1616import { FormFieldExample } from "@/registry/new-york/blocks/form-field/example" ;
1717import { RestTableExample } from "@/registry/new-york/blocks/rest-table/example" ;
18+ import EditorExample from "@/registry/new-york/blocks/editor/example" ;
1819
1920export default function Home ( ) {
2021 return (
@@ -139,6 +140,14 @@ export default function Home() {
139140 >
140141 < RestTableExample />
141142 </ ComponentCard >
143+
144+ < ComponentCard
145+ name = "editor"
146+ description = "A lightweight rich text editor based on Edkit and Shadcn UI with various formatting tools."
147+ minHeight = "min-h-[400px]"
148+ >
149+ < EditorExample />
150+ </ ComponentCard >
142151 </ main >
143152 </ div >
144153 ) ;
Original file line number Diff line number Diff line change 33import { configure } from "mobx" ;
44import { formToJSON } from "web-utility" ;
55import { Editor , OriginalTools , ExtraTools } from "./index" ;
6+ import { Button } from "@/components/ui/button" ;
67
78configure ( { enforceActions : "never" } ) ;
89
@@ -31,12 +32,7 @@ export default function EditorExample() {
3132 onChange = { console . log }
3233 />
3334
34- < button
35- className = "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 bg-primary text-primary-foreground hover:bg-primary/90 h-9 px-4 py-2"
36- type = "submit"
37- >
38- Submit
39- </ button >
35+ < Button type = "submit" > Submit</ Button >
4036 </ div >
4137 </ form >
4238 ) ;
You can’t perform that action at this time.
0 commit comments