@qwanyx/ai-editor 1.2.0 → 1.3.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.
@@ -1,14 +1,17 @@
1
- import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
- import { useState, useEffect, useRef } from 'react';
3
- export function PromptModal({ isOpen, onClose, onSubmit, selectedText, isLoading }) {
4
- const [prompt, setPrompt] = useState('');
5
- const inputRef = useRef(null);
6
- useEffect(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PromptModal = PromptModal;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const react_1 = require("react");
6
+ function PromptModal({ isOpen, onClose, onSubmit, selectedText, isLoading }) {
7
+ const [prompt, setPrompt] = (0, react_1.useState)('');
8
+ const inputRef = (0, react_1.useRef)(null);
9
+ (0, react_1.useEffect)(() => {
7
10
  if (isOpen && inputRef.current) {
8
11
  inputRef.current.focus();
9
12
  }
10
13
  }, [isOpen]);
11
- useEffect(() => {
14
+ (0, react_1.useEffect)(() => {
12
15
  const handleKeyDown = (e) => {
13
16
  if (e.key === 'Escape' && isOpen) {
14
17
  onClose();
@@ -26,13 +29,13 @@ export function PromptModal({ isOpen, onClose, onSubmit, selectedText, isLoading
26
29
  };
27
30
  if (!isOpen)
28
31
  return null;
29
- return (_jsx("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: _jsxs("div", { className: "bg-white rounded-xl shadow-2xl w-full max-w-lg mx-4 overflow-hidden", children: [_jsxs("div", { className: "px-6 py-4 border-b border-gray-200 flex items-center justify-between", children: [_jsx("h3", { className: "text-lg font-semibold text-gray-900", children: "Instruction IA" }), _jsx("button", { onClick: onClose, className: "p-1 text-gray-400 hover:text-gray-600 transition-colors", children: _jsx("span", { className: "material-icons", children: "close" }) })] }), _jsxs("form", { onSubmit: handleSubmit, className: "p-6", children: [selectedText && (_jsxs("div", { className: "mb-4", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Texte s\u00E9lectionn\u00E9" }), _jsx("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm text-gray-700 max-h-32 overflow-y-auto", children: selectedText.length > 200
32
+ return ((0, jsx_runtime_1.jsx)("div", { className: "fixed inset-0 bg-black/50 flex items-center justify-center z-50", children: (0, jsx_runtime_1.jsxs)("div", { className: "bg-white rounded-xl shadow-2xl w-full max-w-lg mx-4 overflow-hidden", children: [(0, jsx_runtime_1.jsxs)("div", { className: "px-6 py-4 border-b border-gray-200 flex items-center justify-between", children: [(0, jsx_runtime_1.jsx)("h3", { className: "text-lg font-semibold text-gray-900", children: "Instruction IA" }), (0, jsx_runtime_1.jsx)("button", { onClick: onClose, className: "p-1 text-gray-400 hover:text-gray-600 transition-colors", children: (0, jsx_runtime_1.jsx)("span", { className: "material-icons", children: "close" }) })] }), (0, jsx_runtime_1.jsxs)("form", { onSubmit: handleSubmit, className: "p-6", children: [selectedText && ((0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: "Texte s\u00E9lectionn\u00E9" }), (0, jsx_runtime_1.jsx)("div", { className: "p-3 bg-blue-50 border border-blue-200 rounded-lg text-sm text-gray-700 max-h-32 overflow-y-auto", children: selectedText.length > 200
30
33
  ? `${selectedText.substring(0, 200)}...`
31
- : selectedText })] })), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: selectedText ? 'Que voulez-vous faire avec ce texte ?' : 'Instruction pour l\'IA' }), _jsx("textarea", { ref: inputRef, value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "Ex: Rends ce texte plus concis, ajoute des exemples, traduis en anglais...", className: "w-full px-4 py-3 border border-gray-300 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500 resize-none", rows: 3, disabled: isLoading })] }), _jsxs("div", { className: "mb-4", children: [_jsx("label", { className: "block text-sm font-medium text-gray-500 mb-2", children: "Actions rapides" }), _jsx("div", { className: "flex flex-wrap gap-2", children: [
34
+ : selectedText })] })), (0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-700 mb-1", children: selectedText ? 'Que voulez-vous faire avec ce texte ?' : 'Instruction pour l\'IA' }), (0, jsx_runtime_1.jsx)("textarea", { ref: inputRef, value: prompt, onChange: (e) => setPrompt(e.target.value), placeholder: "Ex: Rends ce texte plus concis, ajoute des exemples, traduis en anglais...", className: "w-full px-4 py-3 border border-gray-300 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500 resize-none", rows: 3, disabled: isLoading })] }), (0, jsx_runtime_1.jsxs)("div", { className: "mb-4", children: [(0, jsx_runtime_1.jsx)("label", { className: "block text-sm font-medium text-gray-500 mb-2", children: "Actions rapides" }), (0, jsx_runtime_1.jsx)("div", { className: "flex flex-wrap gap-2", children: [
32
35
  'Rends plus concis',
33
36
  'Ajoute des détails',
34
37
  'Simplifie le vocabulaire',
35
38
  'Traduis en anglais',
36
39
  'Reformule autrement'
37
- ].map((action) => (_jsx("button", { type: "button", onClick: () => setPrompt(action), className: "px-3 py-1 text-xs bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200 transition-colors", children: action }, action))) })] }), _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx("button", { type: "button", onClick: onClose, className: "px-4 py-2 text-gray-600 hover:text-gray-900 transition-colors", disabled: isLoading, children: "Annuler" }), _jsx("button", { type: "submit", disabled: !prompt.trim() || isLoading, className: "px-6 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2", children: isLoading ? (_jsxs(_Fragment, { children: [_jsx("span", { className: "material-icons text-sm animate-spin", children: "sync" }), "Traitement..."] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: "material-icons text-sm", children: "send" }), "Appliquer"] })) })] })] })] }) }));
40
+ ].map((action) => ((0, jsx_runtime_1.jsx)("button", { type: "button", onClick: () => setPrompt(action), className: "px-3 py-1 text-xs bg-gray-100 text-gray-700 rounded-full hover:bg-gray-200 transition-colors", children: action }, action))) })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-end gap-3", children: [(0, jsx_runtime_1.jsx)("button", { type: "button", onClick: onClose, className: "px-4 py-2 text-gray-600 hover:text-gray-900 transition-colors", disabled: isLoading, children: "Annuler" }), (0, jsx_runtime_1.jsx)("button", { type: "submit", disabled: !prompt.trim() || isLoading, className: "px-6 py-2 bg-purple-500 text-white rounded-lg hover:bg-purple-600 disabled:opacity-50 disabled:cursor-not-allowed transition-colors flex items-center gap-2", children: isLoading ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons text-sm animate-spin", children: "sync" }), "Traitement..."] })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons text-sm", children: "send" }), "Appliquer"] })) })] })] })] }) }));
38
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichTextEditor.tsx"],"names":[],"mappings":"AAiCA,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;QAC1C,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAqKD,wBAAgB,cAAc,CAAC,EAC7B,cAAmB,EACnB,QAAQ,EACR,WAAW,EACX,WAAqC,EACrC,SAAc,EACd,SAAmB,EACpB,EAAE,mBAAmB,2CAyIrB"}
1
+ {"version":3,"file":"RichTextEditor.d.ts","sourceRoot":"","sources":["../../src/components/RichTextEditor.tsx"],"names":[],"mappings":"AAkCA,MAAM,WAAW,mBAAmB;IAClC,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE;QACrB,QAAQ,EAAE,MAAM,CAAA;QAChB,YAAY,CAAC,EAAE,MAAM,CAAA;QACrB,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAA;QAC1C,YAAY,CAAC,EAAE,MAAM,CAAA;KACtB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAqKD,wBAAgB,cAAc,CAAC,EAC7B,cAAmB,EACnB,QAAQ,EACR,WAAW,EACX,WAAqC,EACrC,SAAc,EACd,SAAmB,EACpB,EAAE,mBAAmB,2CA6IrB"}
@@ -1,26 +1,63 @@
1
+ "use strict";
1
2
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import React, { useCallback, useEffect } from 'react';
4
- import { LexicalComposer } from '@lexical/react/LexicalComposer';
5
- import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
6
- import { ContentEditable } from '@lexical/react/LexicalContentEditable';
7
- import { HistoryPlugin } from '@lexical/react/LexicalHistoryPlugin';
8
- import { OnChangePlugin } from '@lexical/react/LexicalOnChangePlugin';
9
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
10
- import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
11
- import { HeadingNode, QuoteNode } from '@lexical/rich-text';
12
- import { ListNode, ListItemNode } from '@lexical/list';
13
- import { LinkNode } from '@lexical/link';
14
- import { ImageNode } from '../nodes/ImageNode';
15
- import { ImageLinkNode } from '../nodes/ImageLinkNode';
16
- import { SimpleLinkNode } from '../nodes/LinkNode';
17
- import { InsertObjectPlugin } from '../plugins/InsertObjectPlugin';
18
- import { ImageLinkPlugin } from '../plugins/ImageLinkPlugin';
19
- import { SimpleLinkPlugin } from '../plugins/LinkPlugin';
20
- import { ListPlugin } from '@lexical/react/LexicalListPlugin';
21
- import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
22
- import { $getRoot, $getSelection, $isRangeSelection, $createParagraphNode, $createTextNode } from 'lexical';
23
- import { EditorToolbar } from './EditorToolbar';
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.RichTextEditor = RichTextEditor;
38
+ const jsx_runtime_1 = require("react/jsx-runtime");
39
+ const react_1 = __importStar(require("react"));
40
+ const LexicalComposer_1 = require("@lexical/react/LexicalComposer");
41
+ const LexicalRichTextPlugin_1 = require("@lexical/react/LexicalRichTextPlugin");
42
+ const LexicalContentEditable_1 = require("@lexical/react/LexicalContentEditable");
43
+ const LexicalHistoryPlugin_1 = require("@lexical/react/LexicalHistoryPlugin");
44
+ const LexicalOnChangePlugin_1 = require("@lexical/react/LexicalOnChangePlugin");
45
+ const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
46
+ const LexicalErrorBoundary_1 = require("@lexical/react/LexicalErrorBoundary");
47
+ const rich_text_1 = require("@lexical/rich-text");
48
+ const list_1 = require("@lexical/list");
49
+ const link_1 = require("@lexical/link");
50
+ const ImageNode_1 = require("../nodes/ImageNode");
51
+ const ImageLinkNode_1 = require("../nodes/ImageLinkNode");
52
+ const LinkNode_1 = require("../nodes/LinkNode");
53
+ const InsertObjectPlugin_1 = require("../plugins/InsertObjectPlugin");
54
+ const ImageLinkPlugin_1 = require("../plugins/ImageLinkPlugin");
55
+ const LinkPlugin_1 = require("../plugins/LinkPlugin");
56
+ const LexicalListPlugin_1 = require("@lexical/react/LexicalListPlugin");
57
+ const LexicalLinkPlugin_1 = require("@lexical/react/LexicalLinkPlugin");
58
+ const lexical_1 = require("lexical");
59
+ const EditorToolbar_1 = require("./EditorToolbar");
60
+ const EditorModeContext_1 = require("../context/EditorModeContext");
24
61
  // Theme for Lexical editor
25
62
  const editorTheme = {
26
63
  paragraph: 'editor-paragraph',
@@ -123,22 +160,22 @@ function getEditorConfig(initialContent) {
123
160
  console.error('Lexical error:', error);
124
161
  },
125
162
  nodes: [
126
- HeadingNode,
127
- QuoteNode,
128
- ListNode,
129
- ListItemNode,
130
- LinkNode,
131
- ImageNode,
132
- ImageLinkNode,
133
- SimpleLinkNode,
163
+ rich_text_1.HeadingNode,
164
+ rich_text_1.QuoteNode,
165
+ list_1.ListNode,
166
+ list_1.ListItemNode,
167
+ link_1.LinkNode,
168
+ ImageNode_1.ImageNode,
169
+ ImageLinkNode_1.ImageLinkNode,
170
+ LinkNode_1.SimpleLinkNode,
134
171
  ],
135
172
  };
136
173
  }
137
174
  // Plugin to set initial content (supports both JSON and plain text)
138
175
  function InitialContentPlugin({ content }) {
139
- const [editor] = useLexicalComposerContext();
140
- const isFirstRender = React.useRef(true);
141
- useEffect(() => {
176
+ const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
177
+ const isFirstRender = react_1.default.useRef(true);
178
+ (0, react_1.useEffect)(() => {
142
179
  if (isFirstRender.current && content) {
143
180
  isFirstRender.current = false;
144
181
  // Try to parse as JSON (Lexical state)
@@ -156,10 +193,10 @@ function InitialContentPlugin({ content }) {
156
193
  }
157
194
  // Fallback: plain text
158
195
  editor.update(() => {
159
- const root = $getRoot();
196
+ const root = (0, lexical_1.$getRoot)();
160
197
  root.clear();
161
- const paragraph = $createParagraphNode();
162
- paragraph.append($createTextNode(content));
198
+ const paragraph = (0, lexical_1.$createParagraphNode)();
199
+ paragraph.append((0, lexical_1.$createTextNode)(content));
163
200
  root.append(paragraph);
164
201
  });
165
202
  }
@@ -168,24 +205,24 @@ function InitialContentPlugin({ content }) {
168
205
  }
169
206
  // Plugin to get editor reference
170
207
  function EditorRefPlugin({ editorRef }) {
171
- const [editor] = useLexicalComposerContext();
172
- useEffect(() => {
208
+ const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
209
+ (0, react_1.useEffect)(() => {
173
210
  editorRef.current = editor;
174
211
  }, [editor, editorRef]);
175
212
  return null;
176
213
  }
177
- export function RichTextEditor({ initialContent = '', onChange, onAIRequest, placeholder = 'Commencez à écrire...', className = '', minHeight = '300px' }) {
178
- const editorRef = React.useRef(null);
179
- const [isLoading, setIsLoading] = React.useState(false);
180
- const [isFullscreen, setIsFullscreen] = React.useState(false);
181
- const toggleFullscreen = useCallback(() => {
214
+ function RichTextEditor({ initialContent = '', onChange, onAIRequest, placeholder = 'Commencez à écrire...', className = '', minHeight = '300px' }) {
215
+ const editorRef = react_1.default.useRef(null);
216
+ const [isLoading, setIsLoading] = react_1.default.useState(false);
217
+ const [isFullscreen, setIsFullscreen] = react_1.default.useState(false);
218
+ const toggleFullscreen = (0, react_1.useCallback)(() => {
182
219
  setIsFullscreen(prev => !prev);
183
220
  }, []);
184
221
  // Handle editor changes
185
- const handleChange = useCallback((editorState, editor) => {
222
+ const handleChange = (0, react_1.useCallback)((editorState, editor) => {
186
223
  editorState.read(() => {
187
224
  // Get HTML
188
- const root = $getRoot();
225
+ const root = (0, lexical_1.$getRoot)();
189
226
  const textContent = root.getTextContent();
190
227
  // Get JSON
191
228
  const json = JSON.stringify(editorState.toJSON());
@@ -194,30 +231,30 @@ export function RichTextEditor({ initialContent = '', onChange, onAIRequest, pla
194
231
  });
195
232
  }, [onChange]);
196
233
  // Get selected text for AI operations
197
- const getSelectedText = useCallback(() => {
234
+ const getSelectedText = (0, react_1.useCallback)(() => {
198
235
  if (!editorRef.current)
199
236
  return undefined;
200
237
  let selectedText;
201
238
  editorRef.current.getEditorState().read(() => {
202
- const selection = $getSelection();
203
- if ($isRangeSelection(selection)) {
239
+ const selection = (0, lexical_1.$getSelection)();
240
+ if ((0, lexical_1.$isRangeSelection)(selection)) {
204
241
  selectedText = selection.getTextContent();
205
242
  }
206
243
  });
207
244
  return selectedText || undefined;
208
245
  }, []);
209
246
  // Get full text for AI operations
210
- const getFullText = useCallback(() => {
247
+ const getFullText = (0, react_1.useCallback)(() => {
211
248
  if (!editorRef.current)
212
249
  return '';
213
250
  let fullText = '';
214
251
  editorRef.current.getEditorState().read(() => {
215
- fullText = $getRoot().getTextContent();
252
+ fullText = (0, lexical_1.$getRoot)().getTextContent();
216
253
  });
217
254
  return fullText;
218
255
  }, []);
219
256
  // Handle AI actions
220
- const handleAIAction = useCallback(async (action, customPrompt) => {
257
+ const handleAIAction = (0, react_1.useCallback)(async (action, customPrompt) => {
221
258
  if (!onAIRequest || !editorRef.current)
222
259
  return;
223
260
  setIsLoading(true);
@@ -232,10 +269,10 @@ export function RichTextEditor({ initialContent = '', onChange, onAIRequest, pla
232
269
  });
233
270
  // Replace content with AI result
234
271
  editorRef.current.update(() => {
235
- const root = $getRoot();
272
+ const root = (0, lexical_1.$getRoot)();
236
273
  root.clear();
237
- const paragraph = $createParagraphNode();
238
- paragraph.append($createTextNode(result));
274
+ const paragraph = (0, lexical_1.$createParagraphNode)();
275
+ paragraph.append((0, lexical_1.$createTextNode)(result));
239
276
  root.append(paragraph);
240
277
  });
241
278
  }
@@ -249,5 +286,5 @@ export function RichTextEditor({ initialContent = '', onChange, onAIRequest, pla
249
286
  const fullscreenClasses = isFullscreen
250
287
  ? 'fixed inset-0 z-50'
251
288
  : '';
252
- return (_jsxs("div", { className: `border border-gray-200 rounded-lg bg-white flex flex-col ${fullscreenClasses} ${className}`, children: [_jsx("style", { dangerouslySetInnerHTML: { __html: editorStyles } }), _jsxs(LexicalComposer, { initialConfig: getEditorConfig(initialContent), children: [_jsx(EditorToolbar, { onAIAction: handleAIAction, isLoading: isLoading, isFullscreen: isFullscreen, onToggleFullscreen: toggleFullscreen }), _jsxs("div", { className: "relative flex-1 overflow-auto", style: minHeight && !isFullscreen ? { minHeight } : {}, children: [_jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "outline-none p-4 text-gray-900 h-full min-h-full" }), placeholder: _jsx("div", { className: "absolute top-4 left-4 text-gray-400 pointer-events-none", children: placeholder }), ErrorBoundary: LexicalErrorBoundary }), _jsx(HistoryPlugin, {}), _jsx(ListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(OnChangePlugin, { onChange: handleChange }), _jsx(InitialContentPlugin, { content: initialContent }), _jsx(EditorRefPlugin, { editorRef: editorRef }), _jsx(InsertObjectPlugin, {}), _jsx(ImageLinkPlugin, {}), _jsx(SimpleLinkPlugin, {}), isLoading && (_jsx("div", { className: "absolute inset-0 bg-white/80 flex items-center justify-center z-10", children: _jsxs("div", { className: "flex items-center gap-2 text-blue-600", children: [_jsx("span", { className: "material-icons animate-spin", children: "sync" }), _jsx("span", { children: "L'IA travaille..." })] }) }))] })] })] }));
289
+ return ((0, jsx_runtime_1.jsx)(EditorModeContext_1.EditorModeProvider, { isViewer: false, children: (0, jsx_runtime_1.jsxs)("div", { className: `border border-gray-200 rounded-lg bg-white flex flex-col ${fullscreenClasses} ${className}`, children: [(0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: editorStyles } }), (0, jsx_runtime_1.jsxs)(LexicalComposer_1.LexicalComposer, { initialConfig: getEditorConfig(initialContent), children: [(0, jsx_runtime_1.jsx)("div", { className: "sticky top-0 z-10 bg-white border-b border-gray-200", children: (0, jsx_runtime_1.jsx)(EditorToolbar_1.EditorToolbar, { onAIAction: handleAIAction, isLoading: isLoading, isFullscreen: isFullscreen, onToggleFullscreen: toggleFullscreen }) }), (0, jsx_runtime_1.jsxs)("div", { className: "relative flex-1 overflow-auto", style: minHeight && !isFullscreen ? { minHeight } : {}, children: [(0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: "outline-none p-4 text-gray-900 h-full min-h-full" }), placeholder: (0, jsx_runtime_1.jsx)("div", { className: "absolute top-4 left-4 text-gray-400 pointer-events-none", children: placeholder }), ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }), (0, jsx_runtime_1.jsx)(LexicalHistoryPlugin_1.HistoryPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalOnChangePlugin_1.OnChangePlugin, { onChange: handleChange }), (0, jsx_runtime_1.jsx)(InitialContentPlugin, { content: initialContent }), (0, jsx_runtime_1.jsx)(EditorRefPlugin, { editorRef: editorRef }), (0, jsx_runtime_1.jsx)(InsertObjectPlugin_1.InsertObjectPlugin, {}), (0, jsx_runtime_1.jsx)(ImageLinkPlugin_1.ImageLinkPlugin, {}), (0, jsx_runtime_1.jsx)(LinkPlugin_1.SimpleLinkPlugin, {}), isLoading && ((0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 bg-white/80 flex items-center justify-center z-10", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-2 text-blue-600", children: [(0, jsx_runtime_1.jsx)("span", { className: "material-icons animate-spin", children: "sync" }), (0, jsx_runtime_1.jsx)("span", { children: "L'IA travaille..." })] }) }))] })] })] }) }));
253
290
  }
@@ -1 +1 @@
1
- {"version":3,"file":"RichTextViewer.d.ts","sourceRoot":"","sources":["../../src/components/RichTextViewer.tsx"],"names":[],"mappings":"AAmBA,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA4ID,wBAAgB,cAAc,CAAC,EAC7B,OAAY,EACZ,SAAc,EACf,EAAE,mBAAmB,kDA4BrB"}
1
+ {"version":3,"file":"RichTextViewer.d.ts","sourceRoot":"","sources":["../../src/components/RichTextViewer.tsx"],"names":[],"mappings":"AAoBA,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AA4ID,wBAAgB,cAAc,CAAC,EAC7B,OAAY,EACZ,SAAc,EACf,EAAE,mBAAmB,kDA8BrB"}
@@ -1,21 +1,25 @@
1
+ "use strict";
1
2
  'use client';
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect } from 'react';
4
- import { LexicalComposer } from '@lexical/react/LexicalComposer';
5
- import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
6
- import { ContentEditable } from '@lexical/react/LexicalContentEditable';
7
- import { useLexicalComposerContext } from '@lexical/react/LexicalComposerContext';
8
- import { LexicalErrorBoundary } from '@lexical/react/LexicalErrorBoundary';
9
- import { HeadingNode, QuoteNode } from '@lexical/rich-text';
10
- import { ListNode, ListItemNode } from '@lexical/list';
11
- import { LinkNode } from '@lexical/link';
12
- import { ImageNode } from '../nodes/ImageNode';
13
- import { ImageLinkNode } from '../nodes/ImageLinkNode';
14
- import { SimpleLinkNode } from '../nodes/LinkNode';
15
- import { ImageLinkPlugin } from '../plugins/ImageLinkPlugin';
16
- import { SimpleLinkPlugin } from '../plugins/LinkPlugin';
17
- import { ListPlugin } from '@lexical/react/LexicalListPlugin';
18
- import { LinkPlugin } from '@lexical/react/LexicalLinkPlugin';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RichTextViewer = RichTextViewer;
5
+ const jsx_runtime_1 = require("react/jsx-runtime");
6
+ const react_1 = require("react");
7
+ const LexicalComposer_1 = require("@lexical/react/LexicalComposer");
8
+ const LexicalRichTextPlugin_1 = require("@lexical/react/LexicalRichTextPlugin");
9
+ const LexicalContentEditable_1 = require("@lexical/react/LexicalContentEditable");
10
+ const LexicalComposerContext_1 = require("@lexical/react/LexicalComposerContext");
11
+ const LexicalErrorBoundary_1 = require("@lexical/react/LexicalErrorBoundary");
12
+ const rich_text_1 = require("@lexical/rich-text");
13
+ const list_1 = require("@lexical/list");
14
+ const link_1 = require("@lexical/link");
15
+ const ImageNode_1 = require("../nodes/ImageNode");
16
+ const ImageLinkNode_1 = require("../nodes/ImageLinkNode");
17
+ const LinkNode_1 = require("../nodes/LinkNode");
18
+ const ImageLinkPlugin_1 = require("../plugins/ImageLinkPlugin");
19
+ const LinkPlugin_1 = require("../plugins/LinkPlugin");
20
+ const LexicalListPlugin_1 = require("@lexical/react/LexicalListPlugin");
21
+ const LexicalLinkPlugin_1 = require("@lexical/react/LexicalLinkPlugin");
22
+ const EditorModeContext_1 = require("../context/EditorModeContext");
19
23
  // Theme for Lexical viewer (same as editor)
20
24
  const viewerTheme = {
21
25
  paragraph: 'editor-paragraph',
@@ -119,21 +123,21 @@ function getViewerConfig() {
119
123
  console.error('Lexical viewer error:', error);
120
124
  },
121
125
  nodes: [
122
- HeadingNode,
123
- QuoteNode,
124
- ListNode,
125
- ListItemNode,
126
- LinkNode,
127
- ImageNode,
128
- ImageLinkNode,
129
- SimpleLinkNode,
126
+ rich_text_1.HeadingNode,
127
+ rich_text_1.QuoteNode,
128
+ list_1.ListNode,
129
+ list_1.ListItemNode,
130
+ link_1.LinkNode,
131
+ ImageNode_1.ImageNode,
132
+ ImageLinkNode_1.ImageLinkNode,
133
+ LinkNode_1.SimpleLinkNode,
130
134
  ],
131
135
  };
132
136
  }
133
137
  // Plugin to load content
134
138
  function ContentLoaderPlugin({ content }) {
135
- const [editor] = useLexicalComposerContext();
136
- useEffect(() => {
139
+ const [editor] = (0, LexicalComposerContext_1.useLexicalComposerContext)();
140
+ (0, react_1.useEffect)(() => {
137
141
  if (content) {
138
142
  try {
139
143
  const parsed = JSON.parse(content);
@@ -149,10 +153,10 @@ function ContentLoaderPlugin({ content }) {
149
153
  }, [editor, content]);
150
154
  return null;
151
155
  }
152
- export function RichTextViewer({ content = '', className = '' }) {
156
+ function RichTextViewer({ content = '', className = '' }) {
153
157
  // Don't render anything if no content
154
158
  if (!content) {
155
159
  return null;
156
160
  }
157
- return (_jsxs("div", { className: className, children: [_jsx("style", { dangerouslySetInnerHTML: { __html: viewerStyles } }), _jsxs(LexicalComposer, { initialConfig: getViewerConfig(), children: [_jsx(RichTextPlugin, { contentEditable: _jsx(ContentEditable, { className: "outline-none text-gray-900", style: { cursor: 'default' } }), placeholder: null, ErrorBoundary: LexicalErrorBoundary }), _jsx(ListPlugin, {}), _jsx(LinkPlugin, {}), _jsx(ContentLoaderPlugin, { content: content }), _jsx(ImageLinkPlugin, {}), _jsx(SimpleLinkPlugin, {})] })] }));
161
+ return ((0, jsx_runtime_1.jsx)(EditorModeContext_1.EditorModeProvider, { isViewer: true, children: (0, jsx_runtime_1.jsxs)("div", { className: className, children: [(0, jsx_runtime_1.jsx)("style", { dangerouslySetInnerHTML: { __html: viewerStyles } }), (0, jsx_runtime_1.jsxs)(LexicalComposer_1.LexicalComposer, { initialConfig: getViewerConfig(), children: [(0, jsx_runtime_1.jsx)(LexicalRichTextPlugin_1.RichTextPlugin, { contentEditable: (0, jsx_runtime_1.jsx)(LexicalContentEditable_1.ContentEditable, { className: "outline-none text-gray-900", style: { cursor: 'default' } }), placeholder: null, ErrorBoundary: LexicalErrorBoundary_1.LexicalErrorBoundary }), (0, jsx_runtime_1.jsx)(LexicalListPlugin_1.ListPlugin, {}), (0, jsx_runtime_1.jsx)(LexicalLinkPlugin_1.LinkPlugin, {}), (0, jsx_runtime_1.jsx)(ContentLoaderPlugin, { content: content }), (0, jsx_runtime_1.jsx)(ImageLinkPlugin_1.ImageLinkPlugin, {}), (0, jsx_runtime_1.jsx)(LinkPlugin_1.SimpleLinkPlugin, {})] })] }) }));
158
162
  }
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface EditorModeContextValue {
3
+ isViewer: boolean;
4
+ }
5
+ export declare const EditorModeContext: React.Context<EditorModeContextValue>;
6
+ export declare function useEditorMode(): EditorModeContextValue;
7
+ export declare function EditorModeProvider({ children, isViewer }: {
8
+ children: React.ReactNode;
9
+ isViewer?: boolean;
10
+ }): import("react/jsx-runtime").JSX.Element;
11
+ export {};
12
+ //# sourceMappingURL=EditorModeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"EditorModeContext.d.ts","sourceRoot":"","sources":["../../src/context/EditorModeContext.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAA;AAExD,UAAU,sBAAsB;IAC9B,QAAQ,EAAE,OAAO,CAAA;CAClB;AAED,eAAO,MAAM,iBAAiB,uCAA6D,CAAA;AAE3F,wBAAgB,aAAa,2BAE5B;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,QAAgB,EACjB,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,2CAMA"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ 'use client';
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.EditorModeContext = void 0;
5
+ exports.useEditorMode = useEditorMode;
6
+ exports.EditorModeProvider = EditorModeProvider;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const react_1 = require("react");
9
+ exports.EditorModeContext = (0, react_1.createContext)({ isViewer: false });
10
+ function useEditorMode() {
11
+ return (0, react_1.useContext)(exports.EditorModeContext);
12
+ }
13
+ function EditorModeProvider({ children, isViewer = false }) {
14
+ return ((0, jsx_runtime_1.jsx)(exports.EditorModeContext.Provider, { value: { isViewer }, children: children }));
15
+ }
@@ -1,18 +1,21 @@
1
- import { useState, useCallback, useRef } from 'react';
2
- export function useAIEditor(initialContent = '') {
3
- const [content, setContentState] = useState(initialContent);
4
- const [isLoading, setIsLoading] = useState(false);
5
- const [error, setError] = useState(null);
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useAIEditor = useAIEditor;
4
+ const react_1 = require("react");
5
+ function useAIEditor(initialContent = '') {
6
+ const [content, setContentState] = (0, react_1.useState)(initialContent);
7
+ const [isLoading, setIsLoading] = (0, react_1.useState)(false);
8
+ const [error, setError] = (0, react_1.useState)(null);
6
9
  // History for undo/redo
7
- const historyRef = useRef([{ content: initialContent, timestamp: Date.now() }]);
8
- const historyIndexRef = useRef(0);
9
- const [canUndo, setCanUndo] = useState(false);
10
- const [canRedo, setCanRedo] = useState(false);
11
- const updateUndoRedoState = useCallback(() => {
10
+ const historyRef = (0, react_1.useRef)([{ content: initialContent, timestamp: Date.now() }]);
11
+ const historyIndexRef = (0, react_1.useRef)(0);
12
+ const [canUndo, setCanUndo] = (0, react_1.useState)(false);
13
+ const [canRedo, setCanRedo] = (0, react_1.useState)(false);
14
+ const updateUndoRedoState = (0, react_1.useCallback)(() => {
12
15
  setCanUndo(historyIndexRef.current > 0);
13
16
  setCanRedo(historyIndexRef.current < historyRef.current.length - 1);
14
17
  }, []);
15
- const setContent = useCallback((newContent) => {
18
+ const setContent = (0, react_1.useCallback)((newContent) => {
16
19
  // Add to history, removing any future states
17
20
  historyRef.current = historyRef.current.slice(0, historyIndexRef.current + 1);
18
21
  historyRef.current.push({ content: newContent, timestamp: Date.now() });
@@ -20,21 +23,21 @@ export function useAIEditor(initialContent = '') {
20
23
  setContentState(newContent);
21
24
  updateUndoRedoState();
22
25
  }, [updateUndoRedoState]);
23
- const undo = useCallback(() => {
26
+ const undo = (0, react_1.useCallback)(() => {
24
27
  if (historyIndexRef.current > 0) {
25
28
  historyIndexRef.current--;
26
29
  setContentState(historyRef.current[historyIndexRef.current].content);
27
30
  updateUndoRedoState();
28
31
  }
29
32
  }, [updateUndoRedoState]);
30
- const redo = useCallback(() => {
33
+ const redo = (0, react_1.useCallback)(() => {
31
34
  if (historyIndexRef.current < historyRef.current.length - 1) {
32
35
  historyIndexRef.current++;
33
36
  setContentState(historyRef.current[historyIndexRef.current].content);
34
37
  updateUndoRedoState();
35
38
  }
36
39
  }, [updateUndoRedoState]);
37
- const applyAIEdit = useCallback((newContent) => {
40
+ const applyAIEdit = (0, react_1.useCallback)((newContent) => {
38
41
  setContent(newContent);
39
42
  setIsLoading(false);
40
43
  setError(null);
@@ -1,7 +1,10 @@
1
- import { useState, useCallback, useEffect } from 'react';
2
- export function useSelection(containerRef) {
3
- const [selection, setSelection] = useState(null);
4
- const handleSelectionChange = useCallback(() => {
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useSelection = useSelection;
4
+ const react_1 = require("react");
5
+ function useSelection(containerRef) {
6
+ const [selection, setSelection] = (0, react_1.useState)(null);
7
+ const handleSelectionChange = (0, react_1.useCallback)(() => {
5
8
  const sel = window.getSelection();
6
9
  if (!sel || sel.isCollapsed || !containerRef.current) {
7
10
  setSelection(null);
@@ -31,13 +34,13 @@ export function useSelection(containerRef) {
31
34
  originalEnd: startOffset + text.length
32
35
  });
33
36
  }, [containerRef]);
34
- useEffect(() => {
37
+ (0, react_1.useEffect)(() => {
35
38
  document.addEventListener('selectionchange', handleSelectionChange);
36
39
  return () => {
37
40
  document.removeEventListener('selectionchange', handleSelectionChange);
38
41
  };
39
42
  }, [handleSelectionChange]);
40
- const clearSelection = useCallback(() => {
43
+ const clearSelection = (0, react_1.useCallback)(() => {
41
44
  setSelection(null);
42
45
  window.getSelection()?.removeAllRanges();
43
46
  }, []);
package/dist/index.d.ts CHANGED
@@ -13,5 +13,6 @@ export type { SimpleLinkPayload } from './nodes/LinkNode';
13
13
  export { InsertObjectPlugin, INSERT_OBJECT_COMMAND } from './plugins/InsertObjectPlugin';
14
14
  export { ImageLinkPlugin } from './plugins/ImageLinkPlugin';
15
15
  export { SimpleLinkPlugin } from './plugins/LinkPlugin';
16
+ export { EditorModeContext, EditorModeProvider, useEditorMode } from './context/EditorModeContext';
16
17
  export { RichTextEditor as AIEditor } from './components/RichTextEditor';
17
18
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACxH,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AACvH,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGzD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAC5D,YAAY,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAA;AAGtE,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAA;AAC1D,YAAY,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAA;AAGpE,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAC7E,YAAY,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAErE,OAAO,EAAE,aAAa,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAA;AACxH,YAAY,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAA;AAE7D,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,0BAA0B,EAAE,MAAM,kBAAkB,CAAA;AACvH,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AAGzD,OAAO,EAAE,kBAAkB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAA;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAGvD,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAA;AAGlG,OAAO,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,6BAA6B,CAAA"}
package/dist/index.js CHANGED
@@ -1,16 +1,43 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AIEditor = exports.useEditorMode = exports.EditorModeProvider = exports.EditorModeContext = exports.SimpleLinkPlugin = exports.ImageLinkPlugin = exports.INSERT_OBJECT_COMMAND = exports.InsertObjectPlugin = exports.$wrapSelectionInSimpleLink = exports.$isSimpleLinkNode = exports.$createSimpleLinkNode = exports.SimpleLinkNode = exports.$wrapSelectionInImageLink = exports.$isImageLinkNode = exports.$createImageLinkNode = exports.ImageLinkNode = exports.$isImageNode = exports.$createImageNode = exports.ImageNode = exports.EditorToolbar = exports.RichTextViewer = exports.RichTextEditor = void 0;
1
4
  // Main WYSIWYG editor component
2
- export { RichTextEditor } from './components/RichTextEditor';
5
+ var RichTextEditor_1 = require("./components/RichTextEditor");
6
+ Object.defineProperty(exports, "RichTextEditor", { enumerable: true, get: function () { return RichTextEditor_1.RichTextEditor; } });
3
7
  // Read-only viewer component
4
- export { RichTextViewer } from './components/RichTextViewer';
8
+ var RichTextViewer_1 = require("./components/RichTextViewer");
9
+ Object.defineProperty(exports, "RichTextViewer", { enumerable: true, get: function () { return RichTextViewer_1.RichTextViewer; } });
5
10
  // Toolbar component (for custom implementations)
6
- export { EditorToolbar } from './components/EditorToolbar';
11
+ var EditorToolbar_1 = require("./components/EditorToolbar");
12
+ Object.defineProperty(exports, "EditorToolbar", { enumerable: true, get: function () { return EditorToolbar_1.EditorToolbar; } });
7
13
  // Custom nodes
8
- export { ImageNode, $createImageNode, $isImageNode } from './nodes/ImageNode';
9
- export { ImageLinkNode, $createImageLinkNode, $isImageLinkNode, $wrapSelectionInImageLink } from './nodes/ImageLinkNode';
10
- export { SimpleLinkNode, $createSimpleLinkNode, $isSimpleLinkNode, $wrapSelectionInSimpleLink } from './nodes/LinkNode';
14
+ var ImageNode_1 = require("./nodes/ImageNode");
15
+ Object.defineProperty(exports, "ImageNode", { enumerable: true, get: function () { return ImageNode_1.ImageNode; } });
16
+ Object.defineProperty(exports, "$createImageNode", { enumerable: true, get: function () { return ImageNode_1.$createImageNode; } });
17
+ Object.defineProperty(exports, "$isImageNode", { enumerable: true, get: function () { return ImageNode_1.$isImageNode; } });
18
+ var ImageLinkNode_1 = require("./nodes/ImageLinkNode");
19
+ Object.defineProperty(exports, "ImageLinkNode", { enumerable: true, get: function () { return ImageLinkNode_1.ImageLinkNode; } });
20
+ Object.defineProperty(exports, "$createImageLinkNode", { enumerable: true, get: function () { return ImageLinkNode_1.$createImageLinkNode; } });
21
+ Object.defineProperty(exports, "$isImageLinkNode", { enumerable: true, get: function () { return ImageLinkNode_1.$isImageLinkNode; } });
22
+ Object.defineProperty(exports, "$wrapSelectionInImageLink", { enumerable: true, get: function () { return ImageLinkNode_1.$wrapSelectionInImageLink; } });
23
+ var LinkNode_1 = require("./nodes/LinkNode");
24
+ Object.defineProperty(exports, "SimpleLinkNode", { enumerable: true, get: function () { return LinkNode_1.SimpleLinkNode; } });
25
+ Object.defineProperty(exports, "$createSimpleLinkNode", { enumerable: true, get: function () { return LinkNode_1.$createSimpleLinkNode; } });
26
+ Object.defineProperty(exports, "$isSimpleLinkNode", { enumerable: true, get: function () { return LinkNode_1.$isSimpleLinkNode; } });
27
+ Object.defineProperty(exports, "$wrapSelectionInSimpleLink", { enumerable: true, get: function () { return LinkNode_1.$wrapSelectionInSimpleLink; } });
11
28
  // Plugins
12
- export { InsertObjectPlugin, INSERT_OBJECT_COMMAND } from './plugins/InsertObjectPlugin';
13
- export { ImageLinkPlugin } from './plugins/ImageLinkPlugin';
14
- export { SimpleLinkPlugin } from './plugins/LinkPlugin';
29
+ var InsertObjectPlugin_1 = require("./plugins/InsertObjectPlugin");
30
+ Object.defineProperty(exports, "InsertObjectPlugin", { enumerable: true, get: function () { return InsertObjectPlugin_1.InsertObjectPlugin; } });
31
+ Object.defineProperty(exports, "INSERT_OBJECT_COMMAND", { enumerable: true, get: function () { return InsertObjectPlugin_1.INSERT_OBJECT_COMMAND; } });
32
+ var ImageLinkPlugin_1 = require("./plugins/ImageLinkPlugin");
33
+ Object.defineProperty(exports, "ImageLinkPlugin", { enumerable: true, get: function () { return ImageLinkPlugin_1.ImageLinkPlugin; } });
34
+ var LinkPlugin_1 = require("./plugins/LinkPlugin");
35
+ Object.defineProperty(exports, "SimpleLinkPlugin", { enumerable: true, get: function () { return LinkPlugin_1.SimpleLinkPlugin; } });
36
+ // Context
37
+ var EditorModeContext_1 = require("./context/EditorModeContext");
38
+ Object.defineProperty(exports, "EditorModeContext", { enumerable: true, get: function () { return EditorModeContext_1.EditorModeContext; } });
39
+ Object.defineProperty(exports, "EditorModeProvider", { enumerable: true, get: function () { return EditorModeContext_1.EditorModeProvider; } });
40
+ Object.defineProperty(exports, "useEditorMode", { enumerable: true, get: function () { return EditorModeContext_1.useEditorMode; } });
15
41
  // Alias for backwards compatibility
16
- export { RichTextEditor as AIEditor } from './components/RichTextEditor';
42
+ var RichTextEditor_2 = require("./components/RichTextEditor");
43
+ Object.defineProperty(exports, "AIEditor", { enumerable: true, get: function () { return RichTextEditor_2.RichTextEditor; } });