draftify-react 0.1.2 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +190 -0
- package/dist/draftify-react.es.js +6592 -33803
- package/dist/draftify-react.umd.js +17 -238
- package/index.d.ts +192 -0
- package/package.json +4 -3
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# Draftify React ✨
|
|
2
|
+
|
|
3
|
+
**A ready-to-use React editor built on top of Draftify**
|
|
4
|
+
|
|
5
|
+
`draftify-react` is a **fully styled, production-ready React editor** powered by the `draftify` core engine. It provides an out-of-the-box editing experience while preserving the structured, schema-driven philosophy of Draftify.
|
|
6
|
+
|
|
7
|
+
This package focuses purely on **UI and interaction**.
|
|
8
|
+
All document logic lives in `draftify`.
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## ⚠️ Important Dependency Notice
|
|
13
|
+
|
|
14
|
+
`draftify-react` **does not work on its own**.
|
|
15
|
+
|
|
16
|
+
It requires the core engine:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install draftify
|
|
20
|
+
npm install draftify-react
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`draftify-react` consumes and manipulates Draftify documents internally, so both packages must be installed.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
- ✅ Ready-to-use rich editor
|
|
30
|
+
- ✅ Built on top of `draftify`
|
|
31
|
+
- ✅ Precompiled CSS (no Tailwind setup required)
|
|
32
|
+
- ✅ Tailwind v4 compatible
|
|
33
|
+
- ✅ Drag & drop block reordering
|
|
34
|
+
- ✅ Document metadata handling
|
|
35
|
+
- ✅ Preview & editor modes
|
|
36
|
+
- ✅ Clipboard, export & formatting support
|
|
37
|
+
- ✅ Zero configuration required to start
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Installation
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install draftify draftify-react
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Basic Usage
|
|
50
|
+
|
|
51
|
+
```jsx
|
|
52
|
+
import DraftifyReact from "draftify-react";
|
|
53
|
+
import "draftify-react/styles.css";
|
|
54
|
+
|
|
55
|
+
export default function App() {
|
|
56
|
+
return (
|
|
57
|
+
<div>
|
|
58
|
+
<DraftifyReact />
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
That’s all you need for a working editor.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Styling (Required)
|
|
69
|
+
|
|
70
|
+
`draftify-react` ships with **precompiled CSS**.
|
|
71
|
+
|
|
72
|
+
You must import it **once** in your app:
|
|
73
|
+
|
|
74
|
+
```css
|
|
75
|
+
@import "draftify-react/styles.css";
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Tailwind v4 Users
|
|
79
|
+
|
|
80
|
+
If your project uses Tailwind v4, no extra configuration is required.
|
|
81
|
+
All Draftify styles are already compiled and scoped.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Editor Behavior
|
|
86
|
+
|
|
87
|
+
The editor supports:
|
|
88
|
+
|
|
89
|
+
- Multiple block types
|
|
90
|
+
- Inline editing
|
|
91
|
+
- Drag & drop ordering
|
|
92
|
+
- Preview vs edit mode
|
|
93
|
+
- Copy / export helpers
|
|
94
|
+
- Metadata prompts (title, description, author)
|
|
95
|
+
|
|
96
|
+
All content is internally represented using Draftify’s schema.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Hooks API
|
|
101
|
+
|
|
102
|
+
### `useDraftifyReact`
|
|
103
|
+
|
|
104
|
+
```ts
|
|
105
|
+
import { useDraftifyReact } from "draftify-react";
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
This hook powers the editor internally and exposes:
|
|
109
|
+
|
|
110
|
+
- Document state
|
|
111
|
+
- Block data
|
|
112
|
+
- Block creation & modification helpers
|
|
113
|
+
- Drag & drop handlers
|
|
114
|
+
- UI state helpers
|
|
115
|
+
|
|
116
|
+
> Advanced users can build **custom editors or wrappers** using this hook.
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## Project Structure
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
draftify-react/
|
|
124
|
+
├─ dist/
|
|
125
|
+
│ ├─ draftify-react.es.js
|
|
126
|
+
│ ├─ draftify-react.umd.js
|
|
127
|
+
│ └─ draftify-react.css
|
|
128
|
+
│
|
|
129
|
+
├─ index.d.ts
|
|
130
|
+
├─ package.json
|
|
131
|
+
└─ README.md
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
The distributed package contains only what is required at runtime.
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## Exports
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
import DraftifyReact from "draftify-react";
|
|
142
|
+
import { useDraftifyReact } from "draftify-react";
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Styles:
|
|
146
|
+
|
|
147
|
+
```css
|
|
148
|
+
@import "draftify-react/styles.css";
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Why This Package Exists
|
|
154
|
+
|
|
155
|
+
Draftify was designed with separation of concerns in mind.
|
|
156
|
+
|
|
157
|
+
- `draftify` → **logic, schema, validation, export**
|
|
158
|
+
- `draftify-react` → **UI, interactions, visuals**
|
|
159
|
+
|
|
160
|
+
This allows:
|
|
161
|
+
|
|
162
|
+
- Custom editors without UI constraints
|
|
163
|
+
- Backend usage of Draftify
|
|
164
|
+
- Independent evolution of UI and logic
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## When to Use `draftify-react`
|
|
169
|
+
|
|
170
|
+
Use this package if you want:
|
|
171
|
+
|
|
172
|
+
- A complete editor without building UI
|
|
173
|
+
- Fast integration into a React project
|
|
174
|
+
- A clean abstraction over Draftify’s internals
|
|
175
|
+
|
|
176
|
+
If you want to build your own editor UI, use `draftify` directly.
|
|
177
|
+
|
|
178
|
+
---
|
|
179
|
+
|
|
180
|
+
## Compatibility
|
|
181
|
+
|
|
182
|
+
- React ≥ 18
|
|
183
|
+
- Tailwind v4 supported
|
|
184
|
+
- ESM & UMD builds included
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT © 2025 Draftify Team
|