@oix1987/yjd 1.0.0 → 1.0.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/README.md +73 -22
- package/dist/rich-editor.esm.js +2 -0
- package/dist/rich-editor.esm.js.map +1 -0
- package/dist/rich-editor.min.js +2 -0
- package/dist/rich-editor.min.js.map +1 -0
- package/package.json +12 -7
- package/index.js +0 -221
- package/lib/core/editor.js +0 -1175
- package/lib/core/format.js +0 -542
- package/lib/core/module.js +0 -81
- package/lib/core/registry.js +0 -152
- package/lib/formats/background.js +0 -212
- package/lib/formats/bold.js +0 -67
- package/lib/formats/capitalization.js +0 -563
- package/lib/formats/color.js +0 -165
- package/lib/formats/emoji.js +0 -282
- package/lib/formats/font-family.js +0 -547
- package/lib/formats/heading.js +0 -502
- package/lib/formats/image.js +0 -344
- package/lib/formats/import.js +0 -385
- package/lib/formats/indent.js +0 -297
- package/lib/formats/italic.js +0 -27
- package/lib/formats/line-height.js +0 -558
- package/lib/formats/link.js +0 -251
- package/lib/formats/list.js +0 -635
- package/lib/formats/strike.js +0 -31
- package/lib/formats/subscript.js +0 -36
- package/lib/formats/superscript.js +0 -35
- package/lib/formats/table.js +0 -288
- package/lib/formats/tag.js +0 -304
- package/lib/formats/text-align.js +0 -421
- package/lib/formats/text-size.js +0 -497
- package/lib/formats/underline.js +0 -30
- package/lib/formats/video.js +0 -372
- package/lib/modules/block-toolbar.js +0 -628
- package/lib/modules/code-view.js +0 -434
- package/lib/modules/history.js +0 -410
- package/lib/modules/resize-handles.js +0 -677
- package/lib/modules/table-toolbar.js +0 -618
- package/lib/modules/toolbar.js +0 -424
- package/lib/styles-loader.js +0 -144
- package/lib/styles.css +0 -2123
- package/lib/ui/color-picker.js +0 -296
- package/lib/ui/customselect.js +0 -319
- package/lib/ui/emoji-picker.js +0 -196
- package/lib/ui/icons.js +0 -413
- package/lib/ui/image-popup.js +0 -444
- package/lib/ui/import-popup.js +0 -288
- package/lib/ui/link-popup.js +0 -191
- package/lib/ui/list-picker.js +0 -307
- package/lib/ui/select-button.js +0 -61
- package/lib/ui/table-popup.js +0 -171
- package/lib/ui/tag-popup.js +0 -249
- package/lib/ui/text-align-picker.js +0 -281
- package/lib/ui/video-popup.js +0 -422
- package/lib/utils/history-helper.js +0 -50
- package/lib/utils/popup-helper.js +0 -219
- package/lib/utils/popup-positioning.js +0 -231
package/README.md
CHANGED
|
@@ -1,21 +1,30 @@
|
|
|
1
|
-
# Rich Text Editor
|
|
1
|
+
# @oix1987/yjd - Professional Rich Text Editor
|
|
2
2
|
|
|
3
|
-
A powerful rich text editor with real-time content change tracking.
|
|
3
|
+
A powerful, commercial-grade rich text editor with real-time content change tracking for web applications. Built with vanilla JavaScript for maximum performance and compatibility.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
5
|
+
## 🚀 Features
|
|
6
6
|
|
|
7
|
-
- Rich
|
|
8
|
-
-
|
|
9
|
-
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
7
|
+
- **Rich Text Formatting**: Bold, Italic, Underline, Strikethrough, Subscript, Superscript
|
|
8
|
+
- **Advanced Formatting**: Text alignment, line height, font family, text size, background colors
|
|
9
|
+
- **Content Management**: Images, tables, links, lists, emojis, videos
|
|
10
|
+
- **Real-time Tracking**: `onChange` callback for live content monitoring
|
|
11
|
+
- **Modern UI**: Customizable toolbar with intuitive controls
|
|
12
|
+
- **TypeScript Support**: Full type definitions included
|
|
13
|
+
- **Lightweight**: Pure JavaScript implementation, no heavy dependencies
|
|
14
|
+
- **Cross-browser**: Compatible with all modern browsers
|
|
12
15
|
|
|
13
|
-
##
|
|
16
|
+
## 📦 Installation
|
|
14
17
|
|
|
15
|
-
|
|
18
|
+
```bash
|
|
19
|
+
npm install @oix1987/yjd
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## 💻 Usage
|
|
23
|
+
|
|
24
|
+
### Basic Implementation
|
|
16
25
|
|
|
17
26
|
```javascript
|
|
18
|
-
import RichEditor from "
|
|
27
|
+
import RichEditor from "@oix1987/yjd";
|
|
19
28
|
|
|
20
29
|
const editor = new RichEditor("#editor-container", {
|
|
21
30
|
content: "<p>Initial content</p>",
|
|
@@ -32,14 +41,33 @@ const editor = new RichEditor("#editor-container", {
|
|
|
32
41
|
});
|
|
33
42
|
```
|
|
34
43
|
|
|
35
|
-
###
|
|
44
|
+
### CDN Usage
|
|
45
|
+
|
|
46
|
+
```html
|
|
47
|
+
<!-- Using jsDelivr CDN -->
|
|
48
|
+
<script src="https://cdn.jsdelivr.net/npm/@oix1987/yjd@1.0.2/dist/rich-editor.min.js"></script>
|
|
49
|
+
<script>
|
|
50
|
+
const editor = new RichEditor("#editor-container", {
|
|
51
|
+
// configuration options
|
|
52
|
+
});
|
|
53
|
+
</script>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Alternative CDN
|
|
57
|
+
|
|
58
|
+
```html
|
|
59
|
+
<!-- Using unpkg CDN -->
|
|
60
|
+
<script src="https://unpkg.com/@oix1987/yjd@1.0.2/dist/rich-editor.min.js"></script>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## ⚙️ Configuration Options
|
|
36
64
|
|
|
37
65
|
| Option | Type | Default | Description |
|
|
38
66
|
| ------------- | -------- | -------------- | --------------------------------------------- |
|
|
39
67
|
| `content` | string | null | Initial content for the editor |
|
|
40
68
|
| `height` | number | 400 | Editor height in pixels |
|
|
41
69
|
| `width` | number | 800 | Editor width in pixels |
|
|
42
|
-
| `theme` | string | 'light' | Editor theme
|
|
70
|
+
| `theme` | string | 'light' | Editor theme (light/dark) |
|
|
43
71
|
| `placeholder` | string | 'Type here...' | Placeholder text |
|
|
44
72
|
| `onChange` | function | undefined | Callback function called when content changes |
|
|
45
73
|
|
|
@@ -64,9 +92,9 @@ onChange: (content) => {
|
|
|
64
92
|
};
|
|
65
93
|
```
|
|
66
94
|
|
|
67
|
-
## Events
|
|
95
|
+
## 🎯 Events
|
|
68
96
|
|
|
69
|
-
The editor
|
|
97
|
+
The editor supports comprehensive event handling:
|
|
70
98
|
|
|
71
99
|
```javascript
|
|
72
100
|
// Listen for text changes
|
|
@@ -74,18 +102,41 @@ editor.on("text-change", (content) => {
|
|
|
74
102
|
console.log("Text changed:", content);
|
|
75
103
|
});
|
|
76
104
|
|
|
105
|
+
// Listen for focus events
|
|
106
|
+
editor.on("focus", () => {
|
|
107
|
+
console.log("Editor focused");
|
|
108
|
+
});
|
|
109
|
+
|
|
77
110
|
// Remove event listener
|
|
78
111
|
editor.off("text-change", handler);
|
|
79
112
|
```
|
|
80
113
|
|
|
81
|
-
## Methods
|
|
114
|
+
## 🔧 API Methods
|
|
115
|
+
|
|
116
|
+
| Method | Description | Parameters | Returns |
|
|
117
|
+
| --------------------- | ------------------------ | ---------------------------------- | -------- |
|
|
118
|
+
| `getContent()` | Get current HTML content | - | `string` |
|
|
119
|
+
| `setContent(content)` | Set editor content | `content: string` | `void` |
|
|
120
|
+
| `focus()` | Focus the editor | - | `void` |
|
|
121
|
+
| `on(event, handler)` | Add event listener | `event: string, handler: function` | `void` |
|
|
122
|
+
| `off(event, handler)` | Remove event listener | `event: string, handler: function` | `void` |
|
|
123
|
+
|
|
124
|
+
## 💼 Commercial License
|
|
125
|
+
|
|
126
|
+
This is a commercial product. For licensing information and pricing, please contact:
|
|
127
|
+
|
|
128
|
+
- **Author**: Oix1987
|
|
129
|
+
- **License**: ISC (Commercial)
|
|
130
|
+
- **Version**: 1.0.1
|
|
131
|
+
|
|
132
|
+
## 📄 License
|
|
133
|
+
|
|
134
|
+
Copyright (c) 2024 Oix1987. All rights reserved.
|
|
135
|
+
|
|
136
|
+
This software is licensed under the ISC License. Commercial use requires a valid license.
|
|
82
137
|
|
|
83
|
-
|
|
84
|
-
- `setContent(content)` - Set editor content
|
|
85
|
-
- `focus()` - Focus the editor
|
|
86
|
-
- `on(event, handler)` - Add event listener
|
|
87
|
-
- `off(event, handler)` - Remove event listener
|
|
138
|
+
## 🆘 Support
|
|
88
139
|
|
|
89
|
-
|
|
140
|
+
For technical support, feature requests, or licensing inquiries, please contact the author.
|
|
90
141
|
|
|
91
142
|
See `index.html` and `main.js` for a complete working example that demonstrates the `onChange` functionality with real-time output display.
|