pict-section-form 1.1.4 → 1.1.6

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.
@@ -148,17 +148,15 @@ The Origin Story field has `AllowImages: true` and names an uploader. When the u
148
148
  ```javascript
149
149
  uploadImage(pFile, pInputDescriptor, fCallback)
150
150
  {
151
- setTimeout(() =>
152
- {
153
- let tmpFakeURL = '/uploads/heroes/' + Date.now() + '-' +
154
- (pFile.name || 'image.png').replace(/[^A-Za-z0-9._-]/g, '_');
155
- fCallback(null, tmpFakeURL);
156
- }, 600);
151
+ let tmpReader = new FileReader();
152
+ tmpReader.onload = () => fCallback(null, tmpReader.result); // data:image/png;base64,…
153
+ tmpReader.onerror = () => fCallback(new Error('FileReader failed'));
154
+ tmpReader.readAsDataURL(pFile);
157
155
  return true; // we are handling this asynchronously
158
156
  }
159
157
  ```
160
158
 
161
- Returning `true` signals to the underlying `pict-section-markdowneditor` that the caller will resolve the URL. A real app would POST to its storage endpoint here. Set `AllowImages: false` to refuse images entirely; the editor surfaces the rejection in a status pill instead of inserting a half-baked data URI.
159
+ Returning `true` signals to the underlying `pict-section-markdowneditor` that the caller will resolve the URL. The demo's hook reads the file as a base64 data URI so the inserted image renders inline — a real app would POST to its storage endpoint and call back with the permanent URL instead. Set `AllowImages: false` to refuse images entirely; the editor surfaces the rejection in a status pill instead of inserting a half-baked data URI. If `AllowImages: true` but no `ImageUploader` is configured, the editor falls through to its built-in FileReader → base64 inline path (the exact same visible result, just driven by the editor's default rather than the host hook).
162
160
 
163
161
  ## The five superheroes
164
162