kopia lustrzana https://github.com/wagtail/wagtail
Add default values for document decorator rendering
rodzic
239365705c
commit
e72cb44d03
|
@ -9,14 +9,14 @@ const documentIcon = <Icon name="doc-full" />;
|
|||
|
||||
const Document = props => {
|
||||
const { entityKey, contentState } = props;
|
||||
const { url, filename } = contentState.getEntity(entityKey).getData();
|
||||
const data = contentState.getEntity(entityKey).getData();
|
||||
|
||||
return (
|
||||
<TooltipEntity
|
||||
{...props}
|
||||
icon={documentIcon}
|
||||
label={filename}
|
||||
url={url}
|
||||
label={data.filename || ''}
|
||||
url={data.url || ''}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -12,6 +12,7 @@ describe('Document', () => {
|
|||
type: 'DOCUMENT',
|
||||
data: {
|
||||
url: '/example.pdf',
|
||||
filename: 'example.pdf',
|
||||
},
|
||||
}
|
||||
},
|
||||
|
|
Ładowanie…
Reference in New Issue