@elementor/editor-canvas 4.0.0-535 → 4.0.0-537
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 +276 -98
- package/dist/index.mjs +203 -25
- package/package.json +18 -18
- package/src/form-structure/enforce-form-ancestor-commands.ts +100 -0
- package/src/form-structure/prevent-form-nesting-commands.ts +97 -0
- package/src/form-structure/utils.ts +87 -0
- package/src/init.tsx +4 -0
package/dist/index.js
CHANGED
|
@@ -964,7 +964,7 @@ function sortByStateType({ state: stateA }, { state: stateB }) {
|
|
|
964
964
|
function createProviderSubscriber2({ provider, renderStyles, setStyleItems }) {
|
|
965
965
|
return abortPreviousRuns(
|
|
966
966
|
(abortController) => signalizedProcess(abortController.signal).then((_, signal) => {
|
|
967
|
-
const styles = provider.actions.all().map((
|
|
967
|
+
const styles = provider.actions.all().map((__8, index, items) => {
|
|
968
968
|
const lastPosition = items.length - 1;
|
|
969
969
|
const style = items[lastPosition - index];
|
|
970
970
|
return {
|
|
@@ -1019,6 +1019,182 @@ function usePortalContainer2() {
|
|
|
1019
1019
|
return (0, import_editor_v1_adapters8.__privateUseListenTo)((0, import_editor_v1_adapters8.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters8.getCanvasIframeDocument)()?.head);
|
|
1020
1020
|
}
|
|
1021
1021
|
|
|
1022
|
+
// src/form-structure/enforce-form-ancestor-commands.ts
|
|
1023
|
+
var import_editor_notifications = require("@elementor/editor-notifications");
|
|
1024
|
+
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
1025
|
+
var import_i18n = require("@wordpress/i18n");
|
|
1026
|
+
|
|
1027
|
+
// src/form-structure/utils.ts
|
|
1028
|
+
var import_editor_elements3 = require("@elementor/editor-elements");
|
|
1029
|
+
var FORM_ELEMENT_TYPE = "e-form";
|
|
1030
|
+
var FORM_FIELD_ELEMENT_TYPES = /* @__PURE__ */ new Set(["e-form-input", "e-form-textarea", "e-form-label"]);
|
|
1031
|
+
function getArgsElementType(args) {
|
|
1032
|
+
return args.model?.widgetType || args.model?.elType;
|
|
1033
|
+
}
|
|
1034
|
+
function getElementType(element) {
|
|
1035
|
+
return element?.model.get("widgetType") || element?.model.get("elType");
|
|
1036
|
+
}
|
|
1037
|
+
function isElementWithinFormSelector(element) {
|
|
1038
|
+
return !!element?.view?.el?.closest('form,[data-element_type="e-form"]');
|
|
1039
|
+
}
|
|
1040
|
+
function isWithinForm(element) {
|
|
1041
|
+
return isElementWithinFormSelector(element);
|
|
1042
|
+
}
|
|
1043
|
+
function hasElementType(element, type) {
|
|
1044
|
+
return (0, import_editor_elements3.getAllDescendants)(element).some((item) => getElementType(item) === type);
|
|
1045
|
+
}
|
|
1046
|
+
function hasElementTypes(element, types) {
|
|
1047
|
+
return (0, import_editor_elements3.getAllDescendants)(element).some((item) => {
|
|
1048
|
+
const itemType = getElementType(item);
|
|
1049
|
+
return itemType ? types.has(itemType) : false;
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
function hasClipboardElementType(elements, type) {
|
|
1053
|
+
return elements.some((element) => {
|
|
1054
|
+
const elementType = element.widgetType || element.elType;
|
|
1055
|
+
if (elementType === type) {
|
|
1056
|
+
return true;
|
|
1057
|
+
}
|
|
1058
|
+
return element.elements ? hasClipboardElementType(element.elements, type) : false;
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
function hasClipboardElementTypes(elements, types) {
|
|
1062
|
+
return elements.some((element) => {
|
|
1063
|
+
const elementType = element.widgetType || element.elType;
|
|
1064
|
+
if (elementType && types.has(elementType)) {
|
|
1065
|
+
return true;
|
|
1066
|
+
}
|
|
1067
|
+
return element.elements ? hasClipboardElementTypes(element.elements, types) : false;
|
|
1068
|
+
});
|
|
1069
|
+
}
|
|
1070
|
+
|
|
1071
|
+
// src/form-structure/enforce-form-ancestor-commands.ts
|
|
1072
|
+
var FORM_FIELDS_OUTSIDE_ALERT = {
|
|
1073
|
+
type: "default",
|
|
1074
|
+
message: (0, import_i18n.__)("Form fields must be placed inside a form.", "elementor"),
|
|
1075
|
+
id: "form-fields-outside-form-blocked"
|
|
1076
|
+
};
|
|
1077
|
+
function initFormAncestorEnforcement() {
|
|
1078
|
+
(0, import_editor_v1_adapters9.blockCommand)({
|
|
1079
|
+
command: "document/elements/create",
|
|
1080
|
+
condition: blockFormFieldCreate
|
|
1081
|
+
});
|
|
1082
|
+
(0, import_editor_v1_adapters9.blockCommand)({
|
|
1083
|
+
command: "document/elements/move",
|
|
1084
|
+
condition: blockFormFieldMove
|
|
1085
|
+
});
|
|
1086
|
+
(0, import_editor_v1_adapters9.blockCommand)({
|
|
1087
|
+
command: "document/elements/paste",
|
|
1088
|
+
condition: blockFormFieldPaste
|
|
1089
|
+
});
|
|
1090
|
+
}
|
|
1091
|
+
function blockFormFieldCreate(args) {
|
|
1092
|
+
const elementType = getArgsElementType(args);
|
|
1093
|
+
if (!elementType || !FORM_FIELD_ELEMENT_TYPES.has(elementType)) {
|
|
1094
|
+
return false;
|
|
1095
|
+
}
|
|
1096
|
+
if (!isWithinForm(args.container)) {
|
|
1097
|
+
handleBlockedFormField();
|
|
1098
|
+
return true;
|
|
1099
|
+
}
|
|
1100
|
+
return false;
|
|
1101
|
+
}
|
|
1102
|
+
function blockFormFieldMove(args) {
|
|
1103
|
+
const { containers = [args.container], target } = args;
|
|
1104
|
+
const hasFormFieldElement = containers.some(
|
|
1105
|
+
(container) => container ? hasElementTypes(container, FORM_FIELD_ELEMENT_TYPES) : false
|
|
1106
|
+
);
|
|
1107
|
+
if (hasFormFieldElement && !isWithinForm(target)) {
|
|
1108
|
+
handleBlockedFormField();
|
|
1109
|
+
return true;
|
|
1110
|
+
}
|
|
1111
|
+
return false;
|
|
1112
|
+
}
|
|
1113
|
+
function blockFormFieldPaste(args) {
|
|
1114
|
+
const { storageType } = args;
|
|
1115
|
+
if (storageType !== "localstorage") {
|
|
1116
|
+
return false;
|
|
1117
|
+
}
|
|
1118
|
+
const data = window?.elementorCommon?.storage?.get();
|
|
1119
|
+
if (!data?.clipboard?.elements) {
|
|
1120
|
+
return false;
|
|
1121
|
+
}
|
|
1122
|
+
const hasFormFieldElement = hasClipboardElementTypes(data.clipboard.elements, FORM_FIELD_ELEMENT_TYPES);
|
|
1123
|
+
if (hasFormFieldElement && !isWithinForm(args.container)) {
|
|
1124
|
+
handleBlockedFormField();
|
|
1125
|
+
return true;
|
|
1126
|
+
}
|
|
1127
|
+
return false;
|
|
1128
|
+
}
|
|
1129
|
+
function handleBlockedFormField() {
|
|
1130
|
+
(0, import_editor_notifications.notify)(FORM_FIELDS_OUTSIDE_ALERT);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// src/form-structure/prevent-form-nesting-commands.ts
|
|
1134
|
+
var import_editor_notifications2 = require("@elementor/editor-notifications");
|
|
1135
|
+
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
1136
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
1137
|
+
var FORM_NESTING_ALERT = {
|
|
1138
|
+
type: "default",
|
|
1139
|
+
message: (0, import_i18n2.__)("Forms can't be nested. Create separate forms instead.", "elementor"),
|
|
1140
|
+
id: "form-nesting-blocked"
|
|
1141
|
+
};
|
|
1142
|
+
function initFormNestingPrevention() {
|
|
1143
|
+
(0, import_editor_v1_adapters10.blockCommand)({
|
|
1144
|
+
command: "document/elements/create",
|
|
1145
|
+
condition: blockFormCreate
|
|
1146
|
+
});
|
|
1147
|
+
(0, import_editor_v1_adapters10.blockCommand)({
|
|
1148
|
+
command: "document/elements/move",
|
|
1149
|
+
condition: blockFormMove
|
|
1150
|
+
});
|
|
1151
|
+
(0, import_editor_v1_adapters10.blockCommand)({
|
|
1152
|
+
command: "document/elements/paste",
|
|
1153
|
+
condition: blockFormPaste
|
|
1154
|
+
});
|
|
1155
|
+
}
|
|
1156
|
+
function blockFormCreate(args) {
|
|
1157
|
+
const elementType = getArgsElementType(args);
|
|
1158
|
+
if (!elementType) {
|
|
1159
|
+
return false;
|
|
1160
|
+
}
|
|
1161
|
+
if (elementType === FORM_ELEMENT_TYPE && isWithinForm(args.container)) {
|
|
1162
|
+
handleBlockedFormField2();
|
|
1163
|
+
return true;
|
|
1164
|
+
}
|
|
1165
|
+
return false;
|
|
1166
|
+
}
|
|
1167
|
+
function blockFormMove(args) {
|
|
1168
|
+
const { containers = [args.container], target } = args;
|
|
1169
|
+
const hasFormElement = containers.some(
|
|
1170
|
+
(container) => container ? hasElementType(container, FORM_ELEMENT_TYPE) : false
|
|
1171
|
+
);
|
|
1172
|
+
if (hasFormElement && isWithinForm(target)) {
|
|
1173
|
+
handleBlockedFormField2();
|
|
1174
|
+
return true;
|
|
1175
|
+
}
|
|
1176
|
+
return false;
|
|
1177
|
+
}
|
|
1178
|
+
function blockFormPaste(args) {
|
|
1179
|
+
const { storageType } = args;
|
|
1180
|
+
if (storageType !== "localstorage") {
|
|
1181
|
+
return false;
|
|
1182
|
+
}
|
|
1183
|
+
const data = window?.elementorCommon?.storage?.get();
|
|
1184
|
+
if (!data?.clipboard?.elements) {
|
|
1185
|
+
return false;
|
|
1186
|
+
}
|
|
1187
|
+
const hasFormElement = hasClipboardElementType(data.clipboard.elements, FORM_ELEMENT_TYPE);
|
|
1188
|
+
if (hasFormElement && isWithinForm(args.container)) {
|
|
1189
|
+
handleBlockedFormField2();
|
|
1190
|
+
return true;
|
|
1191
|
+
}
|
|
1192
|
+
return false;
|
|
1193
|
+
}
|
|
1194
|
+
function handleBlockedFormField2() {
|
|
1195
|
+
(0, import_editor_notifications2.notify)(FORM_NESTING_ALERT);
|
|
1196
|
+
}
|
|
1197
|
+
|
|
1022
1198
|
// src/settings-transformers-registry.ts
|
|
1023
1199
|
var settingsTransformersRegistry = createTransformersRegistry();
|
|
1024
1200
|
|
|
@@ -1449,8 +1625,8 @@ function initStyleTransformers() {
|
|
|
1449
1625
|
}
|
|
1450
1626
|
|
|
1451
1627
|
// src/legacy/init-legacy-views.ts
|
|
1452
|
-
var
|
|
1453
|
-
var
|
|
1628
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
1629
|
+
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
1454
1630
|
|
|
1455
1631
|
// src/renderers/create-dom-renderer.ts
|
|
1456
1632
|
var import_twing = require("@elementor/twing");
|
|
@@ -1578,7 +1754,7 @@ function createElementViewClassDeclaration() {
|
|
|
1578
1754
|
}
|
|
1579
1755
|
|
|
1580
1756
|
// src/legacy/create-nested-templated-element-type.ts
|
|
1581
|
-
var
|
|
1757
|
+
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1582
1758
|
|
|
1583
1759
|
// src/legacy/twig-rendering-utils.ts
|
|
1584
1760
|
function setupTwigRenderer({ renderer, element }) {
|
|
@@ -1861,7 +2037,7 @@ function createNestedTemplatedElementView({
|
|
|
1861
2037
|
this._initAlpine();
|
|
1862
2038
|
});
|
|
1863
2039
|
this.model.trigger("render:complete");
|
|
1864
|
-
window.dispatchEvent(new CustomEvent(
|
|
2040
|
+
window.dispatchEvent(new CustomEvent(import_editor_elements4.ELEMENT_STYLE_CHANGE_EVENT));
|
|
1865
2041
|
},
|
|
1866
2042
|
async _renderTemplate() {
|
|
1867
2043
|
const model = this.model;
|
|
@@ -1993,10 +2169,10 @@ function createNestedTemplatedElementView({
|
|
|
1993
2169
|
// src/legacy/replacements/inline-editing/inline-editing-elements.tsx
|
|
1994
2170
|
var React6 = __toESM(require("react"));
|
|
1995
2171
|
var import_client = require("react-dom/client");
|
|
1996
|
-
var
|
|
2172
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
1997
2173
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
1998
|
-
var
|
|
1999
|
-
var
|
|
2174
|
+
var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
|
|
2175
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
2000
2176
|
|
|
2001
2177
|
// src/legacy/replacements/base.ts
|
|
2002
2178
|
var TRIGGER_TIMING = {
|
|
@@ -2281,7 +2457,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2281
2457
|
return !!this.inlineEditorRoot;
|
|
2282
2458
|
}
|
|
2283
2459
|
shouldRenderReplacement() {
|
|
2284
|
-
return this.isInlineEditingEligible() && (0,
|
|
2460
|
+
return this.isInlineEditingEligible() && (0, import_editor_v1_adapters11.getCurrentEditMode)() === "edit";
|
|
2285
2461
|
}
|
|
2286
2462
|
handleRenderInlineEditor = () => {
|
|
2287
2463
|
if (this.isEditingModeActive() || !this.isInlineEditingEligible()) {
|
|
@@ -2337,7 +2513,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2337
2513
|
return INLINE_EDITING_PROPERTY_PER_TYPE[this.type] ?? "";
|
|
2338
2514
|
}
|
|
2339
2515
|
getInlineEditablePropType() {
|
|
2340
|
-
const propSchema = (0,
|
|
2516
|
+
const propSchema = (0, import_editor_elements5.getElementType)(this.type)?.propsSchema;
|
|
2341
2517
|
const propertyName = this.getInlineEditablePropertyName();
|
|
2342
2518
|
return propSchema?.[propertyName] ?? null;
|
|
2343
2519
|
}
|
|
@@ -2353,7 +2529,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2353
2529
|
setContentValue(value) {
|
|
2354
2530
|
const settingKey = this.getInlineEditablePropertyName();
|
|
2355
2531
|
const valueToSave = import_editor_props4.htmlPropTypeUtil.create(value || "");
|
|
2356
|
-
(0,
|
|
2532
|
+
(0, import_editor_v1_adapters11.undoable)(
|
|
2357
2533
|
{
|
|
2358
2534
|
do: () => {
|
|
2359
2535
|
const prevValue = this.getInlineEditablePropValue();
|
|
@@ -2365,9 +2541,9 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2365
2541
|
}
|
|
2366
2542
|
},
|
|
2367
2543
|
{
|
|
2368
|
-
title: (0,
|
|
2544
|
+
title: (0, import_editor_elements5.getElementLabel)(this.id),
|
|
2369
2545
|
// translators: %s is the name of the property that was edited.
|
|
2370
|
-
subtitle: (0,
|
|
2546
|
+
subtitle: (0, import_i18n3.__)("%s edited", "elementor").replace(
|
|
2371
2547
|
"%s",
|
|
2372
2548
|
this.getInlineEditablePropTypeKey() ?? "Inline editing"
|
|
2373
2549
|
),
|
|
@@ -2395,17 +2571,17 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2395
2571
|
return null;
|
|
2396
2572
|
}
|
|
2397
2573
|
runCommand(key, value) {
|
|
2398
|
-
(0,
|
|
2574
|
+
(0, import_editor_v1_adapters11.__privateRunCommandSync)(
|
|
2399
2575
|
"document/elements/set-settings",
|
|
2400
2576
|
{
|
|
2401
|
-
container: (0,
|
|
2577
|
+
container: (0, import_editor_elements5.getContainer)(this.id),
|
|
2402
2578
|
settings: {
|
|
2403
2579
|
[key]: value
|
|
2404
2580
|
}
|
|
2405
2581
|
},
|
|
2406
2582
|
{ internal: true }
|
|
2407
2583
|
);
|
|
2408
|
-
(0,
|
|
2584
|
+
(0, import_editor_v1_adapters11.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
|
|
2409
2585
|
}
|
|
2410
2586
|
getExpectedTag() {
|
|
2411
2587
|
const tagPropType = this.getTagPropType();
|
|
@@ -2413,7 +2589,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
2413
2589
|
return import_editor_props4.stringPropTypeUtil.extract(this.getSetting(tagSettingKey) ?? null) ?? import_editor_props4.stringPropTypeUtil.extract(tagPropType?.default ?? null) ?? null;
|
|
2414
2590
|
}
|
|
2415
2591
|
getTagPropType() {
|
|
2416
|
-
const propsSchema = (0,
|
|
2592
|
+
const propsSchema = (0, import_editor_elements5.getElementType)(this.type)?.propsSchema;
|
|
2417
2593
|
if (!propsSchema?.tag) {
|
|
2418
2594
|
return null;
|
|
2419
2595
|
}
|
|
@@ -2557,8 +2733,8 @@ function registerElementType(type, elementTypeGenerator) {
|
|
|
2557
2733
|
elementsLegacyTypes[type] = elementTypeGenerator;
|
|
2558
2734
|
}
|
|
2559
2735
|
function initLegacyViews() {
|
|
2560
|
-
(0,
|
|
2561
|
-
const widgetsCache = (0,
|
|
2736
|
+
(0, import_editor_v1_adapters12.__privateListenTo)((0, import_editor_v1_adapters12.v1ReadyEvent)(), () => {
|
|
2737
|
+
const widgetsCache = (0, import_editor_elements6.getWidgetsCache)() ?? {};
|
|
2562
2738
|
const legacyWindow = window;
|
|
2563
2739
|
const renderer = createDomRenderer();
|
|
2564
2740
|
Object.entries(widgetsCache).forEach(([type, element]) => {
|
|
@@ -2633,7 +2809,7 @@ function initTabsModelExtensions() {
|
|
|
2633
2809
|
}
|
|
2634
2810
|
|
|
2635
2811
|
// src/mcp/resources/document-structure-resource.ts
|
|
2636
|
-
var
|
|
2812
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
2637
2813
|
var DOCUMENT_STRUCTURE_URI = "elementor://document/structure";
|
|
2638
2814
|
var initDocumentStructureResource = (reg) => {
|
|
2639
2815
|
const { mcpServer, sendResourceUpdated } = reg;
|
|
@@ -2646,14 +2822,14 @@ var initDocumentStructureResource = (reg) => {
|
|
|
2646
2822
|
sendResourceUpdated({ uri: DOCUMENT_STRUCTURE_URI });
|
|
2647
2823
|
}
|
|
2648
2824
|
};
|
|
2649
|
-
(0,
|
|
2825
|
+
(0, import_editor_v1_adapters13.__privateListenTo)(
|
|
2650
2826
|
[
|
|
2651
|
-
(0,
|
|
2652
|
-
(0,
|
|
2653
|
-
(0,
|
|
2654
|
-
(0,
|
|
2655
|
-
(0,
|
|
2656
|
-
(0,
|
|
2827
|
+
(0, import_editor_v1_adapters13.commandEndEvent)("document/elements/create"),
|
|
2828
|
+
(0, import_editor_v1_adapters13.commandEndEvent)("document/elements/delete"),
|
|
2829
|
+
(0, import_editor_v1_adapters13.commandEndEvent)("document/elements/move"),
|
|
2830
|
+
(0, import_editor_v1_adapters13.commandEndEvent)("document/elements/copy"),
|
|
2831
|
+
(0, import_editor_v1_adapters13.commandEndEvent)("document/elements/paste"),
|
|
2832
|
+
(0, import_editor_v1_adapters13.commandEndEvent)("editor/documents/attach-preview")
|
|
2657
2833
|
],
|
|
2658
2834
|
updateDocumentStructure
|
|
2659
2835
|
);
|
|
@@ -2708,13 +2884,13 @@ function extractElementData(element) {
|
|
|
2708
2884
|
}
|
|
2709
2885
|
|
|
2710
2886
|
// src/mcp/tools/build-composition/tool.ts
|
|
2711
|
-
var
|
|
2887
|
+
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
2712
2888
|
|
|
2713
2889
|
// src/composition-builder/composition-builder.ts
|
|
2714
|
-
var
|
|
2890
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2715
2891
|
|
|
2716
2892
|
// src/mcp/utils/do-update-element-property.ts
|
|
2717
|
-
var
|
|
2893
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
2718
2894
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
2719
2895
|
var import_editor_styles5 = require("@elementor/editor-styles");
|
|
2720
2896
|
function resolvePropValue(value, forceKey) {
|
|
@@ -2727,7 +2903,7 @@ function resolvePropValue(value, forceKey) {
|
|
|
2727
2903
|
var doUpdateElementProperty = (params) => {
|
|
2728
2904
|
const { elementId, propertyName, propertyValue, elementType } = params;
|
|
2729
2905
|
if (propertyName === "_styles") {
|
|
2730
|
-
const elementStyles = (0,
|
|
2906
|
+
const elementStyles = (0, import_editor_elements7.getElementStyles)(elementId) || {};
|
|
2731
2907
|
const propertyMapValue = propertyValue;
|
|
2732
2908
|
const styleSchema = (0, import_editor_styles5.getStylesSchema)();
|
|
2733
2909
|
const transformedStyleValues = Object.fromEntries(
|
|
@@ -2775,7 +2951,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
2775
2951
|
delete transformedStyleValues.custom_css;
|
|
2776
2952
|
const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
|
|
2777
2953
|
if (!localStyle) {
|
|
2778
|
-
(0,
|
|
2954
|
+
(0, import_editor_elements7.createElementStyle)({
|
|
2779
2955
|
elementId,
|
|
2780
2956
|
...typeof customCss !== "undefined" ? { custom_css: customCss } : {},
|
|
2781
2957
|
classesProp: "classes",
|
|
@@ -2789,7 +2965,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
2789
2965
|
}
|
|
2790
2966
|
});
|
|
2791
2967
|
} else {
|
|
2792
|
-
(0,
|
|
2968
|
+
(0, import_editor_elements7.updateElementStyle)({
|
|
2793
2969
|
elementId,
|
|
2794
2970
|
styleId: localStyle.id,
|
|
2795
2971
|
meta: {
|
|
@@ -2804,7 +2980,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
2804
2980
|
}
|
|
2805
2981
|
return;
|
|
2806
2982
|
}
|
|
2807
|
-
const elementPropSchema = (0,
|
|
2983
|
+
const elementPropSchema = (0, import_editor_elements7.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
|
|
2808
2984
|
if (!elementPropSchema) {
|
|
2809
2985
|
throw new Error(`No prop schema found for element type: ${elementType}`);
|
|
2810
2986
|
}
|
|
@@ -2818,7 +2994,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
2818
2994
|
}
|
|
2819
2995
|
const propKey = elementPropSchema[propertyName].key;
|
|
2820
2996
|
const value = resolvePropValue(propertyValue, propKey);
|
|
2821
|
-
(0,
|
|
2997
|
+
(0, import_editor_elements7.updateElementSettings)({
|
|
2822
2998
|
id: elementId,
|
|
2823
2999
|
props: {
|
|
2824
3000
|
[propertyName]: value
|
|
@@ -2828,7 +3004,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
2828
3004
|
};
|
|
2829
3005
|
|
|
2830
3006
|
// src/mcp/utils/validate-input.ts
|
|
2831
|
-
var
|
|
3007
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
2832
3008
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
2833
3009
|
var import_editor_styles6 = require("@elementor/editor-styles");
|
|
2834
3010
|
var _widgetsSchema = null;
|
|
@@ -2836,7 +3012,7 @@ var validateInput = {
|
|
|
2836
3012
|
get widgetsSchema() {
|
|
2837
3013
|
if (!_widgetsSchema) {
|
|
2838
3014
|
const schema2 = {};
|
|
2839
|
-
const cache = (0,
|
|
3015
|
+
const cache = (0, import_editor_elements8.getWidgetsCache)();
|
|
2840
3016
|
if (!cache) {
|
|
2841
3017
|
return {};
|
|
2842
3018
|
}
|
|
@@ -2919,10 +3095,10 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
2919
3095
|
rootContainers = [];
|
|
2920
3096
|
containerElements = [];
|
|
2921
3097
|
api = {
|
|
2922
|
-
createElement:
|
|
2923
|
-
getWidgetsCache:
|
|
2924
|
-
generateElementId:
|
|
2925
|
-
getContainer:
|
|
3098
|
+
createElement: import_editor_elements9.createElement,
|
|
3099
|
+
getWidgetsCache: import_editor_elements9.getWidgetsCache,
|
|
3100
|
+
generateElementId: import_editor_elements9.generateElementId,
|
|
3101
|
+
getContainer: import_editor_elements9.getContainer,
|
|
2926
3102
|
doUpdateElementProperty
|
|
2927
3103
|
};
|
|
2928
3104
|
xml;
|
|
@@ -2966,7 +3142,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
2966
3142
|
containerId: targetContainerId,
|
|
2967
3143
|
model: {
|
|
2968
3144
|
elType: elementTag,
|
|
2969
|
-
id: (0,
|
|
3145
|
+
id: (0, import_editor_elements9.generateElementId)()
|
|
2970
3146
|
},
|
|
2971
3147
|
options: { useHistory: false }
|
|
2972
3148
|
}) : this.api.createElement({
|
|
@@ -2974,7 +3150,7 @@ var CompositionBuilder = class _CompositionBuilder {
|
|
|
2974
3150
|
model: {
|
|
2975
3151
|
elType: "widget",
|
|
2976
3152
|
widgetType: elementTag,
|
|
2977
|
-
id: (0,
|
|
3153
|
+
id: (0, import_editor_elements9.generateElementId)()
|
|
2978
3154
|
},
|
|
2979
3155
|
options: { useHistory: false }
|
|
2980
3156
|
});
|
|
@@ -3305,11 +3481,11 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
3305
3481
|
let generatedXML = "";
|
|
3306
3482
|
const errors = [];
|
|
3307
3483
|
const rootContainers = [];
|
|
3308
|
-
const documentContainer = (0,
|
|
3484
|
+
const documentContainer = (0, import_editor_elements10.getContainer)("document");
|
|
3309
3485
|
try {
|
|
3310
3486
|
const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
|
|
3311
|
-
createElement:
|
|
3312
|
-
getWidgetsCache:
|
|
3487
|
+
createElement: import_editor_elements10.createElement,
|
|
3488
|
+
getWidgetsCache: import_editor_elements10.getWidgetsCache
|
|
3313
3489
|
});
|
|
3314
3490
|
compositionBuilder.setElementConfig(elementConfig);
|
|
3315
3491
|
compositionBuilder.setStylesConfig(stylesConfig);
|
|
@@ -3344,7 +3520,7 @@ var initBuildCompositionsTool = (reg) => {
|
|
|
3344
3520
|
}
|
|
3345
3521
|
if (errors.length) {
|
|
3346
3522
|
rootContainers.forEach((rootContainer) => {
|
|
3347
|
-
(0,
|
|
3523
|
+
(0, import_editor_elements10.deleteElement)({
|
|
3348
3524
|
elementId: rootContainer.id,
|
|
3349
3525
|
options: { useHistory: false }
|
|
3350
3526
|
});
|
|
@@ -3616,7 +3792,7 @@ Check the styles schema at the resource [${STYLE_SCHEMA_URI.replace(
|
|
|
3616
3792
|
}
|
|
3617
3793
|
|
|
3618
3794
|
// src/mcp/tools/get-element-config/tool.ts
|
|
3619
|
-
var
|
|
3795
|
+
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
3620
3796
|
var import_editor_props8 = require("@elementor/editor-props");
|
|
3621
3797
|
var import_schema5 = require("@elementor/schema");
|
|
3622
3798
|
var schema = {
|
|
@@ -3655,12 +3831,12 @@ var initGetElementConfigTool = (reg) => {
|
|
|
3655
3831
|
speedPriority: 0.9
|
|
3656
3832
|
},
|
|
3657
3833
|
handler: async ({ elementId }) => {
|
|
3658
|
-
const element = (0,
|
|
3834
|
+
const element = (0, import_editor_elements11.getContainer)(elementId);
|
|
3659
3835
|
if (!element) {
|
|
3660
3836
|
throw new Error(`Element with ID ${elementId} not found.`);
|
|
3661
3837
|
}
|
|
3662
3838
|
const elementRawSettings = element.settings;
|
|
3663
|
-
const propSchema = (0,
|
|
3839
|
+
const propSchema = (0, import_editor_elements11.getWidgetsCache)()?.[element.model.get("widgetType") || element.model.get("elType") || ""]?.atomic_props_schema;
|
|
3664
3840
|
if (!elementRawSettings || !propSchema) {
|
|
3665
3841
|
throw new Error(`No settings or prop schema found for element ID: ${elementId}`);
|
|
3666
3842
|
}
|
|
@@ -3669,7 +3845,7 @@ var initGetElementConfigTool = (reg) => {
|
|
|
3669
3845
|
import_editor_props8.Schema.configurableKeys(propSchema).forEach((key) => {
|
|
3670
3846
|
propValues[key] = structuredClone(elementRawSettings.get(key));
|
|
3671
3847
|
});
|
|
3672
|
-
const elementStyles = (0,
|
|
3848
|
+
const elementStyles = (0, import_editor_elements11.getElementStyles)(elementId) || {};
|
|
3673
3849
|
const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
|
|
3674
3850
|
if (localStyle) {
|
|
3675
3851
|
const defaultVariant = localStyle.variants.find(
|
|
@@ -3827,16 +4003,16 @@ Note: The "size" property controls image resolution/loading, not visual size. Se
|
|
|
3827
4003
|
`;
|
|
3828
4004
|
|
|
3829
4005
|
// src/prevent-link-in-link-commands.ts
|
|
3830
|
-
var
|
|
3831
|
-
var
|
|
3832
|
-
var
|
|
3833
|
-
var
|
|
4006
|
+
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
4007
|
+
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
4008
|
+
var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
|
|
4009
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
3834
4010
|
function initLinkInLinkPrevention() {
|
|
3835
|
-
(0,
|
|
4011
|
+
(0, import_editor_v1_adapters14.blockCommand)({
|
|
3836
4012
|
command: "document/elements/paste",
|
|
3837
4013
|
condition: blockLinkInLinkPaste
|
|
3838
4014
|
});
|
|
3839
|
-
(0,
|
|
4015
|
+
(0, import_editor_v1_adapters14.blockCommand)({
|
|
3840
4016
|
command: "document/elements/move",
|
|
3841
4017
|
condition: blockLinkInLinkMove
|
|
3842
4018
|
});
|
|
@@ -3864,7 +4040,7 @@ function blockLinkInLinkPaste(args) {
|
|
|
3864
4040
|
const sourceElements = data.clipboard.elements;
|
|
3865
4041
|
const notification = {
|
|
3866
4042
|
type: "default",
|
|
3867
|
-
message: (0,
|
|
4043
|
+
message: (0, import_i18n4.__)(
|
|
3868
4044
|
"To paste a link to this element, first remove the link from it's parent container.",
|
|
3869
4045
|
"elementor"
|
|
3870
4046
|
),
|
|
@@ -3873,7 +4049,7 @@ function blockLinkInLinkPaste(args) {
|
|
|
3873
4049
|
};
|
|
3874
4050
|
const blocked = shouldBlock(sourceElements, targetElements);
|
|
3875
4051
|
if (blocked) {
|
|
3876
|
-
(0,
|
|
4052
|
+
(0, import_editor_notifications3.notify)(notification);
|
|
3877
4053
|
}
|
|
3878
4054
|
return blocked;
|
|
3879
4055
|
}
|
|
@@ -3883,13 +4059,13 @@ function blockLinkInLinkMove(args) {
|
|
|
3883
4059
|
const targetElement = target;
|
|
3884
4060
|
const notification = {
|
|
3885
4061
|
type: "default",
|
|
3886
|
-
message: (0,
|
|
4062
|
+
message: (0, import_i18n4.__)("To drag a link to this element, first remove the link from it's parent container.", "elementor"),
|
|
3887
4063
|
id: "move-in-link-blocked",
|
|
3888
4064
|
additionalActionProps: [learnMoreActionProps]
|
|
3889
4065
|
};
|
|
3890
4066
|
const isBlocked = shouldBlock(sourceElements, [targetElement]);
|
|
3891
4067
|
if (isBlocked) {
|
|
3892
|
-
(0,
|
|
4068
|
+
(0, import_editor_notifications3.notify)(notification);
|
|
3893
4069
|
}
|
|
3894
4070
|
return isBlocked;
|
|
3895
4071
|
}
|
|
@@ -3898,32 +4074,32 @@ function shouldBlock(sourceElements, targetElements) {
|
|
|
3898
4074
|
return false;
|
|
3899
4075
|
}
|
|
3900
4076
|
const isSourceContainsAnAnchor = sourceElements.some((src) => {
|
|
3901
|
-
return src?.id ? (0,
|
|
4077
|
+
return src?.id ? (0, import_editor_elements12.isElementAnchored)(src.id) || !!(0, import_editor_elements12.getAnchoredDescendantId)(src.id) : false;
|
|
3902
4078
|
});
|
|
3903
4079
|
if (!isSourceContainsAnAnchor) {
|
|
3904
4080
|
return false;
|
|
3905
4081
|
}
|
|
3906
4082
|
const isTargetContainsAnAnchor = targetElements.some((target) => {
|
|
3907
|
-
return target?.id ? (0,
|
|
4083
|
+
return target?.id ? (0, import_editor_elements12.isElementAnchored)(target.id) || !!(0, import_editor_elements12.getAnchoredAncestorId)(target.id) : false;
|
|
3908
4084
|
});
|
|
3909
4085
|
return isTargetContainsAnAnchor;
|
|
3910
4086
|
}
|
|
3911
4087
|
|
|
3912
4088
|
// src/style-commands/paste-style.ts
|
|
3913
|
-
var
|
|
4089
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
3914
4090
|
var import_editor_props10 = require("@elementor/editor-props");
|
|
3915
|
-
var
|
|
4091
|
+
var import_editor_v1_adapters16 = require("@elementor/editor-v1-adapters");
|
|
3916
4092
|
|
|
3917
4093
|
// src/style-commands/undoable-actions/paste-element-style.ts
|
|
3918
|
-
var
|
|
4094
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
3919
4095
|
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
3920
|
-
var
|
|
3921
|
-
var
|
|
4096
|
+
var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
|
|
4097
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
3922
4098
|
|
|
3923
4099
|
// src/style-commands/utils.ts
|
|
3924
|
-
var
|
|
4100
|
+
var import_editor_elements13 = require("@elementor/editor-elements");
|
|
3925
4101
|
var import_editor_props9 = require("@elementor/editor-props");
|
|
3926
|
-
var
|
|
4102
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
3927
4103
|
function hasAtomicWidgets(args) {
|
|
3928
4104
|
const { containers = [args.container] } = args;
|
|
3929
4105
|
return containers.some(isAtomicWidget);
|
|
@@ -3946,7 +4122,7 @@ function getClassesProp(container) {
|
|
|
3946
4122
|
}
|
|
3947
4123
|
function getContainerSchema(container) {
|
|
3948
4124
|
const type = container?.model.get("widgetType") || container?.model.get("elType");
|
|
3949
|
-
const widgetsCache = (0,
|
|
4125
|
+
const widgetsCache = (0, import_editor_elements13.getWidgetsCache)();
|
|
3950
4126
|
const elementType = widgetsCache?.[type];
|
|
3951
4127
|
return elementType?.atomic_props_schema ?? null;
|
|
3952
4128
|
}
|
|
@@ -3959,11 +4135,11 @@ function getClipboardElements(storageKey = "clipboard") {
|
|
|
3959
4135
|
}
|
|
3960
4136
|
}
|
|
3961
4137
|
function getTitleForContainers(containers) {
|
|
3962
|
-
return containers.length > 1 ? (0,
|
|
4138
|
+
return containers.length > 1 ? (0, import_i18n5.__)("Elements", "elementor") : (0, import_editor_elements13.getElementLabel)(containers[0].id);
|
|
3963
4139
|
}
|
|
3964
4140
|
|
|
3965
4141
|
// src/style-commands/undoable-actions/paste-element-style.ts
|
|
3966
|
-
var undoablePasteElementStyle = () => (0,
|
|
4142
|
+
var undoablePasteElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
|
|
3967
4143
|
{
|
|
3968
4144
|
do: ({ containers, newStyle }) => {
|
|
3969
4145
|
return containers.map((container) => {
|
|
@@ -3972,7 +4148,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
|
|
|
3972
4148
|
if (!classesProp) {
|
|
3973
4149
|
return null;
|
|
3974
4150
|
}
|
|
3975
|
-
const originalStyles = (0,
|
|
4151
|
+
const originalStyles = (0, import_editor_elements14.getElementStyles)(container.id);
|
|
3976
4152
|
const [styleId, styleDef] = Object.entries(originalStyles ?? {})[0] ?? [];
|
|
3977
4153
|
const originalStyle = Object.keys(styleDef ?? {}).length ? styleDef : null;
|
|
3978
4154
|
const revertData = {
|
|
@@ -3981,7 +4157,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
|
|
|
3981
4157
|
};
|
|
3982
4158
|
if (styleId) {
|
|
3983
4159
|
newStyle.variants.forEach(({ meta, props, custom_css: customCss }) => {
|
|
3984
|
-
(0,
|
|
4160
|
+
(0, import_editor_elements14.updateElementStyle)({
|
|
3985
4161
|
elementId,
|
|
3986
4162
|
styleId,
|
|
3987
4163
|
meta,
|
|
@@ -3992,7 +4168,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
|
|
|
3992
4168
|
} else {
|
|
3993
4169
|
const [firstVariant] = newStyle.variants;
|
|
3994
4170
|
const additionalVariants = newStyle.variants.slice(1);
|
|
3995
|
-
revertData.styleId = (0,
|
|
4171
|
+
revertData.styleId = (0, import_editor_elements14.createElementStyle)({
|
|
3996
4172
|
elementId,
|
|
3997
4173
|
classesProp,
|
|
3998
4174
|
label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
|
|
@@ -4010,7 +4186,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
|
|
|
4010
4186
|
return;
|
|
4011
4187
|
}
|
|
4012
4188
|
if (!revertData.originalStyle) {
|
|
4013
|
-
(0,
|
|
4189
|
+
(0, import_editor_elements14.deleteElementStyle)(container.id, revertData.styleId);
|
|
4014
4190
|
return;
|
|
4015
4191
|
}
|
|
4016
4192
|
const classesProp = getClassesProp(container);
|
|
@@ -4019,7 +4195,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
|
|
|
4019
4195
|
}
|
|
4020
4196
|
const [firstVariant] = revertData.originalStyle.variants;
|
|
4021
4197
|
const additionalVariants = revertData.originalStyle.variants.slice(1);
|
|
4022
|
-
(0,
|
|
4198
|
+
(0, import_editor_elements14.createElementStyle)({
|
|
4023
4199
|
elementId: container.id,
|
|
4024
4200
|
classesProp,
|
|
4025
4201
|
label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
|
|
@@ -4032,19 +4208,19 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
|
|
|
4032
4208
|
},
|
|
4033
4209
|
{
|
|
4034
4210
|
title: ({ containers }) => getTitleForContainers(containers),
|
|
4035
|
-
subtitle: (0,
|
|
4211
|
+
subtitle: (0, import_i18n6.__)("Style Pasted", "elementor")
|
|
4036
4212
|
}
|
|
4037
4213
|
);
|
|
4038
4214
|
|
|
4039
4215
|
// src/style-commands/paste-style.ts
|
|
4040
4216
|
function initPasteStyleCommand() {
|
|
4041
4217
|
const pasteElementStyleCommand = undoablePasteElementStyle();
|
|
4042
|
-
(0,
|
|
4218
|
+
(0, import_editor_v1_adapters16.blockCommand)({
|
|
4043
4219
|
command: "document/elements/paste-style",
|
|
4044
4220
|
condition: hasAtomicWidgets
|
|
4045
4221
|
});
|
|
4046
|
-
(0,
|
|
4047
|
-
(0,
|
|
4222
|
+
(0, import_editor_v1_adapters16.__privateListenTo)(
|
|
4223
|
+
(0, import_editor_v1_adapters16.commandStartEvent)("document/elements/paste-style"),
|
|
4048
4224
|
(e) => pasteStyles(e.args, pasteElementStyleCommand)
|
|
4049
4225
|
);
|
|
4050
4226
|
}
|
|
@@ -4056,7 +4232,7 @@ function pasteStyles(args, pasteLocalStyle) {
|
|
|
4056
4232
|
}
|
|
4057
4233
|
const clipboardElements = getClipboardElements(storageKey);
|
|
4058
4234
|
const [clipboardElement] = clipboardElements ?? [];
|
|
4059
|
-
const clipboardContainer = (0,
|
|
4235
|
+
const clipboardContainer = (0, import_editor_elements15.getContainer)(clipboardElement.id);
|
|
4060
4236
|
if (!clipboardElement || !clipboardContainer || !isAtomicWidget(clipboardContainer)) {
|
|
4061
4237
|
return;
|
|
4062
4238
|
}
|
|
@@ -4075,7 +4251,7 @@ function getClassesWithoutLocalStyle(clipboardContainer, style) {
|
|
|
4075
4251
|
if (!classesProp) {
|
|
4076
4252
|
return [];
|
|
4077
4253
|
}
|
|
4078
|
-
const classesSetting = (0,
|
|
4254
|
+
const classesSetting = (0, import_editor_elements15.getElementSetting)(clipboardContainer.id, classesProp);
|
|
4079
4255
|
return classesSetting?.value.filter((styleId) => styleId !== style?.id) ?? [];
|
|
4080
4256
|
}
|
|
4081
4257
|
function pasteClasses(containers, classes) {
|
|
@@ -4084,10 +4260,10 @@ function pasteClasses(containers, classes) {
|
|
|
4084
4260
|
if (!classesProp) {
|
|
4085
4261
|
return;
|
|
4086
4262
|
}
|
|
4087
|
-
const classesSetting = (0,
|
|
4263
|
+
const classesSetting = (0, import_editor_elements15.getElementSetting)(container.id, classesProp);
|
|
4088
4264
|
const currentClasses = import_editor_props10.classesPropTypeUtil.extract(classesSetting) ?? [];
|
|
4089
4265
|
const newClasses = import_editor_props10.classesPropTypeUtil.create(Array.from(/* @__PURE__ */ new Set([...classes, ...currentClasses])));
|
|
4090
|
-
(0,
|
|
4266
|
+
(0, import_editor_elements15.updateElementSettings)({
|
|
4091
4267
|
id: container.id,
|
|
4092
4268
|
props: { [classesProp]: newClasses }
|
|
4093
4269
|
});
|
|
@@ -4095,21 +4271,21 @@ function pasteClasses(containers, classes) {
|
|
|
4095
4271
|
}
|
|
4096
4272
|
|
|
4097
4273
|
// src/style-commands/reset-style.ts
|
|
4098
|
-
var
|
|
4274
|
+
var import_editor_v1_adapters18 = require("@elementor/editor-v1-adapters");
|
|
4099
4275
|
|
|
4100
4276
|
// src/style-commands/undoable-actions/reset-element-style.ts
|
|
4101
|
-
var
|
|
4277
|
+
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
4102
4278
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
4103
|
-
var
|
|
4104
|
-
var
|
|
4105
|
-
var undoableResetElementStyle = () => (0,
|
|
4279
|
+
var import_editor_v1_adapters17 = require("@elementor/editor-v1-adapters");
|
|
4280
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
4281
|
+
var undoableResetElementStyle = () => (0, import_editor_v1_adapters17.undoable)(
|
|
4106
4282
|
{
|
|
4107
4283
|
do: ({ containers }) => {
|
|
4108
4284
|
return containers.map((container) => {
|
|
4109
4285
|
const elementId = container.model.get("id");
|
|
4110
|
-
const containerStyles = (0,
|
|
4286
|
+
const containerStyles = (0, import_editor_elements16.getElementStyles)(elementId);
|
|
4111
4287
|
Object.keys(containerStyles ?? {}).forEach(
|
|
4112
|
-
(styleId) => (0,
|
|
4288
|
+
(styleId) => (0, import_editor_elements16.deleteElementStyle)(elementId, styleId)
|
|
4113
4289
|
);
|
|
4114
4290
|
return containerStyles;
|
|
4115
4291
|
});
|
|
@@ -4125,7 +4301,7 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
|
|
|
4125
4301
|
Object.entries(containerStyles ?? {}).forEach(([styleId, style]) => {
|
|
4126
4302
|
const [firstVariant] = style.variants;
|
|
4127
4303
|
const additionalVariants = style.variants.slice(1);
|
|
4128
|
-
(0,
|
|
4304
|
+
(0, import_editor_elements16.createElementStyle)({
|
|
4129
4305
|
elementId,
|
|
4130
4306
|
classesProp,
|
|
4131
4307
|
styleId,
|
|
@@ -4139,19 +4315,19 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
|
|
|
4139
4315
|
},
|
|
4140
4316
|
{
|
|
4141
4317
|
title: ({ containers }) => getTitleForContainers(containers),
|
|
4142
|
-
subtitle: (0,
|
|
4318
|
+
subtitle: (0, import_i18n7.__)("Style Reset", "elementor")
|
|
4143
4319
|
}
|
|
4144
4320
|
);
|
|
4145
4321
|
|
|
4146
4322
|
// src/style-commands/reset-style.ts
|
|
4147
4323
|
function initResetStyleCommand() {
|
|
4148
4324
|
const resetElementStyles = undoableResetElementStyle();
|
|
4149
|
-
(0,
|
|
4325
|
+
(0, import_editor_v1_adapters18.blockCommand)({
|
|
4150
4326
|
command: "document/elements/reset-style",
|
|
4151
4327
|
condition: hasAtomicWidgets
|
|
4152
4328
|
});
|
|
4153
|
-
(0,
|
|
4154
|
-
(0,
|
|
4329
|
+
(0, import_editor_v1_adapters18.__privateListenTo)(
|
|
4330
|
+
(0, import_editor_v1_adapters18.commandStartEvent)("document/elements/reset-style"),
|
|
4155
4331
|
(e) => resetStyles(e.args, resetElementStyles)
|
|
4156
4332
|
);
|
|
4157
4333
|
}
|
|
@@ -4175,6 +4351,8 @@ function init() {
|
|
|
4175
4351
|
initStyleTransformers();
|
|
4176
4352
|
initStyleCommands();
|
|
4177
4353
|
initLinkInLinkPrevention();
|
|
4354
|
+
initFormNestingPrevention();
|
|
4355
|
+
initFormAncestorEnforcement();
|
|
4178
4356
|
initViewReplacements();
|
|
4179
4357
|
initLegacyViews();
|
|
4180
4358
|
initSettingsTransformers();
|