@cyberskill/cyber-editor 3.9.0 → 4.0.0
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 +126 -4
- package/dist/CyberEditor.d.ts +2 -0
- package/dist/CyberViewer.d.ts +2 -0
- package/dist/cyber-editor.cjs.js +703 -0
- package/dist/cyber-editor.css +1 -0
- package/dist/cyber-editor.es.js +52332 -0
- package/dist/index.d.ts +5 -0
- package/dist/modules/accordion/accordion-extension.d.ts +2 -0
- package/dist/modules/accordion/accordion-extension.type.d.ts +11 -0
- package/dist/modules/accordion/accordion-view.component.d.ts +2 -0
- package/dist/modules/accordion/accordion-view.type.d.ts +8 -0
- package/dist/modules/accordion/index.d.ts +4 -0
- package/dist/modules/color-picker/color-picker.component.d.ts +2 -0
- package/dist/modules/color-picker/color-picker.type.d.ts +4 -0
- package/dist/modules/color-picker/index.d.ts +2 -0
- package/dist/modules/heading/heading.component.d.ts +2 -0
- package/dist/modules/heading/heading.type.d.ts +4 -0
- package/dist/modules/heading/index.d.ts +2 -0
- package/dist/modules/image/enhanced-image-view.component.d.ts +2 -0
- package/dist/modules/image/enhanced-image.d.ts +27 -0
- package/dist/modules/image/image-view.type.d.ts +4 -0
- package/dist/modules/image/index.d.ts +2 -0
- package/dist/modules/index.d.ts +6 -0
- package/dist/modules/table/enhanced-table-cell-view.component.d.ts +2 -0
- package/dist/modules/table/enhanced-table-cell.d.ts +1 -0
- package/dist/modules/table/enhanced-table-view.component.d.ts +2 -0
- package/dist/modules/table/enhanced-table.d.ts +7 -0
- package/dist/modules/table/index.d.ts +6 -0
- package/dist/modules/table/table.component.d.ts +2 -0
- package/dist/modules/table/table.type.d.ts +6 -0
- package/dist/modules/toolbar/custom.d.ts +1 -0
- package/dist/modules/toolbar/font-family.d.ts +1 -0
- package/dist/modules/toolbar/font-size.d.ts +1 -0
- package/dist/modules/toolbar/index.d.ts +1 -0
- package/dist/modules/toolbar/table-controls.d.ts +1 -0
- package/dist/modules/video/index.d.ts +2 -0
- package/dist/modules/video/video-view.component.d.ts +16 -0
- package/dist/modules/video/video.d.ts +17 -0
- package/dist/playground/App.d.ts +1 -0
- package/dist/playground/main.d.ts +1 -0
- package/dist/shared/components/color-picker/color-picker.component.d.ts +2 -0
- package/dist/shared/components/color-picker/color-picker.type.d.ts +5 -0
- package/dist/shared/components/color-picker/index.d.ts +2 -0
- package/dist/shared/components/index.d.ts +2 -0
- package/dist/shared/components/modal-edit/index.d.ts +2 -0
- package/dist/shared/components/modal-edit/modal-edit.component.d.ts +2 -0
- package/dist/shared/components/modal-edit/modal-edit.type.d.ts +6 -0
- package/dist/shared/configs/env.d.ts +2 -0
- package/dist/shared/constants/alias.d.ts +4 -0
- package/dist/shared/constants/index.d.ts +1 -0
- package/dist/shared/providers/editor.d.ts +3 -0
- package/dist/shared/providers/index.d.ts +1 -0
- package/dist/shared/typescript/index.d.ts +8 -0
- package/dist/shared/utils/extensions.d.ts +16 -0
- package/dist/shared/utils/index.d.ts +1 -0
- package/package.json +60 -66
- package/dist/client/_commonjsHelpers-C6fGbg64.js +0 -6
- package/dist/client/_commonjsHelpers-DwGv2jUC.cjs +0 -1
- package/dist/client/assets/manifest-e1ae6e39.js +0 -1
- package/dist/client/chunk-D4RADZKF-CqCYZIAv.js +0 -6257
- package/dist/client/chunk-D4RADZKF-sLhgGPy5.cjs +0 -56
- package/dist/client/cyber-editor.cjs.js +0 -259
- package/dist/client/cyber-editor.cjs2.js +0 -1
- package/dist/client/cyber-editor.cjs3.js +0 -1
- package/dist/client/cyber-editor.cjs4.js +0 -604
- package/dist/client/cyber-editor.cjs5.js +0 -1
- package/dist/client/cyber-editor.css +0 -1
- package/dist/client/cyber-editor.es.js +0 -25364
- package/dist/client/cyber-editor.es2.js +0 -43
- package/dist/client/cyber-editor.es3.js +0 -11
- package/dist/client/cyber-editor.es4.js +0 -46769
- package/dist/client/cyber-editor.es5.js +0 -11
- package/dist/client/index-HJNgKdvE.cjs +0 -5
- package/dist/client/index-rkLJDvut.js +0 -156
- package/dist/client/index.d.ts +0 -23
- package/dist/client/index.html +0 -6
- package/dist/client/with-props-Ba4118z_.js +0 -27
- package/dist/client/with-props-CuGIah2q.cjs +0 -1
- /package/dist/{client/assets → assets}/icons/index.ts +0 -0
- /package/dist/{client/favicon.svg → favicon.svg} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,127 @@
|
|
|
1
|
-
|
|
1
|
+
# @cyberskill/cyber-editor
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
A powerful, rich text editor based on Tiptap, designed for the CyberSkill ecosystem. It provides a seamless editing experience with advanced features like image resizing, video embedding, accordion components, and HTML block rendering.
|
|
4
|
+
|
|
5
|
+
## 📦 Installation
|
|
6
|
+
|
|
7
|
+
Install the package via your preferred package manager:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @cyberskill/cyber-editor
|
|
11
|
+
# or
|
|
12
|
+
npm install @cyberskill/cyber-editor
|
|
13
|
+
# or
|
|
14
|
+
yarn add @cyberskill/cyber-editor
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 🚀 Usage
|
|
18
|
+
|
|
19
|
+
The library exports two main components to distinguish between editing (Admin) and viewing (Client) modes.
|
|
20
|
+
|
|
21
|
+
### 1. Import Styles
|
|
22
|
+
|
|
23
|
+
First, import the necessary CSS in your root file (e.g., `_app.tsx`, `layout.tsx`, or `main.tsx`):
|
|
24
|
+
|
|
25
|
+
```tsx
|
|
26
|
+
import '@cyberskill/cyber-editor/index.css';
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### 2. Admin / Edit Mode (`CyberEditor`)
|
|
30
|
+
|
|
31
|
+
Use `CyberEditor` when you want to provide a full editing interface with a toolbar.
|
|
32
|
+
|
|
33
|
+
```tsx
|
|
34
|
+
import { CyberEditor } from '@cyberskill/cyber-editor';
|
|
35
|
+
import { useState } from 'react';
|
|
36
|
+
|
|
37
|
+
function AdminPage() {
|
|
38
|
+
const [content, setContent] = useState('<p>Hello World</p>');
|
|
39
|
+
|
|
40
|
+
return (
|
|
41
|
+
<CyberEditor
|
|
42
|
+
content={content}
|
|
43
|
+
onChange={(newContent) => setContent(newContent)}
|
|
44
|
+
className="my-editor"
|
|
45
|
+
/>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### 3. Client / View Mode (`CyberViewer`)
|
|
51
|
+
|
|
52
|
+
Use `CyberViewer` when you just want to display the content. It is read-only and lightweight without the toolbar.
|
|
53
|
+
|
|
54
|
+
```tsx
|
|
55
|
+
import { CyberViewer } from '@cyberskill/cyber-editor';
|
|
56
|
+
|
|
57
|
+
function PostPage({ content }) {
|
|
58
|
+
return (
|
|
59
|
+
<div className="article-content">
|
|
60
|
+
<CyberViewer content={content} />
|
|
61
|
+
</div>
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## 🛠 Development & Contribution
|
|
67
|
+
|
|
68
|
+
### Project Structure
|
|
69
|
+
|
|
70
|
+
- `src/modules/*`: Contains individual editor extensions (Image, Video, Table, etc.).
|
|
71
|
+
- `src/shared/*`: Shared utilities, providers, and styles.
|
|
72
|
+
- `src/playground/*`: A built-in playground for testing during development.
|
|
73
|
+
- `src/index.ts`: The main entry point for the library.
|
|
74
|
+
|
|
75
|
+
### Common Commands
|
|
76
|
+
|
|
77
|
+
- **Start Playground**: Run the local dev server to test changes.
|
|
78
|
+
```bash
|
|
79
|
+
pnpm dev
|
|
80
|
+
```
|
|
81
|
+
- **Build Library**: Build the package for distribution.
|
|
82
|
+
```bash
|
|
83
|
+
pnpm build
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### 🔄 Versioning & Publishing
|
|
87
|
+
|
|
88
|
+
When the development team adds new components or fixes bugs, follow this workflow to update the package:
|
|
89
|
+
|
|
90
|
+
1. **Develop & Test**:
|
|
91
|
+
- Make changes in `src/modules` or `src/shared`.
|
|
92
|
+
- Test using the playground (`pnpm dev`).
|
|
93
|
+
|
|
94
|
+
2. **Commit Changes**:
|
|
95
|
+
- Use conventional commits (e.g., `feat: add new chart component` or `fix: image resize bug`).
|
|
96
|
+
|
|
97
|
+
3. **Update Version**:
|
|
98
|
+
- **Patch** (Bug fixes): `0.0.x`
|
|
99
|
+
```bash
|
|
100
|
+
npm version patch
|
|
101
|
+
```
|
|
102
|
+
- **Minor** (New features, non-breaking): `0.x.0`
|
|
103
|
+
```bash
|
|
104
|
+
npm version minor
|
|
105
|
+
```
|
|
106
|
+
- **Major** (Breaking changes): `x.0.0`
|
|
107
|
+
```bash
|
|
108
|
+
npm version major
|
|
109
|
+
```
|
|
110
|
+
*This command automatically updates `package.json` and creates a git tag.*
|
|
111
|
+
|
|
112
|
+
4. **Publish**:
|
|
113
|
+
- Push the tag to the repository.
|
|
114
|
+
- Publish to the registry (if handled manually, or let CI/CD handle it).
|
|
115
|
+
```bash
|
|
116
|
+
pnpm publish
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## 🧩 Adding New Components
|
|
120
|
+
|
|
121
|
+
To add a new feature (e.g., a Chart extension):
|
|
122
|
+
|
|
123
|
+
1. Create a new folder in `src/modules/chart`.
|
|
124
|
+
2. Implement the Tiptap node/extension.
|
|
125
|
+
3. Create a React Component for the NodeView (if it has UI).
|
|
126
|
+
4. Export the extension in `src/shared/utils/extensions.ts`.
|
|
127
|
+
5. Test in `src/playground/App.tsx`.
|