@daneshnaik/rich-text-editor 1.0.3 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -111,6 +111,45 @@ export default MyEditorPage;
111
111
 
112
112
  If you're bundling the library for npm, include the `ExportButton` in your published module exports so consumers can import it directly from the package.
113
113
 
114
+ ### New: sizing & drag-and-drop support
115
+
116
+
117
+ The editor now accepts a few props to allow consuming apps to control the editor canvas size and to support drag-and-drop from the host application.
118
+
119
+ - `width` (string): set the page width (e.g. `800px` or `100%`).
120
+ - `height` (string): set the minimum page height (e.g. `1123px`).
121
+ - `fullBleed` (boolean, default: `true`): when `true`, removes the side gutters so the page sits edge-to-edge in its container. The editor now defaults to full-bleed so embedding apps receive the editor + toolbar only (no centered page gaps).
122
+ - `onComponentDrop` (function): optional callback called when something is dropped onto the editor. Receives `(info, event)` where `info` contains `{ html, text, files, types }`.
123
+
124
+ Example usage:
125
+
126
+ ```jsx
127
+ import React from 'react';
128
+ import RichTextEditor from '@daneshnaik/rich-text-editor';
129
+ import ExportButton from '@daneshnaik/rich-text-editor/ExportButton';
130
+ import '@daneshnaik/rich-text-editor/dist/style.css';
131
+
132
+ function MyEditorPage() {
133
+ const handleDrop = (info, ev) => {
134
+ // info.html / info.text / info.files available
135
+ console.log('dropped', info);
136
+ };
137
+
138
+ return (
139
+ <div style={{ width: '100%', height: '100vh' }}>
140
+ <RichTextEditor width="100%" height="900px" fullBleed={true} onComponentDrop={handleDrop} />
141
+ <ExportButton />
142
+ </div>
143
+ );
144
+ }
145
+
146
+ export default MyEditorPage;
147
+ ```
148
+
149
+ Notes:
150
+ - If the dropped data contains `text/html`, it will be inserted as HTML at the caret location. Plain text is inserted as text. Image files dropped will be read and inserted as data-URL images.
151
+ - The `fullBleed` mode keeps the editor from centering and removes left/right page gutters; you can also pass an exact `width` to control the page size.
152
+
114
153
  ## Requirements
115
154
 
116
155
  - React 18.0.0 or higher