@elementor/editor-components 4.3.0-1039 → 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 -34
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +15 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +23 -23
- package/src/utils/component-document-data.ts +25 -8
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");
|
|
@@ -2726,13 +2733,13 @@ function reconcileComponentInstanceElements(elements, overrides = {}) {
|
|
|
2726
2733
|
}
|
|
2727
2734
|
|
|
2728
2735
|
// src/utils/switch-to-component.ts
|
|
2729
|
-
var
|
|
2736
|
+
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
2730
2737
|
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2731
|
-
var
|
|
2738
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
2732
2739
|
async function switchToComponent(componentId, componentInstanceId, element) {
|
|
2733
2740
|
const selector = getSelector(element, componentInstanceId);
|
|
2734
|
-
(0,
|
|
2735
|
-
await (0,
|
|
2741
|
+
(0, import_editor_documents2.invalidateDocumentData)(componentId);
|
|
2742
|
+
await (0, import_editor_documents2.switchToDocument)(componentId, {
|
|
2736
2743
|
selector,
|
|
2737
2744
|
mode: "autosave",
|
|
2738
2745
|
setAsInitial: false,
|
|
@@ -2747,7 +2754,7 @@ async function switchToComponent(componentId, componentInstanceId, element) {
|
|
|
2747
2754
|
}
|
|
2748
2755
|
}
|
|
2749
2756
|
async function expandNavigator() {
|
|
2750
|
-
await (0,
|
|
2757
|
+
await (0, import_editor_v1_adapters4.__privateRunCommand)("navigator/expand-all");
|
|
2751
2758
|
}
|
|
2752
2759
|
function getSelector(element, componentInstanceId) {
|
|
2753
2760
|
if (element) {
|
|
@@ -2858,7 +2865,7 @@ function createComponentView(options) {
|
|
|
2858
2865
|
eventsManagerConfig = legacyWindow.elementorCommon.eventsManager.config;
|
|
2859
2866
|
#componentRenderContext;
|
|
2860
2867
|
isComponentCurrentlyEdited() {
|
|
2861
|
-
const currentDocument = (0,
|
|
2868
|
+
const currentDocument = (0, import_editor_documents3.getCurrentDocument)();
|
|
2862
2869
|
return currentDocument?.id === this.getComponentId();
|
|
2863
2870
|
}
|
|
2864
2871
|
getRenderContext() {
|
|
@@ -3134,7 +3141,7 @@ function PopulateStore() {
|
|
|
3134
3141
|
// src/prevent-circular-nesting.ts
|
|
3135
3142
|
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
3136
3143
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
3137
|
-
var
|
|
3144
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
3138
3145
|
var import_store26 = require("@elementor/store");
|
|
3139
3146
|
var import_i18n14 = require("@wordpress/i18n");
|
|
3140
3147
|
var COMPONENT_TYPE = "e-component";
|
|
@@ -3144,15 +3151,15 @@ var COMPONENT_CIRCULAR_NESTING_ALERT = {
|
|
|
3144
3151
|
id: "circular-component-nesting-blocked"
|
|
3145
3152
|
};
|
|
3146
3153
|
function initCircularNestingPrevention() {
|
|
3147
|
-
(0,
|
|
3154
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
3148
3155
|
command: "document/elements/create",
|
|
3149
3156
|
condition: blockCircularCreate
|
|
3150
3157
|
});
|
|
3151
|
-
(0,
|
|
3158
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
3152
3159
|
command: "document/elements/move",
|
|
3153
3160
|
condition: blockCircularMove
|
|
3154
3161
|
});
|
|
3155
|
-
(0,
|
|
3162
|
+
(0, import_editor_v1_adapters5.blockCommand)({
|
|
3156
3163
|
command: "document/elements/paste",
|
|
3157
3164
|
condition: blockCircularPaste
|
|
3158
3165
|
});
|
|
@@ -3264,7 +3271,7 @@ function removeComponentStyles(id) {
|
|
|
3264
3271
|
}
|
|
3265
3272
|
|
|
3266
3273
|
// src/sync/publish-draft-components-in-page-before-save.ts
|
|
3267
|
-
var
|
|
3274
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
3268
3275
|
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
3269
3276
|
var import_http_client2 = require("@elementor/http-client");
|
|
3270
3277
|
var import_i18n15 = require("@wordpress/i18n");
|
|
@@ -3276,7 +3283,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
3276
3283
|
return;
|
|
3277
3284
|
}
|
|
3278
3285
|
const documents = await getComponentDocuments({ elements });
|
|
3279
|
-
const draftIds = [...documents.values()].filter(
|
|
3286
|
+
const draftIds = [...documents.values()].filter(import_editor_documents4.isDocumentDirty).map((document2) => document2.id);
|
|
3280
3287
|
if (draftIds.length === 0) {
|
|
3281
3288
|
return;
|
|
3282
3289
|
}
|
|
@@ -3289,7 +3296,7 @@ async function publishDraftComponentsInPageBeforeSave({ status, elements }) {
|
|
|
3289
3296
|
}
|
|
3290
3297
|
throw error;
|
|
3291
3298
|
}
|
|
3292
|
-
draftIds.forEach((id) => (0,
|
|
3299
|
+
draftIds.forEach((id) => (0, import_editor_documents4.invalidateDocumentData)(id));
|
|
3293
3300
|
}
|
|
3294
3301
|
function isInsufficientPermissionsError(error) {
|
|
3295
3302
|
return error instanceof import_http_client2.AxiosError && error.response?.data?.code === INSUFFICIENT_PERMISSIONS_ERROR_CODE;
|
|
@@ -3322,12 +3329,12 @@ var beforeSave = ({ container, status }) => {
|
|
|
3322
3329
|
};
|
|
3323
3330
|
|
|
3324
3331
|
// src/sync/load-component-data-after-instance-added.ts
|
|
3325
|
-
var
|
|
3332
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
3326
3333
|
function initLoadComponentDataAfterInstanceAdded() {
|
|
3327
|
-
(0,
|
|
3334
|
+
(0, import_editor_v1_adapters6.registerDataHook)("after", "document/elements/paste", (_args, result) => {
|
|
3328
3335
|
load(result);
|
|
3329
3336
|
});
|
|
3330
|
-
(0,
|
|
3337
|
+
(0, import_editor_v1_adapters6.registerDataHook)("after", "document/elements/import", (_args, result) => {
|
|
3331
3338
|
load(result);
|
|
3332
3339
|
});
|
|
3333
3340
|
}
|
|
@@ -3362,8 +3369,8 @@ function init() {
|
|
|
3362
3369
|
id: "components-populate-store",
|
|
3363
3370
|
component: PopulateStore
|
|
3364
3371
|
});
|
|
3365
|
-
(0,
|
|
3366
|
-
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)() ?? {};
|
|
3367
3374
|
if (!id) {
|
|
3368
3375
|
return;
|
|
3369
3376
|
}
|