pagemaster-editor 0.3.5 → 0.3.7
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 +28 -14
- package/package.json +1 -1
- package/dist/docxExport-C4g0WBf1.js +0 -14192
- package/dist/favicon.ico +0 -0
- package/dist/html2canvas-DlG3m2SO.js +0 -25
- package/dist/index-BEovP1jN.js +0 -90265
- package/dist/index.d.ts +0 -31
- package/dist/index.es-BbHiw86e.js +0 -5647
- package/dist/pagemaster-editor.js +0 -5
- package/dist/pagemaster-editor.umd.cjs +0 -1025
- package/dist/placeholder.svg +0 -1
- package/dist/purify.es-CP0Oxyr7.js +0 -562
- package/dist/robots.txt +0 -14
- package/dist/style.css +0 -1
package/README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Pagemaster Editor
|
|
2
2
|
|
|
3
3
|
A powerful, DOCX-style rich text editor and PDF viewer for React applications. Built with Tiptap, React PDF, and modern styling libraries.
|
|
4
4
|
|
|
5
|
-
[](https://www.npmjs.com/package/pagemaster-editor)
|
|
6
6
|
[](https://opensource.org/licenses/MIT)
|
|
7
7
|
|
|
8
|
+
**[🔥 Live Demo](https://pagemaster-demo-app.vercel.app/)**
|
|
9
|
+
|
|
8
10
|
## Features
|
|
9
11
|
|
|
10
12
|
### 📝 Advanced Document Editor
|
|
@@ -54,7 +56,7 @@ A powerful, DOCX-style rich text editor and PDF viewer for React applications. B
|
|
|
54
56
|
## Installation
|
|
55
57
|
|
|
56
58
|
```bash
|
|
57
|
-
npm install
|
|
59
|
+
npm install pagemaster-editor
|
|
58
60
|
```
|
|
59
61
|
|
|
60
62
|
## Usage
|
|
@@ -64,14 +66,16 @@ npm install aditily
|
|
|
64
66
|
Import the component and its baseline styles. Ensure the parent container has a height.
|
|
65
67
|
|
|
66
68
|
```tsx
|
|
67
|
-
import { DocumentEditor } from '
|
|
68
|
-
import '
|
|
69
|
+
import { DocumentEditor } from 'pagemaster-editor';
|
|
70
|
+
import 'pagemaster-editor/dist/style.css';
|
|
69
71
|
|
|
70
72
|
function App() {
|
|
73
|
+
const llmResponse = "# Welcome to Pagemaster Editor\n\nThis content is generated from **Markdown**!";
|
|
74
|
+
|
|
71
75
|
return (
|
|
72
76
|
<div style={{ height: '100vh', width: '100vw' }}>
|
|
73
77
|
<DocumentEditor
|
|
74
|
-
initialContent=
|
|
78
|
+
initialContent={llmResponse}
|
|
75
79
|
onChange={(html) => console.log('Content updated:', html)}
|
|
76
80
|
/>
|
|
77
81
|
</div>
|
|
@@ -79,18 +83,28 @@ function App() {
|
|
|
79
83
|
}
|
|
80
84
|
```
|
|
81
85
|
|
|
86
|
+
### Using Markdown Content
|
|
87
|
+
|
|
88
|
+
The editor automatically detects if `initialContent` is Markdown and converts it to rich HTML. This is perfect for displaying content from LLMs (AI) or CMS APIs.
|
|
89
|
+
|
|
90
|
+
```tsx
|
|
91
|
+
<DocumentEditor
|
|
92
|
+
initialContent="## Generated Report\n\n- Point 1\n- Point 2"
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
82
96
|
### Next.js Integration (SSR)
|
|
83
97
|
|
|
84
|
-
Since
|
|
98
|
+
Since Pagemaster Editor uses browser-specific APIs (Canvas, DOM), it must be imported dynamically.
|
|
85
99
|
|
|
86
100
|
```tsx
|
|
87
101
|
"use client";
|
|
88
102
|
|
|
89
103
|
import dynamic from 'next/dynamic';
|
|
90
|
-
import '
|
|
104
|
+
import 'pagemaster-editor/dist/style.css';
|
|
91
105
|
|
|
92
106
|
const DocumentEditor = dynamic(
|
|
93
|
-
() => import('
|
|
107
|
+
() => import('pagemaster-editor').then((mod) => mod.DocumentEditor),
|
|
94
108
|
{
|
|
95
109
|
ssr: false,
|
|
96
110
|
loading: () => <div>Loading Editor...</div>
|
|
@@ -104,14 +118,14 @@ export default function Page() {
|
|
|
104
118
|
|
|
105
119
|
### Tailwind CSS Configuration
|
|
106
120
|
|
|
107
|
-
|
|
121
|
+
Pagemaster Editor uses Tailwind for styling. To ensure all library styles are properly purged/generated in your project:
|
|
108
122
|
|
|
109
123
|
#### Tailwind v3 (tailwind.config.js)
|
|
110
124
|
```javascript
|
|
111
125
|
module.exports = {
|
|
112
126
|
content: [
|
|
113
127
|
"./src/**/*.{js,ts,jsx,tsx}",
|
|
114
|
-
"./node_modules/
|
|
128
|
+
"./node_modules/pagemaster-editor/dist/**/*.{js,ts,jsx,tsx}",
|
|
115
129
|
],
|
|
116
130
|
theme: {
|
|
117
131
|
extend: {},
|
|
@@ -123,10 +137,10 @@ module.exports = {
|
|
|
123
137
|
#### Tailwind v4 (globals.css)
|
|
124
138
|
```css
|
|
125
139
|
@import "tailwindcss";
|
|
126
|
-
@import "
|
|
140
|
+
@import "pagemaster-editor/style";
|
|
127
141
|
|
|
128
142
|
/* Ensure Tailwind scans the library for utility classes */
|
|
129
|
-
@source "../../node_modules/
|
|
143
|
+
@source "../../node_modules/pagemaster-editor/dist/**/*.{js,ts,jsx,tsx}";
|
|
130
144
|
```
|
|
131
145
|
|
|
132
146
|
## Props
|
|
@@ -135,7 +149,7 @@ The `DocumentEditor` component accepts the following props:
|
|
|
135
149
|
|
|
136
150
|
| Prop | Type | Default | Description |
|
|
137
151
|
|------|------|---------|-------------|
|
|
138
|
-
| `initialContent` | `string` | `""` | Initial HTML string to load into the editor. |
|
|
152
|
+
| `initialContent` | `string` | `""` | Initial HTML string or **Markdown** to load into the editor. |
|
|
139
153
|
| `className` | `string` | `""` | Additional CSS classes for the outer container. |
|
|
140
154
|
| `onChange` | `(html: string) => void` | `undefined` | Callback function triggered on every content change. |
|
|
141
155
|
| `readOnly` | `boolean` | `false` | If true, the editor is disabled and toolbars are hidden. |
|