Skip to content

Commit c520ddc

Browse files
committed
fix: optimise conditions added
1 parent 7b61a9c commit c520ddc

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/toRedactor.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -225,14 +225,10 @@ export const toRedactor = (jsonValue: any,options?:IJsonToHtmlOptions) : string
225225
}
226226
if (options?.allowedEmptyAttributes && !isEmpty(options.allowedEmptyAttributes)) {
227227
Object.keys(options.allowedEmptyAttributes).forEach(key => {
228-
if (key === 'img' || key === 'reference') {
229-
ALLOWED_EMPTY_ATTRIBUTES[key] = [
230-
...ALLOWED_EMPTY_ATTRIBUTES[key],
231-
...(options.allowedEmptyAttributes?.[key] || [])
232-
];
233-
} else {
234-
ALLOWED_EMPTY_ATTRIBUTES[key] = options.allowedEmptyAttributes?.[key] ?? [];
235-
}
228+
ALLOWED_EMPTY_ATTRIBUTES[key] = [
229+
...(ALLOWED_EMPTY_ATTRIBUTES[key] ?? []),
230+
...(options.allowedEmptyAttributes?.[key] || [])
231+
];
236232
});
237233
}
238234
if (jsonValue.hasOwnProperty('text')) {

0 commit comments

Comments
 (0)