Unverified Commit e169a237 authored by lauriii's avatar lauriii
Browse files

Issue #3275237 by hooroomoo, lauriii, Wim Leers, nod_: Don't convert, instead...

Issue #3275237 by hooroomoo, lauriii, Wim Leers, nod_: Don't convert, instead use response.entity_type in DrupalImageUploadEditing
parent b077d55c
......@@ -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,
);
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment