kopia lustrzana https://github.com/wagtail/wagtail
Clean up Draftail image enitity definition, use the same attrs as Hallo
rodzic
bafc042364
commit
e5856c6f34
|
@ -10,10 +10,10 @@ class ImageSource extends ModalSource {
|
|||
|
||||
parseData(imageData) {
|
||||
this.onConfirmAtomicBlock({
|
||||
src: imageData.preview.url,
|
||||
altText: imageData.alt,
|
||||
id: imageData.id,
|
||||
alignment: imageData.format,
|
||||
src: imageData.preview.url,
|
||||
alt: imageData.alt,
|
||||
format: imageData.format,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ class TestHtmlToContentState(TestCase):
|
|||
],
|
||||
'entityMap': {
|
||||
'0': {
|
||||
'data': {'alignment': 'left', 'altText': 'an image', 'id': '1', 'src': '/media/not-found'},
|
||||
'data': {'format': 'left', 'alt': 'an image', 'id': '1', 'src': '/media/not-found'},
|
||||
'mutability': 'IMMUTABLE', 'type': 'IMAGE'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,9 +81,9 @@ def image_entity(props):
|
|||
"""
|
||||
return DOM.create_element('embed', {
|
||||
'embedtype': 'image',
|
||||
'format': props.get('alignment'),
|
||||
'format': props.get('format'),
|
||||
'id': props.get('id'),
|
||||
'alt': props.get('altText'),
|
||||
'alt': props.get('alt'),
|
||||
})
|
||||
|
||||
|
||||
|
@ -123,8 +123,10 @@ class ImageElementHandler(AtomicBlockEntityElementHandler):
|
|||
src = ''
|
||||
|
||||
return Entity('IMAGE', 'IMMUTABLE', {
|
||||
'id': attrs['id'],
|
||||
'src': src,
|
||||
'altText': attrs.get('alt'), 'id': attrs['id'], 'alignment': attrs['format']
|
||||
'alt': attrs.get('alt'),
|
||||
'format': attrs['format']
|
||||
})
|
||||
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue