suneditor 3.0.0-beta.1 → 3.0.0-beta.2
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/CONTRIBUTING.md +166 -29
- package/README.md +13 -1
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +13 -5
- package/src/assets/{variables.css → design/color.css} +34 -58
- package/src/assets/design/index.css +3 -0
- package/src/assets/design/size.css +35 -0
- package/src/assets/design/typography.css +37 -0
- package/src/assets/suneditor-contents.css +1 -1
- package/src/assets/suneditor.css +24 -17
- package/src/core/base/eventHandlers/handler_ww_key_input.js +15 -15
- package/src/core/base/eventHandlers/handler_ww_mouse.js +1 -1
- package/src/core/base/eventManager.js +21 -9
- package/src/core/class/component.js +21 -11
- package/src/core/class/menu.js +19 -0
- package/src/core/editor.js +3 -3
- package/src/core/section/actives.js +42 -4
- package/src/core/section/constructor.js +116 -41
- package/src/core/section/documentType.js +2 -2
- package/src/events.js +13 -1
- package/src/helper/dom/domCheck.js +10 -0
- package/src/modules/Figure.js +6 -6
- package/src/modules/FileManager.js +1 -1
- package/src/plugins/command/fileUpload.js +3 -3
- package/src/plugins/dropdown/table.js +51 -18
- package/src/plugins/modal/audio.js +2 -2
- package/src/plugins/modal/embed.js +2 -2
- package/src/plugins/modal/image.js +3 -3
- package/src/plugins/modal/math.js +2 -2
- package/src/plugins/modal/video.js +1 -1
- package/src/plugins/popup/anchor.js +1 -1
- package/src/suneditor.js +1 -1
- package/src/themes/dark.css +78 -45
- package/types/core/base/eventManager.d.ts +7 -0
- package/types/core/class/component.d.ts +12 -3
- package/types/core/class/menu.d.ts +8 -0
- package/types/core/section/constructor.d.ts +160 -149
- package/types/events.d.ts +1 -0
- package/types/helper/dom/domCheck.d.ts +7 -0
- package/types/helper/index.d.ts +1 -0
- package/types/index.d.ts +1 -1
- package/types/plugins/dropdown/table.d.ts +1 -0
- package/.eslintignore +0 -7
- package/.eslintrc.json +0 -81
- /package/src/assets/icons/{_default.js → defaultIcons.js} +0 -0
- /package/types/assets/icons/{_default.d.ts → defaultIcons.d.ts} +0 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -1,47 +1,184 @@
|
|
|
1
|
-
# Guidelines For Contributing
|
|
1
|
+
# 🌞 Guidelines For Contributing
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
---
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
Node.js v14 or higher is required to build and test.
|
|
5
|
+
## 📘 Introduction
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
The codebase is written in **JavaScript (ES2020)**, using **JSDoc** for type definitions.
|
|
8
|
+
Node.js **v14 or higher** is required to build and test.
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
- Optional chaining (`?.`)
|
|
12
|
-
- Nullish coalescing (`??`)
|
|
13
|
-
- Private class fields (`#myField`)
|
|
14
|
-
- Polyfills are **not included** – make sure your target environment supports these features.
|
|
10
|
+
### 📝 Notes
|
|
15
11
|
|
|
12
|
+
- Uses modern syntax including:
|
|
13
|
+
- Optional chaining (`?.`)
|
|
14
|
+
- Nullish coalescing (`??`)
|
|
15
|
+
- Private class fields (`#myField`)
|
|
16
|
+
- Polyfills are **not included** – make sure your target environment supports these features.
|
|
16
17
|
|
|
17
|
-
|
|
18
|
+
---
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
- Search the [open issue](https://github.com/jihong88/suneditor/issues) and [closed issue](https://github.com/jihong88/suneditor/issues?q=is%3Aissue+is%3Aclosed) to ensure no one else has reported something similar before.
|
|
21
|
-
- File an [issue ticket](https://github.com/jihong88/suneditor/issues/new) by providing all the required information.
|
|
20
|
+
## 🐛 Before Submitting an Issue
|
|
22
21
|
|
|
23
|
-
|
|
22
|
+
- Make sure you're using the latest `master` branch. Your issue may already be fixed.
|
|
23
|
+
- Search the [open issues](https://github.com/jihong88/suneditor/issues) and [closed issues](https://github.com/jihong88/suneditor/issues?q=is%3Aissue+is%3Aclosed) to avoid duplicates.
|
|
24
|
+
- If your issue is new, [file a ticket](https://github.com/jihong88/suneditor/issues/new) with detailed info, including reproduction steps if possible.
|
|
24
25
|
|
|
25
|
-
|
|
26
|
-
- If no one has suggested something similar, open an ["issue"](https://github.com/swagger-api/swagger-codegen/issues) with your suggestion to gather feedback from the community.
|
|
27
|
-
- It's recommended to **create a new git branch** for the change so that the merge commit message looks nicer in the commit history.
|
|
26
|
+
---
|
|
28
27
|
|
|
29
|
-
##
|
|
28
|
+
## ✅ Before Submitting a PR
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
- Check that no one is working on the same thing in [open issues](https://github.com/jihong88/suneditor/issues).
|
|
31
|
+
- For new features or major changes, please open an issue first to gather feedback.
|
|
32
|
+
- Use a **feature branch** (not `master`) for your pull request.
|
|
33
|
+
- Make sure your code passes tests and doesn’t break existing functionality.
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
---
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
## 🤝 How to Contribute
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
We welcome code contributions, bug reports, documentation improvements, or plugin ideas!
|
|
38
40
|
|
|
39
|
-
|
|
41
|
+
### 🧹 Code Formatting
|
|
40
42
|
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
43
|
+
- Use the provided **ESLint** configuration.
|
|
44
|
+
- 4-space indentation
|
|
45
|
+
- Single quotes (`'`) for strings
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
---
|
|
46
48
|
|
|
47
|
-
|
|
49
|
+
## 🧩 Plugin Development
|
|
50
|
+
|
|
51
|
+
SunEditor allows custom plugins using a flexible API.
|
|
52
|
+
|
|
53
|
+
📘 Start from the [Plugin API Reference](https://suneditor.com/api/plugins)
|
|
54
|
+
🔍 Or explore the `src/plugins/` folder to see real examples.
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## 🔁 CI/CD
|
|
59
|
+
|
|
60
|
+
📦 The `dist/` folder is **not included** in the git repository.
|
|
61
|
+
⚙️ It is automatically built and deployed via **GitHub Actions** after changes are pushed to the `release` branch.
|
|
62
|
+
🛑 **Do not build or commit `dist/` files manually** – this may cause merge conflicts.
|
|
63
|
+
✅ The CI/CD pipeline ensures clean and consistent builds for every release.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## ⚙️ Framework Guide
|
|
68
|
+
|
|
69
|
+
If you're contributing to framework integrations:
|
|
70
|
+
|
|
71
|
+
- React: [suneditor-react](https://github.com/JiHong88/suneditor-react)
|
|
72
|
+
- Vue: [suneditor-vue](https://github.com/JiHong88/suneditor-vue)
|
|
73
|
+
|
|
74
|
+
💡 Feel free to propose wrappers for other frameworks too!
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
78
|
+
## 🤖 AI Plugin Helper
|
|
79
|
+
|
|
80
|
+
Need real-time help?
|
|
81
|
+
|
|
82
|
+
Check out **[SunEditor Devs AI](https://chatgpt.com/g/g-JViNPCrkD-suneditor-devs)** –
|
|
83
|
+
|
|
84
|
+
> 💡 Just paste your code or describe your plugin idea – and get instant support.
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
## 🗂️ Code Architecture
|
|
89
|
+
|
|
90
|
+
A quick overview of the `src/` directory:
|
|
91
|
+
|
|
92
|
+
### `/core/` – 🧠 Editor Core Logic
|
|
93
|
+
|
|
94
|
+
- `editor.js`: Defines the main Editor class, managing lifecycle, commands, and overall orchestration
|
|
95
|
+
- `section/`: Context management and document setup
|
|
96
|
+
- `class/`: Core classes like toolbars, selections, HTML parsing, etc.
|
|
97
|
+
- `base/`: Undo/redo history, event manager, and shared core logic
|
|
98
|
+
|
|
99
|
+
### `/helper/` – 🛠️ Utility Functions
|
|
100
|
+
|
|
101
|
+
- String converters, clipboard helpers, DOM queries
|
|
102
|
+
- `helper/dom/`: Low-level DOM operations
|
|
103
|
+
|
|
104
|
+
### `/modules/` – 🧩 Reusable UI Modules
|
|
105
|
+
|
|
106
|
+
- Functional components like:
|
|
107
|
+
- `Modal`, `ColorPicker`, `SelectMenu`, `FileManager`, etc.
|
|
108
|
+
- Useful for building consistent plugin UIs
|
|
109
|
+
|
|
110
|
+
### `/editorInjector/` – 🧬 Plugin Integration Point
|
|
111
|
+
|
|
112
|
+
- Wraps and initializes the core editor
|
|
113
|
+
- Plugins must inherit from this to register correctly
|
|
114
|
+
|
|
115
|
+
### `/plugins/` – ✨ Feature Extensions
|
|
116
|
+
|
|
117
|
+
- Modular plugins organized by type:
|
|
118
|
+
- Examples: `image`, `video`, `link`, `blockquote`, etc.
|
|
119
|
+
- Each plugin is isolated and optional
|
|
120
|
+
|
|
121
|
+
### `/langs/` – 🌍 i18n Support
|
|
122
|
+
|
|
123
|
+
- Language packs in separate JS files
|
|
124
|
+
|
|
125
|
+
### `/assets/` – 🎨 Styles & Icons
|
|
126
|
+
|
|
127
|
+
- CSS for editor layout and themes
|
|
128
|
+
- SVG icon sets (`icons/defaultIcons.js`)
|
|
129
|
+
|
|
130
|
+
### `/themes/` – 🧪 Theme Stylesheets
|
|
131
|
+
|
|
132
|
+
- Includes variants like `dark.css`
|
|
133
|
+
|
|
134
|
+
### `suneditor.js` – 🚪 Main Entry Point
|
|
135
|
+
|
|
136
|
+
- Bootstraps and exports the editor instance
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## 🚀 Useful Commands
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
# Start local dev server
|
|
144
|
+
npm run dev
|
|
145
|
+
|
|
146
|
+
# Build for development
|
|
147
|
+
npm run build:dev
|
|
148
|
+
|
|
149
|
+
# Build for production
|
|
150
|
+
npm run build:prod
|
|
151
|
+
|
|
152
|
+
# lint
|
|
153
|
+
npm run lint
|
|
154
|
+
|
|
155
|
+
# Auto-fix JavaScript issues
|
|
156
|
+
npm run lint:fix-js
|
|
157
|
+
|
|
158
|
+
# Auto-fix TypeScript issues
|
|
159
|
+
npm run lint:fix-ts
|
|
160
|
+
|
|
161
|
+
# ✅ Run before committing!
|
|
162
|
+
# Fix all lint issues (JS + TS)
|
|
163
|
+
npm run lint:fix-all
|
|
164
|
+
|
|
165
|
+
# Build types and update barrels
|
|
166
|
+
npm run ts-build
|
|
167
|
+
|
|
168
|
+
# Sync language files (base: en.js)
|
|
169
|
+
npm run i18n-build
|
|
170
|
+
|
|
171
|
+
# test
|
|
172
|
+
npm run test
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
> [scripts/README](https://github.com/JiHong88/suneditor/blob/develop/scripts/README.md)
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
Thanks for contributing 💛
|
|
180
|
+
You're helping make SunEditor better for everyone!
|
|
181
|
+
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
```
|
package/README.md
CHANGED
|
@@ -137,9 +137,18 @@ suneditor.create(document.querySelector('#editor'), {
|
|
|
137
137
|
|
|
138
138
|
---
|
|
139
139
|
|
|
140
|
+
## 🔧 Framework Integration
|
|
141
|
+
|
|
142
|
+
You can use the official wrappers for easier integration:
|
|
143
|
+
|
|
144
|
+
React – [suneditor-react](https://github.com/JiHong88/suneditor-react)\
|
|
145
|
+
Vue – [suneditor-vue](https://github.com/JiHong88/suneditor-vue)
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
140
149
|
## 📦 Plugins
|
|
141
150
|
|
|
142
|
-
SunEditor supports a plugin-based architecture
|
|
151
|
+
SunEditor supports a plugin-based architecture.\
|
|
143
152
|
You can enable only the plugins you need or even create your own custom ones.
|
|
144
153
|
|
|
145
154
|
```js
|
|
@@ -153,6 +162,9 @@ suneditor.create('#editor', {
|
|
|
153
162
|
|
|
154
163
|
📘 [Learn how to build your own plugin →](https://suneditor.com/plugins)
|
|
155
164
|
|
|
165
|
+
🤖 Want to build plugins? Get real-time help from [SunEditor Devs AI](https://chatgpt.com/g/g-JViNPCrkD-suneditor-devs).\
|
|
166
|
+
See [Contribution Guide](./CONTRIBUTING.md#ai-plugin-helper) for tips and examples.
|
|
167
|
+
|
|
156
168
|
---
|
|
157
169
|
|
|
158
170
|
## ✨ Contributors
|