Issue #3275237 by hooroomoo, lauriii, Wim Leers, nod_: Don't convert, instead use response.entity_type in DrupalImageUploadEditing
parent
ce0ec61fdf
commit
b51ab0dafc
File diff suppressed because one or more lines are too long
|
@ -5,11 +5,6 @@
|
|||
* Upload adapter.
|
||||
*
|
||||
* Copied from @ckeditor5/ckeditor5-upload/src/adapters/simpleuploadadapter
|
||||
* Adds a mapping from `response.uuid` to `dataEntityUuid` and
|
||||
* `response.entity_type` to `dataEntityType` for the callback after the file
|
||||
* upload in the `_initListeners` method.
|
||||
*
|
||||
* @todo use response.entity_type directly instead of converting it https://www.drupal.org/project/drupal/issues/3275237
|
||||
*
|
||||
* @private
|
||||
* @implements module:upload/filerepository~UploadAdapter
|
||||
|
@ -110,10 +105,11 @@ export default class DrupalImageUploadAdapter {
|
|||
: genericErrorText,
|
||||
);
|
||||
}
|
||||
// Resolve with the `urls` property and pass the response
|
||||
// to allow customizing the behavior of features relying on the upload adapters.
|
||||
resolve({
|
||||
response,
|
||||
urls: { default: response.url },
|
||||
dataEntityUuid: response.uuid ? response.uuid : '',
|
||||
dataEntityType: response.entity_type ? response.entity_type : '',
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -15,14 +15,10 @@ export default class DrupalImageUploadEditing extends Plugin {
|
|||
const imageUploadEditing = editor.plugins.get('ImageUploadEditing');
|
||||
imageUploadEditing.on('uploadComplete', (evt, { data, imageElement }) => {
|
||||
editor.model.change((writer) => {
|
||||
writer.setAttribute(
|
||||
'dataEntityUuid',
|
||||
data.dataEntityUuid,
|
||||
imageElement,
|
||||
);
|
||||
writer.setAttribute('dataEntityUuid', data.response.uuid, imageElement);
|
||||
writer.setAttribute(
|
||||
'dataEntityType',
|
||||
data.dataEntityType,
|
||||
data.response.entity_type,
|
||||
imageElement,
|
||||
);
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue