@elementor/editor-canvas 4.4.0-1138 → 4.4.0-1139
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 +238 -132
- package/dist/index.mjs +135 -29
- package/package.json +20 -20
- package/src/form-structure/__tests__/honeypot-hint.test.ts +137 -0
- package/src/form-structure/__tests__/prevent-duplicate-honeypot-commands.test.ts +133 -0
- package/src/form-structure/honeypot-hint.ts +29 -0
- package/src/form-structure/prevent-duplicate-honeypot-commands.ts +87 -0
- package/src/form-structure/utils.ts +29 -0
- package/src/init.tsx +4 -0
package/dist/index.js
CHANGED
|
@@ -1798,6 +1798,7 @@ var import_i18n = require("@wordpress/i18n");
|
|
|
1798
1798
|
var import_editor_elements4 = require("@elementor/editor-elements");
|
|
1799
1799
|
var FORM_ELEMENT_TYPE = "e-form";
|
|
1800
1800
|
var FORM_HIDDEN_FIELD_ELEMENT_TYPE = "e-form-hidden";
|
|
1801
|
+
var FORM_HONEYPOT_ELEMENT_TYPE = "e-form-honeypot";
|
|
1801
1802
|
var FORM_FIELD_ELEMENT_TYPES = /* @__PURE__ */ new Set([
|
|
1802
1803
|
"e-form-input",
|
|
1803
1804
|
"e-form-textarea",
|
|
@@ -1809,11 +1810,31 @@ var FORM_FIELD_ELEMENT_TYPES = /* @__PURE__ */ new Set([
|
|
|
1809
1810
|
"e-form-file-upload",
|
|
1810
1811
|
"e-form-date-picker",
|
|
1811
1812
|
"e-form-time-picker",
|
|
1812
|
-
FORM_HIDDEN_FIELD_ELEMENT_TYPE
|
|
1813
|
+
FORM_HIDDEN_FIELD_ELEMENT_TYPE,
|
|
1814
|
+
FORM_HONEYPOT_ELEMENT_TYPE
|
|
1813
1815
|
]);
|
|
1814
1816
|
function getArgsElementType(args) {
|
|
1815
1817
|
return args.model?.widgetType || args.model?.elType;
|
|
1816
1818
|
}
|
|
1819
|
+
function hasModelElementType(model, type) {
|
|
1820
|
+
if (!model) {
|
|
1821
|
+
return false;
|
|
1822
|
+
}
|
|
1823
|
+
if ((model.widgetType || model.elType) === type) {
|
|
1824
|
+
return true;
|
|
1825
|
+
}
|
|
1826
|
+
return (model.elements ?? []).some((child) => hasModelElementType(child, type));
|
|
1827
|
+
}
|
|
1828
|
+
function getFormContainer(element) {
|
|
1829
|
+
let current = element;
|
|
1830
|
+
while (current) {
|
|
1831
|
+
if (getElementType(current) === FORM_ELEMENT_TYPE) {
|
|
1832
|
+
return current;
|
|
1833
|
+
}
|
|
1834
|
+
current = current.parent;
|
|
1835
|
+
}
|
|
1836
|
+
return void 0;
|
|
1837
|
+
}
|
|
1817
1838
|
function getElementType(element) {
|
|
1818
1839
|
return element?.model.get("widgetType") || element?.model.get("elType");
|
|
1819
1840
|
}
|
|
@@ -1950,25 +1971,108 @@ function initHiddenFieldHint() {
|
|
|
1950
1971
|
});
|
|
1951
1972
|
}
|
|
1952
1973
|
|
|
1953
|
-
// src/form-structure/
|
|
1974
|
+
// src/form-structure/honeypot-hint.ts
|
|
1954
1975
|
var import_editor_notifications3 = require("@elementor/editor-notifications");
|
|
1955
1976
|
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
1956
1977
|
var import_i18n3 = require("@wordpress/i18n");
|
|
1978
|
+
var MOVE_COMMAND2 = "document/elements/move";
|
|
1979
|
+
var notificationCounter2 = 0;
|
|
1980
|
+
function createHoneypotNotification() {
|
|
1981
|
+
return {
|
|
1982
|
+
type: "default",
|
|
1983
|
+
message: (0, import_i18n3.__)("Honeypot added - invisible on your form. Reorder it in the Structure panel.", "elementor"),
|
|
1984
|
+
id: `honeypot-added-${++notificationCounter2}`
|
|
1985
|
+
};
|
|
1986
|
+
}
|
|
1987
|
+
function initHoneypotHint() {
|
|
1988
|
+
(0, import_editor_v1_adapters13.registerDataHook)("after", "document/elements/create", (args, _result, options) => {
|
|
1989
|
+
if (options?.commandsCurrentTrace?.includes(MOVE_COMMAND2)) {
|
|
1990
|
+
return;
|
|
1991
|
+
}
|
|
1992
|
+
if (getArgsElementType(args) === FORM_HONEYPOT_ELEMENT_TYPE) {
|
|
1993
|
+
(0, import_editor_notifications3.notify)(createHoneypotNotification());
|
|
1994
|
+
}
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
// src/form-structure/prevent-duplicate-honeypot-commands.ts
|
|
1999
|
+
var import_editor_elements5 = require("@elementor/editor-elements");
|
|
2000
|
+
var import_editor_notifications4 = require("@elementor/editor-notifications");
|
|
2001
|
+
var import_editor_v1_adapters14 = require("@elementor/editor-v1-adapters");
|
|
2002
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
2003
|
+
var MOVE_COMMAND3 = "document/elements/move";
|
|
2004
|
+
var DUPLICATE_HONEYPOT_ALERT = {
|
|
2005
|
+
type: "default",
|
|
2006
|
+
message: (0, import_i18n4.__)("Only one Honeypot can be added per form.", "elementor"),
|
|
2007
|
+
id: "duplicate-honeypot-blocked"
|
|
2008
|
+
};
|
|
2009
|
+
function initDuplicateHoneypotPrevention() {
|
|
2010
|
+
(0, import_editor_v1_adapters14.registerDataHook)("dependency", "document/elements/create", (args, options) => {
|
|
2011
|
+
return !blockHoneypotCreate(args, options);
|
|
2012
|
+
});
|
|
2013
|
+
(0, import_editor_v1_adapters14.blockCommand)({
|
|
2014
|
+
command: "document/elements/move",
|
|
2015
|
+
condition: blockHoneypotMove
|
|
2016
|
+
});
|
|
2017
|
+
}
|
|
2018
|
+
function blockHoneypotCreate(args, options) {
|
|
2019
|
+
if (options?.commandsCurrentTrace?.includes(MOVE_COMMAND3)) {
|
|
2020
|
+
return false;
|
|
2021
|
+
}
|
|
2022
|
+
if (!hasModelElementType(args.model, FORM_HONEYPOT_ELEMENT_TYPE)) {
|
|
2023
|
+
return false;
|
|
2024
|
+
}
|
|
2025
|
+
const containers = args.containers ?? [args.container];
|
|
2026
|
+
if (containers.some((container) => formHasHoneypot(getFormContainer(container)))) {
|
|
2027
|
+
handleBlockedHoneypot();
|
|
2028
|
+
return true;
|
|
2029
|
+
}
|
|
2030
|
+
return false;
|
|
2031
|
+
}
|
|
2032
|
+
function blockHoneypotMove(args) {
|
|
2033
|
+
const { containers = [args.container], target } = args;
|
|
2034
|
+
const movedContainers = containers.filter((container) => !!container);
|
|
2035
|
+
if (!movedContainers.some((container) => hasElementType(container, FORM_HONEYPOT_ELEMENT_TYPE))) {
|
|
2036
|
+
return false;
|
|
2037
|
+
}
|
|
2038
|
+
const movedElements = new Set(movedContainers.flatMap((container) => (0, import_editor_elements5.getAllDescendants)(container)));
|
|
2039
|
+
if (formHasHoneypot(getFormContainer(target), movedElements)) {
|
|
2040
|
+
handleBlockedHoneypot();
|
|
2041
|
+
return true;
|
|
2042
|
+
}
|
|
2043
|
+
return false;
|
|
2044
|
+
}
|
|
2045
|
+
function formHasHoneypot(form, excluded = /* @__PURE__ */ new Set()) {
|
|
2046
|
+
if (!form) {
|
|
2047
|
+
return false;
|
|
2048
|
+
}
|
|
2049
|
+
return (0, import_editor_elements5.getAllDescendants)(form).some(
|
|
2050
|
+
(element) => !excluded.has(element) && getElementType(element) === FORM_HONEYPOT_ELEMENT_TYPE
|
|
2051
|
+
);
|
|
2052
|
+
}
|
|
2053
|
+
function handleBlockedHoneypot() {
|
|
2054
|
+
(0, import_editor_notifications4.notify)(DUPLICATE_HONEYPOT_ALERT);
|
|
2055
|
+
}
|
|
2056
|
+
|
|
2057
|
+
// src/form-structure/prevent-form-nesting-commands.ts
|
|
2058
|
+
var import_editor_notifications5 = require("@elementor/editor-notifications");
|
|
2059
|
+
var import_editor_v1_adapters15 = require("@elementor/editor-v1-adapters");
|
|
2060
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
1957
2061
|
var FORM_NESTING_ALERT = {
|
|
1958
2062
|
type: "default",
|
|
1959
|
-
message: (0,
|
|
2063
|
+
message: (0, import_i18n5.__)("Forms can't be nested. Create separate forms instead.", "elementor"),
|
|
1960
2064
|
id: "form-nesting-blocked"
|
|
1961
2065
|
};
|
|
1962
2066
|
function initFormNestingPrevention() {
|
|
1963
|
-
(0,
|
|
2067
|
+
(0, import_editor_v1_adapters15.blockCommand)({
|
|
1964
2068
|
command: "document/elements/create",
|
|
1965
2069
|
condition: blockFormCreate
|
|
1966
2070
|
});
|
|
1967
|
-
(0,
|
|
2071
|
+
(0, import_editor_v1_adapters15.blockCommand)({
|
|
1968
2072
|
command: "document/elements/move",
|
|
1969
2073
|
condition: blockFormMove
|
|
1970
2074
|
});
|
|
1971
|
-
(0,
|
|
2075
|
+
(0, import_editor_v1_adapters15.blockCommand)({
|
|
1972
2076
|
command: "document/elements/paste",
|
|
1973
2077
|
condition: blockFormPaste
|
|
1974
2078
|
});
|
|
@@ -2012,7 +2116,7 @@ function blockFormPaste(args) {
|
|
|
2012
2116
|
return false;
|
|
2013
2117
|
}
|
|
2014
2118
|
function handleBlockedFormField2() {
|
|
2015
|
-
(0,
|
|
2119
|
+
(0, import_editor_notifications5.notify)(FORM_NESTING_ALERT);
|
|
2016
2120
|
}
|
|
2017
2121
|
|
|
2018
2122
|
// src/settings-transformers-registry.ts
|
|
@@ -2703,8 +2807,8 @@ function initStyleTransformers() {
|
|
|
2703
2807
|
}
|
|
2704
2808
|
|
|
2705
2809
|
// src/legacy/init-legacy-views.ts
|
|
2706
|
-
var
|
|
2707
|
-
var
|
|
2810
|
+
var import_editor_elements9 = require("@elementor/editor-elements");
|
|
2811
|
+
var import_editor_v1_adapters17 = require("@elementor/editor-v1-adapters");
|
|
2708
2812
|
|
|
2709
2813
|
// src/renderers/create-dom-renderer.ts
|
|
2710
2814
|
var import_twing = require("@elementor/twing");
|
|
@@ -2817,7 +2921,7 @@ function createElementViewClassDeclaration() {
|
|
|
2817
2921
|
}
|
|
2818
2922
|
|
|
2819
2923
|
// src/legacy/create-nested-templated-element-type.ts
|
|
2820
|
-
var
|
|
2924
|
+
var import_editor_elements7 = require("@elementor/editor-elements");
|
|
2821
2925
|
|
|
2822
2926
|
// src/renderers/compute-html-tag.ts
|
|
2823
2927
|
var DEFAULT_LINK_TAG = "a";
|
|
@@ -2866,17 +2970,17 @@ function isRecord(value) {
|
|
|
2866
2970
|
}
|
|
2867
2971
|
|
|
2868
2972
|
// src/legacy/create-pending-element.ts
|
|
2869
|
-
var
|
|
2973
|
+
var import_editor_elements6 = require("@elementor/editor-elements");
|
|
2870
2974
|
function createPendingElement(wrapperView, data, options = {}) {
|
|
2871
2975
|
const parentContainer = wrapperView.getContainer();
|
|
2872
|
-
const model = options.clone ? (0,
|
|
2976
|
+
const model = options.clone ? (0, import_editor_elements6.cloneElementTree)(data) : { ...data };
|
|
2873
2977
|
if (!options.clone && !model.id) {
|
|
2874
|
-
model.id = (0,
|
|
2978
|
+
model.id = (0, import_editor_elements6.generateElementId)();
|
|
2875
2979
|
}
|
|
2876
2980
|
if (!model.elements) {
|
|
2877
2981
|
model.elements = [];
|
|
2878
2982
|
}
|
|
2879
|
-
const added = (0,
|
|
2983
|
+
const added = (0, import_editor_elements6.addModelToParent)(parentContainer.id, model, {
|
|
2880
2984
|
...options,
|
|
2881
2985
|
clone: false
|
|
2882
2986
|
});
|
|
@@ -2884,7 +2988,7 @@ function createPendingElement(wrapperView, data, options = {}) {
|
|
|
2884
2988
|
return void 0;
|
|
2885
2989
|
}
|
|
2886
2990
|
const childId = model.id;
|
|
2887
|
-
const childModel = (0,
|
|
2991
|
+
const childModel = (0, import_editor_elements6.findModelInDocument)(childId);
|
|
2888
2992
|
if (!childModel) {
|
|
2889
2993
|
return void 0;
|
|
2890
2994
|
}
|
|
@@ -2895,7 +2999,7 @@ function createPendingElement(wrapperView, data, options = {}) {
|
|
|
2895
2999
|
model: childModel,
|
|
2896
3000
|
view: void 0,
|
|
2897
3001
|
lookup() {
|
|
2898
|
-
return (0,
|
|
3002
|
+
return (0, import_editor_elements6.getContainer)(childId) ?? pendingContainer;
|
|
2899
3003
|
}
|
|
2900
3004
|
};
|
|
2901
3005
|
wrapperView.once("render", () => {
|
|
@@ -2908,7 +3012,7 @@ function createPendingElement(wrapperView, data, options = {}) {
|
|
|
2908
3012
|
}
|
|
2909
3013
|
function selectChildWhenWrapperRenders(wrapperView, childId) {
|
|
2910
3014
|
wrapperView.once("render", () => {
|
|
2911
|
-
const childContainer = (0,
|
|
3015
|
+
const childContainer = (0, import_editor_elements6.getContainer)(childId);
|
|
2912
3016
|
if (childContainer?.model?.trigger) {
|
|
2913
3017
|
childContainer.model.trigger("request:edit");
|
|
2914
3018
|
return;
|
|
@@ -3204,7 +3308,7 @@ function createNestedTemplatedElementView({
|
|
|
3204
3308
|
return;
|
|
3205
3309
|
}
|
|
3206
3310
|
this._lastRenderedStyles = styles;
|
|
3207
|
-
window.dispatchEvent(new CustomEvent(
|
|
3311
|
+
window.dispatchEvent(new CustomEvent(import_editor_elements7.ELEMENT_STYLE_CHANGE_EVENT));
|
|
3208
3312
|
},
|
|
3209
3313
|
async _renderTemplate() {
|
|
3210
3314
|
const model = this.model;
|
|
@@ -3453,10 +3557,10 @@ var import_client = require("react-dom/client");
|
|
|
3453
3557
|
|
|
3454
3558
|
// src/legacy/replacements/inline-editing/inline-editing-elements.tsx
|
|
3455
3559
|
var React11 = __toESM(require("react"));
|
|
3456
|
-
var
|
|
3560
|
+
var import_editor_elements8 = require("@elementor/editor-elements");
|
|
3457
3561
|
var import_editor_props4 = require("@elementor/editor-props");
|
|
3458
|
-
var
|
|
3459
|
-
var
|
|
3562
|
+
var import_editor_v1_adapters16 = require("@elementor/editor-v1-adapters");
|
|
3563
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
3460
3564
|
|
|
3461
3565
|
// src/legacy/replacements/base.ts
|
|
3462
3566
|
var TRIGGER_TIMING = {
|
|
@@ -3773,7 +3877,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3773
3877
|
return this.editing;
|
|
3774
3878
|
}
|
|
3775
3879
|
shouldRenderReplacement() {
|
|
3776
|
-
return this.isInlineEditingEligible() && (0,
|
|
3880
|
+
return this.isInlineEditingEligible() && (0, import_editor_v1_adapters16.getCurrentEditMode)() === "edit";
|
|
3777
3881
|
}
|
|
3778
3882
|
handleRenderInlineEditor = () => {
|
|
3779
3883
|
if (this.isEditingModeActive() || !this.isInlineEditingEligible()) {
|
|
@@ -3829,7 +3933,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3829
3933
|
return INLINE_EDITING_PROPERTY_PER_TYPE[this.type] ?? "";
|
|
3830
3934
|
}
|
|
3831
3935
|
getInlineEditablePropType() {
|
|
3832
|
-
const propSchema = (0,
|
|
3936
|
+
const propSchema = (0, import_editor_elements8.getElementType)(this.type)?.propsSchema;
|
|
3833
3937
|
const propertyName = this.getInlineEditablePropertyName();
|
|
3834
3938
|
return propSchema?.[propertyName] ?? null;
|
|
3835
3939
|
}
|
|
@@ -3860,7 +3964,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3860
3964
|
setContentValue(value) {
|
|
3861
3965
|
const settingKey = this.getInlineEditablePropertyName();
|
|
3862
3966
|
const valueToSave = this.createContentPropValue(value);
|
|
3863
|
-
(0,
|
|
3967
|
+
(0, import_editor_v1_adapters16.undoable)(
|
|
3864
3968
|
{
|
|
3865
3969
|
do: () => {
|
|
3866
3970
|
const prevValue = this.getInlineEditablePropValue();
|
|
@@ -3872,9 +3976,9 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3872
3976
|
}
|
|
3873
3977
|
},
|
|
3874
3978
|
{
|
|
3875
|
-
title: (0,
|
|
3979
|
+
title: (0, import_editor_elements8.getElementLabel)(this.id),
|
|
3876
3980
|
// translators: %s is the name of the property that was edited.
|
|
3877
|
-
subtitle: (0,
|
|
3981
|
+
subtitle: (0, import_i18n6.__)("%s edited", "elementor").replace(
|
|
3878
3982
|
"%s",
|
|
3879
3983
|
this.getInlineEditablePropTypeKey() ?? "Inline editing"
|
|
3880
3984
|
),
|
|
@@ -3902,17 +4006,17 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3902
4006
|
return null;
|
|
3903
4007
|
}
|
|
3904
4008
|
runCommand(key, value) {
|
|
3905
|
-
(0,
|
|
4009
|
+
(0, import_editor_v1_adapters16.__privateRunCommandSync)(
|
|
3906
4010
|
"document/elements/set-settings",
|
|
3907
4011
|
{
|
|
3908
|
-
container: (0,
|
|
4012
|
+
container: (0, import_editor_elements8.getContainer)(this.id),
|
|
3909
4013
|
settings: {
|
|
3910
4014
|
[key]: value
|
|
3911
4015
|
}
|
|
3912
4016
|
},
|
|
3913
4017
|
{ internal: true }
|
|
3914
4018
|
);
|
|
3915
|
-
(0,
|
|
4019
|
+
(0, import_editor_v1_adapters16.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
|
|
3916
4020
|
}
|
|
3917
4021
|
getExpectedTag() {
|
|
3918
4022
|
const tagPropType = this.getTagPropType();
|
|
@@ -3920,7 +4024,7 @@ var InlineEditingReplacement = class extends ReplacementBase {
|
|
|
3920
4024
|
return import_editor_props4.stringPropTypeUtil.extract(this.getSetting(tagSettingKey) ?? null) ?? import_editor_props4.stringPropTypeUtil.extract(tagPropType?.default ?? null) ?? null;
|
|
3921
4025
|
}
|
|
3922
4026
|
getTagPropType() {
|
|
3923
|
-
const propsSchema = (0,
|
|
4027
|
+
const propsSchema = (0, import_editor_elements8.getElementType)(this.type)?.propsSchema;
|
|
3924
4028
|
if (!propsSchema?.tag) {
|
|
3925
4029
|
return null;
|
|
3926
4030
|
}
|
|
@@ -4077,13 +4181,13 @@ function registerModelExtensions(type, extensions) {
|
|
|
4077
4181
|
}
|
|
4078
4182
|
function registerElementType(type, elementTypeGenerator) {
|
|
4079
4183
|
elementsLegacyTypes[type] = elementTypeGenerator;
|
|
4080
|
-
if ((0,
|
|
4184
|
+
if ((0, import_editor_v1_adapters17.__privateIsReady)()) {
|
|
4081
4185
|
registerElementInLegacyManager(type, createDomRenderer());
|
|
4082
4186
|
}
|
|
4083
4187
|
}
|
|
4084
4188
|
function initLegacyViews() {
|
|
4085
|
-
(0,
|
|
4086
|
-
const widgetsCache = (0,
|
|
4189
|
+
(0, import_editor_v1_adapters17.__privateListenTo)((0, import_editor_v1_adapters17.v1ReadyEvent)(), () => {
|
|
4190
|
+
const widgetsCache = (0, import_editor_elements9.getWidgetsCache)() ?? {};
|
|
4087
4191
|
const renderer = createDomRenderer();
|
|
4088
4192
|
registerProPromotionTypes(widgetsCache);
|
|
4089
4193
|
Object.keys(widgetsCache).forEach((type) => {
|
|
@@ -4092,7 +4196,7 @@ function initLegacyViews() {
|
|
|
4092
4196
|
});
|
|
4093
4197
|
}
|
|
4094
4198
|
function registerElementInLegacyManager(type, renderer) {
|
|
4095
|
-
const element = ((0,
|
|
4199
|
+
const element = ((0, import_editor_elements9.getWidgetsCache)() ?? {})[type];
|
|
4096
4200
|
if (!element?.atomic) {
|
|
4097
4201
|
return;
|
|
4098
4202
|
}
|
|
@@ -4220,9 +4324,9 @@ function initTabsModelExtensions() {
|
|
|
4220
4324
|
var import_editor_props8 = require("@elementor/editor-props");
|
|
4221
4325
|
|
|
4222
4326
|
// src/mcp/icon-library-experiment.ts
|
|
4223
|
-
var
|
|
4327
|
+
var import_editor_v1_adapters18 = require("@elementor/editor-v1-adapters");
|
|
4224
4328
|
var ICON_LIBRARY_EXPERIMENT = "e_svg_library";
|
|
4225
|
-
var isIconLibraryActive = () => (0,
|
|
4329
|
+
var isIconLibraryActive = () => (0, import_editor_v1_adapters18.isExperimentActive)(ICON_LIBRARY_EXPERIMENT);
|
|
4226
4330
|
|
|
4227
4331
|
// src/mcp/resources/available-widgets-resource.ts
|
|
4228
4332
|
var import_http_client3 = require("@elementor/http-client");
|
|
@@ -4299,8 +4403,8 @@ var initBestPracticesResource = (reg) => {
|
|
|
4299
4403
|
};
|
|
4300
4404
|
|
|
4301
4405
|
// src/mcp/resources/document-structure-resource.ts
|
|
4302
|
-
var
|
|
4303
|
-
var
|
|
4406
|
+
var import_editor_elements10 = require("@elementor/editor-elements");
|
|
4407
|
+
var import_editor_v1_adapters19 = require("@elementor/editor-v1-adapters");
|
|
4304
4408
|
var DOCUMENT_STRUCTURE_URI = "elementor://document/structure";
|
|
4305
4409
|
var initDocumentStructureResource = (reg) => {
|
|
4306
4410
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -4313,15 +4417,15 @@ var initDocumentStructureResource = (reg) => {
|
|
|
4313
4417
|
sendResourceUpdated({ uri: DOCUMENT_STRUCTURE_URI });
|
|
4314
4418
|
}
|
|
4315
4419
|
};
|
|
4316
|
-
(0,
|
|
4420
|
+
(0, import_editor_v1_adapters19.__privateListenTo)(
|
|
4317
4421
|
[
|
|
4318
|
-
(0,
|
|
4319
|
-
(0,
|
|
4320
|
-
(0,
|
|
4321
|
-
(0,
|
|
4322
|
-
(0,
|
|
4323
|
-
(0,
|
|
4324
|
-
(0,
|
|
4422
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/create"),
|
|
4423
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/delete"),
|
|
4424
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/move"),
|
|
4425
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/copy"),
|
|
4426
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("document/elements/paste"),
|
|
4427
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("editor/documents/attach-preview"),
|
|
4428
|
+
(0, import_editor_v1_adapters19.commandEndEvent)("editor/documents/switch")
|
|
4325
4429
|
],
|
|
4326
4430
|
updateDocumentStructure
|
|
4327
4431
|
);
|
|
@@ -4364,7 +4468,7 @@ function resolveElementVersion(element) {
|
|
|
4364
4468
|
return "v4";
|
|
4365
4469
|
}
|
|
4366
4470
|
const widgetType = element.model?.attributes?.widgetType;
|
|
4367
|
-
if (widgetType && (0,
|
|
4471
|
+
if (widgetType && (0, import_editor_elements10.getWidgetsCache)()?.[widgetType]?.atomic_props_schema) {
|
|
4368
4472
|
return "v4";
|
|
4369
4473
|
}
|
|
4370
4474
|
return "v3";
|
|
@@ -4424,7 +4528,7 @@ var initDynamicTagsResource = (reg) => {
|
|
|
4424
4528
|
};
|
|
4425
4529
|
|
|
4426
4530
|
// src/mcp/resources/editor-state-resource.ts
|
|
4427
|
-
var
|
|
4531
|
+
var import_editor_v1_adapters20 = require("@elementor/editor-v1-adapters");
|
|
4428
4532
|
var CURRENTLY_VIEWED_SCREEN = "The user is currently viewing the Elementor editor";
|
|
4429
4533
|
var PAGE_CONTENT_CHARACTER_LIMIT = 500;
|
|
4430
4534
|
var PREVIEW_TEXT_NODE_MIN_LENGTH = 2;
|
|
@@ -4445,8 +4549,8 @@ var initEditorStateResource = (reg) => {
|
|
|
4445
4549
|
lastSerializedState = serialized;
|
|
4446
4550
|
sendResourceUpdated({ uri: EDITOR_STATE_URI });
|
|
4447
4551
|
};
|
|
4448
|
-
(0,
|
|
4449
|
-
[(0,
|
|
4552
|
+
(0, import_editor_v1_adapters20.__privateListenTo)(
|
|
4553
|
+
[(0, import_editor_v1_adapters20.commandEndEvent)("editor/documents/switch"), (0, import_editor_v1_adapters20.commandEndEvent)("editor/documents/attach-preview")],
|
|
4450
4554
|
notifyIfChanged
|
|
4451
4555
|
);
|
|
4452
4556
|
lastSerializedState = JSON.stringify(buildState());
|
|
@@ -4520,7 +4624,7 @@ function getPageTitle() {
|
|
|
4520
4624
|
}
|
|
4521
4625
|
|
|
4522
4626
|
// src/mcp/resources/general-context-resource.ts
|
|
4523
|
-
var
|
|
4627
|
+
var import_editor_v1_adapters21 = require("@elementor/editor-v1-adapters");
|
|
4524
4628
|
var GENERAL_CONTEXT_URI = "elementor://context/general";
|
|
4525
4629
|
var initGeneralContextResource = (reg) => {
|
|
4526
4630
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -4581,11 +4685,11 @@ var initGeneralContextResource = (reg) => {
|
|
|
4581
4685
|
};
|
|
4582
4686
|
}
|
|
4583
4687
|
);
|
|
4584
|
-
(0,
|
|
4688
|
+
(0, import_editor_v1_adapters21.__privateListenTo)(
|
|
4585
4689
|
[
|
|
4586
|
-
(0,
|
|
4587
|
-
(0,
|
|
4588
|
-
(0,
|
|
4690
|
+
(0, import_editor_v1_adapters21.commandEndEvent)("editor/documents/switch"),
|
|
4691
|
+
(0, import_editor_v1_adapters21.commandEndEvent)("editor/documents/attach-preview"),
|
|
4692
|
+
(0, import_editor_v1_adapters21.commandEndEvent)("document/elements/settings")
|
|
4589
4693
|
],
|
|
4590
4694
|
pushUpdateIfChanged
|
|
4591
4695
|
);
|
|
@@ -4593,8 +4697,8 @@ var initGeneralContextResource = (reg) => {
|
|
|
4593
4697
|
};
|
|
4594
4698
|
|
|
4595
4699
|
// src/mcp/resources/selected-element-resource.ts
|
|
4596
|
-
var
|
|
4597
|
-
var
|
|
4700
|
+
var import_editor_elements11 = require("@elementor/editor-elements");
|
|
4701
|
+
var import_editor_v1_adapters22 = require("@elementor/editor-v1-adapters");
|
|
4598
4702
|
var SELECTED_ELEMENT_URI = "elementor://context/selected-element";
|
|
4599
4703
|
var initSelectedElementResource = (reg) => {
|
|
4600
4704
|
const { resource, sendResourceUpdated } = reg;
|
|
@@ -4625,11 +4729,11 @@ var initSelectedElementResource = (reg) => {
|
|
|
4625
4729
|
}
|
|
4626
4730
|
publishIfChanged(readSelectionFromEditor());
|
|
4627
4731
|
};
|
|
4628
|
-
(0,
|
|
4732
|
+
(0, import_editor_v1_adapters22.__privateListenTo)(
|
|
4629
4733
|
[
|
|
4630
|
-
(0,
|
|
4631
|
-
(0,
|
|
4632
|
-
(0,
|
|
4734
|
+
(0, import_editor_v1_adapters22.commandEndEvent)("document/elements/select"),
|
|
4735
|
+
(0, import_editor_v1_adapters22.commandEndEvent)("document/elements/deselect-all"),
|
|
4736
|
+
(0, import_editor_v1_adapters22.commandEndEvent)("document/elements/settings")
|
|
4633
4737
|
],
|
|
4634
4738
|
onCommand
|
|
4635
4739
|
);
|
|
@@ -4664,11 +4768,11 @@ function createEmptySelectedElementPayload() {
|
|
|
4664
4768
|
};
|
|
4665
4769
|
}
|
|
4666
4770
|
function readSelectionFromEditor() {
|
|
4667
|
-
const elements = (0,
|
|
4771
|
+
const elements = (0, import_editor_elements11.getSelectedElements)();
|
|
4668
4772
|
if (elements.length !== 1) {
|
|
4669
4773
|
return createEmptySelectedElementPayload();
|
|
4670
4774
|
}
|
|
4671
|
-
const container = (0,
|
|
4775
|
+
const container = (0, import_editor_elements11.getContainer)(elements[0].id);
|
|
4672
4776
|
return buildPayloadFromContainer(container);
|
|
4673
4777
|
}
|
|
4674
4778
|
function buildPayloadFromContainer(container) {
|
|
@@ -4691,7 +4795,7 @@ function resolveElementVersion2(container, widgetType) {
|
|
|
4691
4795
|
if (container.model?.config?.atomic) {
|
|
4692
4796
|
return "v4";
|
|
4693
4797
|
}
|
|
4694
|
-
if (widgetType && (0,
|
|
4798
|
+
if (widgetType && (0, import_editor_elements11.getWidgetsCache)()?.[widgetType]?.atomic_props_schema) {
|
|
4695
4799
|
return "v4";
|
|
4696
4800
|
}
|
|
4697
4801
|
return "v3";
|
|
@@ -4701,7 +4805,7 @@ function getElementProperties(container, widgetType) {
|
|
|
4701
4805
|
if (!settings || typeof settings !== "object") {
|
|
4702
4806
|
return null;
|
|
4703
4807
|
}
|
|
4704
|
-
const widgetConfig = widgetType ? (0,
|
|
4808
|
+
const widgetConfig = widgetType ? (0, import_editor_elements11.getWidgetsCache)()?.[widgetType] : null;
|
|
4705
4809
|
const controls = widgetConfig?.controls;
|
|
4706
4810
|
const filtered = {};
|
|
4707
4811
|
for (const [key, value] of Object.entries(settings)) {
|
|
@@ -4739,15 +4843,15 @@ function getElementDisplayName(container) {
|
|
|
4739
4843
|
}
|
|
4740
4844
|
|
|
4741
4845
|
// src/mcp/tools/configure-element/tool.ts
|
|
4742
|
-
var
|
|
4846
|
+
var import_editor_elements14 = require("@elementor/editor-elements");
|
|
4743
4847
|
var import_editor_mcp3 = require("@elementor/editor-mcp");
|
|
4744
4848
|
var import_editor_props7 = require("@elementor/editor-props");
|
|
4745
4849
|
|
|
4746
4850
|
// src/mcp/utils/do-update-element-property.ts
|
|
4747
|
-
var
|
|
4851
|
+
var import_editor_elements13 = require("@elementor/editor-elements");
|
|
4748
4852
|
var import_editor_props6 = require("@elementor/editor-props");
|
|
4749
4853
|
var import_editor_styles4 = require("@elementor/editor-styles");
|
|
4750
|
-
var
|
|
4854
|
+
var import_editor_v1_adapters24 = require("@elementor/editor-v1-adapters");
|
|
4751
4855
|
|
|
4752
4856
|
// src/mcp/utils/merge-custom-css.ts
|
|
4753
4857
|
var CUSTOM_CSS_SEPARATOR = "\n";
|
|
@@ -4764,7 +4868,7 @@ var readStoredCustomCssText = (raw) => {
|
|
|
4764
4868
|
};
|
|
4765
4869
|
|
|
4766
4870
|
// src/mcp/utils/resolve-canonical-prop-name.ts
|
|
4767
|
-
var
|
|
4871
|
+
var import_editor_elements12 = require("@elementor/editor-elements");
|
|
4768
4872
|
function buildAliasToCanonicalMap(schema) {
|
|
4769
4873
|
const aliasToCanonical = {};
|
|
4770
4874
|
for (const [canonical, propType] of Object.entries(schema)) {
|
|
@@ -4781,14 +4885,14 @@ function buildAliasToCanonicalMap(schema) {
|
|
|
4781
4885
|
return aliasToCanonical;
|
|
4782
4886
|
}
|
|
4783
4887
|
function resolveCanonicalPropName(elementType, propertyName) {
|
|
4784
|
-
const schema = (0,
|
|
4888
|
+
const schema = (0, import_editor_elements12.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
|
|
4785
4889
|
if (!schema || schema[propertyName]) {
|
|
4786
4890
|
return propertyName;
|
|
4787
4891
|
}
|
|
4788
4892
|
return buildAliasToCanonicalMap(schema)[propertyName] ?? propertyName;
|
|
4789
4893
|
}
|
|
4790
4894
|
function resolveCanonicalPropKeys(elementType, props) {
|
|
4791
|
-
const schema = (0,
|
|
4895
|
+
const schema = (0, import_editor_elements12.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
|
|
4792
4896
|
if (!schema) {
|
|
4793
4897
|
return { ...props };
|
|
4794
4898
|
}
|
|
@@ -4816,11 +4920,11 @@ function resolveCanonicalPropKeys(elementType, props) {
|
|
|
4816
4920
|
}
|
|
4817
4921
|
|
|
4818
4922
|
// src/mcp/utils/resolve-dynamic-tag.ts
|
|
4819
|
-
var
|
|
4923
|
+
var import_editor_v1_adapters23 = require("@elementor/editor-v1-adapters");
|
|
4820
4924
|
var DYNAMIC_PROP_TYPE_KEY = "dynamic";
|
|
4821
4925
|
var OMITTED_DYNAMIC_SETTING_KEYS = ["fallback"];
|
|
4822
4926
|
var getAtomicDynamicTags = () => {
|
|
4823
|
-
const config = (0,
|
|
4927
|
+
const config = (0, import_editor_v1_adapters23.getElementorConfig)();
|
|
4824
4928
|
return config.atomicDynamicTags?.tags ?? {};
|
|
4825
4929
|
};
|
|
4826
4930
|
var getDynamicTagNamesByCategories = (categories) => {
|
|
@@ -4910,7 +5014,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4910
5014
|
const { elementId, propertyValue, elementType, customCssWriteMode = "replace" } = params;
|
|
4911
5015
|
const propertyName = params.propertyName === "_styles" ? params.propertyName : resolveCanonicalPropName(elementType, params.propertyName);
|
|
4912
5016
|
if (propertyName === "_styles") {
|
|
4913
|
-
const elementStyles = (0,
|
|
5017
|
+
const elementStyles = (0, import_editor_elements13.getElementStyles)(elementId) || {};
|
|
4914
5018
|
const propertyMapValue = propertyValue;
|
|
4915
5019
|
const styleSchema = (0, import_editor_styles4.getStylesSchema)();
|
|
4916
5020
|
const transformedStyleValues = Object.fromEntries(
|
|
@@ -4967,7 +5071,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4967
5071
|
});
|
|
4968
5072
|
delete transformedStyleValues.custom_css;
|
|
4969
5073
|
if (!localStyle) {
|
|
4970
|
-
(0,
|
|
5074
|
+
(0, import_editor_elements13.createElementStyle)({
|
|
4971
5075
|
elementId,
|
|
4972
5076
|
...typeof customCss !== "undefined" ? { custom_css: customCss } : {},
|
|
4973
5077
|
classesProp: "classes",
|
|
@@ -4981,7 +5085,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4981
5085
|
}
|
|
4982
5086
|
});
|
|
4983
5087
|
} else {
|
|
4984
|
-
(0,
|
|
5088
|
+
(0, import_editor_elements13.updateElementStyle)({
|
|
4985
5089
|
elementId,
|
|
4986
5090
|
styleId: localStyle.id,
|
|
4987
5091
|
meta: {
|
|
@@ -4996,7 +5100,7 @@ var doUpdateElementProperty = (params) => {
|
|
|
4996
5100
|
}
|
|
4997
5101
|
return;
|
|
4998
5102
|
}
|
|
4999
|
-
const elementPropSchema = (0,
|
|
5103
|
+
const elementPropSchema = (0, import_editor_elements13.getWidgetsCache)()?.[elementType]?.atomic_props_schema;
|
|
5000
5104
|
if (!elementPropSchema) {
|
|
5001
5105
|
throw new Error(`No prop schema found for element type: ${elementType}`);
|
|
5002
5106
|
}
|
|
@@ -5014,14 +5118,14 @@ var doUpdateElementProperty = (params) => {
|
|
|
5014
5118
|
Expected Schema: ${jsonSchema}`
|
|
5015
5119
|
);
|
|
5016
5120
|
}
|
|
5017
|
-
(0,
|
|
5121
|
+
(0, import_editor_elements13.updateElementSettings)({
|
|
5018
5122
|
id: elementId,
|
|
5019
5123
|
props: {
|
|
5020
5124
|
[propertyName]: value
|
|
5021
5125
|
},
|
|
5022
5126
|
withHistory: false
|
|
5023
5127
|
});
|
|
5024
|
-
(0,
|
|
5128
|
+
(0, import_editor_v1_adapters24.__privateRunCommandSync)("document/save/set-is-modified", { status: true }, { internal: true });
|
|
5025
5129
|
};
|
|
5026
5130
|
|
|
5027
5131
|
// src/mcp/tools/configure-element/prompt.ts
|
|
@@ -5232,13 +5336,13 @@ var initConfigureElementTool = (reg) => {
|
|
|
5232
5336
|
{ description: "Dynamic tags catalog", uri: DYNAMIC_TAGS_URI }
|
|
5233
5337
|
],
|
|
5234
5338
|
handler: async ({ elementId, propertiesToChange, elementType, style }) => {
|
|
5235
|
-
const widgetData = (0,
|
|
5339
|
+
const widgetData = (0, import_editor_elements14.getWidgetsCache)()?.[elementType];
|
|
5236
5340
|
if (!widgetData) {
|
|
5237
5341
|
throw new Error(
|
|
5238
5342
|
`Unknown element type: ${elementType}. Check the available-widgets resource for valid types.`
|
|
5239
5343
|
);
|
|
5240
5344
|
}
|
|
5241
|
-
const container = (0,
|
|
5345
|
+
const container = (0, import_editor_elements14.getContainer)(elementId);
|
|
5242
5346
|
if (!container) {
|
|
5243
5347
|
throw new Error(`Element with id ${elementId} not found`);
|
|
5244
5348
|
}
|
|
@@ -5630,16 +5734,16 @@ Note: The "size" property controls image resolution/loading, not visual size. Se
|
|
|
5630
5734
|
`;
|
|
5631
5735
|
|
|
5632
5736
|
// src/prevent-link-in-link-commands.ts
|
|
5633
|
-
var
|
|
5634
|
-
var
|
|
5635
|
-
var
|
|
5636
|
-
var
|
|
5737
|
+
var import_editor_elements15 = require("@elementor/editor-elements");
|
|
5738
|
+
var import_editor_notifications6 = require("@elementor/editor-notifications");
|
|
5739
|
+
var import_editor_v1_adapters25 = require("@elementor/editor-v1-adapters");
|
|
5740
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
5637
5741
|
function initLinkInLinkPrevention() {
|
|
5638
|
-
(0,
|
|
5742
|
+
(0, import_editor_v1_adapters25.blockCommand)({
|
|
5639
5743
|
command: "document/elements/paste",
|
|
5640
5744
|
condition: blockLinkInLinkPaste
|
|
5641
5745
|
});
|
|
5642
|
-
(0,
|
|
5746
|
+
(0, import_editor_v1_adapters25.blockCommand)({
|
|
5643
5747
|
command: "document/elements/move",
|
|
5644
5748
|
condition: blockLinkInLinkMove
|
|
5645
5749
|
});
|
|
@@ -5667,7 +5771,7 @@ function blockLinkInLinkPaste(args) {
|
|
|
5667
5771
|
const sourceElements = data.clipboard.elements;
|
|
5668
5772
|
const notification = {
|
|
5669
5773
|
type: "default",
|
|
5670
|
-
message: (0,
|
|
5774
|
+
message: (0, import_i18n7.__)(
|
|
5671
5775
|
"To paste a link to this element, first remove the link from it's parent container.",
|
|
5672
5776
|
"elementor"
|
|
5673
5777
|
),
|
|
@@ -5676,7 +5780,7 @@ function blockLinkInLinkPaste(args) {
|
|
|
5676
5780
|
};
|
|
5677
5781
|
const blocked = shouldBlock(sourceElements, targetElements);
|
|
5678
5782
|
if (blocked) {
|
|
5679
|
-
(0,
|
|
5783
|
+
(0, import_editor_notifications6.notify)(notification);
|
|
5680
5784
|
}
|
|
5681
5785
|
return blocked;
|
|
5682
5786
|
}
|
|
@@ -5686,13 +5790,13 @@ function blockLinkInLinkMove(args) {
|
|
|
5686
5790
|
const targetElement = target;
|
|
5687
5791
|
const notification = {
|
|
5688
5792
|
type: "default",
|
|
5689
|
-
message: (0,
|
|
5793
|
+
message: (0, import_i18n7.__)("To drag a link to this element, first remove the link from it's parent container.", "elementor"),
|
|
5690
5794
|
id: "move-in-link-blocked",
|
|
5691
5795
|
additionalActionProps: [learnMoreActionProps]
|
|
5692
5796
|
};
|
|
5693
5797
|
const isBlocked = shouldBlock(sourceElements, [targetElement]);
|
|
5694
5798
|
if (isBlocked) {
|
|
5695
|
-
(0,
|
|
5799
|
+
(0, import_editor_notifications6.notify)(notification);
|
|
5696
5800
|
}
|
|
5697
5801
|
return isBlocked;
|
|
5698
5802
|
}
|
|
@@ -5701,26 +5805,26 @@ function shouldBlock(sourceElements, targetElements) {
|
|
|
5701
5805
|
return false;
|
|
5702
5806
|
}
|
|
5703
5807
|
const isSourceContainsAnAnchor = sourceElements.some((src) => {
|
|
5704
|
-
return src?.id ? (0,
|
|
5808
|
+
return src?.id ? (0, import_editor_elements15.isElementAnchored)(src.id) || !!(0, import_editor_elements15.getAnchoredDescendantId)(src.id) : false;
|
|
5705
5809
|
});
|
|
5706
5810
|
if (!isSourceContainsAnAnchor) {
|
|
5707
5811
|
return false;
|
|
5708
5812
|
}
|
|
5709
5813
|
const isTargetContainsAnAnchor = targetElements.some((target) => {
|
|
5710
|
-
return target?.id ? (0,
|
|
5814
|
+
return target?.id ? (0, import_editor_elements15.isElementAnchored)(target.id) || !!(0, import_editor_elements15.getAnchoredAncestorId)(target.id) : false;
|
|
5711
5815
|
});
|
|
5712
5816
|
return isTargetContainsAnAnchor;
|
|
5713
5817
|
}
|
|
5714
5818
|
|
|
5715
5819
|
// src/style-commands/paste-style.ts
|
|
5716
|
-
var
|
|
5820
|
+
var import_editor_elements18 = require("@elementor/editor-elements");
|
|
5717
5821
|
var import_editor_props10 = require("@elementor/editor-props");
|
|
5718
|
-
var
|
|
5822
|
+
var import_editor_v1_adapters27 = require("@elementor/editor-v1-adapters");
|
|
5719
5823
|
|
|
5720
5824
|
// src/utils/command-utils.ts
|
|
5721
|
-
var
|
|
5825
|
+
var import_editor_elements16 = require("@elementor/editor-elements");
|
|
5722
5826
|
var import_editor_props9 = require("@elementor/editor-props");
|
|
5723
|
-
var
|
|
5827
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
5724
5828
|
function hasAtomicWidgets(args) {
|
|
5725
5829
|
const { containers = [args.container] } = args;
|
|
5726
5830
|
return containers.some(isAtomicWidget);
|
|
@@ -5743,7 +5847,7 @@ function getClassesProp(container) {
|
|
|
5743
5847
|
}
|
|
5744
5848
|
function getContainerSchema(container) {
|
|
5745
5849
|
const type = container?.model.get("widgetType") || container?.model.get("elType");
|
|
5746
|
-
const widgetsCache = (0,
|
|
5850
|
+
const widgetsCache = (0, import_editor_elements16.getWidgetsCache)();
|
|
5747
5851
|
const elementType = widgetsCache?.[type];
|
|
5748
5852
|
return elementType?.atomic_props_schema ?? null;
|
|
5749
5853
|
}
|
|
@@ -5756,15 +5860,15 @@ function getClipboardElements(storageKey = "clipboard") {
|
|
|
5756
5860
|
}
|
|
5757
5861
|
}
|
|
5758
5862
|
function getTitleForContainers(containers) {
|
|
5759
|
-
return containers.length > 1 ? (0,
|
|
5863
|
+
return containers.length > 1 ? (0, import_i18n8.__)("Elements", "elementor") : (0, import_editor_elements16.getElementLabel)(containers[0].id);
|
|
5760
5864
|
}
|
|
5761
5865
|
|
|
5762
5866
|
// src/style-commands/undoable-actions/paste-element-style.ts
|
|
5763
|
-
var
|
|
5867
|
+
var import_editor_elements17 = require("@elementor/editor-elements");
|
|
5764
5868
|
var import_editor_styles_repository4 = require("@elementor/editor-styles-repository");
|
|
5765
|
-
var
|
|
5766
|
-
var
|
|
5767
|
-
var undoablePasteElementStyle = () => (0,
|
|
5869
|
+
var import_editor_v1_adapters26 = require("@elementor/editor-v1-adapters");
|
|
5870
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
5871
|
+
var undoablePasteElementStyle = () => (0, import_editor_v1_adapters26.undoable)(
|
|
5768
5872
|
{
|
|
5769
5873
|
do: ({ containers, newStyle }) => {
|
|
5770
5874
|
return containers.map((container) => {
|
|
@@ -5773,7 +5877,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
|
5773
5877
|
if (!classesProp) {
|
|
5774
5878
|
return null;
|
|
5775
5879
|
}
|
|
5776
|
-
const originalStyles = (0,
|
|
5880
|
+
const originalStyles = (0, import_editor_elements17.getElementStyles)(container.id);
|
|
5777
5881
|
const [styleId, styleDef] = Object.entries(originalStyles ?? {})[0] ?? [];
|
|
5778
5882
|
const originalStyle = Object.keys(styleDef ?? {}).length ? styleDef : null;
|
|
5779
5883
|
const revertData = {
|
|
@@ -5782,7 +5886,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
|
5782
5886
|
};
|
|
5783
5887
|
if (styleId) {
|
|
5784
5888
|
newStyle.variants.forEach(({ meta, props, custom_css: customCss }) => {
|
|
5785
|
-
(0,
|
|
5889
|
+
(0, import_editor_elements17.updateElementStyle)({
|
|
5786
5890
|
elementId,
|
|
5787
5891
|
styleId,
|
|
5788
5892
|
meta,
|
|
@@ -5793,7 +5897,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
|
5793
5897
|
} else {
|
|
5794
5898
|
const [firstVariant] = newStyle.variants;
|
|
5795
5899
|
const additionalVariants = newStyle.variants.slice(1);
|
|
5796
|
-
revertData.styleId = (0,
|
|
5900
|
+
revertData.styleId = (0, import_editor_elements17.createElementStyle)({
|
|
5797
5901
|
elementId,
|
|
5798
5902
|
classesProp,
|
|
5799
5903
|
label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
|
|
@@ -5811,7 +5915,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
|
5811
5915
|
return;
|
|
5812
5916
|
}
|
|
5813
5917
|
if (!revertData.originalStyle) {
|
|
5814
|
-
(0,
|
|
5918
|
+
(0, import_editor_elements17.deleteElementStyle)(container.id, revertData.styleId);
|
|
5815
5919
|
return;
|
|
5816
5920
|
}
|
|
5817
5921
|
const classesProp = getClassesProp(container);
|
|
@@ -5820,7 +5924,7 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
|
5820
5924
|
}
|
|
5821
5925
|
const [firstVariant] = revertData.originalStyle.variants;
|
|
5822
5926
|
const additionalVariants = revertData.originalStyle.variants.slice(1);
|
|
5823
|
-
(0,
|
|
5927
|
+
(0, import_editor_elements17.createElementStyle)({
|
|
5824
5928
|
elementId: container.id,
|
|
5825
5929
|
classesProp,
|
|
5826
5930
|
label: import_editor_styles_repository4.ELEMENTS_STYLES_RESERVED_LABEL,
|
|
@@ -5833,19 +5937,19 @@ var undoablePasteElementStyle = () => (0, import_editor_v1_adapters24.undoable)(
|
|
|
5833
5937
|
},
|
|
5834
5938
|
{
|
|
5835
5939
|
title: ({ containers }) => getTitleForContainers(containers),
|
|
5836
|
-
subtitle: (0,
|
|
5940
|
+
subtitle: (0, import_i18n9.__)("Style Pasted", "elementor")
|
|
5837
5941
|
}
|
|
5838
5942
|
);
|
|
5839
5943
|
|
|
5840
5944
|
// src/style-commands/paste-style.ts
|
|
5841
5945
|
function initPasteStyleCommand() {
|
|
5842
5946
|
const pasteElementStyleCommand = undoablePasteElementStyle();
|
|
5843
|
-
(0,
|
|
5947
|
+
(0, import_editor_v1_adapters27.blockCommand)({
|
|
5844
5948
|
command: "document/elements/paste-style",
|
|
5845
5949
|
condition: hasAtomicWidgets
|
|
5846
5950
|
});
|
|
5847
|
-
(0,
|
|
5848
|
-
(0,
|
|
5951
|
+
(0, import_editor_v1_adapters27.__privateListenTo)(
|
|
5952
|
+
(0, import_editor_v1_adapters27.commandStartEvent)("document/elements/paste-style"),
|
|
5849
5953
|
(e) => pasteStyles(e.args, pasteElementStyleCommand)
|
|
5850
5954
|
);
|
|
5851
5955
|
}
|
|
@@ -5857,7 +5961,7 @@ function pasteStyles(args, pasteLocalStyle) {
|
|
|
5857
5961
|
}
|
|
5858
5962
|
const clipboardElements = getClipboardElements(storageKey);
|
|
5859
5963
|
const [clipboardElement] = clipboardElements ?? [];
|
|
5860
|
-
const clipboardContainer = (0,
|
|
5964
|
+
const clipboardContainer = (0, import_editor_elements18.getContainer)(clipboardElement.id);
|
|
5861
5965
|
if (!clipboardElement || !clipboardContainer || !isAtomicWidget(clipboardContainer)) {
|
|
5862
5966
|
return;
|
|
5863
5967
|
}
|
|
@@ -5876,7 +5980,7 @@ function getClassesWithoutLocalStyle(clipboardContainer, style) {
|
|
|
5876
5980
|
if (!classesProp) {
|
|
5877
5981
|
return [];
|
|
5878
5982
|
}
|
|
5879
|
-
const classesSetting = (0,
|
|
5983
|
+
const classesSetting = (0, import_editor_elements18.getElementSetting)(clipboardContainer.id, classesProp);
|
|
5880
5984
|
return classesSetting?.value.filter((styleId) => styleId !== style?.id) ?? [];
|
|
5881
5985
|
}
|
|
5882
5986
|
function pasteClasses(containers, classes) {
|
|
@@ -5885,10 +5989,10 @@ function pasteClasses(containers, classes) {
|
|
|
5885
5989
|
if (!classesProp) {
|
|
5886
5990
|
return;
|
|
5887
5991
|
}
|
|
5888
|
-
const classesSetting = (0,
|
|
5992
|
+
const classesSetting = (0, import_editor_elements18.getElementSetting)(container.id, classesProp);
|
|
5889
5993
|
const currentClasses = import_editor_props10.classesPropTypeUtil.extract(classesSetting) ?? [];
|
|
5890
5994
|
const newClasses = import_editor_props10.classesPropTypeUtil.create(Array.from(/* @__PURE__ */ new Set([...classes, ...currentClasses])));
|
|
5891
|
-
(0,
|
|
5995
|
+
(0, import_editor_elements18.updateElementSettings)({
|
|
5892
5996
|
id: container.id,
|
|
5893
5997
|
props: { [classesProp]: newClasses }
|
|
5894
5998
|
});
|
|
@@ -5896,21 +6000,21 @@ function pasteClasses(containers, classes) {
|
|
|
5896
6000
|
}
|
|
5897
6001
|
|
|
5898
6002
|
// src/style-commands/reset-style.ts
|
|
5899
|
-
var
|
|
6003
|
+
var import_editor_v1_adapters29 = require("@elementor/editor-v1-adapters");
|
|
5900
6004
|
|
|
5901
6005
|
// src/style-commands/undoable-actions/reset-element-style.ts
|
|
5902
|
-
var
|
|
6006
|
+
var import_editor_elements19 = require("@elementor/editor-elements");
|
|
5903
6007
|
var import_editor_styles_repository5 = require("@elementor/editor-styles-repository");
|
|
5904
|
-
var
|
|
5905
|
-
var
|
|
5906
|
-
var undoableResetElementStyle = () => (0,
|
|
6008
|
+
var import_editor_v1_adapters28 = require("@elementor/editor-v1-adapters");
|
|
6009
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
6010
|
+
var undoableResetElementStyle = () => (0, import_editor_v1_adapters28.undoable)(
|
|
5907
6011
|
{
|
|
5908
6012
|
do: ({ containers }) => {
|
|
5909
6013
|
return containers.map((container) => {
|
|
5910
6014
|
const elementId = container.model.get("id");
|
|
5911
|
-
const containerStyles = (0,
|
|
6015
|
+
const containerStyles = (0, import_editor_elements19.getElementStyles)(elementId);
|
|
5912
6016
|
Object.keys(containerStyles ?? {}).forEach(
|
|
5913
|
-
(styleId) => (0,
|
|
6017
|
+
(styleId) => (0, import_editor_elements19.deleteElementStyle)(elementId, styleId)
|
|
5914
6018
|
);
|
|
5915
6019
|
return containerStyles;
|
|
5916
6020
|
});
|
|
@@ -5926,7 +6030,7 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters26.undoable)(
|
|
|
5926
6030
|
Object.entries(containerStyles ?? {}).forEach(([styleId, style]) => {
|
|
5927
6031
|
const [firstVariant] = style.variants;
|
|
5928
6032
|
const additionalVariants = style.variants.slice(1);
|
|
5929
|
-
(0,
|
|
6033
|
+
(0, import_editor_elements19.createElementStyle)({
|
|
5930
6034
|
elementId,
|
|
5931
6035
|
classesProp,
|
|
5932
6036
|
styleId,
|
|
@@ -5940,19 +6044,19 @@ var undoableResetElementStyle = () => (0, import_editor_v1_adapters26.undoable)(
|
|
|
5940
6044
|
},
|
|
5941
6045
|
{
|
|
5942
6046
|
title: ({ containers }) => getTitleForContainers(containers),
|
|
5943
|
-
subtitle: (0,
|
|
6047
|
+
subtitle: (0, import_i18n10.__)("Style Reset", "elementor")
|
|
5944
6048
|
}
|
|
5945
6049
|
);
|
|
5946
6050
|
|
|
5947
6051
|
// src/style-commands/reset-style.ts
|
|
5948
6052
|
function initResetStyleCommand() {
|
|
5949
6053
|
const resetElementStyles = undoableResetElementStyle();
|
|
5950
|
-
(0,
|
|
6054
|
+
(0, import_editor_v1_adapters29.blockCommand)({
|
|
5951
6055
|
command: "document/elements/reset-style",
|
|
5952
6056
|
condition: hasAtomicWidgets
|
|
5953
6057
|
});
|
|
5954
|
-
(0,
|
|
5955
|
-
(0,
|
|
6058
|
+
(0, import_editor_v1_adapters29.__privateListenTo)(
|
|
6059
|
+
(0, import_editor_v1_adapters29.commandStartEvent)("document/elements/reset-style"),
|
|
5956
6060
|
(e) => resetStyles(e.args, resetElementStyles)
|
|
5957
6061
|
);
|
|
5958
6062
|
}
|
|
@@ -5979,6 +6083,8 @@ function init() {
|
|
|
5979
6083
|
initFormNestingPrevention();
|
|
5980
6084
|
initFormAncestorEnforcement();
|
|
5981
6085
|
initHiddenFieldHint();
|
|
6086
|
+
initDuplicateHoneypotPrevention();
|
|
6087
|
+
initHoneypotHint();
|
|
5982
6088
|
initViewReplacements();
|
|
5983
6089
|
initLegacyViews();
|
|
5984
6090
|
initSettingsTransformers();
|
|
@@ -6102,9 +6208,9 @@ function getRectClipPath(rect, viewport) {
|
|
|
6102
6208
|
}
|
|
6103
6209
|
|
|
6104
6210
|
// src/hooks/use-canvas-document.ts
|
|
6105
|
-
var
|
|
6211
|
+
var import_editor_v1_adapters30 = require("@elementor/editor-v1-adapters");
|
|
6106
6212
|
function useCanvasDocument() {
|
|
6107
|
-
return (0,
|
|
6213
|
+
return (0, import_editor_v1_adapters30.__privateUseListenTo)((0, import_editor_v1_adapters30.commandEndEvent)("editor/documents/attach-preview"), () => (0, import_editor_v1_adapters30.getCanvasIframeDocument)());
|
|
6108
6214
|
}
|
|
6109
6215
|
|
|
6110
6216
|
// src/hooks/use-escape-on-canvas.ts
|
|
@@ -6127,10 +6233,10 @@ function useEscapeOnCanvas(canvasDocument, onEscape) {
|
|
|
6127
6233
|
}
|
|
6128
6234
|
|
|
6129
6235
|
// src/utils/after-render.ts
|
|
6130
|
-
var
|
|
6236
|
+
var import_editor_elements20 = require("@elementor/editor-elements");
|
|
6131
6237
|
function doAfterRender(elementIds, callback) {
|
|
6132
6238
|
const pending = elementIds.map((elementId) => {
|
|
6133
|
-
const view = (0,
|
|
6239
|
+
const view = (0, import_editor_elements20.getContainer)(elementId)?.view;
|
|
6134
6240
|
if (!view || !hasDoAfterRender(view)) {
|
|
6135
6241
|
return void 0;
|
|
6136
6242
|
}
|