pagemaster-editor 0.2.1 → 0.3.5
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 +80 -25
- package/dist/{html2canvas-BcdjAaMa.js → html2canvas-DlG3m2SO.js} +1 -1
- package/dist/{index-Db7fhGrG.js → index-BEovP1jN.js} +24420 -23234
- package/dist/index.d.ts +3 -0
- package/dist/{index.es-z3XdDhzI.js → index.es-BbHiw86e.js} +1 -1
- package/dist/pagemaster-editor.js +1 -1
- package/dist/pagemaster-editor.umd.cjs +314 -256
- package/dist/style.css +1 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Aditily
|
|
2
2
|
|
|
3
|
-
A powerful, DOCX-style rich text editor and PDF viewer for React applications. Built with Tiptap, React PDF, and
|
|
3
|
+
A powerful, DOCX-style rich text editor and PDF viewer for React applications. Built with Tiptap, React PDF, and modern styling libraries.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/aditily)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
4
7
|
|
|
5
8
|
## Features
|
|
6
9
|
|
|
@@ -24,14 +27,14 @@ A powerful, DOCX-style rich text editor and PDF viewer for React applications. B
|
|
|
24
27
|
|
|
25
28
|
### 📄 PDF Integration
|
|
26
29
|
- **Integrated Viewer**: Built-in tabbed interface to switch between Editor and PDF viewing modes.
|
|
27
|
-
- **PDF Upload**: Upload PDF files directly from the toolbar.
|
|
28
|
-
- **Advanced Controls**: Zoom (50%-300%), page navigation, and responsive rendering.
|
|
30
|
+
- **PDF Upload**: Upload PDF files directly from the toolbar for convenient viewing and reference.
|
|
31
|
+
- **Advanced Controls**: Zoom (50%-300%), page navigation, sidebars for thumbnails, and responsive rendering.
|
|
29
32
|
|
|
30
33
|
### 💾 Import & Export
|
|
31
34
|
- **DOCX Support**:
|
|
32
35
|
- **Import**: Load existing DOCX files for editing.
|
|
33
|
-
- **Export**: Generate
|
|
34
|
-
- **PDF Export**: Export your document content directly to PDF format.
|
|
36
|
+
- **Export**: Generate high-fidelity DOCX files compatible with Microsoft Word and Google Docs.
|
|
37
|
+
- **PDF Export**: Export your document content directly to PDF format with a single click.
|
|
35
38
|
|
|
36
39
|
### ⌨️ Keyboard Shortcuts
|
|
37
40
|
|
|
@@ -51,47 +54,99 @@ A powerful, DOCX-style rich text editor and PDF viewer for React applications. B
|
|
|
51
54
|
## Installation
|
|
52
55
|
|
|
53
56
|
```bash
|
|
54
|
-
npm install
|
|
57
|
+
npm install aditily
|
|
55
58
|
```
|
|
56
59
|
|
|
57
60
|
## Usage
|
|
58
61
|
|
|
59
|
-
###
|
|
62
|
+
### Basic Usage
|
|
63
|
+
|
|
64
|
+
Import the component and its baseline styles. Ensure the parent container has a height.
|
|
60
65
|
|
|
61
66
|
```tsx
|
|
62
|
-
import { DocumentEditor } from '
|
|
63
|
-
import '
|
|
67
|
+
import { DocumentEditor } from 'aditily';
|
|
68
|
+
import 'aditily/dist/style.css';
|
|
64
69
|
|
|
65
70
|
function App() {
|
|
66
71
|
return (
|
|
67
|
-
<div style={{ height: '100vh' }}>
|
|
68
|
-
<DocumentEditor
|
|
72
|
+
<div style={{ height: '100vh', width: '100vw' }}>
|
|
73
|
+
<DocumentEditor
|
|
74
|
+
initialContent="<h1>Welcome to Aditily</h1>"
|
|
75
|
+
onChange={(html) => console.log('Content updated:', html)}
|
|
76
|
+
/>
|
|
69
77
|
</div>
|
|
70
78
|
);
|
|
71
79
|
}
|
|
72
80
|
```
|
|
73
81
|
|
|
74
|
-
###
|
|
82
|
+
### Next.js Integration (SSR)
|
|
83
|
+
|
|
84
|
+
Since Aditily uses browser-specific APIs (Canvas, DOM), it must be imported dynamically.
|
|
75
85
|
|
|
76
86
|
```tsx
|
|
77
|
-
|
|
78
|
-
import 'pagemaster-editor/dist/style.css';
|
|
87
|
+
"use client";
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
89
|
+
import dynamic from 'next/dynamic';
|
|
90
|
+
import 'aditily/dist/style.css';
|
|
91
|
+
|
|
92
|
+
const DocumentEditor = dynamic(
|
|
93
|
+
() => import('aditily').then((mod) => mod.DocumentEditor),
|
|
94
|
+
{
|
|
95
|
+
ssr: false,
|
|
96
|
+
loading: () => <div>Loading Editor...</div>
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
export default function Page() {
|
|
101
|
+
return <DocumentEditor />;
|
|
86
102
|
}
|
|
87
103
|
```
|
|
88
104
|
|
|
105
|
+
### Tailwind CSS Configuration
|
|
106
|
+
|
|
107
|
+
Aditily uses Tailwind for styling. To ensure all library styles are properly purged/generated in your project:
|
|
108
|
+
|
|
109
|
+
#### Tailwind v3 (tailwind.config.js)
|
|
110
|
+
```javascript
|
|
111
|
+
module.exports = {
|
|
112
|
+
content: [
|
|
113
|
+
"./src/**/*.{js,ts,jsx,tsx}",
|
|
114
|
+
"./node_modules/aditily/dist/**/*.{js,ts,jsx,tsx}",
|
|
115
|
+
],
|
|
116
|
+
theme: {
|
|
117
|
+
extend: {},
|
|
118
|
+
},
|
|
119
|
+
plugins: [],
|
|
120
|
+
}
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
#### Tailwind v4 (globals.css)
|
|
124
|
+
```css
|
|
125
|
+
@import "tailwindcss";
|
|
126
|
+
@import "aditily/style";
|
|
127
|
+
|
|
128
|
+
/* Ensure Tailwind scans the library for utility classes */
|
|
129
|
+
@source "../../node_modules/aditily/dist/**/*.{js,ts,jsx,tsx}";
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Props
|
|
133
|
+
|
|
134
|
+
The `DocumentEditor` component accepts the following props:
|
|
135
|
+
|
|
136
|
+
| Prop | Type | Default | Description |
|
|
137
|
+
|------|------|---------|-------------|
|
|
138
|
+
| `initialContent` | `string` | `""` | Initial HTML string to load into the editor. |
|
|
139
|
+
| `className` | `string` | `""` | Additional CSS classes for the outer container. |
|
|
140
|
+
| `onChange` | `(html: string) => void` | `undefined` | Callback function triggered on every content change. |
|
|
141
|
+
| `readOnly` | `boolean` | `false` | If true, the editor is disabled and toolbars are hidden. |
|
|
142
|
+
| `placeholder` | `string` | `"Enter your content here..."` | Text to show when the editor is empty. |
|
|
143
|
+
|
|
89
144
|
## Peer Dependencies
|
|
90
145
|
|
|
91
|
-
Ensure
|
|
92
|
-
- `react`
|
|
93
|
-
- `react-dom`
|
|
146
|
+
Ensure your project has these dependencies:
|
|
147
|
+
- `react` >= 18.0.0
|
|
148
|
+
- `react-dom` >= 18.0.0
|
|
94
149
|
|
|
95
150
|
## License
|
|
96
151
|
|
|
97
|
-
MIT
|
|
152
|
+
MIT © [Surendra Singh](https://github.com/surendrasinghc80)
|