From 02ec031ca07108e86941031d93c38d7aa5a89c0a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Ku=CC=88hn?= Date: Thu, 26 Aug 2021 18:15:31 +0200 Subject: [PATCH] add loader to demos --- docs/src/TiptapDemo.js | 57 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 56 insertions(+), 1 deletion(-) diff --git a/docs/src/TiptapDemo.js b/docs/src/TiptapDemo.js index e4a58eb8..7bdee884 100644 --- a/docs/src/TiptapDemo.js +++ b/docs/src/TiptapDemo.js @@ -7,7 +7,7 @@ if (typeof window === 'object' && !window.process) { connectedCallback() { const wrapper = document.createElement('div') const iframe = document.createElement('iframe') - const shadow = this.attachShadow({ mode: 'open' }) + const shadow = this.attachShadow({ mode: 'closed' }) const name = this.getAttribute('name') const inline = this.getAttribute('inline') === '' const hideSource = this.getAttribute('hideSource') === '' @@ -17,10 +17,65 @@ if (typeof window === 'object' && !window.process) { iframe.height = '0' iframe.frameBorder = '0' + wrapper.innerHTML = ` + + + + + + ` + shadow.appendChild(wrapper) iframe.addEventListener('load', () => { iframeResize({}, iframe) + wrapper.classList.add('has-loaded') }, { once: true }) const observer = new IntersectionObserver(([entry]) => {