suneditor 3.0.0-beta.3 → 3.0.0-beta.30
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 +8 -8
- package/README.md +44 -49
- package/dist/suneditor.min.css +1 -1
- package/dist/suneditor.min.js +1 -1
- package/package.json +95 -53
- package/src/assets/design/color.css +2 -2
- package/src/assets/design/size.css +2 -0
- package/src/assets/icons/defaultIcons.js +16 -1
- package/src/assets/suneditor-contents.css +9 -8
- package/src/assets/suneditor.css +29 -26
- package/src/core/{section → base}/actives.js +20 -12
- package/src/core/base/history.js +4 -4
- package/src/core/class/char.js +10 -10
- package/src/core/class/component.js +146 -57
- package/src/core/class/format.js +94 -2458
- package/src/core/class/html.js +187 -129
- package/src/core/class/inline.js +1853 -0
- package/src/core/class/listFormat.js +582 -0
- package/src/core/class/menu.js +14 -3
- package/src/core/class/nodeTransform.js +9 -14
- package/src/core/class/offset.js +162 -197
- package/src/core/class/selection.js +137 -34
- package/src/core/class/toolbar.js +73 -52
- package/src/core/class/ui.js +11 -11
- package/src/core/class/viewer.js +56 -55
- package/src/core/config/context.js +122 -0
- package/src/core/config/frameContext.js +204 -0
- package/src/core/config/options.js +639 -0
- package/src/core/editor.js +181 -108
- package/src/core/event/actions/index.js +229 -0
- package/src/core/event/effects/common.registry.js +60 -0
- package/src/core/event/effects/keydown.registry.js +551 -0
- package/src/core/event/effects/ruleHelpers.js +145 -0
- package/src/core/{base → event}/eventManager.js +119 -201
- package/src/core/event/executor.js +21 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_toolbar.js +4 -4
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.js +2 -2
- package/src/core/event/handlers/handler_ww_input.js +77 -0
- package/src/core/event/handlers/handler_ww_key.js +228 -0
- package/src/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.js +3 -3
- package/src/core/event/ports.js +211 -0
- package/src/core/event/reducers/keydown.reducer.js +89 -0
- package/src/core/event/rules/keydown.rule.arrow.js +54 -0
- package/src/core/event/rules/keydown.rule.backspace.js +202 -0
- package/src/core/event/rules/keydown.rule.delete.js +126 -0
- package/src/core/event/rules/keydown.rule.enter.js +144 -0
- package/src/core/event/rules/keydown.rule.tab.js +29 -0
- package/src/core/section/constructor.js +79 -388
- package/src/core/section/documentType.js +47 -26
- package/src/core/util/instanceCheck.js +59 -0
- package/src/editorInjector/_classes.js +4 -0
- package/src/editorInjector/_core.js +17 -7
- package/src/editorInjector/index.js +10 -2
- package/src/events.js +6 -0
- package/src/helper/clipboard.js +24 -10
- package/src/helper/converter.js +17 -12
- package/src/helper/dom/domCheck.js +22 -3
- package/src/helper/dom/domQuery.js +91 -45
- package/src/helper/dom/domUtils.js +93 -19
- package/src/helper/dom/index.js +4 -0
- package/src/helper/env.js +11 -7
- package/src/helper/keyCodeMap.js +4 -3
- package/src/langs/ckb.js +1 -1
- package/src/langs/cs.js +1 -1
- package/src/langs/da.js +1 -1
- package/src/langs/de.js +1 -1
- package/src/langs/en.js +1 -1
- package/src/langs/es.js +1 -1
- package/src/langs/fa.js +1 -1
- package/src/langs/fr.js +1 -1
- package/src/langs/he.js +1 -1
- package/src/langs/hu.js +1 -1
- package/src/langs/it.js +1 -1
- package/src/langs/ja.js +1 -1
- package/src/langs/km.js +1 -1
- package/src/langs/ko.js +1 -1
- package/src/langs/lv.js +1 -1
- package/src/langs/nl.js +1 -1
- package/src/langs/pl.js +1 -1
- package/src/langs/pt_br.js +10 -10
- package/src/langs/ro.js +1 -1
- package/src/langs/ru.js +1 -1
- package/src/langs/se.js +1 -1
- package/src/langs/tr.js +1 -1
- package/src/langs/uk.js +1 -1
- package/src/langs/ur.js +1 -1
- package/src/langs/zh_cn.js +1 -1
- package/src/modules/ApiManager.js +25 -18
- package/src/modules/Browser.js +52 -61
- package/src/modules/ColorPicker.js +37 -38
- package/src/modules/Controller.js +85 -79
- package/src/modules/Figure.js +275 -187
- package/src/modules/FileManager.js +86 -92
- package/src/modules/HueSlider.js +67 -35
- package/src/modules/Modal.js +84 -77
- package/src/modules/ModalAnchorEditor.js +62 -79
- package/src/modules/SelectMenu.js +89 -86
- package/src/plugins/browser/audioGallery.js +9 -5
- package/src/plugins/browser/fileBrowser.js +10 -6
- package/src/plugins/browser/fileGallery.js +9 -5
- package/src/plugins/browser/imageGallery.js +9 -5
- package/src/plugins/browser/videoGallery.js +11 -6
- package/src/plugins/command/blockquote.js +1 -0
- package/src/plugins/command/exportPDF.js +11 -8
- package/src/plugins/command/fileUpload.js +41 -29
- package/src/plugins/command/list_bulleted.js +2 -1
- package/src/plugins/command/list_numbered.js +2 -1
- package/src/plugins/dropdown/align.js +8 -2
- package/src/plugins/dropdown/backgroundColor.js +19 -11
- package/src/plugins/dropdown/font.js +15 -9
- package/src/plugins/dropdown/fontColor.js +19 -11
- package/src/plugins/dropdown/formatBlock.js +7 -2
- package/src/plugins/dropdown/hr.js +7 -3
- package/src/plugins/dropdown/layout.js +6 -2
- package/src/plugins/dropdown/lineHeight.js +8 -3
- package/src/plugins/dropdown/list.js +2 -1
- package/src/plugins/dropdown/paragraphStyle.js +15 -11
- package/src/plugins/dropdown/{table.js → table/index.js} +514 -362
- package/src/plugins/dropdown/template.js +6 -2
- package/src/plugins/dropdown/textStyle.js +7 -3
- package/src/plugins/field/mention.js +33 -27
- package/src/plugins/input/fontSize.js +44 -37
- package/src/plugins/input/pageNavigator.js +3 -2
- package/src/plugins/modal/audio.js +90 -85
- package/src/plugins/modal/drawing.js +58 -66
- package/src/plugins/modal/embed.js +193 -180
- package/src/plugins/modal/image.js +441 -439
- package/src/plugins/modal/link.js +31 -8
- package/src/plugins/modal/math.js +23 -22
- package/src/plugins/modal/video.js +233 -230
- package/src/plugins/popup/anchor.js +24 -18
- package/src/suneditor.js +69 -24
- package/src/typedef.js +42 -19
- package/types/assets/icons/defaultIcons.d.ts +8 -0
- package/types/core/class/char.d.ts +1 -1
- package/types/core/class/component.d.ts +29 -7
- package/types/core/class/format.d.ts +4 -354
- package/types/core/class/html.d.ts +13 -4
- package/types/core/class/inline.d.ts +263 -0
- package/types/core/class/listFormat.d.ts +135 -0
- package/types/core/class/menu.d.ts +10 -2
- package/types/core/class/offset.d.ts +24 -26
- package/types/core/class/selection.d.ts +2 -0
- package/types/core/class/toolbar.d.ts +24 -11
- package/types/core/class/ui.d.ts +1 -1
- package/types/core/class/viewer.d.ts +1 -1
- package/types/core/config/context.d.ts +157 -0
- package/types/core/config/frameContext.d.ts +367 -0
- package/types/core/config/options.d.ts +1119 -0
- package/types/core/editor.d.ts +101 -66
- package/types/core/event/actions/index.d.ts +47 -0
- package/types/core/event/effects/common.registry.d.ts +50 -0
- package/types/core/event/effects/keydown.registry.d.ts +73 -0
- package/types/core/event/effects/ruleHelpers.d.ts +31 -0
- package/types/core/{base → event}/eventManager.d.ts +15 -46
- package/types/core/event/executor.d.ts +6 -0
- package/types/core/event/handlers/handler_ww_input.d.ts +41 -0
- package/types/core/{base/eventHandlers/handler_ww_key_input.d.ts → event/handlers/handler_ww_key.d.ts} +4 -6
- package/types/core/event/ports.d.ts +255 -0
- package/types/core/event/reducers/keydown.reducer.d.ts +75 -0
- package/types/core/event/rules/keydown.rule.arrow.d.ts +8 -0
- package/types/core/event/rules/keydown.rule.backspace.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.delete.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.enter.d.ts +9 -0
- package/types/core/event/rules/keydown.rule.tab.d.ts +9 -0
- package/types/core/section/constructor.d.ts +101 -631
- package/types/core/section/documentType.d.ts +14 -4
- package/types/core/util/instanceCheck.d.ts +50 -0
- package/types/editorInjector/_classes.d.ts +4 -0
- package/types/editorInjector/_core.d.ts +17 -7
- package/types/editorInjector/index.d.ts +10 -2
- package/types/events.d.ts +1 -0
- package/types/helper/clipboard.d.ts +2 -2
- package/types/helper/converter.d.ts +6 -9
- package/types/helper/dom/domCheck.d.ts +7 -0
- package/types/helper/dom/domQuery.d.ts +19 -8
- package/types/helper/dom/domUtils.d.ts +24 -2
- package/types/helper/dom/index.d.ts +86 -1
- package/types/helper/env.d.ts +6 -1
- package/types/helper/index.d.ts +7 -1
- package/types/helper/keyCodeMap.d.ts +3 -3
- package/types/index.d.ts +23 -117
- package/types/langs/index.d.ts +2 -2
- package/types/modules/ApiManager.d.ts +1 -8
- package/types/modules/Browser.d.ts +4 -62
- package/types/modules/ColorPicker.d.ts +4 -21
- package/types/modules/Controller.d.ts +8 -64
- package/types/modules/Figure.d.ts +54 -50
- package/types/modules/FileManager.d.ts +1 -13
- package/types/modules/HueSlider.d.ts +13 -3
- package/types/modules/Modal.d.ts +0 -43
- package/types/modules/ModalAnchorEditor.d.ts +0 -73
- package/types/modules/SelectMenu.d.ts +0 -85
- package/types/modules/index.d.ts +3 -3
- package/types/plugins/browser/audioGallery.d.ts +29 -18
- package/types/plugins/browser/fileBrowser.d.ts +38 -27
- package/types/plugins/browser/fileGallery.d.ts +29 -18
- package/types/plugins/browser/imageGallery.d.ts +24 -16
- package/types/plugins/browser/videoGallery.d.ts +29 -18
- package/types/plugins/command/blockquote.d.ts +1 -0
- package/types/plugins/command/exportPDF.d.ts +18 -18
- package/types/plugins/command/fileUpload.d.ts +65 -45
- package/types/plugins/command/list_bulleted.d.ts +1 -0
- package/types/plugins/command/list_numbered.d.ts +1 -0
- package/types/plugins/dropdown/align.d.ts +13 -8
- package/types/plugins/dropdown/backgroundColor.d.ts +30 -19
- package/types/plugins/dropdown/font.d.ts +13 -12
- package/types/plugins/dropdown/fontColor.d.ts +30 -19
- package/types/plugins/dropdown/formatBlock.d.ts +13 -8
- package/types/plugins/dropdown/hr.d.ts +15 -11
- package/types/plugins/dropdown/layout.d.ts +15 -11
- package/types/plugins/dropdown/lineHeight.d.ts +16 -11
- package/types/plugins/dropdown/list.d.ts +1 -0
- package/types/plugins/dropdown/paragraphStyle.d.ts +31 -27
- package/types/plugins/dropdown/table/index.d.ts +582 -0
- package/types/plugins/dropdown/table.d.ts +41 -86
- package/types/plugins/dropdown/template.d.ts +15 -11
- package/types/plugins/dropdown/textStyle.d.ts +19 -11
- package/types/plugins/field/mention.d.ts +58 -56
- package/types/plugins/index.d.ts +38 -38
- package/types/plugins/input/fontSize.d.ts +46 -50
- package/types/plugins/modal/audio.d.ts +26 -56
- package/types/plugins/modal/drawing.d.ts +0 -85
- package/types/plugins/modal/embed.d.ts +15 -79
- package/types/plugins/modal/image.d.ts +24 -136
- package/types/plugins/modal/link.d.ts +34 -15
- package/types/plugins/modal/math.d.ts +0 -16
- package/types/plugins/modal/video.d.ts +17 -86
- package/types/plugins/popup/anchor.d.ts +1 -8
- package/types/suneditor.d.ts +70 -19
- package/types/typedef.d.ts +60 -46
- package/src/core/base/eventHandlers/handler_ww_key_input.js +0 -1200
- package/src/core/section/context.js +0 -102
- package/types/core/section/context.d.ts +0 -45
- package/types/langs/_Lang.d.ts +0 -194
- /package/src/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.js +0 -0
- /package/types/core/{section → base}/actives.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_toolbar.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_clipboard.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_dragDrop.d.ts +0 -0
- /package/types/core/{base/eventHandlers → event/handlers}/handler_ww_mouse.d.ts +0 -0
package/CONTRIBUTING.md
CHANGED
|
@@ -4,16 +4,14 @@
|
|
|
4
4
|
|
|
5
5
|
## 📘 Introduction
|
|
6
6
|
|
|
7
|
-
The codebase is written in **JavaScript
|
|
7
|
+
The codebase is written in **JavaScript**, using **JSDoc** for type definitions.
|
|
8
8
|
Node.js **v14 or higher** is required to build and test.
|
|
9
9
|
|
|
10
10
|
### 📝 Notes
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- Private class fields (`#myField`)
|
|
16
|
-
- Polyfills are **not included** – make sure your target environment supports these features.
|
|
12
|
+
- **Polyfills are not included**. Make sure your target environment (browser or runtime) natively supports these features.
|
|
13
|
+
- Target ECMAScript version: **ES2022**
|
|
14
|
+
- Supported browsers: [See Browser Support](./README.md#-browser-support)
|
|
17
15
|
|
|
18
16
|
---
|
|
19
17
|
|
|
@@ -27,6 +25,8 @@ Node.js **v14 or higher** is required to build and test.
|
|
|
27
25
|
|
|
28
26
|
## ✅ Before Submitting a PR
|
|
29
27
|
|
|
28
|
+
> [commit-guide](./guide/commit-types.md)
|
|
29
|
+
|
|
30
30
|
- Check that no one is working on the same thing in [open issues](https://github.com/jihong88/suneditor/issues).
|
|
31
31
|
- For new features or major changes, please open an issue first to gather feedback.
|
|
32
32
|
- Use a **feature branch** (not `master`) for your pull request.
|
|
@@ -139,6 +139,8 @@ A quick overview of the `src/` directory:
|
|
|
139
139
|
|
|
140
140
|
## 🚀 Useful Commands
|
|
141
141
|
|
|
142
|
+
> [scripts-guide](./guide/scripts-guide.md)
|
|
143
|
+
|
|
142
144
|
```bash
|
|
143
145
|
# Start local dev server
|
|
144
146
|
npm run dev
|
|
@@ -172,8 +174,6 @@ npm run i18n-build
|
|
|
172
174
|
npm run test
|
|
173
175
|
```
|
|
174
176
|
|
|
175
|
-
> [scripts/README](https://github.com/JiHong88/suneditor/blob/develop/scripts/README.md)
|
|
176
|
-
|
|
177
177
|
---
|
|
178
178
|
|
|
179
179
|
Thanks for contributing 💛
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://suneditor.com" target="_blank">
|
|
3
|
-
<img src="https://suneditor-files.s3.ap-northeast-2.amazonaws.com/docs/se3_logo_title_flat.svg" alt="SunEditor" width="280" />
|
|
3
|
+
<img src="https://suneditor-files.s3.ap-northeast-2.amazonaws.com/docs/se3_logo_title_flat.svg?v=1" alt="SunEditor" width="280" />
|
|
4
4
|
</a>
|
|
5
5
|
</p>
|
|
6
6
|
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<a href="https://www.npmjs.com/package/suneditor" title="npm release"><img src="https://img.shields.io/npm/v/suneditor.svg?style=flat-square" alt="npm"></a>
|
|
12
12
|
<a href="https://www.npmjs.com/package/suneditor" title="npm month downloads"><img src="https://img.shields.io/npm/dm/suneditor.svg?logo=npm&style=flat-square" alt="npm weekly downloads"></a>
|
|
13
13
|
<a href="https://www.jsdelivr.com/package/npm/suneditor" title="jsDelivr CDN month downloads"><img src="https://img.shields.io/jsdelivr/npm/hm/suneditor?label=CDN&style=flat-square" alt="jsDelivr CDN" /></a>
|
|
14
|
+
<a href="https://codecov.io/gh/jihong88/suneditor" title="Test coverage"><img src="https://codecov.io/gh/jihong88/suneditor/branch/develop/graph/badge.svg" alt="Test coverage" /></a>
|
|
14
15
|
</p>
|
|
15
16
|
|
|
16
17
|
#
|
|
@@ -24,16 +25,16 @@ It's easy to integrate, highly customizable, and built for modern web applicatio
|
|
|
24
25
|
|
|
25
26
|
### Key Features
|
|
26
27
|
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
-
|
|
31
|
-
-
|
|
32
|
-
-
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
28
|
+
- ⚡ **No dependencies** — Optimized for speed and simplicity
|
|
29
|
+
- 🧩 **Modular architecture** — Enable only the plugins you need
|
|
30
|
+
- 📱 **Responsive UI** — Works smoothly on all modern devices
|
|
31
|
+
- 🔌 **Framework-friendly** — Easy to use with React, Vue, Svelte, etc.
|
|
32
|
+
- 💼 **Feature-rich plugin ecosystem**, including:
|
|
33
|
+
- 🏷 @Mentions with autocomplete
|
|
34
|
+
- 🎨 Advanced table editing & custom layouts
|
|
35
|
+
- 🧮 Math (LaTeX), drawing, and code block support
|
|
36
|
+
- 📂 Built-in media galleries (image, video, audio, file)
|
|
37
|
+
- 📄 PDF export, templates, and embedded content (audio/video/iframe)
|
|
37
38
|
|
|
38
39
|
🌤 **[Explore all plugins](https://suneditor.com/plugins)**
|
|
39
40
|
|
|
@@ -43,23 +44,37 @@ It's easy to integrate, highly customizable, and built for modern web applicatio
|
|
|
43
44
|
|
|
44
45
|
## 🌍 Browser Support
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
|
52
|
-
|
|
|
53
|
-
|  | 119 (Oct 2023) |
|
|
55
|
+
|  | 119 (Nov 2023) |
|
|
56
|
+
|  | 121 (Dec 2023) |
|
|
57
|
+
|  | 17.0 (Sep 2023) |
|
|
58
|
+
|  | 105 (Nov 2023) |
|
|
59
|
+
|  | 119 (Oct 2023) |
|
|
60
|
+
|  | 23.0 (Oct 2023) |
|
|
61
|
+
|  | 128 (Jul 2024) |
|
|
56
62
|
|
|
57
63
|
❌ Not Supported : IE, Legacy Edge
|
|
58
64
|
|
|
65
|
+
### 📌 Why This Baseline? (Late 2023)
|
|
66
|
+
|
|
67
|
+
- This is based on features commonly supported by modern browsers.
|
|
68
|
+
- Most modern web APIs and CSS features are supported reliably in versions after this point.
|
|
69
|
+
- Unless specific compatibility issues arise, you can use it out of the box without additional polyfills.
|
|
70
|
+
- If you need support for older browsers, you can extend it by adding your own polyfills.
|
|
71
|
+
|
|
59
72
|
---
|
|
60
73
|
|
|
61
74
|
## 📦 Legacy Version (v2-legacy)
|
|
62
75
|
|
|
76
|
+
\* Supported IE11
|
|
77
|
+
|
|
63
78
|
> **SunEditor v3 is the latest version.**
|
|
64
79
|
> This section refers to the **previous stable version, SunEditor v2**.
|
|
65
80
|
|
|
@@ -87,20 +102,7 @@ import suneditor from 'suneditor';
|
|
|
87
102
|
|
|
88
103
|
// HTML: <div id="editor"></div> or <textarea id="editor"></textarea>
|
|
89
104
|
suneditor.create(document.querySelector('#editor'), {
|
|
90
|
-
|
|
91
|
-
['undo', 'redo'],
|
|
92
|
-
'|',
|
|
93
|
-
['bold', 'underline', 'italic', 'strike', '|', 'subscript', 'superscript'],
|
|
94
|
-
'|',
|
|
95
|
-
['removeFormat'],
|
|
96
|
-
'|',
|
|
97
|
-
['outdent', 'indent'],
|
|
98
|
-
'|',
|
|
99
|
-
['fullScreen', 'showBlocks', 'codeView'],
|
|
100
|
-
'|',
|
|
101
|
-
['preview', 'print', 'copy']
|
|
102
|
-
],
|
|
103
|
-
height: 'auto'
|
|
105
|
+
// options
|
|
104
106
|
});
|
|
105
107
|
```
|
|
106
108
|
|
|
@@ -117,20 +119,7 @@ suneditor.create(document.querySelector('#editor'), {
|
|
|
117
119
|
|
|
118
120
|
<script>
|
|
119
121
|
SUNEDITOR.create(document.querySelector('#editor'), {
|
|
120
|
-
|
|
121
|
-
['undo', 'redo'],
|
|
122
|
-
'|',
|
|
123
|
-
['bold', 'underline', 'italic', 'strike', '|', 'subscript', 'superscript'],
|
|
124
|
-
'|',
|
|
125
|
-
['removeFormat'],
|
|
126
|
-
'|',
|
|
127
|
-
['outdent', 'indent'],
|
|
128
|
-
'|',
|
|
129
|
-
['fullScreen', 'showBlocks', 'codeView'],
|
|
130
|
-
'|',
|
|
131
|
-
['preview', 'print', 'copy']
|
|
132
|
-
],
|
|
133
|
-
height: 'auto'
|
|
122
|
+
// options
|
|
134
123
|
});
|
|
135
124
|
</script>
|
|
136
125
|
```
|
|
@@ -175,6 +164,12 @@ See [Contribution Guide](./CONTRIBUTING.md#ai-plugin-helper) for tips and exampl
|
|
|
175
164
|
|
|
176
165
|
---
|
|
177
166
|
|
|
167
|
+
## 💎 Sponsors
|
|
168
|
+
|
|
169
|
+
[](https://opencollective.com/suneditor)
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
178
173
|
## 📄 License
|
|
179
174
|
|
|
180
175
|
SunEditor is an open-source project available under the [MIT License](./LICENSE).
|