@oix1987/yjd 1.0.1 → 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.
Files changed (58) hide show
  1. package/README.md +9 -1
  2. package/dist/rich-editor.esm.js +2 -0
  3. package/dist/rich-editor.esm.js.map +1 -0
  4. package/dist/rich-editor.min.js +2 -0
  5. package/dist/rich-editor.min.js.map +1 -0
  6. package/package.json +12 -7
  7. package/index.js +0 -221
  8. package/lib/core/editor.js +0 -1175
  9. package/lib/core/format.js +0 -542
  10. package/lib/core/module.js +0 -81
  11. package/lib/core/registry.js +0 -152
  12. package/lib/formats/background.js +0 -212
  13. package/lib/formats/bold.js +0 -67
  14. package/lib/formats/capitalization.js +0 -563
  15. package/lib/formats/color.js +0 -165
  16. package/lib/formats/emoji.js +0 -282
  17. package/lib/formats/font-family.js +0 -547
  18. package/lib/formats/heading.js +0 -502
  19. package/lib/formats/image.js +0 -344
  20. package/lib/formats/import.js +0 -385
  21. package/lib/formats/indent.js +0 -297
  22. package/lib/formats/italic.js +0 -27
  23. package/lib/formats/line-height.js +0 -558
  24. package/lib/formats/link.js +0 -251
  25. package/lib/formats/list.js +0 -635
  26. package/lib/formats/strike.js +0 -31
  27. package/lib/formats/subscript.js +0 -36
  28. package/lib/formats/superscript.js +0 -35
  29. package/lib/formats/table.js +0 -288
  30. package/lib/formats/tag.js +0 -304
  31. package/lib/formats/text-align.js +0 -421
  32. package/lib/formats/text-size.js +0 -497
  33. package/lib/formats/underline.js +0 -30
  34. package/lib/formats/video.js +0 -372
  35. package/lib/modules/block-toolbar.js +0 -628
  36. package/lib/modules/code-view.js +0 -434
  37. package/lib/modules/history.js +0 -410
  38. package/lib/modules/resize-handles.js +0 -677
  39. package/lib/modules/table-toolbar.js +0 -618
  40. package/lib/modules/toolbar.js +0 -424
  41. package/lib/styles-loader.js +0 -144
  42. package/lib/styles.css +0 -2123
  43. package/lib/ui/color-picker.js +0 -296
  44. package/lib/ui/customselect.js +0 -319
  45. package/lib/ui/emoji-picker.js +0 -196
  46. package/lib/ui/icons.js +0 -413
  47. package/lib/ui/image-popup.js +0 -444
  48. package/lib/ui/import-popup.js +0 -288
  49. package/lib/ui/link-popup.js +0 -191
  50. package/lib/ui/list-picker.js +0 -307
  51. package/lib/ui/select-button.js +0 -61
  52. package/lib/ui/table-popup.js +0 -171
  53. package/lib/ui/tag-popup.js +0 -249
  54. package/lib/ui/text-align-picker.js +0 -281
  55. package/lib/ui/video-popup.js +0 -422
  56. package/lib/utils/history-helper.js +0 -50
  57. package/lib/utils/popup-helper.js +0 -219
  58. package/lib/utils/popup-positioning.js +0 -231
package/package.json CHANGED
@@ -1,23 +1,28 @@
1
1
  {
2
2
  "name": "@oix1987/yjd",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "A powerful rich text editor with real-time content change tracking for web applications using base javascript",
5
5
  "license": "ISC",
6
6
  "author": "Oix1987",
7
7
  "type": "module",
8
8
  "main": "dist/rich-editor.min.js",
9
- "module": "lib/index.js",
9
+ "module": "dist/rich-editor.esm.js",
10
+ "exports": {
11
+ ".": {
12
+ "import": "./dist/rich-editor.esm.js",
13
+ "require": "./dist/rich-editor.min.js"
14
+ }
15
+ },
10
16
  "types": "index.d.ts",
11
17
  "files": [
12
- "lib",
13
- "assets",
14
18
  "dist",
15
- "index.js",
16
- "index.d.ts"
19
+ "index.d.ts",
20
+ "README.md"
17
21
  ],
18
22
  "scripts": {
19
23
  "test": "echo \"Error: no test specified\" && exit 1",
20
- "build": "rollup -c"
24
+ "build": "rollup -c",
25
+ "prepublishOnly": "npm run build"
21
26
  },
22
27
  "devDependencies": {
23
28
  "@rollup/plugin-terser": "^0.4.4",
package/index.js DELETED
@@ -1,221 +0,0 @@
1
- import Editor from './lib/core/editor.js';
2
- import registry from './lib/core/registry.js';
3
- import Module from './lib/core/module.js';
4
- import { Format, InlineFormat, BlockFormat } from './lib/core/format.js';
5
- import StylesLoader from './lib/styles-loader.js';
6
-
7
- // Import formats
8
- import Bold from './lib/formats/bold.js';
9
- import Italic from './lib/formats/italic.js';
10
- import Underline from './lib/formats/underline.js';
11
- import Strike from './lib/formats/strike.js';
12
- import Subscript from './lib/formats/subscript.js';
13
- import Superscript from './lib/formats/superscript.js';
14
- import Color from './lib/formats/color.js';
15
- import Background from './lib/formats/background.js';
16
- import Link from './lib/formats/link.js';
17
- import Table from './lib/formats/table.js';
18
- import Heading from './lib/formats/heading.js';
19
- import FontFamily from './lib/formats/font-family.js';
20
- import LineHeight from './lib/formats/line-height.js';
21
- import Capitalization from './lib/formats/capitalization.js';
22
- import TextAlign from './lib/formats/text-align.js';
23
- import List from './lib/formats/list.js';
24
- import Indent, { IndentIncrease, IndentDecrease } from './lib/formats/indent.js';
25
- import Emoji from './lib/formats/emoji.js';
26
- import Image from './lib/formats/image.js';
27
- import Video from './lib/formats/video.js';
28
- import Tag from './lib/formats/tag.js';
29
- import TextSize from './lib/formats/text-size.js';
30
-
31
- import Import from './lib/formats/import.js';
32
-
33
- // Import modules
34
- import Toolbar from './lib/modules/toolbar.js';
35
- import History from './lib/modules/history.js';
36
- import BlockToolbar from './lib/modules/block-toolbar.js';
37
- import TableToolbar from './lib/modules/table-toolbar.js';
38
- import CodeView from './lib/modules/code-view.js';
39
-
40
- import ResizeHandles from './lib/modules/resize-handles.js';
41
-
42
- // Import UI components
43
- import ColorPicker from './lib/ui/color-picker.js';
44
- import IconUtils from './lib/ui/icons.js';
45
- import LinkPopup from './lib/ui/link-popup.js';
46
- import TablePopup from './lib/ui/table-popup.js';
47
- import TextAlignPicker from './lib/ui/text-align-picker.js';
48
- import ListPicker from './lib/ui/list-picker.js';
49
- import EmojiPicker from './lib/ui/emoji-picker.js';
50
- import ImagePopup from './lib/ui/image-popup.js';
51
- import VideoPopup from './lib/ui/video-popup.js';
52
- import TagPopup from './lib/ui/tag-popup.js';
53
-
54
- import createCustomButton from './lib/ui/select-button.js';
55
-
56
-
57
-
58
- // Register default formats
59
- registry.register('formats/bold', Bold, true);
60
- registry.register('formats/italic', Italic, true);
61
- registry.register('formats/underline', Underline, true);
62
- registry.register('formats/strike', Strike, true);
63
- registry.register('formats/subscript', Subscript, true);
64
- registry.register('formats/superscript', Superscript, true);
65
- registry.register('formats/color', Color, true);
66
- registry.register('formats/background', Background, true);
67
- registry.register('formats/link', Link, true);
68
- registry.register('formats/table', Table, true);
69
- registry.register('formats/heading', Heading, true);
70
- registry.register('formats/font-family', FontFamily, true);
71
- registry.register('formats/line-height', LineHeight, true);
72
- registry.register('formats/capitalization', Capitalization, true);
73
- registry.register('formats/text-align', TextAlign, true);
74
- registry.register('formats/list', List, true);
75
- registry.register('formats/indent', Indent, true);
76
- registry.register('formats/indent-increase', IndentIncrease, true);
77
- registry.register('formats/indent-decrease', IndentDecrease, true);
78
- registry.register('formats/emoji', Emoji, true);
79
- registry.register('formats/image', Image, true);
80
- registry.register('formats/video', Video, true);
81
- registry.register('formats/tag', Tag, true);
82
- registry.register('formats/text-size', TextSize, true);
83
-
84
- registry.register('formats/import', Import, true);
85
-
86
- // Register default modules
87
- registry.register('modules/toolbar', Toolbar, true);
88
- registry.register('modules/history', History, true);
89
- registry.register('modules/block-toolbar', BlockToolbar, true);
90
- registry.register('modules/table-toolbar', TableToolbar, true);
91
- registry.register('modules/code-view', CodeView, true);
92
-
93
- registry.register('modules/resize-handles', ResizeHandles, true);
94
-
95
- // Register UI components
96
- registry.register('ui/color-picker', ColorPicker, true);
97
- registry.register('ui/text-align-picker', TextAlignPicker, true);
98
- registry.register('ui/list-picker', ListPicker, true);
99
- registry.register('ui/emoji-picker', EmojiPicker, true);
100
- registry.register('ui/image-popup', ImagePopup, true);
101
- registry.register('ui/video-popup', VideoPopup, true);
102
- registry.register('ui/tag-popup', TagPopup, true);
103
-
104
- registry.register('ui/custom-button', createCustomButton, true);
105
-
106
-
107
-
108
- // Load CSS styles
109
- StylesLoader.loadStyles().catch(error => {
110
- console.warn('Could not load Rich Editor styles:', error);
111
- });
112
-
113
- // Main Editor class with registration system
114
- class RichEditor extends Editor {
115
- /**
116
- * Register a module, format, or theme
117
- * @param {string|object} path - Registration path
118
- * @param {*} definition - Class definition
119
- * @param {boolean} suppressWarning - Suppress overwrite warnings
120
- */
121
- static register(path, definition, suppressWarning = false) {
122
- registry.register(path, definition, suppressWarning);
123
- }
124
-
125
- /**
126
- * Get registered item
127
- * @param {string} path - Registration path
128
- */
129
- static get(path) {
130
- return registry.get(path);
131
- }
132
-
133
- /**
134
- * Create new editor instance
135
- * @param {string|Element} selector - DOM selector or element
136
- * @param {object} options - Editor options
137
- */
138
- static create(selector, options = {}) {
139
- return new RichEditor(selector, options);
140
- }
141
- }
142
-
143
- // Export classes for extension
144
- export {
145
- RichEditor as default,
146
- Editor,
147
- Module,
148
- Format,
149
- InlineFormat,
150
- BlockFormat,
151
- registry
152
- };
153
-
154
- // Export formats
155
- export {
156
- Bold,
157
- Italic,
158
- Underline,
159
- Strike,
160
- Subscript,
161
- Superscript,
162
- Color,
163
- Background,
164
- Link,
165
- Table,
166
- Heading,
167
- FontFamily,
168
- LineHeight,
169
- Capitalization,
170
- TextAlign,
171
- List,
172
- Indent,
173
- IndentIncrease,
174
- IndentDecrease,
175
- Emoji,
176
- Image,
177
- Video,
178
- Tag,
179
- TextSize,
180
-
181
- Import
182
- };
183
-
184
- // Export modules
185
- export {
186
- Toolbar,
187
- History,
188
- BlockToolbar,
189
- TableToolbar,
190
- CodeView,
191
-
192
- ResizeHandles
193
- };
194
-
195
- // Export UI components
196
- export {
197
- ColorPicker,
198
- IconUtils,
199
- LinkPopup,
200
- TablePopup,
201
- TextAlignPicker,
202
- ListPicker,
203
- EmojiPicker,
204
- ImagePopup,
205
- VideoPopup,
206
- TagPopup,
207
-
208
- createCustomButton
209
- };
210
-
211
-
212
-
213
-
214
- /**
215
- * Utility function to create editor instance
216
- * @param {string|Element} selector - DOM selector or element
217
- * @param {object} options - Editor options
218
- */
219
- export function createEditor(selector, options = {}) {
220
- return new RichEditor(selector, options);
221
- }