Sha256: 8a617c7b60a91f7d709b2d1c45456009f67b298e4785474d7ceda4b36c6153fe
Contents?: true
Size: 1019 Bytes
Versions: 15
Compression:
Stored size: 1019 Bytes
Contents
import "iframe-resizer/js/iframeResizer"; export default function embedInspectorComponent(id, embedStore) { if (!embedStore[id]) { embedStore[id] = { width: "100%", height: "100%" }; } return { iframe: null, viewportHeight: 0, targetPath: window.location.pathname, get viewportCssHeight() { return this.viewportHeight ? `${this.viewportHeight}px` : "100%"; }, get store() { return embedStore[id]; }, init() { const onResized = this.onResized.bind(this); this.iframe = this.$el.querySelector("iframe"); window.iFrameResize({ onResized, checkOrigin: false }, this.iframe); this.$watch("targetPath", (value) => this.switchTarget(value)); }, switchTarget(newTargetPath) { this.navigateTo(`${newTargetPath}${window.location.search}`); }, onResized({ height }) { if (height) { this.viewportHeight = height; } }, resizeIframe() { this.iframe.iFrameResizer.resize(); }, }; }
Version data entries
15 entries across 15 versions & 1 rubygems