@elementor/editor-components 4.3.0-1038 → 4.3.0-1040
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +41 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/utils/component-document-data.ts +25 -8
- package/src/utils/reconcile-component-instance-elements.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -91,11 +91,11 @@ module.exports = __toCommonJS(index_exports);
|
|
|
91
91
|
// src/init.ts
|
|
92
92
|
var import_editor = require("@elementor/editor");
|
|
93
93
|
var import_editor_canvas6 = require("@elementor/editor-canvas");
|
|
94
|
-
var
|
|
94
|
+
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
95
95
|
var import_editor_editing_panel7 = require("@elementor/editor-editing-panel");
|
|
96
96
|
var import_editor_elements_panel = require("@elementor/editor-elements-panel");
|
|
97
97
|
var import_editor_embedded_documents_manager2 = require("@elementor/editor-embedded-documents-manager");
|
|
98
|
-
var
|
|
98
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
99
99
|
var import_store28 = require("@elementor/store");
|
|
100
100
|
var import_i18n16 = require("@wordpress/i18n");
|
|
101
101
|
|
|
@@ -417,14 +417,21 @@ var useIsSanitizedComponent = (componentId, key) => {
|
|
|
417
417
|
};
|
|
418
418
|
|
|
419
419
|
// src/utils/component-document-data.ts
|
|
420
|
-
var
|
|
421
|
-
var
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
420
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
421
|
+
var getComponentDocumentParams = (id) => ({
|
|
422
|
+
action: "get_document_config",
|
|
423
|
+
unique_id: `document-${id}`,
|
|
424
|
+
data: { id }
|
|
425
|
+
});
|
|
426
|
+
var pendingRequests = /* @__PURE__ */ new Map();
|
|
427
|
+
var getComponentDocumentData = (id) => {
|
|
428
|
+
const pendingRequest = pendingRequests.get(id);
|
|
429
|
+
if (pendingRequest) {
|
|
430
|
+
return pendingRequest;
|
|
431
|
+
}
|
|
432
|
+
const request = import_editor_v1_adapters2.ajax.load(getComponentDocumentParams(id)).catch(() => null).finally(() => pendingRequests.delete(id));
|
|
433
|
+
pendingRequests.set(id, request);
|
|
434
|
+
return request;
|
|
428
435
|
};
|
|
429
436
|
|
|
430
437
|
// src/component-instance-transformer.ts
|
|
@@ -1126,7 +1133,7 @@ var import_i18n10 = require("@wordpress/i18n");
|
|
|
1126
1133
|
// src/utils/detach-component-instance/detach-component-instance.ts
|
|
1127
1134
|
var import_editor_canvas4 = require("@elementor/editor-canvas");
|
|
1128
1135
|
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
1129
|
-
var
|
|
1136
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
1130
1137
|
var import_store10 = require("@elementor/store");
|
|
1131
1138
|
var import_i18n9 = require("@wordpress/i18n");
|
|
1132
1139
|
|
|
@@ -1406,7 +1413,7 @@ async function detachComponentInstance({
|
|
|
1406
1413
|
if (!rootElement) {
|
|
1407
1414
|
throw new Error(`Component with ID "${componentId}" has no root element.`);
|
|
1408
1415
|
}
|
|
1409
|
-
const undoableDetach = (0,
|
|
1416
|
+
const undoableDetach = (0, import_editor_v1_adapters3.undoable)(
|
|
1410
1417
|
{
|
|
1411
1418
|
do: () => {
|
|
1412
1419
|
const overrides = extractInstanceOverrides(instanceContainer);
|
|
@@ -2548,7 +2555,7 @@ var import_react10 = require("react");
|
|
|
2548
2555
|
var import_editor_templates = require("@elementor/editor-templates");
|
|
2549
2556
|
|
|
2550
2557
|
// src/store/actions/load-components-assets.ts
|
|
2551
|
-
var
|
|
2558
|
+
var import_editor_documents = require("@elementor/editor-documents");
|
|
2552
2559
|
var import_editor_embedded_documents_manager = require("@elementor/editor-embedded-documents-manager");
|
|
2553
2560
|
|
|
2554
2561
|
// src/utils/get-component-documents.ts
|
|
@@ -2624,9 +2631,9 @@ async function loadComponentsAssets(elements) {
|
|
|
2624
2631
|
await loadComponentsOverridableProps([...documents.keys()]);
|
|
2625
2632
|
}
|
|
2626
2633
|
function updateDocumentState(documents) {
|
|
2627
|
-
const isDrafted = [...documents.values()].some(
|
|
2634
|
+
const isDrafted = [...documents.values()].some(import_editor_documents.isDocumentDirty);
|
|
2628
2635
|
if (isDrafted) {
|
|
2629
|
-
(0,
|
|
2636
|
+
(0, import_editor_documents.setDocumentModifiedStatus)(true);
|
|
2630
2637
|
}
|
|
2631
2638
|
}
|
|
2632
2639
|
|
|
@@ -2647,7 +2654,7 @@ function LoadTemplateComponentsInternal() {
|
|
|
2647
2654
|
|
|
2648
2655
|
// src/create-component-type.ts
|
|
2649
2656
|
var import_editor_canvas5 = require("@elementor/editor-canvas");
|
|
2650
|
-
var
|
|
2657
|
+
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
2651
2658
|
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
2652
2659
|
var import_store23 = require("@elementor/store");
|
|
2653
2660
|
var import_utils6 = require("@elementor/utils");
|
|
@@ -2717,7 +2724,6 @@ function reconcileElementTree(element, overridesMapping) {
|
|
|
2717
2724
|
).map((child) => reconcileElementTree(child, overridesMapping));
|
|
2718
2725
|
return {
|
|
2719
2726
|
...element,
|
|
2720
|
-
settings: effectiveSettings,
|
|
2721
2727
|
elements: reconciledChildren
|
|
2722
2728
|
};
|
|
2723
2729
|
}
|
|
@@ -2727,13 +2733,13 @@ function reconcileComponentInstanceElements(elements, overrides = {}) {
|
|
|
2727
2733
|
}
|
|
2728
2734
|
|
|
2729
2735
|
// src/utils/switch-to-component.ts
|
|
2730
|
-
var
|
|
2736
|
+
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
2731
2737
|
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2732
|
-
var
|
|
2738
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2733
2739
|
async function switchToComponent(componentId, componentInstanceId, element) {
|
|
2734
2740
|
const selector = getSelector(element, componentInstanceId);
|
|
2735
|
-
(0,
|
|
2736
|
-
await (0,
|
|
2741
|
+
(0, import_editor_documents2.invalidateDocumentData)(componentId);
|
|
2742
|
+
await (0, import_editor_documents2.switchToDocument)(componentId, {
|
|
2737
2743
|
selector,
|
|
2738
2744
|
mode: "autosave",
|
|
2739
2745
|
setAsInitial: false,
|
|
@@ -2748,7 +2754,7 @@ async function switchToComponent(componentId, componentInstanceId, element) {
|
|
|
2748
2754
|
}
|
|
2749
2755
|
}
|
|
2750
2756
|
async function expandNavigator() {
|
|
2751
|
-
await (0,
|
|
2757
|
+
await (0, import_editor_v1_adapters4.__privateRunCommand)("navigator/expand-all");
|
|
2752
2758
|
}
|
|
2753
2759
|
function getSelector(element, componentInstanceId) {
|
|
2754
2760
|
if (element) {
|
|
@@ -2859,7 +2865,7 @@ function createComponentView(options) {
|
|
|
2859
2865
|
eventsManagerConfig = legacyWindow.elementorCommon.eventsManager.config;
|
|
2860
2866
|
#componentRenderContext;
|
|
2861
2867
|
isComponentCurrentlyEdited() {
|
|
2862
|
-
const currentDocument = (0,
|
|
2868
|
+
const currentDocument = (0, import_editor_documents3.getCurrentDocument)();
|
|
2863
2869
|
return currentDocument?.id === this.getComponentId();
|
|
2864
2870
|
}
|
|
2865
2871
|
getRenderContext() {
|
|
@@ -3135,7 +3141,7 @@ function PopulateStore() {
|
|
|
3135
3141
|
// src/prevent-circular-nesting.ts
|
|
3136
3142
|
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
3137
3143
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
3138
|
-
var
|
|
3144
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3139
3145
|
var import_store26 = require("@elementor/store");
|
|
3140
3146
|
var import_i18n14 = require("@wordpress/i18n");
|
|
3141
3147
|
var COMPONENT_TYPE = "e-component";
|
|
@@ -3145,15 +3151,15 @@ var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
|
3145
3151
|
id: "circular-component-nesting-blocked"
|
|
3146
3152
|
};
|
|
3147
3153
|
function initCircularNestingPrevention() {
|
|
3148
|
-
(0,
|
|
3154
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
3149
3155
|
command: "document/elements/create",
|
|
3150
3156
|
condition: blockCircularCreate
|
|
3151
3157
|
});
|
|
3152
|
-
(0,
|
|
3158
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
3153
3159
|
command: "document/elements/move",
|
|
3154
3160
|
condition: blockCircularMove
|
|
3155
3161
|
});
|
|
3156
|
-
(0,
|
|
3162
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
3157
3163
|
command: "document/elements/paste",
|
|
3158
3164
|
condition: blockCircularPaste
|
|
3159
3165
|
});
|
|
@@ -3265,7 +3271,7 @@ function removeComponentStyles(id) {
|
|
|
3265
3271
|
}
|
|
3266
3272
|
|
|
3267
3273
|
// src/sync/publish-draft-components-in-page-before-save.ts
|
|
3268
|
-
var
|
|
3274
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
3269
3275
|
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
3270
3276
|
var import_http_client2 = require("@elementor/http-client");
|
|
3271
3277
|
var import_i18n15 = require("@wordpress/i18n");
|
|
@@ -3277,7 +3283,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
3277
3283
|
return;
|
|
3278
3284
|
}
|
|
3279
3285
|
const documents = await getComponentDocuments({ elements });
|
|
3280
|
-
const draftIds = [...documents.values()].filter(
|
|
3286
|
+
const draftIds = [...documents.values()].filter(import_editor_documents4.isDocumentDirty).map((document2) => document2.id);
|
|
3281
3287
|
if (draftIds.length === 0) {
|
|
3282
3288
|
return;
|
|
3283
3289
|
}
|
|
@@ -3290,7 +3296,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
3290
3296
|
}
|
|
3291
3297
|
throw error;
|
|
3292
3298
|
}
|
|
3293
|
-
draftIds.forEach((id) => (0,
|
|
3299
|
+
draftIds.forEach((id) => (0, import_editor_documents4.invalidateDocumentData)(id));
|
|
3294
3300
|
}
|
|
3295
3301
|
function isInsufficientPermissionsError(error) {
|
|
3296
3302
|
return error instanceof import_http_client2.AxiosError && error.response?.data?.code === INSUFFICIENT_PERMISSIONS_ERROR_CODE;
|
|
@@ -3323,12 +3329,12 @@ var beforeSave = ({ container, status }) => {
|
|
|
3323
3329
|
};
|
|
3324
3330
|
|
|
3325
3331
|
// src/sync/load-component-data-after-instance-added.ts
|
|
3326
|
-
var
|
|
3332
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3327
3333
|
function initLoadComponentDataAfterInstanceAdded() {
|
|
3328
|
-
(0,
|
|
3334
|
+
(0, import_editor_v1_adapters6.registerDataHook)("after", "document/elements/paste", (_args, result) => {
|
|
3329
3335
|
load(result);
|
|
3330
3336
|
});
|
|
3331
|
-
(0,
|
|
3337
|
+
(0, import_editor_v1_adapters6.registerDataHook)("after", "document/elements/import", (_args, result) => {
|
|
3332
3338
|
load(result);
|
|
3333
3339
|
});
|
|
3334
3340
|
}
|
|
@@ -3363,8 +3369,8 @@ function init() {
|
|
|
3363
3369
|
id: "components-populate-store",
|
|
3364
3370
|
component: PopulateStore
|
|
3365
3371
|
});
|
|
3366
|
-
(0,
|
|
3367
|
-
const { id, config } = (0,
|
|
3372
|
+
(0, import_editor_v1_adapters7.registerDataHook)("after", "editor/documents/attach-preview", () => {
|
|
3373
|
+
const { id, config } = (0, import_editor_documents5.getV1CurrentDocument)() ?? {};
|
|
3368
3374
|
if (!id) {
|
|
3369
3375
|
return;
|
|
3370
3376
|
}
|