Apply preview styles from file page block to module field

This commit is contained in:
Katrin Yordanova
2023-03-30 15:32:17 +03:00
parent 6fbf36ec67
commit 1d67e906a3
4 changed files with 58 additions and 94 deletions
+15 -15
View File
@@ -22,12 +22,12 @@ interface FileOptions extends Options {
inline: boolean;
hideFileName: boolean;
mimetypes?: string;
height?: number;
width?: number;
maxHeight?: number;
maxWidth?: number;
borderRadius?: number;
margin?: number;
height?: string;
width?: string;
maxHeight?: string;
maxWidth?: string;
borderRadius?: string;
margin?: string;
backgroundColor?: string;
}
@@ -40,13 +40,13 @@ const defaults = (): Readonly<FileOptions> => Object.freeze({
inline: true,
hideFileName: false,
mimetypes: '',
height: undefined,
width: undefined,
maxHeight: undefined,
maxWidth: undefined,
borderRadius: undefined,
margin: undefined,
backgroundColor: undefined,
height: '',
width: '',
maxHeight: '',
maxWidth: '',
borderRadius: '',
margin: 'auto',
backgroundColor: '',
})
export class ModuleFieldFile extends ModuleField {
@@ -63,9 +63,9 @@ export class ModuleFieldFile extends ModuleField {
if (!o) return
super.applyOptions(o)
Apply(this.options, o, Number, 'maxSize', 'height', 'width', 'maxHeight', 'maxWidth', 'borderRadius', 'margin')
Apply(this.options, o, Number, 'maxSize')
Apply(this.options, o, Boolean, 'allowImages', 'allowDocuments', 'inline', 'hideFileName')
Apply(this.options, o, String, 'mimetypes', 'backgroundColor')
Apply(this.options, o, String, 'mimetypes', 'height', 'width', 'maxHeight', 'maxWidth', 'borderRadius', 'margin', 'backgroundColor')
ApplyWhitelisted(this.options, o, modes, 'mode')
}
}