Merge branch 'master' of ssh://github.com/bd-js/wcui
commit
12dd847e1e
|
@ -192,7 +192,7 @@ class Sandbox extends Component {
|
||||||
contentLoaded(ev) {
|
contentLoaded(ev) {
|
||||||
let elem = ev.target
|
let elem = ev.target
|
||||||
let body = elem.contentDocument.body
|
let body = elem.contentDocument.body
|
||||||
elem.style.height = body.clientHeight + 'px'
|
elem.style.height = body.scrollHeight + 10 + 'px'
|
||||||
}
|
}
|
||||||
|
|
||||||
renderTemplate() {
|
renderTemplate() {
|
||||||
|
@ -207,9 +207,17 @@ class Sandbox extends Component {
|
||||||
|
|
||||||
mounted() {
|
mounted() {
|
||||||
//
|
//
|
||||||
this.#cache.preview.panel = this.$refs.preview
|
let target = this.$refs.preview
|
||||||
|
this.#cache.preview.panel = target
|
||||||
this.renderTemplate()
|
this.renderTemplate()
|
||||||
this.$refs.preview.style.display = 'block'
|
target.style.display = 'block'
|
||||||
|
|
||||||
|
this.__observer = new ResizeObserver(_ => this.contentLoaded({ target }))
|
||||||
|
this.__observer.observe(target.contentDocument.body)
|
||||||
|
}
|
||||||
|
|
||||||
|
unmounted() {
|
||||||
|
this.__observer?.disconnect()
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
|
Loading…
Reference in New Issue