@cyberskill/cyber-editor 3.9.1 → 4.0.1

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.
Files changed (192) hide show
  1. package/README.md +126 -4
  2. package/dist/CyberEditor.d.ts +2 -0
  3. package/dist/CyberViewer.d.ts +2 -0
  4. package/dist/cyber-editor.cjs.js +714 -0
  5. package/dist/cyber-editor.css +1 -0
  6. package/dist/cyber-editor.es.js +52940 -0
  7. package/dist/index.d.ts +5 -20
  8. package/dist/modules/accordion/accordion-extension.d.ts +2 -1
  9. package/dist/modules/accordion/accordion-extension.type.d.ts +11 -0
  10. package/dist/modules/accordion/accordion-view.component.d.ts +2 -1
  11. package/dist/modules/accordion/accordion-view.type.d.ts +8 -2
  12. package/dist/modules/accordion/index.d.ts +4 -4
  13. package/dist/modules/color-picker/color-picker.component.d.ts +2 -1
  14. package/dist/modules/color-picker/color-picker.type.d.ts +4 -1
  15. package/dist/modules/color-picker/index.d.ts +2 -2
  16. package/dist/modules/heading/heading.component.d.ts +2 -1
  17. package/dist/modules/heading/heading.type.d.ts +4 -1
  18. package/dist/modules/heading/index.d.ts +2 -2
  19. package/dist/modules/image/enhanced-image-view.component.d.ts +2 -0
  20. package/dist/modules/image/enhanced-image.d.ts +27 -0
  21. package/dist/modules/image/image-view.type.d.ts +4 -2
  22. package/dist/modules/image/index.d.ts +2 -4
  23. package/dist/modules/index.d.ts +6 -20
  24. package/dist/modules/table/enhanced-table-cell-view.component.d.ts +2 -0
  25. package/dist/modules/table/enhanced-table-cell.d.ts +1 -0
  26. package/dist/modules/table/enhanced-table-view.component.d.ts +2 -0
  27. package/dist/modules/table/enhanced-table.d.ts +7 -0
  28. package/dist/modules/table/index.d.ts +6 -2
  29. package/dist/modules/table/table.component.d.ts +2 -1
  30. package/dist/modules/table/table.type.d.ts +6 -1
  31. package/dist/modules/toolbar/custom.d.ts +1 -0
  32. package/dist/modules/toolbar/font-family.d.ts +1 -0
  33. package/dist/modules/toolbar/font-size.d.ts +1 -0
  34. package/dist/modules/toolbar/index.d.ts +1 -2
  35. package/dist/modules/toolbar/table-controls.d.ts +1 -0
  36. package/dist/modules/video/index.d.ts +2 -0
  37. package/dist/modules/video/video-view.component.d.ts +16 -0
  38. package/dist/modules/video/video.d.ts +17 -0
  39. package/dist/playground/App.d.ts +1 -0
  40. package/dist/playground/main.d.ts +1 -0
  41. package/dist/shared/components/color-picker/color-picker.component.d.ts +2 -0
  42. package/dist/shared/components/color-picker/color-picker.type.d.ts +5 -0
  43. package/dist/shared/components/color-picker/index.d.ts +2 -0
  44. package/dist/shared/components/index.d.ts +2 -0
  45. package/dist/shared/components/modal-edit/index.d.ts +2 -0
  46. package/dist/shared/components/modal-edit/modal-edit.component.d.ts +2 -0
  47. package/dist/shared/components/modal-edit/modal-edit.type.d.ts +6 -0
  48. package/dist/shared/configs/env.d.ts +2 -0
  49. package/dist/shared/constants/alias.d.ts +4 -0
  50. package/dist/shared/constants/index.d.ts +1 -0
  51. package/dist/shared/providers/editor.d.ts +3 -0
  52. package/dist/shared/providers/index.d.ts +1 -0
  53. package/dist/shared/typescript/index.d.ts +8 -0
  54. package/dist/shared/utils/extensions.d.ts +16 -0
  55. package/dist/shared/utils/index.d.ts +1 -0
  56. package/package.json +65 -80
  57. package/dist/_tsup-dts-rollup.d.cts +0 -196
  58. package/dist/_tsup-dts-rollup.d.ts +0 -196
  59. package/dist/index.cjs +0 -1
  60. package/dist/index.d.cts +0 -20
  61. package/dist/index.js +0 -1
  62. package/dist/modules/accordion/accordion-extension.cjs +0 -1
  63. package/dist/modules/accordion/accordion-extension.d.cts +0 -1
  64. package/dist/modules/accordion/accordion-extension.js +0 -1
  65. package/dist/modules/accordion/accordion-view.component.cjs +0 -1
  66. package/dist/modules/accordion/accordion-view.component.d.cts +0 -1
  67. package/dist/modules/accordion/accordion-view.component.js +0 -1
  68. package/dist/modules/accordion/accordion-view.type.cjs +0 -1
  69. package/dist/modules/accordion/accordion-view.type.d.cts +0 -2
  70. package/dist/modules/accordion/accordion-view.type.js +0 -0
  71. package/dist/modules/accordion/index.cjs +0 -1
  72. package/dist/modules/accordion/index.d.cts +0 -4
  73. package/dist/modules/accordion/index.js +0 -1
  74. package/dist/modules/color-picker/color-picker.component.cjs +0 -1
  75. package/dist/modules/color-picker/color-picker.component.d.cts +0 -1
  76. package/dist/modules/color-picker/color-picker.component.js +0 -1
  77. package/dist/modules/color-picker/color-picker.type.cjs +0 -1
  78. package/dist/modules/color-picker/color-picker.type.d.cts +0 -1
  79. package/dist/modules/color-picker/color-picker.type.js +0 -0
  80. package/dist/modules/color-picker/index.cjs +0 -1
  81. package/dist/modules/color-picker/index.d.cts +0 -2
  82. package/dist/modules/color-picker/index.js +0 -1
  83. package/dist/modules/editor/editor.component.cjs +0 -1
  84. package/dist/modules/editor/editor.component.d.cts +0 -1
  85. package/dist/modules/editor/editor.component.d.ts +0 -1
  86. package/dist/modules/editor/editor.component.js +0 -1
  87. package/dist/modules/editor/editor.constant.cjs +0 -1
  88. package/dist/modules/editor/editor.constant.d.cts +0 -1
  89. package/dist/modules/editor/editor.constant.d.ts +0 -1
  90. package/dist/modules/editor/editor.constant.js +0 -1
  91. package/dist/modules/editor/editor.module.d.cts +0 -1
  92. package/dist/modules/editor/editor.module.d.ts +0 -1
  93. package/dist/modules/editor/editor.module.scss +0 -313
  94. package/dist/modules/editor/editor.type.cjs +0 -1
  95. package/dist/modules/editor/editor.type.d.cts +0 -1
  96. package/dist/modules/editor/editor.type.d.ts +0 -1
  97. package/dist/modules/editor/editor.type.js +0 -0
  98. package/dist/modules/editor/index.cjs +0 -1
  99. package/dist/modules/editor/index.d.cts +0 -3
  100. package/dist/modules/editor/index.d.ts +0 -3
  101. package/dist/modules/editor/index.js +0 -1
  102. package/dist/modules/heading/heading.component.cjs +0 -1
  103. package/dist/modules/heading/heading.component.d.cts +0 -1
  104. package/dist/modules/heading/heading.component.js +0 -1
  105. package/dist/modules/heading/heading.type.cjs +0 -1
  106. package/dist/modules/heading/heading.type.d.cts +0 -1
  107. package/dist/modules/heading/heading.type.js +0 -0
  108. package/dist/modules/heading/index.cjs +0 -1
  109. package/dist/modules/heading/index.d.cts +0 -2
  110. package/dist/modules/heading/index.js +0 -1
  111. package/dist/modules/home/home.page.cjs +0 -1
  112. package/dist/modules/home/home.page.d.cts +0 -1
  113. package/dist/modules/home/home.page.d.ts +0 -1
  114. package/dist/modules/home/home.page.js +0 -1
  115. package/dist/modules/home/index.cjs +0 -1
  116. package/dist/modules/home/index.d.cts +0 -1
  117. package/dist/modules/home/index.d.ts +0 -1
  118. package/dist/modules/home/index.js +0 -1
  119. package/dist/modules/image/image-view.component.cjs +0 -1
  120. package/dist/modules/image/image-view.component.d.cts +0 -1
  121. package/dist/modules/image/image-view.component.d.ts +0 -1
  122. package/dist/modules/image/image-view.component.js +0 -1
  123. package/dist/modules/image/image-view.type.cjs +0 -1
  124. package/dist/modules/image/image-view.type.d.cts +0 -2
  125. package/dist/modules/image/image-view.type.js +0 -0
  126. package/dist/modules/image/image.cjs +0 -1
  127. package/dist/modules/image/image.d.cts +0 -1
  128. package/dist/modules/image/image.d.ts +0 -1
  129. package/dist/modules/image/image.js +0 -1
  130. package/dist/modules/image/index.cjs +0 -1
  131. package/dist/modules/image/index.d.cts +0 -4
  132. package/dist/modules/image/index.js +0 -1
  133. package/dist/modules/index.cjs +0 -1
  134. package/dist/modules/index.d.cts +0 -20
  135. package/dist/modules/index.js +0 -1
  136. package/dist/modules/table/index.cjs +0 -1
  137. package/dist/modules/table/index.d.cts +0 -2
  138. package/dist/modules/table/index.js +0 -1
  139. package/dist/modules/table/table.component.cjs +0 -1
  140. package/dist/modules/table/table.component.d.cts +0 -1
  141. package/dist/modules/table/table.component.js +0 -1
  142. package/dist/modules/table/table.type.cjs +0 -1
  143. package/dist/modules/table/table.type.d.cts +0 -1
  144. package/dist/modules/table/table.type.js +0 -0
  145. package/dist/modules/toolbar/index.cjs +0 -1
  146. package/dist/modules/toolbar/index.d.cts +0 -2
  147. package/dist/modules/toolbar/index.js +0 -1
  148. package/dist/modules/toolbar/toolbar.component.cjs +0 -1
  149. package/dist/modules/toolbar/toolbar.component.d.cts +0 -1
  150. package/dist/modules/toolbar/toolbar.component.d.ts +0 -1
  151. package/dist/modules/toolbar/toolbar.component.js +0 -1
  152. package/dist/modules/toolbar/toolbar.custom.component.cjs +0 -1
  153. package/dist/modules/toolbar/toolbar.custom.component.d.cts +0 -1
  154. package/dist/modules/toolbar/toolbar.custom.component.d.ts +0 -1
  155. package/dist/modules/toolbar/toolbar.custom.component.js +0 -1
  156. package/dist/shared/component/color-picker/color-picker.component.cjs +0 -1
  157. package/dist/shared/component/color-picker/color-picker.component.d.cts +0 -1
  158. package/dist/shared/component/color-picker/color-picker.component.d.ts +0 -1
  159. package/dist/shared/component/color-picker/color-picker.component.js +0 -1
  160. package/dist/shared/component/color-picker/color-picker.type.cjs +0 -1
  161. package/dist/shared/component/color-picker/color-picker.type.d.cts +0 -1
  162. package/dist/shared/component/color-picker/color-picker.type.d.ts +0 -1
  163. package/dist/shared/component/color-picker/color-picker.type.js +0 -0
  164. package/dist/shared/component/color-picker/index.cjs +0 -1
  165. package/dist/shared/component/color-picker/index.d.cts +0 -2
  166. package/dist/shared/component/color-picker/index.d.ts +0 -2
  167. package/dist/shared/component/color-picker/index.js +0 -1
  168. package/dist/shared/component/index.cjs +0 -1
  169. package/dist/shared/component/index.d.cts +0 -4
  170. package/dist/shared/component/index.d.ts +0 -4
  171. package/dist/shared/component/index.js +0 -1
  172. package/dist/shared/component/modal-edit/index.cjs +0 -1
  173. package/dist/shared/component/modal-edit/index.d.cts +0 -2
  174. package/dist/shared/component/modal-edit/index.d.ts +0 -2
  175. package/dist/shared/component/modal-edit/index.js +0 -1
  176. package/dist/shared/component/modal-edit/modal-edit.component.cjs +0 -1
  177. package/dist/shared/component/modal-edit/modal-edit.component.d.cts +0 -1
  178. package/dist/shared/component/modal-edit/modal-edit.component.d.ts +0 -1
  179. package/dist/shared/component/modal-edit/modal-edit.component.js +0 -1
  180. package/dist/shared/component/modal-edit/modal-edit.type.cjs +0 -1
  181. package/dist/shared/component/modal-edit/modal-edit.type.d.cts +0 -1
  182. package/dist/shared/component/modal-edit/modal-edit.type.d.ts +0 -1
  183. package/dist/shared/component/modal-edit/modal-edit.type.js +0 -0
  184. package/dist/shared/style/global.css +0 -2
  185. package/dist/shared/style/global.d.cts +0 -1
  186. package/dist/shared/style/global.d.ts +0 -1
  187. package/dist/shared/typescript/style.d.cjs +0 -1
  188. package/dist/shared/typescript/style.d.d.cts +0 -1
  189. package/dist/shared/typescript/style.d.d.ts +0 -1
  190. package/dist/shared/typescript/style.d.js +0 -0
  191. /package/{public → dist}/assets/icons/index.ts +0 -0
  192. /package/{public → dist}/favicon.svg +0 -0
package/README.md CHANGED
@@ -1,5 +1,127 @@
1
- ## Instructions
1
+ # @cyberskill/cyber-editor
2
2
 
3
- <a href="https://github.com/cyberskill-world/.github/wiki">
4
- Read here
5
- </a>
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`.
@@ -0,0 +1,2 @@
1
+ import type { I_CyberEditorProviderProps } from './shared/typescript';
2
+ export declare function CyberEditor(props: I_CyberEditorProviderProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import type { I_CyberEditorProviderProps } from './shared/typescript';
2
+ export declare function CyberViewer(props: I_CyberEditorProviderProps): import("react/jsx-runtime").JSX.Element;