Fix font size not being removed when pasting between fields
This commit is contained in:
parent
de4d69454a
commit
ea3b40e400
@ -16,14 +16,18 @@ function filterStyling(
|
||||
): (element: HTMLElement) => void {
|
||||
return (element: HTMLElement): void => {
|
||||
// jsdom does not support @@iterator, so manually iterate
|
||||
const toRemove = [] as string[];
|
||||
for (let i = 0; i < element.style.length; i++) {
|
||||
const key = element.style.item(i);
|
||||
const value = element.style.getPropertyValue(key);
|
||||
const predicate = exceptions[key] ?? defaultPredicate;
|
||||
if (!predicate(key, value)) {
|
||||
element.style.removeProperty(key);
|
||||
toRemove.push(key);
|
||||
}
|
||||
}
|
||||
for (const key of toRemove) {
|
||||
element.style.removeProperty(key);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user