PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-dev4
Elementor Website Builder – more than just a page builder v4.0.0-dev4
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
← All changes | assets/js/design-system-sync.js +66 -60 4.3.1 → 4.0.0-dev4 View file →
@@ -1,65 +1,71 @@
1 -(function() {
1 +/******/ (() => { // webpackBootstrap
2 +/******/ "use strict";
3 +/*!*****************************************************************************!*\
4 + !*** ../modules/design-system-sync/assets/js/design-system-sync-handler.js ***!
5 + \*****************************************************************************/
2 6
3 -//#region \0rolldown/runtime.js
4 - var __defProp = Object.defineProperty;
5 - var __name = (target, value) => __defProp(target, "name", {
6 - value,
7 - configurable: true
8 - });
9 7
10 -//#endregion
8 +(function () {
9 + 'use strict';
11 10
12 -//#region modules/design-system-sync/assets/js/design-system-sync-handler.js
13 - (function() {
14 - "use strict";
15 - var SYNC_ENDPOINT = wpApiSettings.root + "elementor/v1/design-system-sync/stylesheet";
16 - var SYNC_STYLESHEET_ID = "elementor-design-system-sync-css";
17 - var DEBOUNCE_MS = 500;
18 - var syncTimeout;
19 - function syncDesignSystem() {
20 - fetch(SYNC_ENDPOINT, {
21 - method: "POST",
22 - headers: { "X-WP-Nonce": wpApiSettings.nonce }
23 - }).then(function(response) {
24 - if (!response.ok) return;
25 - if (204 === response.status) return;
26 - return response.json();
27 - }).then(function(data) {
28 - if (!data) return;
29 - refreshGlobals();
30 - reloadCanvasDesignSyncStyles(data);
31 - });
32 - }
33 - function refreshGlobals() {
34 - var globals = $e.components.get("globals");
35 - globals === null || globals === void 0 || globals.refreshGlobalData();
36 - globals === null || globals === void 0 || globals.populateGlobalData();
37 - }
38 - function reloadCanvasDesignSyncStyles(_ref) {
39 - var url = _ref.url;
40 - var previewFrame = document.getElementById("elementor-preview-iframe");
41 - if (!(previewFrame !== null && previewFrame !== void 0 && previewFrame.contentDocument)) return;
42 - var link = previewFrame.contentDocument.getElementById(SYNC_STYLESHEET_ID);
43 - if (!link) {
44 - link = previewFrame.contentDocument.createElement("link");
45 - link.id = SYNC_STYLESHEET_ID;
46 - link.rel = "stylesheet";
47 - previewFrame.contentDocument.head.appendChild(link);
48 - }
49 - link.href = url;
50 - }
51 - function onClassesUpdated(event) {
52 - if (event.detail.context !== "frontend") return;
53 - clearTimeout(syncTimeout);
54 - syncTimeout = setTimeout(syncDesignSystem, DEBOUNCE_MS);
55 - }
56 - window.addEventListener("classes:updated", onClassesUpdated);
57 - window.addEventListener("variables:updated", function() {
58 - clearTimeout(syncTimeout);
59 - syncTimeout = setTimeout(syncDesignSystem, DEBOUNCE_MS);
60 - });
61 - })();
62 -
63 -//#endregion
11 + var SYNC_ENDPOINT = wpApiSettings.root + 'elementor/v1/design-system-sync/stylesheet';
12 + var SYNC_STYLESHEET_ID = 'elementor-design-system-sync-css';
13 + var DEBOUNCE_MS = 500;
14 + var syncTimeout;
15 + function syncDesignSystem() {
16 + fetch(SYNC_ENDPOINT, {
17 + method: 'POST',
18 + headers: {
19 + 'X-WP-Nonce': wpApiSettings.nonce
20 + }
21 + }).then(function (response) {
22 + if (!response.ok) {
23 + return;
24 + }
25 + return response.json();
26 + }).then(function (data) {
27 + if (!data) {
28 + return;
29 + }
30 + refreshGlobals();
31 + reloadCanvasDesignSyncStyles(data);
32 + });
33 + }
34 + function refreshGlobals() {
35 + var globals = $e.components.get('globals');
36 + globals === null || globals === void 0 || globals.refreshGlobalData();
37 + globals === null || globals === void 0 || globals.populateGlobalData();
38 + }
39 + function reloadCanvasDesignSyncStyles(_ref) {
40 + var url = _ref.url,
41 + version = _ref.version;
42 + var previewFrame = document.getElementById('elementor-preview-iframe');
43 + if (!(previewFrame !== null && previewFrame !== void 0 && previewFrame.contentDocument)) {
44 + return;
45 + }
46 + var link = previewFrame.contentDocument.getElementById(SYNC_STYLESHEET_ID);
47 + if (!link) {
48 + link = previewFrame.contentDocument.createElement('link');
49 + link.id = SYNC_STYLESHEET_ID;
50 + link.rel = 'stylesheet';
51 + previewFrame.contentDocument.head.appendChild(link);
52 + }
53 + link.href = url + '?ver=' + version;
54 + }
55 + function onClassesUpdated(event) {
56 + var context = event.detail.context;
57 + if (context !== 'frontend') {
58 + return;
59 + }
60 + clearTimeout(syncTimeout);
61 + syncTimeout = setTimeout(syncDesignSystem, DEBOUNCE_MS);
62 + }
63 + window.addEventListener('classes:updated', onClassesUpdated);
64 + window.addEventListener('variables:updated', function () {
65 + clearTimeout(syncTimeout);
66 + syncTimeout = setTimeout(syncDesignSystem, DEBOUNCE_MS);
67 + });
64 68 })();
69 +/******/ })()
70 +;
65 71 //# sourceMappingURL=design-system-sync.js.map