improve iframe maxheight scrolling

This commit is contained in:
Philipp Kühn
2021-02-02 22:20:16 +01:00
parent 3ce615326e
commit fb7c13e066
6 changed files with 21 additions and 9 deletions

View File

@@ -28,9 +28,20 @@ export default function (Vue, { head }) {
iframeResize({
...value,
messageCallback(messageData) {
if (messageData.message === 'resize') {
el.iFrameResizer.resize()
if (messageData.message.type !== 'resize') {
return
}
const style = window.getComputedStyle(el.parentElement)
const maxHeight = parseInt(style.getPropertyValue('max-height'), 10)
if (messageData.message.height > maxHeight) {
el.setAttribute('scrolling', 'auto')
} else {
el.setAttribute('scrolling', 'no')
}
el.iFrameResizer.resize()
},
}, el)
})