You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| `contentTypeId` | String | The ID of the parent content type this will be used in. | yes | None |
123
+
| `dataStore` | DataStore | The DataStore that the selected image should be stored in. | yes | None |
124
+
| `initialValue` | Object[] | The value to be used for the initial state of the component. | yes | None |
125
+
| `onChangeCallback` | Function | A callback that will be called when an image is selected. | no | The image will be saved to the provided `dataStore` using `uploaderConfig.dataScope` as the key. |
126
+
| `onDeleteCallback` | Function | A callback that will be called when the current used image is deleted from storage. | no | The image will be removed from to the provided `dataStore` using `uploaderConfig.dataScope` as the key. |
127
+
128
+
The following is an example extracted from the image content type:
129
+
130
+
```js
131
+
var dataStore =this.parent.dataStore.get();
132
+
var initialImageValue = dataStore[this.config.additional_data.uploaderConfig.dataScope] ||"";
133
+
134
+
this.uploader=newUploader(
135
+
'imageuploader_'+this.parent.id,
136
+
this.config.additional_data.uploaderConfig,
137
+
this.parent.id,
138
+
this.parent.dataStore,
139
+
initialImageValue,
140
+
);
141
+
```
115
142
116
143
2. Add configuration for the uploader in the `<content-type-name>.xml` file to initialize the uploader.
117
144
@@ -141,3 +168,5 @@ Update the preview template file, `bluefoot/app/code/Magento/PageBuilder/view/ad
141
168
...
142
169
</div>
143
170
```
171
+
172
+
**Note:** When a file is deleted from the media browser, the `fileDeleted` event is triggered on the window with the `mediabrowser` namespace. The passed argument is an object containing the `ids` property, which is an array of ID strings for each of the deleted files. The IDs of the selected files are provided in the objects dispatched by the `addFile` and `processFile` methods inside the image uploader UI Component.
0 commit comments