Improved message responsive resizing #678

This commit is contained in:
the-djmaze 2022-11-16 08:42:28 +01:00
parent 565c8b13fa
commit ee5fb1a83e

View file

@ -229,33 +229,28 @@ export const
// if ('TABLE' === name || 'TD' === name || 'TH' === name) {
if (!oStyle.backgroundImage) {
value = oStyle.width;
if (hasAttribute('width')) {
if (!value) {
if ('TD' !== name && 'TH' !== name) {
// Make width responsive
if (hasAttribute('width')) {
value = getAttribute('width');
value = value.includes('%') ? value : value + 'px';
if (1 < pInt(value)) {
oStyle.width = value;
}
oStyle.width = value.includes('%') ? value : value + 'px';
delAttribute('width');
}
delAttribute('width');
}
if (value && !value.includes('%')) {
oStyle.maxWidth = value;
if ('TD' !== name && 'TH' !== name) {
value = oStyle.removeProperty('width');
if (value) {
oStyle.maxWidth = value;
oStyle.width = '100%';
}
}
if (hasAttribute('height')) {
value = getAttribute('height');
if (pInt(value)) {
// Make height responsive
if (hasAttribute('height')) {
value = getAttribute('height');
oStyle.height = value.includes('%') ? value : value + 'px';
delAttribute('height');
}
value = oStyle.removeProperty('height');
if (value) {
oStyle.maxHeight = value;
}
delAttribute('height');
}
value = oStyle.removeProperty('height');
if (value && !value.includes('%')) {
oStyle.maxHeight = value;
}
}
// } else