| 1 |
(function(){(function(){"use strict";var e=wpApiSettings.root+`elementor/v1/design-system-sync/stylesheet`,t=`elementor-design-system-sync-css`,n=500,r;function syncDesignSystem(){fetch(e,{method:`POST`,headers:{"X-WP-Nonce":wpApiSettings.nonce}}).then(function(e){if(e.ok&&e.status!==204)return e.json()}).then(function(e){e&&(refreshGlobals(),reloadCanvasDesignSyncStyles(e))})}function refreshGlobals(){var e=$e.components.get(`globals`);e==null||e.refreshGlobalData(),e==null||e.populateGlobalData()}function reloadCanvasDesignSyncStyles(e){var n=e.url,r=document.getElementById(`elementor-preview-iframe`);if(r!=null&&r.contentDocument){var i=r.contentDocument.getElementById(t);i||(i=r.contentDocument.createElement(`link`),i.id=t,i.rel=`stylesheet`,r.contentDocument.head.appendChild(i)),i.href=n}}function onClassesUpdated(e){e.detail.context===`frontend`&&(clearTimeout(r),r=setTimeout(syncDesignSystem,n))}window.addEventListener(`classes:updated`,onClassesUpdated),window.addEventListener(`variables:updated`,function(){clearTimeout(r),r=setTimeout(syncDesignSystem,n)})})()})(); |