@editora/core 1.0.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ajay Kumar
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,230 @@
1
+ # @editora/core
2
+
3
+ Framework-agnostic core editor engine for Editora Rich Text Editor.
4
+
5
+ ## 📦 Installation
6
+
7
+ ```bash
8
+ npm install @editora/core
9
+ ```
10
+
11
+ ## 🎯 Overview
12
+
13
+ The core package provides the fundamental editor engine that can be integrated with any JavaScript framework. It's built on top of modern web standards and provides a solid foundation for building rich text editors.
14
+
15
+ ## ✨ Features
16
+
17
+ - **Framework Agnostic**: Works with React, Vue, Angular, Svelte, or vanilla JavaScript
18
+ - **Type Safe**: Full TypeScript support with comprehensive type definitions
19
+ - **Modular Architecture**: Plugin-based system for extending functionality
20
+ - **Performance Optimized**: Efficient DOM manipulation and memory management
21
+ - **XSS Protection**: Built-in content sanitization and security
22
+ - **Accessibility**: WCAG compliant with keyboard navigation support
23
+
24
+ ## 🚀 Quick Start
25
+
26
+ ### Basic Usage
27
+
28
+ ```typescript
29
+ import { createEditor, EditorConfig } from '@editora/core';
30
+
31
+ // Create editor configuration
32
+ const config: EditorConfig = {
33
+ content: '<p>Hello World!</p>',
34
+ placeholder: 'Start typing...',
35
+ onChange: (html) => {
36
+ console.log('Content changed:', html);
37
+ }
38
+ };
39
+
40
+ // Create editor instance
41
+ const editor = createEditor(config);
42
+
43
+ // Mount to DOM element
44
+ const container = document.getElementById('editor');
45
+ editor.mount(container);
46
+ ```
47
+
48
+ ### With Plugins
49
+
50
+ ```typescript
51
+ import { createEditor } from '@editora/core';
52
+ import { BoldPlugin, ItalicPlugin, HeadingPlugin } from '@editora/plugins';
53
+
54
+ const editor = createEditor({
55
+ plugins: [
56
+ new BoldPlugin(),
57
+ new ItalicPlugin(),
58
+ new HeadingPlugin()
59
+ ],
60
+ content: '<h1>Welcome</h1><p>Start writing...</p>'
61
+ });
62
+
63
+ editor.mount(document.getElementById('editor'));
64
+ ```
65
+
66
+ ## 📖 API Reference
67
+
68
+ ### `createEditor(config: EditorConfig): Editor`
69
+
70
+ Creates a new editor instance with the provided configuration.
71
+
72
+ **Parameters:**
73
+ - `config.content` (string, optional): Initial HTML content
74
+ - `config.placeholder` (string, optional): Placeholder text when empty
75
+ - `config.onChange` (function, optional): Callback fired when content changes
76
+ - `config.plugins` (Plugin[], optional): Array of plugins to load
77
+ - `config.readonly` (boolean, optional): Make editor read-only
78
+ - `config.autofocus` (boolean, optional): Auto-focus on mount
79
+
80
+ **Returns:** Editor instance
81
+
82
+ ### Editor Instance Methods
83
+
84
+ #### `mount(element: HTMLElement): void`
85
+
86
+ Mounts the editor to a DOM element.
87
+
88
+ ```typescript
89
+ editor.mount(document.getElementById('editor'));
90
+ ```
91
+
92
+ #### `unmount(): void`
93
+
94
+ Unmounts the editor and cleans up resources.
95
+
96
+ ```typescript
97
+ editor.unmount();
98
+ ```
99
+
100
+ #### `getHTML(): string`
101
+
102
+ Gets the current editor content as HTML.
103
+
104
+ ```typescript
105
+ const html = editor.getHTML();
106
+ ```
107
+
108
+ #### `setHTML(html: string): void`
109
+
110
+ Sets the editor content from HTML.
111
+
112
+ ```typescript
113
+ editor.setHTML('<p>New content</p>');
114
+ ```
115
+
116
+ #### `getJSON(): object`
117
+
118
+ Gets the current content as JSON (AST).
119
+
120
+ ```typescript
121
+ const json = editor.getJSON();
122
+ ```
123
+
124
+ #### `setJSON(json: object): void`
125
+
126
+ Sets content from JSON (AST).
127
+
128
+ ```typescript
129
+ editor.setJSON(jsonContent);
130
+ ```
131
+
132
+ #### `focus(): void`
133
+
134
+ Focuses the editor.
135
+
136
+ ```typescript
137
+ editor.focus();
138
+ ```
139
+
140
+ #### `blur(): void`
141
+
142
+ Blurs the editor.
143
+
144
+ ```typescript
145
+ editor.blur();
146
+ ```
147
+
148
+ #### `clear(): void`
149
+
150
+ Clears all content.
151
+
152
+ ```typescript
153
+ editor.clear();
154
+ ```
155
+
156
+ #### `destroy(): void`
157
+
158
+ Destroys the editor instance and frees resources.
159
+
160
+ ```typescript
161
+ editor.destroy();
162
+ ```
163
+
164
+ ## 🔧 Configuration Options
165
+
166
+ ```typescript
167
+ interface EditorConfig {
168
+ // Initial content
169
+ content?: string;
170
+
171
+ // Placeholder text
172
+ placeholder?: string;
173
+
174
+ // Change handler
175
+ onChange?: (html: string, json: object) => void;
176
+
177
+ // Focus handlers
178
+ onFocus?: () => void;
179
+ onBlur?: () => void;
180
+
181
+ // Plugins
182
+ plugins?: Plugin[];
183
+
184
+ // Editor state
185
+ readonly?: boolean;
186
+ autofocus?: boolean;
187
+
188
+ // Content validation
189
+ sanitize?: boolean;
190
+ maxLength?: number;
191
+
192
+ // Performance
193
+ debounceDelay?: number;
194
+ }
195
+ ```
196
+
197
+ ## 🔌 Plugin System
198
+
199
+ Create custom plugins by extending the base Plugin class:
200
+
201
+ ```typescript
202
+ import { Plugin, Editor } from '@editora/core';
203
+
204
+ class CustomPlugin extends Plugin {
205
+ name = 'custom';
206
+
207
+ install(editor: Editor) {
208
+ // Plugin initialization
209
+ console.log('Plugin installed');
210
+ }
211
+
212
+ execute(command: string, ...args: any[]) {
213
+ // Handle commands
214
+ if (command === 'doSomething') {
215
+ // Custom logic
216
+ }
217
+ }
218
+ }
219
+ ```
220
+
221
+ ## 📄 License
222
+
223
+ MIT © [Ajay Kumar](https://github.com/ajaykr089)
224
+
225
+ ## 🔗 Links
226
+
227
+ - [Documentation](https://github.com/ajaykr089/Editora#readme)
228
+ - [GitHub Repository](https://github.com/ajaykr089/Editora)
229
+ - [Issue Tracker](https://github.com/ajaykr089/Editora/issues)
230
+ - [npm Package](https://www.npmjs.com/package/@editora/core)
@@ -0,0 +1,7 @@
1
+ var Editora=(function(s){"use strict";class l{constructor(e,t,i){this.doc=e,this.selection=t,this.schema=i}static create(e,t){const i=t||e.node("doc",{},[e.node("paragraph")]);return new l(i,{anchor:0,head:0},e)}apply(e,t){return new l(e,t||this.selection,this.schema)}}class f{constructor(e){this.listeners=[],this.pluginManager=e;const t=e.buildSchema();this.state=l.create(t),this.commands=e.getCommands()}setState(e){this.state=e,this.listeners.forEach(t=>t(e))}onChange(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}execCommand(e){const t=this.commands[e];if(!t)return!1;const i=t(this.state);return i?(this.setState(i),!0):!1}setContent(e){this.setState(this.state.apply(e))}getContent(){return this.state.doc}}class g{constructor(e,t){this.nodes=new Map(Object.entries(e)),this.marks=new Map(Object.entries(t))}node(e,t,i){return{type:e,attrs:t,content:i}}text(e,t){return{type:"text",text:e,marks:t}}}class y{constructor(){this.plugins=[]}register(e){this.plugins.push(e)}buildSchema(){const e={},t={};return this.plugins.forEach(i=>{i.nodes&&Object.assign(e,i.nodes),i.marks&&Object.assign(t,i.marks)}),new g(e,t)}getCommands(){const e={};return this.plugins.forEach(t=>{t.commands&&Object.assign(e,t.commands)}),e}getToolbarItems(){return this.plugins.flatMap(e=>e.toolbar||[])}}class p{constructor(e){this.initialized=!1,this.plugin=e}initialize(e){if(this.initialized)return console.warn(`Plugin "${this.plugin.name}" already initialized`),!1;try{return this.context=e,this.plugin.context?.initialize&&this.plugin.context.initialize(),this.plugin.context?.onEditorReady&&e.provider&&this.plugin.context.onEditorReady(e),this.initialized=!0,!0}catch(t){return console.error(`Failed to initialize plugin "${this.plugin.name}":`,t),!1}}destroy(){if(!this.initialized)return!1;try{return this.plugin.context?.destroy&&this.plugin.context.destroy(),this.initialized=!1,this.context=void 0,!0}catch(e){return console.error(`Failed to destroy plugin "${this.plugin.name}":`,e),!1}}executeCommand(e,...t){if(!this.initialized)return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`),null;try{const i=this.plugin.commands?.[e];return i?i(...t):(console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`),null)}catch(i){return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`,i),null}}getName(){return this.plugin.name}isInitialized(){return this.initialized}getPlugin(){return this.plugin}getContext(){return this.context}}function S(a){return new p(a)}class k{constructor(e){this.shortcuts=new Map,this.enabled=!0,this.isMac=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,e?.enabled===!1&&(this.enabled=!1),this.registerDefaultShortcuts(),e?.shortcuts&&e.shortcuts.forEach(t=>this.registerShortcut(t)),e?.customShortcuts&&Object.values(e.customShortcuts).forEach(t=>{this.registerShortcut(t)})}registerDefaultShortcuts(){this.registerShortcut({key:"b",ctrl:!this.isMac,meta:this.isMac,command:"toggleBold",description:"Bold",preventDefault:!0}),this.registerShortcut({key:"i",ctrl:!this.isMac,meta:this.isMac,command:"toggleItalic",description:"Italic",preventDefault:!0}),this.registerShortcut({key:"u",ctrl:!this.isMac,meta:this.isMac,command:"toggleUnderline",description:"Underline",preventDefault:!0}),this.registerShortcut({key:"d",ctrl:!this.isMac,meta:this.isMac,command:"toggleStrikethrough",description:"Strikethrough",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,command:"undo",description:"Undo",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"redo",description:"Redo",preventDefault:!0}),this.registerShortcut({key:"y",ctrl:!this.isMac,meta:this.isMac,command:"redo",description:"Redo",preventDefault:!0});for(let e=1;e<=6;e++)this.registerShortcut({key:String(e),ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:`h${e}`,description:`Heading ${e}`,preventDefault:!0});this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:"p",description:"Paragraph",preventDefault:!0}),this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleOrderedList",description:"Numbered List",preventDefault:!0}),this.registerShortcut({key:"8",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBulletList",description:"Bullet List",preventDefault:!0}),this.registerShortcut({key:"k",ctrl:!this.isMac,meta:this.isMac,command:"openLinkDialog",description:"Insert/Edit Link",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertCodeBlock",description:"Code Block",preventDefault:!0}),this.registerShortcut({key:"q",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBlockquote",description:"Blockquote",preventDefault:!0}),this.registerShortcut({key:"l",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"left",description:"Align Left",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"setTextAlignment",params:"center",description:"Align Center",preventDefault:!0}),this.registerShortcut({key:"r",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"right",description:"Align Right",preventDefault:!0}),this.registerShortcut({key:"j",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"justify",description:"Justify",preventDefault:!0}),this.registerShortcut({key:"\\",ctrl:!this.isMac,meta:this.isMac,command:"clearFormatting",description:"Clear Formatting",preventDefault:!0}),this.registerShortcut({key:"]",ctrl:!this.isMac,meta:this.isMac,command:"increaseIndent",description:"Indent",preventDefault:!0}),this.registerShortcut({key:"[",ctrl:!this.isMac,meta:this.isMac,command:"decreaseIndent",description:"Outdent",preventDefault:!0}),this.registerShortcut({key:"g",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertImage",description:"Insert Image",preventDefault:!0}),this.registerShortcut({key:"t",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertTable",description:"Insert Table",preventDefault:!0}),this.registerShortcut({key:"f11",command:"toggleFullscreen",description:"Toggle Fullscreen",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"togglePreview",description:"Preview",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,command:"print",description:"Print",preventDefault:!0}),this.registerShortcut({key:"s",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertSpecialCharacter",description:"Insert Special Character",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertEmoji",description:"Insert Emoji",preventDefault:!0}),this.registerShortcut({key:"9",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleChecklist",description:"Checklist",preventDefault:!0}),this.registerShortcut({key:"a",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"toggleA11yChecker",description:"Accessibility Checker",preventDefault:!0}),this.registerShortcut({key:"F7",command:"toggleSpellCheck",description:"Spell Check",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertMath",description:"Insert Math",preventDefault:!0}),this.registerShortcut({key:"f",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertFootnote",description:"Insert Footnote",preventDefault:!0})}registerShortcut(e){const t=this.getShortcutKey(e);this.shortcuts.set(t,e)}unregisterShortcut(e){const t=this.getShortcutKey(e);this.shortcuts.delete(t)}getShortcutKey(e){const t=[];return e.ctrl&&t.push("ctrl"),e.alt&&t.push("alt"),e.shift&&t.push("shift"),e.meta&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}getEventKey(e){const t=[];return e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.metaKey&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}handleKeyDown(e,t){if(!this.enabled)return!1;const i=this.getEventKey(e),r=this.shortcuts.get(i);return r?(r.preventDefault!==!1&&(e.preventDefault(),e.stopPropagation()),t(r.command,r.params),!0):!1}enable(){this.enabled=!0}disable(){this.enabled=!1}isEnabled(){return this.enabled}getAllShortcuts(){return Array.from(this.shortcuts.values())}getShortcutForCommand(e){return Array.from(this.shortcuts.values()).find(t=>t.command===e)}getShortcutDescription(e){const t=[];this.isMac?(e.meta&&t.push("⌘"),e.ctrl&&t.push("⌃"),e.alt&&t.push("⌥"),e.shift&&t.push("⇧")):(e.ctrl&&t.push("Ctrl"),e.alt&&t.push("Alt"),e.shift&&t.push("Shift"));const i=e.key.length===1?e.key.toUpperCase():e.key;return t.push(i),t.join("+")}getShortcutsHelp(){const e=this.getAllShortcuts(),t=new Map;e.forEach(r=>{const c=this.getShortcutCategory(r.command);t.has(c)||t.set(c,[]),t.get(c).push(r)});let i=`# Keyboard Shortcuts
2
+
3
+ `;return t.forEach((r,c)=>{i+=`## ${c}
4
+
5
+ `,r.forEach(o=>{const u=this.getShortcutDescription(o);i+=`- **${u}**: ${o.description||o.command}
6
+ `}),i+=`
7
+ `}),i}getShortcutCategory(e){return e.includes("toggle")&&(e.includes("Bold")||e.includes("Italic")||e.includes("Underline")||e.includes("Strike")||e.includes("Code")||e.includes("Super")||e.includes("Sub"))?"Text Formatting":e.includes("Heading")||e.includes("Paragraph")?"Block Formatting":e.includes("List")||e.includes("Checklist")?"Lists":e.includes("Alignment")||e.includes("Indent")?"Alignment & Indentation":e.includes("undo")||e.includes("redo")?"History":e.includes("insert")?"Insert":e.includes("find")||e.includes("replace")?"Find & Replace":e.includes("Accessibility")||e.includes("spell")?"Tools":"Other"}}function M(a={}){const{enabled:e=!1,provider:t="browser",apiUrl:i="",apiHeaders:r={},language:c="en",customDictionary:o=[],ignoreAllCaps:u=!0,ignoreNumbers:v=!0}=a;return{name:"spellcheck",context:{initialize:()=>{if(e)switch(console.log("[Spellcheck Plugin] Initialized",{provider:t,language:c}),t){case"browser":console.log("[Spellcheck] Using browser spellcheck");break;case"local":console.log("[Spellcheck] Using local dictionary (not implemented)");break;case"api":i?console.log("[Spellcheck] Using API:",i):console.warn("[Spellcheck] API provider selected but no apiUrl provided");break}},destroy:()=>{console.log("[Spellcheck Plugin] Destroyed")},onEditorReady:h=>{console.log("[Spellcheck Plugin] Editor ready")}},commands:{toggleSpellcheck:()=>(console.log("[Spellcheck] Toggle command (not implemented)"),null),addToDictionary:h=>(console.log("[Spellcheck] Add to dictionary:",h),null),checkSpelling:async()=>(console.log("[Spellcheck] Check spelling (not implemented)"),null)},toolbar:e?[{label:"Spellcheck",command:"toggleSpellcheck",icon:"Aa",type:"button"}]:[]}}function b(a={}){const{uploadUrl:e="",libraryUrl:t="",maxFileSize:i=10485760,allowedTypes:r=["image/jpeg","image/png","image/gif","image/webp"],headers:c={},withCredentials:o=!1,chunkSize:u=1048576,enableChunking:v=!0,onProgress:h,onError:m,onSuccess:D}=a;return{name:"media",context:{initialize:()=>{console.log("[Media Plugin] Initialized",{uploadUrl:e,libraryUrl:t,maxFileSize:i,allowedTypes:r}),e||console.warn("[Media] No uploadUrl provided - upload will not work")},destroy:()=>{console.log("[Media Plugin] Destroyed")},onEditorReady:n=>{console.log("[Media Plugin] Editor ready")}},commands:{insertImage:async n=>{if(console.log("[Media] Insert image command (not implemented)",n),!n)return console.log("[Media] No file provided - should open picker"),null;if(!r.includes(n.type)){const d=new Error(`File type ${n.type} not allowed`);return m?.(d),null}if(n.size>i){const d=new Error(`File size ${n.size} exceeds max ${i}`);return m?.(d),null}return null},openMediaLibrary:()=>(console.log("[Media] Open media library (not implemented)"),t||console.warn("[Media] No libraryUrl provided"),null),uploadMedia:async n=>(console.log("[Media] Upload media (not implemented)",{name:n.name,size:n.size,type:n.type}),null)},toolbar:[{label:"Image",command:"insertImage",icon:"🖼️",type:"button"},{label:"Media Library",command:"openMediaLibrary",icon:"📁",type:"button"}]}}return s.Editor=f,s.EditorState=l,s.KeyboardShortcutManager=k,s.PluginManager=y,s.PluginRuntime=p,s.Schema=g,s.createMediaPlugin=b,s.createPluginRuntime=S,s.createSpellcheckPlugin=M,Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),s})({});
@@ -0,0 +1,7 @@
1
+ (function(r,l){typeof exports=="object"&&typeof module<"u"?l(exports):typeof define=="function"&&define.amd?define(["exports"],l):(r=typeof globalThis<"u"?globalThis:r||self,l(r.Editora={}))})(this,(function(r){"use strict";class l{constructor(e,t,i){this.doc=e,this.selection=t,this.schema=i}static create(e,t){const i=t||e.node("doc",{},[e.node("paragraph")]);return new l(i,{anchor:0,head:0},e)}apply(e,t){return new l(e,t||this.selection,this.schema)}}class f{constructor(e){this.listeners=[],this.pluginManager=e;const t=e.buildSchema();this.state=l.create(t),this.commands=e.getCommands()}setState(e){this.state=e,this.listeners.forEach(t=>t(e))}onChange(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}execCommand(e){const t=this.commands[e];if(!t)return!1;const i=t(this.state);return i?(this.setState(i),!0):!1}setContent(e){this.setState(this.state.apply(e))}getContent(){return this.state.doc}}class p{constructor(e,t){this.nodes=new Map(Object.entries(e)),this.marks=new Map(Object.entries(t))}node(e,t,i){return{type:e,attrs:t,content:i}}text(e,t){return{type:"text",text:e,marks:t}}}class y{constructor(){this.plugins=[]}register(e){this.plugins.push(e)}buildSchema(){const e={},t={};return this.plugins.forEach(i=>{i.nodes&&Object.assign(e,i.nodes),i.marks&&Object.assign(t,i.marks)}),new p(e,t)}getCommands(){const e={};return this.plugins.forEach(t=>{t.commands&&Object.assign(e,t.commands)}),e}getToolbarItems(){return this.plugins.flatMap(e=>e.toolbar||[])}}class g{constructor(e){this.initialized=!1,this.plugin=e}initialize(e){if(this.initialized)return console.warn(`Plugin "${this.plugin.name}" already initialized`),!1;try{return this.context=e,this.plugin.context?.initialize&&this.plugin.context.initialize(),this.plugin.context?.onEditorReady&&e.provider&&this.plugin.context.onEditorReady(e),this.initialized=!0,!0}catch(t){return console.error(`Failed to initialize plugin "${this.plugin.name}":`,t),!1}}destroy(){if(!this.initialized)return!1;try{return this.plugin.context?.destroy&&this.plugin.context.destroy(),this.initialized=!1,this.context=void 0,!0}catch(e){return console.error(`Failed to destroy plugin "${this.plugin.name}":`,e),!1}}executeCommand(e,...t){if(!this.initialized)return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`),null;try{const i=this.plugin.commands?.[e];return i?i(...t):(console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`),null)}catch(i){return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`,i),null}}getName(){return this.plugin.name}isInitialized(){return this.initialized}getPlugin(){return this.plugin}getContext(){return this.context}}function S(a){return new g(a)}class k{constructor(e){this.shortcuts=new Map,this.enabled=!0,this.isMac=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,e?.enabled===!1&&(this.enabled=!1),this.registerDefaultShortcuts(),e?.shortcuts&&e.shortcuts.forEach(t=>this.registerShortcut(t)),e?.customShortcuts&&Object.values(e.customShortcuts).forEach(t=>{this.registerShortcut(t)})}registerDefaultShortcuts(){this.registerShortcut({key:"b",ctrl:!this.isMac,meta:this.isMac,command:"toggleBold",description:"Bold",preventDefault:!0}),this.registerShortcut({key:"i",ctrl:!this.isMac,meta:this.isMac,command:"toggleItalic",description:"Italic",preventDefault:!0}),this.registerShortcut({key:"u",ctrl:!this.isMac,meta:this.isMac,command:"toggleUnderline",description:"Underline",preventDefault:!0}),this.registerShortcut({key:"d",ctrl:!this.isMac,meta:this.isMac,command:"toggleStrikethrough",description:"Strikethrough",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,command:"undo",description:"Undo",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"redo",description:"Redo",preventDefault:!0}),this.registerShortcut({key:"y",ctrl:!this.isMac,meta:this.isMac,command:"redo",description:"Redo",preventDefault:!0});for(let e=1;e<=6;e++)this.registerShortcut({key:String(e),ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:`h${e}`,description:`Heading ${e}`,preventDefault:!0});this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:"p",description:"Paragraph",preventDefault:!0}),this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleOrderedList",description:"Numbered List",preventDefault:!0}),this.registerShortcut({key:"8",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBulletList",description:"Bullet List",preventDefault:!0}),this.registerShortcut({key:"k",ctrl:!this.isMac,meta:this.isMac,command:"openLinkDialog",description:"Insert/Edit Link",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertCodeBlock",description:"Code Block",preventDefault:!0}),this.registerShortcut({key:"q",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBlockquote",description:"Blockquote",preventDefault:!0}),this.registerShortcut({key:"l",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"left",description:"Align Left",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"setTextAlignment",params:"center",description:"Align Center",preventDefault:!0}),this.registerShortcut({key:"r",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"right",description:"Align Right",preventDefault:!0}),this.registerShortcut({key:"j",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"justify",description:"Justify",preventDefault:!0}),this.registerShortcut({key:"\\",ctrl:!this.isMac,meta:this.isMac,command:"clearFormatting",description:"Clear Formatting",preventDefault:!0}),this.registerShortcut({key:"]",ctrl:!this.isMac,meta:this.isMac,command:"increaseIndent",description:"Indent",preventDefault:!0}),this.registerShortcut({key:"[",ctrl:!this.isMac,meta:this.isMac,command:"decreaseIndent",description:"Outdent",preventDefault:!0}),this.registerShortcut({key:"g",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertImage",description:"Insert Image",preventDefault:!0}),this.registerShortcut({key:"t",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertTable",description:"Insert Table",preventDefault:!0}),this.registerShortcut({key:"f11",command:"toggleFullscreen",description:"Toggle Fullscreen",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"togglePreview",description:"Preview",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,command:"print",description:"Print",preventDefault:!0}),this.registerShortcut({key:"s",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertSpecialCharacter",description:"Insert Special Character",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertEmoji",description:"Insert Emoji",preventDefault:!0}),this.registerShortcut({key:"9",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleChecklist",description:"Checklist",preventDefault:!0}),this.registerShortcut({key:"a",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"toggleA11yChecker",description:"Accessibility Checker",preventDefault:!0}),this.registerShortcut({key:"F7",command:"toggleSpellCheck",description:"Spell Check",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertMath",description:"Insert Math",preventDefault:!0}),this.registerShortcut({key:"f",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertFootnote",description:"Insert Footnote",preventDefault:!0})}registerShortcut(e){const t=this.getShortcutKey(e);this.shortcuts.set(t,e)}unregisterShortcut(e){const t=this.getShortcutKey(e);this.shortcuts.delete(t)}getShortcutKey(e){const t=[];return e.ctrl&&t.push("ctrl"),e.alt&&t.push("alt"),e.shift&&t.push("shift"),e.meta&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}getEventKey(e){const t=[];return e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.metaKey&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}handleKeyDown(e,t){if(!this.enabled)return!1;const i=this.getEventKey(e),s=this.shortcuts.get(i);return s?(s.preventDefault!==!1&&(e.preventDefault(),e.stopPropagation()),t(s.command,s.params),!0):!1}enable(){this.enabled=!0}disable(){this.enabled=!1}isEnabled(){return this.enabled}getAllShortcuts(){return Array.from(this.shortcuts.values())}getShortcutForCommand(e){return Array.from(this.shortcuts.values()).find(t=>t.command===e)}getShortcutDescription(e){const t=[];this.isMac?(e.meta&&t.push("⌘"),e.ctrl&&t.push("⌃"),e.alt&&t.push("⌥"),e.shift&&t.push("⇧")):(e.ctrl&&t.push("Ctrl"),e.alt&&t.push("Alt"),e.shift&&t.push("Shift"));const i=e.key.length===1?e.key.toUpperCase():e.key;return t.push(i),t.join("+")}getShortcutsHelp(){const e=this.getAllShortcuts(),t=new Map;e.forEach(s=>{const c=this.getShortcutCategory(s.command);t.has(c)||t.set(c,[]),t.get(c).push(s)});let i=`# Keyboard Shortcuts
2
+
3
+ `;return t.forEach((s,c)=>{i+=`## ${c}
4
+
5
+ `,s.forEach(o=>{const u=this.getShortcutDescription(o);i+=`- **${u}**: ${o.description||o.command}
6
+ `}),i+=`
7
+ `}),i}getShortcutCategory(e){return e.includes("toggle")&&(e.includes("Bold")||e.includes("Italic")||e.includes("Underline")||e.includes("Strike")||e.includes("Code")||e.includes("Super")||e.includes("Sub"))?"Text Formatting":e.includes("Heading")||e.includes("Paragraph")?"Block Formatting":e.includes("List")||e.includes("Checklist")?"Lists":e.includes("Alignment")||e.includes("Indent")?"Alignment & Indentation":e.includes("undo")||e.includes("redo")?"History":e.includes("insert")?"Insert":e.includes("find")||e.includes("replace")?"Find & Replace":e.includes("Accessibility")||e.includes("spell")?"Tools":"Other"}}function M(a={}){const{enabled:e=!1,provider:t="browser",apiUrl:i="",apiHeaders:s={},language:c="en",customDictionary:o=[],ignoreAllCaps:u=!0,ignoreNumbers:v=!0}=a;return{name:"spellcheck",context:{initialize:()=>{if(e)switch(console.log("[Spellcheck Plugin] Initialized",{provider:t,language:c}),t){case"browser":console.log("[Spellcheck] Using browser spellcheck");break;case"local":console.log("[Spellcheck] Using local dictionary (not implemented)");break;case"api":i?console.log("[Spellcheck] Using API:",i):console.warn("[Spellcheck] API provider selected but no apiUrl provided");break}},destroy:()=>{console.log("[Spellcheck Plugin] Destroyed")},onEditorReady:h=>{console.log("[Spellcheck Plugin] Editor ready")}},commands:{toggleSpellcheck:()=>(console.log("[Spellcheck] Toggle command (not implemented)"),null),addToDictionary:h=>(console.log("[Spellcheck] Add to dictionary:",h),null),checkSpelling:async()=>(console.log("[Spellcheck] Check spelling (not implemented)"),null)},toolbar:e?[{label:"Spellcheck",command:"toggleSpellcheck",icon:"Aa",type:"button"}]:[]}}function b(a={}){const{uploadUrl:e="",libraryUrl:t="",maxFileSize:i=10*1024*1024,allowedTypes:s=["image/jpeg","image/png","image/gif","image/webp"],headers:c={},withCredentials:o=!1,chunkSize:u=1024*1024,enableChunking:v=!0,onProgress:h,onError:m,onSuccess:D}=a;return{name:"media",context:{initialize:()=>{console.log("[Media Plugin] Initialized",{uploadUrl:e,libraryUrl:t,maxFileSize:i,allowedTypes:s}),e||console.warn("[Media] No uploadUrl provided - upload will not work")},destroy:()=>{console.log("[Media Plugin] Destroyed")},onEditorReady:n=>{console.log("[Media Plugin] Editor ready")}},commands:{insertImage:async n=>{if(console.log("[Media] Insert image command (not implemented)",n),!n)return console.log("[Media] No file provided - should open picker"),null;if(!s.includes(n.type)){const d=new Error(`File type ${n.type} not allowed`);return m?.(d),null}if(n.size>i){const d=new Error(`File size ${n.size} exceeds max ${i}`);return m?.(d),null}return null},openMediaLibrary:()=>(console.log("[Media] Open media library (not implemented)"),t||console.warn("[Media] No libraryUrl provided"),null),uploadMedia:async n=>(console.log("[Media] Upload media (not implemented)",{name:n.name,size:n.size,type:n.type}),null)},toolbar:[{label:"Image",command:"insertImage",icon:"🖼️",type:"button"},{label:"Media Library",command:"openMediaLibrary",icon:"📁",type:"button"}]}}r.Editor=f,r.EditorState=l,r.KeyboardShortcutManager=k,r.PluginManager=y,r.PluginRuntime=g,r.Schema=p,r.createMediaPlugin=b,r.createPluginRuntime=S,r.createSpellcheckPlugin=M,Object.defineProperty(r,Symbol.toStringTag,{value:"Module"})}));
@@ -0,0 +1,7 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});class c{constructor(e,t,i){this.doc=e,this.selection=t,this.schema=i}static create(e,t){const i=t||e.node("doc",{},[e.node("paragraph")]);return new c(i,{anchor:0,head:0},e)}apply(e,t){return new c(e,t||this.selection,this.schema)}}class f{constructor(e){this.listeners=[],this.pluginManager=e;const t=e.buildSchema();this.state=c.create(t),this.commands=e.getCommands()}setState(e){this.state=e,this.listeners.forEach(t=>t(e))}onChange(e){return this.listeners.push(e),()=>{this.listeners=this.listeners.filter(t=>t!==e)}}execCommand(e){const t=this.commands[e];if(!t)return!1;const i=t(this.state);return i?(this.setState(i),!0):!1}setContent(e){this.setState(this.state.apply(e))}getContent(){return this.state.doc}}class p{constructor(e,t){this.nodes=new Map(Object.entries(e)),this.marks=new Map(Object.entries(t))}node(e,t,i){return{type:e,attrs:t,content:i}}text(e,t){return{type:"text",text:e,marks:t}}}class y{constructor(){this.plugins=[]}register(e){this.plugins.push(e)}buildSchema(){const e={},t={};return this.plugins.forEach(i=>{i.nodes&&Object.assign(e,i.nodes),i.marks&&Object.assign(t,i.marks)}),new p(e,t)}getCommands(){const e={};return this.plugins.forEach(t=>{t.commands&&Object.assign(e,t.commands)}),e}getToolbarItems(){return this.plugins.flatMap(e=>e.toolbar||[])}}class g{constructor(e){this.initialized=!1,this.plugin=e}initialize(e){if(this.initialized)return console.warn(`Plugin "${this.plugin.name}" already initialized`),!1;try{return this.context=e,this.plugin.context?.initialize&&this.plugin.context.initialize(),this.plugin.context?.onEditorReady&&e.provider&&this.plugin.context.onEditorReady(e),this.initialized=!0,!0}catch(t){return console.error(`Failed to initialize plugin "${this.plugin.name}":`,t),!1}}destroy(){if(!this.initialized)return!1;try{return this.plugin.context?.destroy&&this.plugin.context.destroy(),this.initialized=!1,this.context=void 0,!0}catch(e){return console.error(`Failed to destroy plugin "${this.plugin.name}":`,e),!1}}executeCommand(e,...t){if(!this.initialized)return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`),null;try{const i=this.plugin.commands?.[e];return i?i(...t):(console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`),null)}catch(i){return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`,i),null}}getName(){return this.plugin.name}isInitialized(){return this.initialized}getPlugin(){return this.plugin}getContext(){return this.context}}function S(n){return new g(n)}class k{constructor(e){this.shortcuts=new Map,this.enabled=!0,this.isMac=typeof navigator<"u"&&navigator.platform.toUpperCase().indexOf("MAC")>=0,e?.enabled===!1&&(this.enabled=!1),this.registerDefaultShortcuts(),e?.shortcuts&&e.shortcuts.forEach(t=>this.registerShortcut(t)),e?.customShortcuts&&Object.values(e.customShortcuts).forEach(t=>{this.registerShortcut(t)})}registerDefaultShortcuts(){this.registerShortcut({key:"b",ctrl:!this.isMac,meta:this.isMac,command:"toggleBold",description:"Bold",preventDefault:!0}),this.registerShortcut({key:"i",ctrl:!this.isMac,meta:this.isMac,command:"toggleItalic",description:"Italic",preventDefault:!0}),this.registerShortcut({key:"u",ctrl:!this.isMac,meta:this.isMac,command:"toggleUnderline",description:"Underline",preventDefault:!0}),this.registerShortcut({key:"d",ctrl:!this.isMac,meta:this.isMac,command:"toggleStrikethrough",description:"Strikethrough",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,command:"undo",description:"Undo",preventDefault:!0}),this.registerShortcut({key:"z",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"redo",description:"Redo",preventDefault:!0}),this.registerShortcut({key:"y",ctrl:!this.isMac,meta:this.isMac,command:"redo",description:"Redo",preventDefault:!0});for(let e=1;e<=6;e++)this.registerShortcut({key:String(e),ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:`h${e}`,description:`Heading ${e}`,preventDefault:!0});this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"setBlockType",params:"p",description:"Paragraph",preventDefault:!0}),this.registerShortcut({key:"7",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleOrderedList",description:"Numbered List",preventDefault:!0}),this.registerShortcut({key:"8",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBulletList",description:"Bullet List",preventDefault:!0}),this.registerShortcut({key:"k",ctrl:!this.isMac,meta:this.isMac,command:"openLinkDialog",description:"Insert/Edit Link",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertCodeBlock",description:"Code Block",preventDefault:!0}),this.registerShortcut({key:"q",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleBlockquote",description:"Blockquote",preventDefault:!0}),this.registerShortcut({key:"l",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"left",description:"Align Left",preventDefault:!0}),this.registerShortcut({key:"e",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"setTextAlignment",params:"center",description:"Align Center",preventDefault:!0}),this.registerShortcut({key:"r",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"right",description:"Align Right",preventDefault:!0}),this.registerShortcut({key:"j",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"setTextAlignment",params:"justify",description:"Justify",preventDefault:!0}),this.registerShortcut({key:"\\",ctrl:!this.isMac,meta:this.isMac,command:"clearFormatting",description:"Clear Formatting",preventDefault:!0}),this.registerShortcut({key:"]",ctrl:!this.isMac,meta:this.isMac,command:"increaseIndent",description:"Indent",preventDefault:!0}),this.registerShortcut({key:"[",ctrl:!this.isMac,meta:this.isMac,command:"decreaseIndent",description:"Outdent",preventDefault:!0}),this.registerShortcut({key:"g",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertImage",description:"Insert Image",preventDefault:!0}),this.registerShortcut({key:"t",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertTable",description:"Insert Table",preventDefault:!0}),this.registerShortcut({key:"f11",command:"toggleFullscreen",description:"Toggle Fullscreen",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"togglePreview",description:"Preview",preventDefault:!0}),this.registerShortcut({key:"p",ctrl:!this.isMac,meta:this.isMac,command:"print",description:"Print",preventDefault:!0}),this.registerShortcut({key:"s",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"insertSpecialCharacter",description:"Insert Special Character",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"insertEmoji",description:"Insert Emoji",preventDefault:!0}),this.registerShortcut({key:"9",ctrl:!this.isMac,meta:this.isMac,shift:!0,command:"toggleChecklist",description:"Checklist",preventDefault:!0}),this.registerShortcut({key:"a",ctrl:!this.isMac,meta:this.isMac,shift:!0,alt:!0,command:"toggleA11yChecker",description:"Accessibility Checker",preventDefault:!0}),this.registerShortcut({key:"F7",command:"toggleSpellCheck",description:"Spell Check",preventDefault:!0}),this.registerShortcut({key:"m",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertMath",description:"Insert Math",preventDefault:!0}),this.registerShortcut({key:"f",ctrl:!this.isMac,meta:this.isMac,alt:!0,command:"insertFootnote",description:"Insert Footnote",preventDefault:!0})}registerShortcut(e){const t=this.getShortcutKey(e);this.shortcuts.set(t,e)}unregisterShortcut(e){const t=this.getShortcutKey(e);this.shortcuts.delete(t)}getShortcutKey(e){const t=[];return e.ctrl&&t.push("ctrl"),e.alt&&t.push("alt"),e.shift&&t.push("shift"),e.meta&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}getEventKey(e){const t=[];return e.ctrlKey&&t.push("ctrl"),e.altKey&&t.push("alt"),e.shiftKey&&t.push("shift"),e.metaKey&&t.push("meta"),t.push(e.key.toLowerCase()),t.join("+")}handleKeyDown(e,t){if(!this.enabled)return!1;const i=this.getEventKey(e),r=this.shortcuts.get(i);return r?(r.preventDefault!==!1&&(e.preventDefault(),e.stopPropagation()),t(r.command,r.params),!0):!1}enable(){this.enabled=!0}disable(){this.enabled=!1}isEnabled(){return this.enabled}getAllShortcuts(){return Array.from(this.shortcuts.values())}getShortcutForCommand(e){return Array.from(this.shortcuts.values()).find(t=>t.command===e)}getShortcutDescription(e){const t=[];this.isMac?(e.meta&&t.push("⌘"),e.ctrl&&t.push("⌃"),e.alt&&t.push("⌥"),e.shift&&t.push("⇧")):(e.ctrl&&t.push("Ctrl"),e.alt&&t.push("Alt"),e.shift&&t.push("Shift"));const i=e.key.length===1?e.key.toUpperCase():e.key;return t.push(i),t.join("+")}getShortcutsHelp(){const e=this.getAllShortcuts(),t=new Map;e.forEach(r=>{const a=this.getShortcutCategory(r.command);t.has(a)||t.set(a,[]),t.get(a).push(r)});let i=`# Keyboard Shortcuts
2
+
3
+ `;return t.forEach((r,a)=>{i+=`## ${a}
4
+
5
+ `,r.forEach(l=>{const o=this.getShortcutDescription(l);i+=`- **${o}**: ${l.description||l.command}
6
+ `}),i+=`
7
+ `}),i}getShortcutCategory(e){return e.includes("toggle")&&(e.includes("Bold")||e.includes("Italic")||e.includes("Underline")||e.includes("Strike")||e.includes("Code")||e.includes("Super")||e.includes("Sub"))?"Text Formatting":e.includes("Heading")||e.includes("Paragraph")?"Block Formatting":e.includes("List")||e.includes("Checklist")?"Lists":e.includes("Alignment")||e.includes("Indent")?"Alignment & Indentation":e.includes("undo")||e.includes("redo")?"History":e.includes("insert")?"Insert":e.includes("find")||e.includes("replace")?"Find & Replace":e.includes("Accessibility")||e.includes("spell")?"Tools":"Other"}}function M(n={}){const{enabled:e=!1,provider:t="browser",apiUrl:i="",apiHeaders:r={},language:a="en",customDictionary:l=[],ignoreAllCaps:o=!0,ignoreNumbers:m=!0}=n;return{name:"spellcheck",context:{initialize:()=>{if(e)switch(console.log("[Spellcheck Plugin] Initialized",{provider:t,language:a}),t){case"browser":console.log("[Spellcheck] Using browser spellcheck");break;case"local":console.log("[Spellcheck] Using local dictionary (not implemented)");break;case"api":i?console.log("[Spellcheck] Using API:",i):console.warn("[Spellcheck] API provider selected but no apiUrl provided");break}},destroy:()=>{console.log("[Spellcheck Plugin] Destroyed")},onEditorReady:u=>{console.log("[Spellcheck Plugin] Editor ready")}},commands:{toggleSpellcheck:()=>(console.log("[Spellcheck] Toggle command (not implemented)"),null),addToDictionary:u=>(console.log("[Spellcheck] Add to dictionary:",u),null),checkSpelling:async()=>(console.log("[Spellcheck] Check spelling (not implemented)"),null)},toolbar:e?[{label:"Spellcheck",command:"toggleSpellcheck",icon:"Aa",type:"button"}]:[]}}function b(n={}){const{uploadUrl:e="",libraryUrl:t="",maxFileSize:i=10*1024*1024,allowedTypes:r=["image/jpeg","image/png","image/gif","image/webp"],headers:a={},withCredentials:l=!1,chunkSize:o=1024*1024,enableChunking:m=!0,onProgress:u,onError:d,onSuccess:v}=n;return{name:"media",context:{initialize:()=>{console.log("[Media Plugin] Initialized",{uploadUrl:e,libraryUrl:t,maxFileSize:i,allowedTypes:r}),e||console.warn("[Media] No uploadUrl provided - upload will not work")},destroy:()=>{console.log("[Media Plugin] Destroyed")},onEditorReady:s=>{console.log("[Media Plugin] Editor ready")}},commands:{insertImage:async s=>{if(console.log("[Media] Insert image command (not implemented)",s),!s)return console.log("[Media] No file provided - should open picker"),null;if(!r.includes(s.type)){const h=new Error(`File type ${s.type} not allowed`);return d?.(h),null}if(s.size>i){const h=new Error(`File size ${s.size} exceeds max ${i}`);return d?.(h),null}return null},openMediaLibrary:()=>(console.log("[Media] Open media library (not implemented)"),t||console.warn("[Media] No libraryUrl provided"),null),uploadMedia:async s=>(console.log("[Media] Upload media (not implemented)",{name:s.name,size:s.size,type:s.type}),null)},toolbar:[{label:"Image",command:"insertImage",icon:"🖼️",type:"button"},{label:"Media Library",command:"openMediaLibrary",icon:"📁",type:"button"}]}}exports.Editor=f;exports.EditorState=c;exports.KeyboardShortcutManager=k;exports.PluginManager=y;exports.PluginRuntime=g;exports.Schema=p;exports.createMediaPlugin=b;exports.createPluginRuntime=S;exports.createSpellcheckPlugin=M;
@@ -0,0 +1,612 @@
1
+ class l {
2
+ constructor(e, t, i) {
3
+ this.doc = e, this.selection = t, this.schema = i;
4
+ }
5
+ static create(e, t) {
6
+ const i = t || e.node("doc", {}, [e.node("paragraph")]);
7
+ return new l(i, { anchor: 0, head: 0 }, e);
8
+ }
9
+ apply(e, t) {
10
+ return new l(e, t || this.selection, this.schema);
11
+ }
12
+ }
13
+ class y {
14
+ constructor(e) {
15
+ this.listeners = [], this.pluginManager = e;
16
+ const t = e.buildSchema();
17
+ this.state = l.create(t), this.commands = e.getCommands();
18
+ }
19
+ setState(e) {
20
+ this.state = e, this.listeners.forEach((t) => t(e));
21
+ }
22
+ onChange(e) {
23
+ return this.listeners.push(e), () => {
24
+ this.listeners = this.listeners.filter((t) => t !== e);
25
+ };
26
+ }
27
+ execCommand(e) {
28
+ const t = this.commands[e];
29
+ if (!t) return !1;
30
+ const i = t(this.state);
31
+ return i ? (this.setState(i), !0) : !1;
32
+ }
33
+ setContent(e) {
34
+ this.setState(this.state.apply(e));
35
+ }
36
+ getContent() {
37
+ return this.state.doc;
38
+ }
39
+ }
40
+ class g {
41
+ constructor(e, t) {
42
+ this.nodes = new Map(Object.entries(e)), this.marks = new Map(Object.entries(t));
43
+ }
44
+ node(e, t, i) {
45
+ return { type: e, attrs: t, content: i };
46
+ }
47
+ text(e, t) {
48
+ return { type: "text", text: e, marks: t };
49
+ }
50
+ }
51
+ class k {
52
+ constructor() {
53
+ this.plugins = [];
54
+ }
55
+ register(e) {
56
+ this.plugins.push(e);
57
+ }
58
+ buildSchema() {
59
+ const e = {}, t = {};
60
+ return this.plugins.forEach((i) => {
61
+ i.nodes && Object.assign(e, i.nodes), i.marks && Object.assign(t, i.marks);
62
+ }), new g(e, t);
63
+ }
64
+ getCommands() {
65
+ const e = {};
66
+ return this.plugins.forEach((t) => {
67
+ t.commands && Object.assign(e, t.commands);
68
+ }), e;
69
+ }
70
+ getToolbarItems() {
71
+ return this.plugins.flatMap((e) => e.toolbar || []);
72
+ }
73
+ }
74
+ class m {
75
+ constructor(e) {
76
+ this.initialized = !1, this.plugin = e;
77
+ }
78
+ /**
79
+ * Safe initialization
80
+ */
81
+ initialize(e) {
82
+ if (this.initialized)
83
+ return console.warn(`Plugin "${this.plugin.name}" already initialized`), !1;
84
+ try {
85
+ return this.context = e, this.plugin.context?.initialize && this.plugin.context.initialize(), this.plugin.context?.onEditorReady && e.provider && this.plugin.context.onEditorReady(e), this.initialized = !0, !0;
86
+ } catch (t) {
87
+ return console.error(`Failed to initialize plugin "${this.plugin.name}":`, t), !1;
88
+ }
89
+ }
90
+ /**
91
+ * Safe destruction
92
+ */
93
+ destroy() {
94
+ if (!this.initialized)
95
+ return !1;
96
+ try {
97
+ return this.plugin.context?.destroy && this.plugin.context.destroy(), this.initialized = !1, this.context = void 0, !0;
98
+ } catch (e) {
99
+ return console.error(`Failed to destroy plugin "${this.plugin.name}":`, e), !1;
100
+ }
101
+ }
102
+ /**
103
+ * Safe command execution
104
+ */
105
+ executeCommand(e, ...t) {
106
+ if (!this.initialized)
107
+ return console.warn(`Plugin "${this.plugin.name}" not initialized, cannot execute command "${e}"`), null;
108
+ try {
109
+ const i = this.plugin.commands?.[e];
110
+ return i ? i(...t) : (console.warn(`Command "${e}" not found in plugin "${this.plugin.name}"`), null);
111
+ } catch (i) {
112
+ return console.error(`Error executing command "${e}" in plugin "${this.plugin.name}":`, i), null;
113
+ }
114
+ }
115
+ /**
116
+ * Get plugin name
117
+ */
118
+ getName() {
119
+ return this.plugin.name;
120
+ }
121
+ /**
122
+ * Check if initialized
123
+ */
124
+ isInitialized() {
125
+ return this.initialized;
126
+ }
127
+ /**
128
+ * Get underlying plugin
129
+ */
130
+ getPlugin() {
131
+ return this.plugin;
132
+ }
133
+ /**
134
+ * Get context
135
+ */
136
+ getContext() {
137
+ return this.context;
138
+ }
139
+ }
140
+ function S(n) {
141
+ return new m(n);
142
+ }
143
+ class M {
144
+ constructor(e) {
145
+ this.shortcuts = /* @__PURE__ */ new Map(), this.enabled = !0, this.isMac = typeof navigator < "u" && navigator.platform.toUpperCase().indexOf("MAC") >= 0, e?.enabled === !1 && (this.enabled = !1), this.registerDefaultShortcuts(), e?.shortcuts && e.shortcuts.forEach((t) => this.registerShortcut(t)), e?.customShortcuts && Object.values(e.customShortcuts).forEach((t) => {
146
+ this.registerShortcut(t);
147
+ });
148
+ }
149
+ registerDefaultShortcuts() {
150
+ this.registerShortcut({
151
+ key: "b",
152
+ ctrl: !this.isMac,
153
+ meta: this.isMac,
154
+ command: "toggleBold",
155
+ description: "Bold",
156
+ preventDefault: !0
157
+ }), this.registerShortcut({
158
+ key: "i",
159
+ ctrl: !this.isMac,
160
+ meta: this.isMac,
161
+ command: "toggleItalic",
162
+ description: "Italic",
163
+ preventDefault: !0
164
+ }), this.registerShortcut({
165
+ key: "u",
166
+ ctrl: !this.isMac,
167
+ meta: this.isMac,
168
+ command: "toggleUnderline",
169
+ description: "Underline",
170
+ preventDefault: !0
171
+ }), this.registerShortcut({
172
+ key: "d",
173
+ ctrl: !this.isMac,
174
+ meta: this.isMac,
175
+ command: "toggleStrikethrough",
176
+ description: "Strikethrough",
177
+ preventDefault: !0
178
+ }), this.registerShortcut({
179
+ key: "z",
180
+ ctrl: !this.isMac,
181
+ meta: this.isMac,
182
+ command: "undo",
183
+ description: "Undo",
184
+ preventDefault: !0
185
+ }), this.registerShortcut({
186
+ key: "z",
187
+ ctrl: !this.isMac,
188
+ meta: this.isMac,
189
+ shift: !0,
190
+ command: "redo",
191
+ description: "Redo",
192
+ preventDefault: !0
193
+ }), this.registerShortcut({
194
+ key: "y",
195
+ ctrl: !this.isMac,
196
+ meta: this.isMac,
197
+ command: "redo",
198
+ description: "Redo",
199
+ preventDefault: !0
200
+ });
201
+ for (let e = 1; e <= 6; e++)
202
+ this.registerShortcut({
203
+ key: String(e),
204
+ ctrl: !this.isMac,
205
+ meta: this.isMac,
206
+ alt: !0,
207
+ command: "setBlockType",
208
+ params: `h${e}`,
209
+ description: `Heading ${e}`,
210
+ preventDefault: !0
211
+ });
212
+ this.registerShortcut({
213
+ key: "7",
214
+ ctrl: !this.isMac,
215
+ meta: this.isMac,
216
+ alt: !0,
217
+ command: "setBlockType",
218
+ params: "p",
219
+ description: "Paragraph",
220
+ preventDefault: !0
221
+ }), this.registerShortcut({
222
+ key: "7",
223
+ ctrl: !this.isMac,
224
+ meta: this.isMac,
225
+ shift: !0,
226
+ command: "toggleOrderedList",
227
+ description: "Numbered List",
228
+ preventDefault: !0
229
+ }), this.registerShortcut({
230
+ key: "8",
231
+ ctrl: !this.isMac,
232
+ meta: this.isMac,
233
+ shift: !0,
234
+ command: "toggleBulletList",
235
+ description: "Bullet List",
236
+ preventDefault: !0
237
+ }), this.registerShortcut({
238
+ key: "k",
239
+ ctrl: !this.isMac,
240
+ meta: this.isMac,
241
+ command: "openLinkDialog",
242
+ description: "Insert/Edit Link",
243
+ preventDefault: !0
244
+ }), this.registerShortcut({
245
+ key: "e",
246
+ ctrl: !this.isMac,
247
+ meta: this.isMac,
248
+ alt: !0,
249
+ command: "insertCodeBlock",
250
+ description: "Code Block",
251
+ preventDefault: !0
252
+ }), this.registerShortcut({
253
+ key: "q",
254
+ ctrl: !this.isMac,
255
+ meta: this.isMac,
256
+ shift: !0,
257
+ command: "toggleBlockquote",
258
+ description: "Blockquote",
259
+ preventDefault: !0
260
+ }), this.registerShortcut({
261
+ key: "l",
262
+ ctrl: !this.isMac,
263
+ meta: this.isMac,
264
+ shift: !0,
265
+ command: "setTextAlignment",
266
+ params: "left",
267
+ description: "Align Left",
268
+ preventDefault: !0
269
+ }), this.registerShortcut({
270
+ key: "e",
271
+ ctrl: !this.isMac,
272
+ meta: this.isMac,
273
+ shift: !0,
274
+ alt: !0,
275
+ command: "setTextAlignment",
276
+ params: "center",
277
+ description: "Align Center",
278
+ preventDefault: !0
279
+ }), this.registerShortcut({
280
+ key: "r",
281
+ ctrl: !this.isMac,
282
+ meta: this.isMac,
283
+ shift: !0,
284
+ command: "setTextAlignment",
285
+ params: "right",
286
+ description: "Align Right",
287
+ preventDefault: !0
288
+ }), this.registerShortcut({
289
+ key: "j",
290
+ ctrl: !this.isMac,
291
+ meta: this.isMac,
292
+ shift: !0,
293
+ command: "setTextAlignment",
294
+ params: "justify",
295
+ description: "Justify",
296
+ preventDefault: !0
297
+ }), this.registerShortcut({
298
+ key: "\\",
299
+ ctrl: !this.isMac,
300
+ meta: this.isMac,
301
+ command: "clearFormatting",
302
+ description: "Clear Formatting",
303
+ preventDefault: !0
304
+ }), this.registerShortcut({
305
+ key: "]",
306
+ ctrl: !this.isMac,
307
+ meta: this.isMac,
308
+ command: "increaseIndent",
309
+ description: "Indent",
310
+ preventDefault: !0
311
+ }), this.registerShortcut({
312
+ key: "[",
313
+ ctrl: !this.isMac,
314
+ meta: this.isMac,
315
+ command: "decreaseIndent",
316
+ description: "Outdent",
317
+ preventDefault: !0
318
+ }), this.registerShortcut({
319
+ key: "g",
320
+ ctrl: !this.isMac,
321
+ meta: this.isMac,
322
+ shift: !0,
323
+ command: "insertImage",
324
+ description: "Insert Image",
325
+ preventDefault: !0
326
+ }), this.registerShortcut({
327
+ key: "t",
328
+ ctrl: !this.isMac,
329
+ meta: this.isMac,
330
+ shift: !0,
331
+ alt: !0,
332
+ command: "insertTable",
333
+ description: "Insert Table",
334
+ preventDefault: !0
335
+ }), this.registerShortcut({
336
+ key: "f11",
337
+ command: "toggleFullscreen",
338
+ description: "Toggle Fullscreen",
339
+ preventDefault: !0
340
+ }), this.registerShortcut({
341
+ key: "p",
342
+ ctrl: !this.isMac,
343
+ meta: this.isMac,
344
+ shift: !0,
345
+ command: "togglePreview",
346
+ description: "Preview",
347
+ preventDefault: !0
348
+ }), this.registerShortcut({
349
+ key: "p",
350
+ ctrl: !this.isMac,
351
+ meta: this.isMac,
352
+ command: "print",
353
+ description: "Print",
354
+ preventDefault: !0
355
+ }), this.registerShortcut({
356
+ key: "s",
357
+ ctrl: !this.isMac,
358
+ meta: this.isMac,
359
+ shift: !0,
360
+ alt: !0,
361
+ command: "insertSpecialCharacter",
362
+ description: "Insert Special Character",
363
+ preventDefault: !0
364
+ }), this.registerShortcut({
365
+ key: "m",
366
+ ctrl: !this.isMac,
367
+ meta: this.isMac,
368
+ shift: !0,
369
+ command: "insertEmoji",
370
+ description: "Insert Emoji",
371
+ preventDefault: !0
372
+ }), this.registerShortcut({
373
+ key: "9",
374
+ ctrl: !this.isMac,
375
+ meta: this.isMac,
376
+ shift: !0,
377
+ command: "toggleChecklist",
378
+ description: "Checklist",
379
+ preventDefault: !0
380
+ }), this.registerShortcut({
381
+ key: "a",
382
+ ctrl: !this.isMac,
383
+ meta: this.isMac,
384
+ shift: !0,
385
+ alt: !0,
386
+ command: "toggleA11yChecker",
387
+ description: "Accessibility Checker",
388
+ preventDefault: !0
389
+ }), this.registerShortcut({
390
+ key: "F7",
391
+ command: "toggleSpellCheck",
392
+ description: "Spell Check",
393
+ preventDefault: !0
394
+ }), this.registerShortcut({
395
+ key: "m",
396
+ ctrl: !this.isMac,
397
+ meta: this.isMac,
398
+ alt: !0,
399
+ command: "insertMath",
400
+ description: "Insert Math",
401
+ preventDefault: !0
402
+ }), this.registerShortcut({
403
+ key: "f",
404
+ ctrl: !this.isMac,
405
+ meta: this.isMac,
406
+ alt: !0,
407
+ command: "insertFootnote",
408
+ description: "Insert Footnote",
409
+ preventDefault: !0
410
+ });
411
+ }
412
+ registerShortcut(e) {
413
+ const t = this.getShortcutKey(e);
414
+ this.shortcuts.set(t, e);
415
+ }
416
+ unregisterShortcut(e) {
417
+ const t = this.getShortcutKey(e);
418
+ this.shortcuts.delete(t);
419
+ }
420
+ getShortcutKey(e) {
421
+ const t = [];
422
+ return e.ctrl && t.push("ctrl"), e.alt && t.push("alt"), e.shift && t.push("shift"), e.meta && t.push("meta"), t.push(e.key.toLowerCase()), t.join("+");
423
+ }
424
+ getEventKey(e) {
425
+ const t = [];
426
+ return e.ctrlKey && t.push("ctrl"), e.altKey && t.push("alt"), e.shiftKey && t.push("shift"), e.metaKey && t.push("meta"), t.push(e.key.toLowerCase()), t.join("+");
427
+ }
428
+ handleKeyDown(e, t) {
429
+ if (!this.enabled) return !1;
430
+ const i = this.getEventKey(e), r = this.shortcuts.get(i);
431
+ return r ? (r.preventDefault !== !1 && (e.preventDefault(), e.stopPropagation()), t(r.command, r.params), !0) : !1;
432
+ }
433
+ enable() {
434
+ this.enabled = !0;
435
+ }
436
+ disable() {
437
+ this.enabled = !1;
438
+ }
439
+ isEnabled() {
440
+ return this.enabled;
441
+ }
442
+ getAllShortcuts() {
443
+ return Array.from(this.shortcuts.values());
444
+ }
445
+ getShortcutForCommand(e) {
446
+ return Array.from(this.shortcuts.values()).find((t) => t.command === e);
447
+ }
448
+ getShortcutDescription(e) {
449
+ const t = [];
450
+ this.isMac ? (e.meta && t.push("⌘"), e.ctrl && t.push("⌃"), e.alt && t.push("⌥"), e.shift && t.push("⇧")) : (e.ctrl && t.push("Ctrl"), e.alt && t.push("Alt"), e.shift && t.push("Shift"));
451
+ const i = e.key.length === 1 ? e.key.toUpperCase() : e.key;
452
+ return t.push(i), t.join("+");
453
+ }
454
+ getShortcutsHelp() {
455
+ const e = this.getAllShortcuts(), t = /* @__PURE__ */ new Map();
456
+ e.forEach((r) => {
457
+ const a = this.getShortcutCategory(r.command);
458
+ t.has(a) || t.set(a, []), t.get(a).push(r);
459
+ });
460
+ let i = `# Keyboard Shortcuts
461
+
462
+ `;
463
+ return t.forEach((r, a) => {
464
+ i += `## ${a}
465
+
466
+ `, r.forEach((c) => {
467
+ const o = this.getShortcutDescription(c);
468
+ i += `- **${o}**: ${c.description || c.command}
469
+ `;
470
+ }), i += `
471
+ `;
472
+ }), i;
473
+ }
474
+ getShortcutCategory(e) {
475
+ return e.includes("toggle") && (e.includes("Bold") || e.includes("Italic") || e.includes("Underline") || e.includes("Strike") || e.includes("Code") || e.includes("Super") || e.includes("Sub")) ? "Text Formatting" : e.includes("Heading") || e.includes("Paragraph") ? "Block Formatting" : e.includes("List") || e.includes("Checklist") ? "Lists" : e.includes("Alignment") || e.includes("Indent") ? "Alignment & Indentation" : e.includes("undo") || e.includes("redo") ? "History" : e.includes("insert") ? "Insert" : e.includes("find") || e.includes("replace") ? "Find & Replace" : e.includes("Accessibility") || e.includes("spell") ? "Tools" : "Other";
476
+ }
477
+ }
478
+ function b(n = {}) {
479
+ const {
480
+ enabled: e = !1,
481
+ provider: t = "browser",
482
+ apiUrl: i = "",
483
+ apiHeaders: r = {},
484
+ language: a = "en",
485
+ customDictionary: c = [],
486
+ ignoreAllCaps: o = !0,
487
+ ignoreNumbers: p = !0
488
+ } = n;
489
+ return {
490
+ name: "spellcheck",
491
+ context: {
492
+ initialize: () => {
493
+ if (e)
494
+ switch (console.log("[Spellcheck Plugin] Initialized", {
495
+ provider: t,
496
+ language: a
497
+ }), t) {
498
+ case "browser":
499
+ console.log("[Spellcheck] Using browser spellcheck");
500
+ break;
501
+ case "local":
502
+ console.log("[Spellcheck] Using local dictionary (not implemented)");
503
+ break;
504
+ case "api":
505
+ i ? console.log("[Spellcheck] Using API:", i) : console.warn("[Spellcheck] API provider selected but no apiUrl provided");
506
+ break;
507
+ }
508
+ },
509
+ destroy: () => {
510
+ console.log("[Spellcheck Plugin] Destroyed");
511
+ },
512
+ onEditorReady: (u) => {
513
+ console.log("[Spellcheck Plugin] Editor ready");
514
+ }
515
+ },
516
+ commands: {
517
+ toggleSpellcheck: () => (console.log("[Spellcheck] Toggle command (not implemented)"), null),
518
+ addToDictionary: (u) => (console.log("[Spellcheck] Add to dictionary:", u), null),
519
+ checkSpelling: async () => (console.log("[Spellcheck] Check spelling (not implemented)"), null)
520
+ },
521
+ toolbar: e ? [
522
+ {
523
+ label: "Spellcheck",
524
+ command: "toggleSpellcheck",
525
+ icon: "Aa",
526
+ type: "button"
527
+ }
528
+ ] : []
529
+ };
530
+ }
531
+ function v(n = {}) {
532
+ const {
533
+ uploadUrl: e = "",
534
+ libraryUrl: t = "",
535
+ maxFileSize: i = 10 * 1024 * 1024,
536
+ // 10MB
537
+ allowedTypes: r = ["image/jpeg", "image/png", "image/gif", "image/webp"],
538
+ headers: a = {},
539
+ withCredentials: c = !1,
540
+ chunkSize: o = 1024 * 1024,
541
+ // 1MB chunks
542
+ enableChunking: p = !0,
543
+ onProgress: u,
544
+ onError: d,
545
+ onSuccess: f
546
+ } = n;
547
+ return {
548
+ name: "media",
549
+ context: {
550
+ initialize: () => {
551
+ console.log("[Media Plugin] Initialized", {
552
+ uploadUrl: e,
553
+ libraryUrl: t,
554
+ maxFileSize: i,
555
+ allowedTypes: r
556
+ }), e || console.warn("[Media] No uploadUrl provided - upload will not work");
557
+ },
558
+ destroy: () => {
559
+ console.log("[Media Plugin] Destroyed");
560
+ },
561
+ onEditorReady: (s) => {
562
+ console.log("[Media Plugin] Editor ready");
563
+ }
564
+ },
565
+ commands: {
566
+ insertImage: async (s) => {
567
+ if (console.log("[Media] Insert image command (not implemented)", s), !s)
568
+ return console.log("[Media] No file provided - should open picker"), null;
569
+ if (!r.includes(s.type)) {
570
+ const h = new Error(`File type ${s.type} not allowed`);
571
+ return d?.(h), null;
572
+ }
573
+ if (s.size > i) {
574
+ const h = new Error(`File size ${s.size} exceeds max ${i}`);
575
+ return d?.(h), null;
576
+ }
577
+ return null;
578
+ },
579
+ openMediaLibrary: () => (console.log("[Media] Open media library (not implemented)"), t || console.warn("[Media] No libraryUrl provided"), null),
580
+ uploadMedia: async (s) => (console.log("[Media] Upload media (not implemented)", {
581
+ name: s.name,
582
+ size: s.size,
583
+ type: s.type
584
+ }), null)
585
+ },
586
+ toolbar: [
587
+ {
588
+ label: "Image",
589
+ command: "insertImage",
590
+ icon: "🖼️",
591
+ type: "button"
592
+ },
593
+ {
594
+ label: "Media Library",
595
+ command: "openMediaLibrary",
596
+ icon: "📁",
597
+ type: "button"
598
+ }
599
+ ]
600
+ };
601
+ }
602
+ export {
603
+ y as Editor,
604
+ l as EditorState,
605
+ M as KeyboardShortcutManager,
606
+ k as PluginManager,
607
+ m as PluginRuntime,
608
+ g as Schema,
609
+ v as createMediaPlugin,
610
+ S as createPluginRuntime,
611
+ b as createSpellcheckPlugin
612
+ };
package/package.json ADDED
@@ -0,0 +1,64 @@
1
+ {
2
+ "name": "@editora/core",
3
+ "version": "1.0.0",
4
+ "description": "Framework-agnostic core editor engine for Editora Rich Text Editor",
5
+ "author": "Ajay Kumar <ajaykr089@gmail.com>",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/ajaykr089/Editora.git",
10
+ "directory": "packages/core"
11
+ },
12
+ "homepage": "https://github.com/ajaykr089/Editora#readme",
13
+ "bugs": {
14
+ "url": "https://github.com/ajaykr089/Editora/issues"
15
+ },
16
+ "keywords": [
17
+ "editor",
18
+ "rich-text",
19
+ "wysiwyg",
20
+ "contenteditable",
21
+ "modular",
22
+ "framework-agnostic",
23
+ "typescript",
24
+ "umd",
25
+ "browser"
26
+ ],
27
+ "main": "dist/index.cjs.js",
28
+ "module": "dist/index.esm.js",
29
+ "browser": "dist/editora.min.js",
30
+ "unpkg": "dist/editora.min.js",
31
+ "jsdelivr": "dist/editora.min.js",
32
+ "types": "dist/index.d.ts",
33
+ "exports": {
34
+ ".": {
35
+ "types": "./dist/index.d.ts",
36
+ "import": "./dist/index.esm.js",
37
+ "require": "./dist/index.cjs.js"
38
+ },
39
+ "./KeyboardShortcuts": {
40
+ "types": "./dist/index.d.ts",
41
+ "import": "./dist/index.esm.js",
42
+ "require": "./dist/index.cjs.js"
43
+ }
44
+ },
45
+ "files": [
46
+ "dist",
47
+ "README.md",
48
+ "LICENSE"
49
+ ],
50
+ "scripts": {
51
+ "build": "vite build",
52
+ "dev": "vite build --watch",
53
+ "clean": "rm -rf dist",
54
+ "prepublishOnly": "npm run build"
55
+ },
56
+ "devDependencies": {
57
+ "typescript": "^5.0.0",
58
+ "vite": "^7.3.1"
59
+ },
60
+ "publishConfig": {
61
+ "access": "public"
62
+ },
63
+ "gitHead": "e26546f8b2455c9a27eceb61818db31fd81fb518"
64
+ }