@elementor/editor-canvas 4.0.0-536 → 4.0.0-538

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 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((__6, index, items) => {
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 import_editor_elements5 = require("@elementor/editor-elements");
1453
- var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
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 import_editor_elements3 = require("@elementor/editor-elements");
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(import_editor_elements3.ELEMENT_STYLE_CHANGE_EVENT));
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 import_editor_elements4 = require("@elementor/editor-elements");
2172
+ var import_editor_elements5 = require("@elementor/editor-elements");
1997
2173
  var import_editor_props4 = require("@elementor/editor-props");
1998
- var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
1999
- var import_i18n = require("@wordpress/i18n");
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 = {
@@ -2045,6 +2221,7 @@ var import_react12 = require("@floating-ui/react");
2045
2221
 
2046
2222
  // src/legacy/replacements/inline-editing/inline-editing-utils.ts
2047
2223
  var INLINE_EDITING_PROPERTY_PER_TYPE = {
2224
+ "e-button": "text",
2048
2225
  "e-form-label": "text",
2049
2226
  "e-heading": "title",
2050
2227
  "e-paragraph": "paragraph"
@@ -2122,6 +2299,10 @@ var CanvasInlineEditor = ({
2122
2299
  .ProseMirror > * {
2123
2300
  height: 100%;
2124
2301
  }
2302
+ .${EDITOR_WRAPPER_SELECTOR} .ProseMirror > button[contenteditable="true"] {
2303
+ height: auto;
2304
+ cursor: text;
2305
+ }
2125
2306
  `), /* @__PURE__ */ React5.createElement(
2126
2307
  import_editor_controls2.InlineEditor,
2127
2308
  {
@@ -2281,7 +2462,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
2281
2462
  return !!this.inlineEditorRoot;
2282
2463
  }
2283
2464
  shouldRenderReplacement() {
2284
- return this.isInlineEditingEligible() && (0, import_editor_v1_adapters9.getCurrentEditMode)() === "edit";
2465
+ return this.isInlineEditingEligible() && (0, import_editor_v1_adapters11.getCurrentEditMode)() === "edit";
2285
2466
  }
2286
2467
  handleRenderInlineEditor = () => {
2287
2468
  if (this.isEditingModeActive() || !this.isInlineEditingEligible()) {
@@ -2337,7 +2518,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
2337
2518
  return INLINE_EDITING_PROPERTY_PER_TYPE[this.type] ?? "";
2338
2519
  }
2339
2520
  getInlineEditablePropType() {
2340
- const propSchema = (0, import_editor_elements4.getElementType)(this.type)?.propsSchema;
2521
+ const propSchema = (0, import_editor_elements5.getElementType)(this.type)?.propsSchema;
2341
2522
  const propertyName = this.getInlineEditablePropertyName();
2342
2523
  return propSchema?.[propertyName] ?? null;
2343
2524
  }
@@ -2353,7 +2534,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
2353
2534
  setContentValue(value) {
2354
2535
  const settingKey = this.getInlineEditablePropertyName();
2355
2536
  const valueToSave = import_editor_props4.htmlPropTypeUtil.create(value || "");
2356
- (0, import_editor_v1_adapters9.undoable)(
2537
+ (0, import_editor_v1_adapters11.undoable)(
2357
2538
  {
2358
2539
  do: () => {
2359
2540
  const prevValue = this.getInlineEditablePropValue();
@@ -2365,9 +2546,9 @@ var InlineEditingReplacement = class extends ReplacementBase {
2365
2546
  }
2366
2547
  },
2367
2548
  {
2368
- title: (0, import_editor_elements4.getElementLabel)(this.id),
2549
+ title: (0, import_editor_elements5.getElementLabel)(this.id),
2369
2550
  // translators: %s is the name of the property that was edited.
2370
- subtitle: (0, import_i18n.__)("%s edited", "elementor").replace(
2551
+ subtitle: (0, import_i18n3.__)("%s edited", "elementor").replace(
2371
2552
  "%s",
2372
2553
  this.getInlineEditablePropTypeKey() ?? "Inline editing"
2373
2554
  ),
@@ -2395,17 +2576,17 @@ var InlineEditingReplacement = class extends ReplacementBase {
2395
2576
  return null;
2396
2577
  }
2397
2578
  runCommand(key, value) {
2398
- (0, import_editor_v1_adapters9.__privateRunCommandSync)(
2579
+ (0, import_editor_v1_adapters11.__privateRunCommandSync)(
2399
2580
  "document/elements/set-settings",
2400
2581
  {
2401
- container: (0, import_editor_elements4.getContainer)(this.id),
2582
+ container: (0, import_editor_elements5.getContainer)(this.id),
2402
2583
  settings: {
2403
2584
  [key]: value
2404
2585
  }
2405
2586
  },
2406
2587
  { internal: true }
2407
2588
  );
2408
- (0, import_editor_v1_adapters9.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
2589
+ (0, import_editor_v1_adapters11.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
2409
2590
  }
2410
2591
  getExpectedTag() {
2411
2592
  const tagPropType = this.getTagPropType();
@@ -2413,7 +2594,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
2413
2594
  return import_editor_props4.stringPropTypeUtil.extract(this.getSetting(tagSettingKey) ?? null) ?? import_editor_props4.stringPropTypeUtil.extract(tagPropType?.default ?? null) ?? null;
2414
2595
  }
2415
2596
  getTagPropType() {
2416
- const propsSchema = (0, import_editor_elements4.getElementType)(this.type)?.propsSchema;
2597
+ const propsSchema = (0, import_editor_elements5.getElementType)(this.type)?.propsSchema;
2417
2598
  if (!propsSchema?.tag) {
2418
2599
  return null;
2419
2600
  }
@@ -2557,8 +2738,8 @@ function registerElementType(type, elementTypeGenerator) {
2557
2738
  elementsLegacyTypes[type] = elementTypeGenerator;
2558
2739
  }
2559
2740
  function initLegacyViews() {
2560
- (0, import_editor_v1_adapters10.__privateListenTo)((0, import_editor_v1_adapters10.v1ReadyEvent)(), () => {
2561
- const widgetsCache = (0, import_editor_elements5.getWidgetsCache)() ?? {};
2741
+ (0, import_editor_v1_adapters12.__privateListenTo)((0, import_editor_v1_adapters12.v1ReadyEvent)(), () => {
2742
+ const widgetsCache = (0, import_editor_elements6.getWidgetsCache)() ?? {};
2562
2743
  const legacyWindow = window;
2563
2744
  const renderer = createDomRenderer();
2564
2745
  Object.entries(widgetsCache).forEach(([type, element]) => {
@@ -2633,7 +2814,7 @@ function initTabsModelExtensions() {
2633
2814
  }
2634
2815
 
2635
2816
  // src/mcp/resources/document-structure-resource.ts
2636
- var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
2817
+ var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
2637
2818
  var DOCUMENT_STRUCTURE_URI = "elementor://document/structure";
2638
2819
  var initDocumentStructureResource = (reg) => {
2639
2820
  const { mcpServer, sendResourceUpdated } = reg;
@@ -2646,14 +2827,14 @@ var initDocumentStructureResource = (reg) => {
2646
2827
  sendResourceUpdated({ uri: DOCUMENT_STRUCTURE_URI });
2647
2828
  }
2648
2829
  };
2649
- (0, import_editor_v1_adapters11.__privateListenTo)(
2830
+ (0, import_editor_v1_adapters13.__privateListenTo)(
2650
2831
  [
2651
- (0, import_editor_v1_adapters11.commandEndEvent)("document/elements/create"),
2652
- (0, import_editor_v1_adapters11.commandEndEvent)("document/elements/delete"),
2653
- (0, import_editor_v1_adapters11.commandEndEvent)("document/elements/move"),
2654
- (0, import_editor_v1_adapters11.commandEndEvent)("document/elements/copy"),
2655
- (0, import_editor_v1_adapters11.commandEndEvent)("document/elements/paste"),
2656
- (0, import_editor_v1_adapters11.commandEndEvent)("editor/documents/attach-preview")
2832
+ (0, import_editor_v1_adapters13.commandEndEvent)("document/elements/create"),
2833
+ (0, import_editor_v1_adapters13.commandEndEvent)("document/elements/delete"),
2834
+ (0, import_editor_v1_adapters13.commandEndEvent)("document/elements/move"),
2835
+ (0, import_editor_v1_adapters13.commandEndEvent)("document/elements/copy"),
2836
+ (0, import_editor_v1_adapters13.commandEndEvent)("document/elements/paste"),
2837
+ (0, import_editor_v1_adapters13.commandEndEvent)("editor/documents/attach-preview")
2657
2838
  ],
2658
2839
  updateDocumentStructure
2659
2840
  );
@@ -2708,13 +2889,13 @@ function extractElementData(element) {
2708
2889
  }
2709
2890
 
2710
2891
  // src/mcp/tools/build-composition/tool.ts
2711
- var import_editor_elements9 = require("@elementor/editor-elements");
2892
+ var import_editor_elements10 = require("@elementor/editor-elements");
2712
2893
 
2713
2894
  // src/composition-builder/composition-builder.ts
2714
- var import_editor_elements8 = require("@elementor/editor-elements");
2895
+ var import_editor_elements9 = require("@elementor/editor-elements");
2715
2896
 
2716
2897
  // src/mcp/utils/do-update-element-property.ts
2717
- var import_editor_elements6 = require("@elementor/editor-elements");
2898
+ var import_editor_elements7 = require("@elementor/editor-elements");
2718
2899
  var import_editor_props6 = require("@elementor/editor-props");
2719
2900
  var import_editor_styles5 = require("@elementor/editor-styles");
2720
2901
  function resolvePropValue(value, forceKey) {
@@ -2727,7 +2908,7 @@ function resolvePropValue(value, forceKey) {
2727
2908
  var doUpdateElementProperty = (params) => {
2728
2909
  const { elementId, propertyName, propertyValue, elementType } = params;
2729
2910
  if (propertyName === "_styles") {
2730
- const elementStyles = (0, import_editor_elements6.getElementStyles)(elementId) || {};
2911
+ const elementStyles = (0, import_editor_elements7.getElementStyles)(elementId) || {};
2731
2912
  const propertyMapValue = propertyValue;
2732
2913
  const styleSchema = (0, import_editor_styles5.getStylesSchema)();
2733
2914
  const transformedStyleValues = Object.fromEntries(
@@ -2775,7 +2956,7 @@ var doUpdateElementProperty = (params) => {
2775
2956
  delete transformedStyleValues.custom_css;
2776
2957
  const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
2777
2958
  if (!localStyle) {
2778
- (0, import_editor_elements6.createElementStyle)({
2959
+ (0, import_editor_elements7.createElementStyle)({
2779
2960
  elementId,
2780
2961
  ...typeof customCss !== "undefined" ? { custom_css: customCss } : {},
2781
2962
  classesProp: "classes",
@@ -2789,7 +2970,7 @@ var doUpdateElementProperty = (params) => {
2789
2970
  }
2790
2971
  });
2791
2972
  } else {
2792
- (0, import_editor_elements6.updateElementStyle)({
2973
+ (0, import_editor_elements7.updateElementStyle)({
2793
2974
  elementId,
2794
2975
  styleId: localStyle.id,
2795
2976
  meta: {
@@ -2804,7 +2985,7 @@ var doUpdateElementProperty = (params) => {
2804
2985
  }
2805
2986
  return;
2806
2987
  }
2807
- const elementPropSchema = (0, import_editor_elements6.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
2988
+ const elementPropSchema = (0, import_editor_elements7.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
2808
2989
  if (!elementPropSchema) {
2809
2990
  throw new Error(`No prop schema found for element type: ${elementType}`);
2810
2991
  }
@@ -2818,7 +2999,7 @@ var doUpdateElementProperty = (params) => {
2818
2999
  }
2819
3000
  const propKey = elementPropSchema[propertyName].key;
2820
3001
  const value = resolvePropValue(propertyValue, propKey);
2821
- (0, import_editor_elements6.updateElementSettings)({
3002
+ (0, import_editor_elements7.updateElementSettings)({
2822
3003
  id: elementId,
2823
3004
  props: {
2824
3005
  [propertyName]: value
@@ -2828,7 +3009,7 @@ var doUpdateElementProperty = (params) => {
2828
3009
  };
2829
3010
 
2830
3011
  // src/mcp/utils/validate-input.ts
2831
- var import_editor_elements7 = require("@elementor/editor-elements");
3012
+ var import_editor_elements8 = require("@elementor/editor-elements");
2832
3013
  var import_editor_props7 = require("@elementor/editor-props");
2833
3014
  var import_editor_styles6 = require("@elementor/editor-styles");
2834
3015
  var _widgetsSchema = null;
@@ -2836,7 +3017,7 @@ var validateInput = {
2836
3017
  get widgetsSchema() {
2837
3018
  if (!_widgetsSchema) {
2838
3019
  const schema2 = {};
2839
- const cache = (0, import_editor_elements7.getWidgetsCache)();
3020
+ const cache = (0, import_editor_elements8.getWidgetsCache)();
2840
3021
  if (!cache) {
2841
3022
  return {};
2842
3023
  }
@@ -2919,10 +3100,10 @@ var CompositionBuilder = class _CompositionBuilder {
2919
3100
  rootContainers = [];
2920
3101
  containerElements = [];
2921
3102
  api = {
2922
- createElement: import_editor_elements8.createElement,
2923
- getWidgetsCache: import_editor_elements8.getWidgetsCache,
2924
- generateElementId: import_editor_elements8.generateElementId,
2925
- getContainer: import_editor_elements8.getContainer,
3103
+ createElement: import_editor_elements9.createElement,
3104
+ getWidgetsCache: import_editor_elements9.getWidgetsCache,
3105
+ generateElementId: import_editor_elements9.generateElementId,
3106
+ getContainer: import_editor_elements9.getContainer,
2926
3107
  doUpdateElementProperty
2927
3108
  };
2928
3109
  xml;
@@ -2966,7 +3147,7 @@ var CompositionBuilder = class _CompositionBuilder {
2966
3147
  containerId: targetContainerId,
2967
3148
  model: {
2968
3149
  elType: elementTag,
2969
- id: (0, import_editor_elements8.generateElementId)()
3150
+ id: (0, import_editor_elements9.generateElementId)()
2970
3151
  },
2971
3152
  options: { useHistory: false }
2972
3153
  }) : this.api.createElement({
@@ -2974,7 +3155,7 @@ var CompositionBuilder = class _CompositionBuilder {
2974
3155
  model: {
2975
3156
  elType: "widget",
2976
3157
  widgetType: elementTag,
2977
- id: (0, import_editor_elements8.generateElementId)()
3158
+ id: (0, import_editor_elements9.generateElementId)()
2978
3159
  },
2979
3160
  options: { useHistory: false }
2980
3161
  });
@@ -3305,11 +3486,11 @@ var initBuildCompositionsTool = (reg) => {
3305
3486
  let generatedXML = "";
3306
3487
  const errors = [];
3307
3488
  const rootContainers = [];
3308
- const documentContainer = (0, import_editor_elements9.getContainer)("document");
3489
+ const documentContainer = (0, import_editor_elements10.getContainer)("document");
3309
3490
  try {
3310
3491
  const compositionBuilder = CompositionBuilder.fromXMLString(xmlStructure, {
3311
- createElement: import_editor_elements9.createElement,
3312
- getWidgetsCache: import_editor_elements9.getWidgetsCache
3492
+ createElement: import_editor_elements10.createElement,
3493
+ getWidgetsCache: import_editor_elements10.getWidgetsCache
3313
3494
  });
3314
3495
  compositionBuilder.setElementConfig(elementConfig);
3315
3496
  compositionBuilder.setStylesConfig(stylesConfig);
@@ -3344,7 +3525,7 @@ var initBuildCompositionsTool = (reg) => {
3344
3525
  }
3345
3526
  if (errors.length) {
3346
3527
  rootContainers.forEach((rootContainer) => {
3347
- (0, import_editor_elements9.deleteElement)({
3528
+ (0, import_editor_elements10.deleteElement)({
3348
3529
  elementId: rootContainer.id,
3349
3530
  options: { useHistory: false }
3350
3531
  });
@@ -3616,7 +3797,7 @@ Check the styles schema at the resource [${STYLE_SCHEMA_URI.replace(
3616
3797
  }
3617
3798
 
3618
3799
  // src/mcp/tools/get-element-config/tool.ts
3619
- var import_editor_elements10 = require("@elementor/editor-elements");
3800
+ var import_editor_elements11 = require("@elementor/editor-elements");
3620
3801
  var import_editor_props8 = require("@elementor/editor-props");
3621
3802
  var import_schema5 = require("@elementor/schema");
3622
3803
  var schema = {
@@ -3655,12 +3836,12 @@ var initGetElementConfigTool = (reg) => {
3655
3836
  speedPriority: 0.9
3656
3837
  },
3657
3838
  handler: async ({ elementId }) => {
3658
- const element = (0, import_editor_elements10.getContainer)(elementId);
3839
+ const element = (0, import_editor_elements11.getContainer)(elementId);
3659
3840
  if (!element) {
3660
3841
  throw new Error(`Element with ID ${elementId} not found.`);
3661
3842
  }
3662
3843
  const elementRawSettings = element.settings;
3663
- const propSchema = (0, import_editor_elements10.getWidgetsCache)()?.[element.model.get("widgetType") || element.model.get("elType") || ""]?.atomic_props_schema;
3844
+ const propSchema = (0, import_editor_elements11.getWidgetsCache)()?.[element.model.get("widgetType") || element.model.get("elType") || ""]?.atomic_props_schema;
3664
3845
  if (!elementRawSettings || !propSchema) {
3665
3846
  throw new Error(`No settings or prop schema found for element ID: ${elementId}`);
3666
3847
  }
@@ -3669,7 +3850,7 @@ var initGetElementConfigTool = (reg) => {
3669
3850
  import_editor_props8.Schema.configurableKeys(propSchema).forEach((key) => {
3670
3851
  propValues[key] = structuredClone(elementRawSettings.get(key));
3671
3852
  });
3672
- const elementStyles = (0, import_editor_elements10.getElementStyles)(elementId) || {};
3853
+ const elementStyles = (0, import_editor_elements11.getElementStyles)(elementId) || {};
3673
3854
  const localStyle = Object.values(elementStyles).find((style) => style.label === "local");
3674
3855
  if (localStyle) {
3675
3856
  const defaultVariant = localStyle.variants.find(
@@ -3827,16 +4008,16 @@ Note: The "size" property controls image resolution/loading, not visual size. Se
3827
4008
  `;
3828
4009
 
3829
4010
  // src/prevent-link-in-link-commands.ts
3830
- var import_editor_elements11 = require("@elementor/editor-elements");
3831
- var import_editor_notifications = require("@elementor/editor-notifications");
3832
- var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
3833
- var import_i18n2 = require("@wordpress/i18n");
4011
+ var import_editor_elements12 = require("@elementor/editor-elements");
4012
+ var import_editor_notifications3 = require("@elementor/editor-notifications");
4013
+ var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
4014
+ var import_i18n4 = require("@wordpress/i18n");
3834
4015
  function initLinkInLinkPrevention() {
3835
- (0, import_editor_v1_adapters12.blockCommand)({
4016
+ (0, import_editor_v1_adapters14.blockCommand)({
3836
4017
  command: "document/elements/paste",
3837
4018
  condition: blockLinkInLinkPaste
3838
4019
  });
3839
- (0, import_editor_v1_adapters12.blockCommand)({
4020
+ (0, import_editor_v1_adapters14.blockCommand)({
3840
4021
  command: "document/elements/move",
3841
4022
  condition: blockLinkInLinkMove
3842
4023
  });
@@ -3864,7 +4045,7 @@ function blockLinkInLinkPaste(args) {
3864
4045
  const sourceElements = data.clipboard.elements;
3865
4046
  const notification = {
3866
4047
  type: "default",
3867
- message: (0, import_i18n2.__)(
4048
+ message: (0, import_i18n4.__)(
3868
4049
  "To paste a link to this element, first remove the link from it's parent container.",
3869
4050
  "elementor"
3870
4051
  ),
@@ -3873,7 +4054,7 @@ function blockLinkInLinkPaste(args) {
3873
4054
  };
3874
4055
  const blocked = shouldBlock(sourceElements, targetElements);
3875
4056
  if (blocked) {
3876
- (0, import_editor_notifications.notify)(notification);
4057
+ (0, import_editor_notifications3.notify)(notification);
3877
4058
  }
3878
4059
  return blocked;
3879
4060
  }
@@ -3883,13 +4064,13 @@ function blockLinkInLinkMove(args) {
3883
4064
  const targetElement = target;
3884
4065
  const notification = {
3885
4066
  type: "default",
3886
- message: (0, import_i18n2.__)("To drag a link to this element, first remove the link from it's parent container.", "elementor"),
4067
+ message: (0, import_i18n4.__)("To drag a link to this element, first remove the link from it's parent container.", "elementor"),
3887
4068
  id: "move-in-link-blocked",
3888
4069
  additionalActionProps: [learnMoreActionProps]
3889
4070
  };
3890
4071
  const isBlocked = shouldBlock(sourceElements, [targetElement]);
3891
4072
  if (isBlocked) {
3892
- (0, import_editor_notifications.notify)(notification);
4073
+ (0, import_editor_notifications3.notify)(notification);
3893
4074
  }
3894
4075
  return isBlocked;
3895
4076
  }
@@ -3898,32 +4079,32 @@ function shouldBlock(sourceElements, targetElements) {
3898
4079
  return false;
3899
4080
  }
3900
4081
  const isSourceContainsAnAnchor = sourceElements.some((src) => {
3901
- return src?.id ? (0, import_editor_elements11.isElementAnchored)(src.id) || !!(0, import_editor_elements11.getAnchoredDescendantId)(src.id) : false;
4082
+ return src?.id ? (0, import_editor_elements12.isElementAnchored)(src.id) || !!(0, import_editor_elements12.getAnchoredDescendantId)(src.id) : false;
3902
4083
  });
3903
4084
  if (!isSourceContainsAnAnchor) {
3904
4085
  return false;
3905
4086
  }
3906
4087
  const isTargetContainsAnAnchor = targetElements.some((target) => {
3907
- return target?.id ? (0, import_editor_elements11.isElementAnchored)(target.id) || !!(0, import_editor_elements11.getAnchoredAncestorId)(target.id) : false;
4088
+ return target?.id ? (0, import_editor_elements12.isElementAnchored)(target.id) || !!(0, import_editor_elements12.getAnchoredAncestorId)(target.id) : false;
3908
4089
  });
3909
4090
  return isTargetContainsAnAnchor;
3910
4091
  }
3911
4092
 
3912
4093
  // src/style-commands/paste-style.ts
3913
- var import_editor_elements14 = require("@elementor/editor-elements");
4094
+ var import_editor_elements15 = require("@elementor/editor-elements");
3914
4095
  var import_editor_props10 = require("@elementor/editor-props");
3915
- var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
4096
+ var import_editor_v1_adapters16 = require("@elementor/editor-v1-adapters");
3916
4097
 
3917
4098
  // src/style-commands/undoable-actions/paste-element-style.ts
3918
- var import_editor_elements13 = require("@elementor/editor-elements");
4099
+ var import_editor_elements14 = require("@elementor/editor-elements");
3919
4100
  var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
3920
- var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
3921
- var import_i18n4 = require("@wordpress/i18n");
4101
+ var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
4102
+ var import_i18n6 = require("@wordpress/i18n");
3922
4103
 
3923
4104
  // src/style-commands/utils.ts
3924
- var import_editor_elements12 = require("@elementor/editor-elements");
4105
+ var import_editor_elements13 = require("@elementor/editor-elements");
3925
4106
  var import_editor_props9 = require("@elementor/editor-props");
3926
- var import_i18n3 = require("@wordpress/i18n");
4107
+ var import_i18n5 = require("@wordpress/i18n");
3927
4108
  function hasAtomicWidgets(args) {
3928
4109
  const { containers = [args.container] } = args;
3929
4110
  return containers.some(isAtomicWidget);
@@ -3946,7 +4127,7 @@ function getClassesProp(container) {
3946
4127
  }
3947
4128
  function getContainerSchema(container) {
3948
4129
  const type = container?.model.get("widgetType") || container?.model.get("elType");
3949
- const widgetsCache = (0, import_editor_elements12.getWidgetsCache)();
4130
+ const widgetsCache = (0, import_editor_elements13.getWidgetsCache)();
3950
4131
  const elementType = widgetsCache?.[type];
3951
4132
  return elementType?.atomic_props_schema ?? null;
3952
4133
  }
@@ -3959,11 +4140,11 @@ function getClipboardElements(storageKey = "clipboard") {
3959
4140
  }
3960
4141
  }
3961
4142
  function getTitleForContainers(containers) {
3962
- return containers.length > 1 ? (0, import_i18n3.__)("Elements", "elementor") : (0, import_editor_elements12.getElementLabel)(containers[0].id);
4143
+ return containers.length > 1 ? (0, import_i18n5.__)("Elements", "elementor") : (0, import_editor_elements13.getElementLabel)(containers[0].id);
3963
4144
  }
3964
4145
 
3965
4146
  // src/style-commands/undoable-actions/paste-element-style.ts
3966
- var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
4147
+ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
3967
4148
  {
3968
4149
  do: ({ containers, newStyle }) => {
3969
4150
  return containers.map((container) => {
@@ -3972,7 +4153,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
3972
4153
  if (!classesProp) {
3973
4154
  return null;
3974
4155
  }
3975
- const originalStyles = (0, import_editor_elements13.getElementStyles)(container.id);
4156
+ const originalStyles = (0, import_editor_elements14.getElementStyles)(container.id);
3976
4157
  const [styleId, styleDef] = Object.entries(originalStyles ?? {})[0] ?? [];
3977
4158
  const originalStyle = Object.keys(styleDef ?? {}).length ? styleDef : null;
3978
4159
  const revertData = {
@@ -3981,7 +4162,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
3981
4162
  };
3982
4163
  if (styleId) {
3983
4164
  newStyle.variants.forEach(({ meta, props, custom_css: customCss }) => {
3984
- (0, import_editor_elements13.updateElementStyle)({
4165
+ (0, import_editor_elements14.updateElementStyle)({
3985
4166
  elementId,
3986
4167
  styleId,
3987
4168
  meta,
@@ -3992,7 +4173,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
3992
4173
  } else {
3993
4174
  const [firstVariant] = newStyle.variants;
3994
4175
  const additionalVariants = newStyle.variants.slice(1);
3995
- revertData.styleId = (0, import_editor_elements13.createElementStyle)({
4176
+ revertData.styleId = (0, import_editor_elements14.createElementStyle)({
3996
4177
  elementId,
3997
4178
  classesProp,
3998
4179
  label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
@@ -4010,7 +4191,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
4010
4191
  return;
4011
4192
  }
4012
4193
  if (!revertData.originalStyle) {
4013
- (0, import_editor_elements13.deleteElementStyle)(container.id, revertData.styleId);
4194
+ (0, import_editor_elements14.deleteElementStyle)(container.id, revertData.styleId);
4014
4195
  return;
4015
4196
  }
4016
4197
  const classesProp = getClassesProp(container);
@@ -4019,7 +4200,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
4019
4200
  }
4020
4201
  const [firstVariant] = revertData.originalStyle.variants;
4021
4202
  const additionalVariants = revertData.originalStyle.variants.slice(1);
4022
- (0, import_editor_elements13.createElementStyle)({
4203
+ (0, import_editor_elements14.createElementStyle)({
4023
4204
  elementId: container.id,
4024
4205
  classesProp,
4025
4206
  label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
@@ -4032,19 +4213,19 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters13.undoable)(
4032
4213
  },
4033
4214
  {
4034
4215
  title: ({ containers }) => getTitleForContainers(containers),
4035
- subtitle: (0, import_i18n4.__)("Style Pasted", "elementor")
4216
+ subtitle: (0, import_i18n6.__)("Style Pasted", "elementor")
4036
4217
  }
4037
4218
  );
4038
4219
 
4039
4220
  // src/style-commands/paste-style.ts
4040
4221
  function initPasteStyleCommand() {
4041
4222
  const pasteElementStyleCommand = undoablePasteElementStyle();
4042
- (0, import_editor_v1_adapters14.blockCommand)({
4223
+ (0, import_editor_v1_adapters16.blockCommand)({
4043
4224
  command: "document/elements/paste-style",
4044
4225
  condition: hasAtomicWidgets
4045
4226
  });
4046
- (0, import_editor_v1_adapters14.__privateListenTo)(
4047
- (0, import_editor_v1_adapters14.commandStartEvent)("document/elements/paste-style"),
4227
+ (0, import_editor_v1_adapters16.__privateListenTo)(
4228
+ (0, import_editor_v1_adapters16.commandStartEvent)("document/elements/paste-style"),
4048
4229
  (e) => pasteStyles(e.args, pasteElementStyleCommand)
4049
4230
  );
4050
4231
  }
@@ -4056,7 +4237,7 @@ function pasteStyles(args, pasteLocalStyle) {
4056
4237
  }
4057
4238
  const clipboardElements = getClipboardElements(storageKey);
4058
4239
  const [clipboardElement] = clipboardElements ?? [];
4059
- const clipboardContainer = (0, import_editor_elements14.getContainer)(clipboardElement.id);
4240
+ const clipboardContainer = (0, import_editor_elements15.getContainer)(clipboardElement.id);
4060
4241
  if (!clipboardElement || !clipboardContainer || !isAtomicWidget(clipboardContainer)) {
4061
4242
  return;
4062
4243
  }
@@ -4075,7 +4256,7 @@ function getClassesWithoutLocalStyle(clipboardContainer, style) {
4075
4256
  if (!classesProp) {
4076
4257
  return [];
4077
4258
  }
4078
- const classesSetting = (0, import_editor_elements14.getElementSetting)(clipboardContainer.id, classesProp);
4259
+ const classesSetting = (0, import_editor_elements15.getElementSetting)(clipboardContainer.id, classesProp);
4079
4260
  return classesSetting?.value.filter((styleId) => styleId !== style?.id) ?? [];
4080
4261
  }
4081
4262
  function pasteClasses(containers, classes) {
@@ -4084,10 +4265,10 @@ function pasteClasses(containers, classes) {
4084
4265
  if (!classesProp) {
4085
4266
  return;
4086
4267
  }
4087
- const classesSetting = (0, import_editor_elements14.getElementSetting)(container.id, classesProp);
4268
+ const classesSetting = (0, import_editor_elements15.getElementSetting)(container.id, classesProp);
4088
4269
  const currentClasses = import_editor_props10.classesPropTypeUtil.extract(classesSetting) ?? [];
4089
4270
  const newClasses = import_editor_props10.classesPropTypeUtil.create(Array.from(/* @__PURE__ */ new Set([...classes, ...currentClasses])));
4090
- (0, import_editor_elements14.updateElementSettings)({
4271
+ (0, import_editor_elements15.updateElementSettings)({
4091
4272
  id: container.id,
4092
4273
  props: { [classesProp]: newClasses }
4093
4274
  });
@@ -4095,21 +4276,21 @@ function pasteClasses(containers, classes) {
4095
4276
  }
4096
4277
 
4097
4278
  // src/style-commands/reset-style.ts
4098
- var import_editor_v1_adapters16 = require("@elementor/editor-v1-adapters");
4279
+ var import_editor_v1_adapters18 = require("@elementor/editor-v1-adapters");
4099
4280
 
4100
4281
  // src/style-commands/undoable-actions/reset-element-style.ts
4101
- var import_editor_elements15 = require("@elementor/editor-elements");
4282
+ var import_editor_elements16 = require("@elementor/editor-elements");
4102
4283
  var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
4103
- var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
4104
- var import_i18n5 = require("@wordpress/i18n");
4105
- var undoableResetElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
4284
+ var import_editor_v1_adapters17 = require("@elementor/editor-v1-adapters");
4285
+ var import_i18n7 = require("@wordpress/i18n");
4286
+ var undoableResetElementStyle = () => (0, import_editor_v1_adapters17.undoable)(
4106
4287
  {
4107
4288
  do: ({ containers }) => {
4108
4289
  return containers.map((container) => {
4109
4290
  const elementId = container.model.get("id");
4110
- const containerStyles = (0, import_editor_elements15.getElementStyles)(elementId);
4291
+ const containerStyles = (0, import_editor_elements16.getElementStyles)(elementId);
4111
4292
  Object.keys(containerStyles ?? {}).forEach(
4112
- (styleId) => (0, import_editor_elements15.deleteElementStyle)(elementId, styleId)
4293
+ (styleId) => (0, import_editor_elements16.deleteElementStyle)(elementId, styleId)
4113
4294
  );
4114
4295
  return containerStyles;
4115
4296
  });
@@ -4125,7 +4306,7 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
4125
4306
  Object.entries(containerStyles ?? {}).forEach(([styleId, style]) => {
4126
4307
  const [firstVariant] = style.variants;
4127
4308
  const additionalVariants = style.variants.slice(1);
4128
- (0, import_editor_elements15.createElementStyle)({
4309
+ (0, import_editor_elements16.createElementStyle)({
4129
4310
  elementId,
4130
4311
  classesProp,
4131
4312
  styleId,
@@ -4139,19 +4320,19 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters15.undoable)(
4139
4320
  },
4140
4321
  {
4141
4322
  title: ({ containers }) => getTitleForContainers(containers),
4142
- subtitle: (0, import_i18n5.__)("Style Reset", "elementor")
4323
+ subtitle: (0, import_i18n7.__)("Style Reset", "elementor")
4143
4324
  }
4144
4325
  );
4145
4326
 
4146
4327
  // src/style-commands/reset-style.ts
4147
4328
  function initResetStyleCommand() {
4148
4329
  const resetElementStyles = undoableResetElementStyle();
4149
- (0, import_editor_v1_adapters16.blockCommand)({
4330
+ (0, import_editor_v1_adapters18.blockCommand)({
4150
4331
  command: "document/elements/reset-style",
4151
4332
  condition: hasAtomicWidgets
4152
4333
  });
4153
- (0, import_editor_v1_adapters16.__privateListenTo)(
4154
- (0, import_editor_v1_adapters16.commandStartEvent)("document/elements/reset-style"),
4334
+ (0, import_editor_v1_adapters18.__privateListenTo)(
4335
+ (0, import_editor_v1_adapters18.commandStartEvent)("document/elements/reset-style"),
4155
4336
  (e) => resetStyles(e.args, resetElementStyles)
4156
4337
  );
4157
4338
  }
@@ -4175,6 +4356,8 @@ function init() {
4175
4356
  initStyleTransformers();
4176
4357
  initStyleCommands();
4177
4358
  initLinkInLinkPrevention();
4359
+ initFormNestingPrevention();
4360
+ initFormAncestorEnforcement();
4178
4361
  initViewReplacements();
4179
4362
  initLegacyViews();
4180
4363
  initSettingsTransformers();