From 867816209093a5aaf649a72119de1293d6d61d2c Mon Sep 17 00:00:00 2001 From: Sebastian Date: Fri, 7 Aug 2020 16:46:49 +0200 Subject: [PATCH] Simplified preview images. --- .../content/shared/list/content-list-cell.directive.ts | 2 ++ .../content/shared/list/content-value.component.scss | 6 +----- .../content/shared/references/reference-item.component.html | 2 +- frontend/app/shared/state/contents.forms.spec.ts | 6 +++--- frontend/app/shared/state/contents.forms.visitors.ts | 6 +++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/frontend/app/features/content/shared/list/content-list-cell.directive.ts b/frontend/app/features/content/shared/list/content-list-cell.directive.ts index c3cb45572..9fa0a1b4b 100644 --- a/frontend/app/features/content/shared/list/content-list-cell.directive.ts +++ b/frontend/app/features/content/shared/list/content-list-cell.directive.ts @@ -86,5 +86,7 @@ export class ContentListCellDirective implements OnChanges { this.renderer.setStyle(this.element.nativeElement, 'max-width', width); this.renderer.setStyle(this.element.nativeElement, 'width', width); } + + this.renderer.setStyle(this.element.nativeElement, 'position', 'relative'); } } \ No newline at end of file diff --git a/frontend/app/features/content/shared/list/content-value.component.scss b/frontend/app/features/content/shared/list/content-value.component.scss index 9c4c63504..3de8b1711 100644 --- a/frontend/app/features/content/shared/list/content-value.component.scss +++ b/frontend/app/features/content/shared/list/content-value.component.scss @@ -1,13 +1,9 @@ -:host { - position: relative; -} - :host ::ng-deep { img { max-height: 50px; min-height: 50px; position: absolute; - top: -15px; + top: 5px; } img + span { diff --git a/frontend/app/features/content/shared/references/reference-item.component.html b/frontend/app/features/content/shared/references/reference-item.component.html index 845e47abe..d38200658 100644 --- a/frontend/app/features/content/shared/references/reference-item.component.html +++ b/frontend/app/features/content/shared/references/reference-item.component.html @@ -3,7 +3,7 @@ - + diff --git a/frontend/app/shared/state/contents.forms.spec.ts b/frontend/app/shared/state/contents.forms.spec.ts index 70e53ffa1..863e41e11 100644 --- a/frontend/app/shared/state/contents.forms.spec.ts +++ b/frontend/app/shared/state/contents.forms.spec.ts @@ -422,7 +422,7 @@ describe('StringField', () => { it('should format to preview image', () => { const field2 = createField({ properties: createProperties('String', { editor: 'StockPhoto' }) }); - expect(FieldFormatter.format(field2, 'https://images.unsplash.com/123?x', true)).toEqual(new HtmlValue('  ')); + expect(FieldFormatter.format(field2, 'https://images.unsplash.com/123?x', true)).toEqual(new HtmlValue('')); }); it('should not format to preview image when html not allowed', () => { @@ -463,7 +463,7 @@ describe('GetContentValue', () => { const result = getContentValue(content, language, assetWithImageAndFileName); - expect(result).toEqual({ value: ['url/to/13', 'file13'], formatted: new HtmlValue(' file13  ') }); + expect(result).toEqual({ value: ['url/to/13', 'file13'], formatted: new HtmlValue(' file13') }); }); it('should resolve image url only from referenced asset', () => { @@ -479,7 +479,7 @@ describe('GetContentValue', () => { const result = getContentValue(content, language, assetWithImage); - expect(result).toEqual({ value: ['url/to/13', 'file13'], formatted: new HtmlValue('  ') }); + expect(result).toEqual({ value: ['url/to/13', 'file13'], formatted: new HtmlValue('') }); }); it('should resolve filename only from referenced asset', () => { diff --git a/frontend/app/shared/state/contents.forms.visitors.ts b/frontend/app/shared/state/contents.forms.visitors.ts index 86beca463..2eacffc6f 100644 --- a/frontend/app/shared/state/contents.forms.visitors.ts +++ b/frontend/app/shared/state/contents.forms.visitors.ts @@ -55,9 +55,9 @@ export function getContentValue(content: ContentDto, language: LanguageDto, fiel const previewMode = field.properties['previewMode']; if (previewMode === 'ImageAndFileName') { - formatted = new HtmlValue(` ${value[1]}  `); + formatted = new HtmlValue(` ${value[1]}`); } else if (previewMode === 'Image') { - formatted = new HtmlValue(`  `); + formatted = new HtmlValue(``); } else { formatted = value[1]; } @@ -181,7 +181,7 @@ export class FieldFormatter implements FieldPropertiesVisitor { const src = thumbnail(this.value, undefined, 50); if (src) { - return new HtmlValue(`  `); + return new HtmlValue(``); } }