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.
- package/docs/examples/richtext_form/richtext_form_example.min.js +2 -1
- package/docs/examples/superhero_studio/README.md +5 -7
- package/docs/examples/superhero_studio/superhero_studio_example.min.js +3 -2
- package/example_applications/superhero_studio/SuperheroStudio-Example-Application.js +28 -9
- package/package.json +1 -1
- package/source/providers/inputs/Pict-Provider-Input-RichText.js +21 -0
|
@@ -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
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
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.
|
|
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
|
|