@elementor/editor-variables 3.35.0-404 → 3.35.0-405
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 +44 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +104 -73
- package/dist/index.mjs.map +1 -1
- package/package.json +15 -14
- package/src/components/variables-manager/variables-manager-create-menu.tsx +37 -7
package/dist/index.js
CHANGED
|
@@ -1058,6 +1058,7 @@ var React6 = __toESM(require("react"));
|
|
|
1058
1058
|
var import_react6 = require("react");
|
|
1059
1059
|
var import_editor_ui = require("@elementor/editor-ui");
|
|
1060
1060
|
var import_icons3 = require("@elementor/icons");
|
|
1061
|
+
var import_menus = require("@elementor/menus");
|
|
1061
1062
|
var import_ui6 = require("@elementor/ui");
|
|
1062
1063
|
var import_i18n7 = require("@wordpress/i18n");
|
|
1063
1064
|
|
|
@@ -1150,8 +1151,9 @@ var MenuOption = ({
|
|
|
1150
1151
|
onCreate,
|
|
1151
1152
|
onClose
|
|
1152
1153
|
}) => {
|
|
1153
|
-
const
|
|
1154
|
+
const [isPopoverOpen, setIsPopoverOpen] = (0, import_react6.useState)(false);
|
|
1154
1155
|
const userQuotaPermissions = useQuotaPermissions(config.propTypeKey);
|
|
1156
|
+
const displayName = (0, import_menus.capitalize)(config.variableType);
|
|
1155
1157
|
const isDisabled = !userQuotaPermissions.canAdd();
|
|
1156
1158
|
const handleClick = () => {
|
|
1157
1159
|
if (isDisabled) {
|
|
@@ -1162,15 +1164,44 @@ var MenuOption = ({
|
|
|
1162
1164
|
trackVariablesManagerEvent({ action: "add", varType: config.variableType });
|
|
1163
1165
|
onClose();
|
|
1164
1166
|
};
|
|
1167
|
+
const title = (0, import_i18n7.sprintf)(
|
|
1168
|
+
/* translators: %s: Variable Type. */
|
|
1169
|
+
(0, import_i18n7.__)("%s variables", "elementor"),
|
|
1170
|
+
(0, import_menus.capitalize)(config.variableType)
|
|
1171
|
+
);
|
|
1172
|
+
const content = (0, import_i18n7.sprintf)(
|
|
1173
|
+
/* translators: %s: Variable Type. */
|
|
1174
|
+
(0, import_i18n7.__)("Upgrade to continue creating and editing %s variables.", "elementor"),
|
|
1175
|
+
config.variableType
|
|
1176
|
+
);
|
|
1165
1177
|
return /* @__PURE__ */ React6.createElement(import_ui6.MenuItem, { onClick: handleClick, sx: { gap: 1.5, cursor: isDisabled ? "default" : "pointer" } }, (0, import_react6.createElement)(config.icon, { fontSize: SIZE, color: isDisabled ? "disabled" : "action" }), /* @__PURE__ */ React6.createElement(import_ui6.Typography, { variant: "caption", color: isDisabled ? "text.disabled" : "text.primary" }, displayName), isDisabled && /* @__PURE__ */ React6.createElement(
|
|
1166
1178
|
import_ui6.Box,
|
|
1167
1179
|
{
|
|
1168
|
-
onClick: () => {
|
|
1169
|
-
event
|
|
1180
|
+
onClick: (event) => {
|
|
1181
|
+
event.stopPropagation();
|
|
1170
1182
|
}
|
|
1171
1183
|
},
|
|
1172
|
-
/* @__PURE__ */ React6.createElement(
|
|
1173
|
-
|
|
1184
|
+
/* @__PURE__ */ React6.createElement(
|
|
1185
|
+
import_editor_ui.PromotionPopover,
|
|
1186
|
+
{
|
|
1187
|
+
open: isPopoverOpen,
|
|
1188
|
+
title,
|
|
1189
|
+
content,
|
|
1190
|
+
ctaText: (0, import_i18n7.__)("Upgrade now", "elementor"),
|
|
1191
|
+
ctaUrl: `https://go.elementor.com/go-pro-manager-${config.variableType}-variable/`,
|
|
1192
|
+
onClose: () => {
|
|
1193
|
+
setIsPopoverOpen(false);
|
|
1194
|
+
}
|
|
1195
|
+
},
|
|
1196
|
+
/* @__PURE__ */ React6.createElement(
|
|
1197
|
+
import_editor_ui.PromotionChip,
|
|
1198
|
+
{
|
|
1199
|
+
onClick: () => {
|
|
1200
|
+
setIsPopoverOpen(true);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1203
|
+
)
|
|
1204
|
+
)
|
|
1174
1205
|
));
|
|
1175
1206
|
};
|
|
1176
1207
|
var getDefaultName = (variables, type, baseName) => {
|
|
@@ -1389,14 +1420,14 @@ var VariableEditableCell = React10.memo(
|
|
|
1389
1420
|
const handleDoubleClick = () => {
|
|
1390
1421
|
setIsEditing(true);
|
|
1391
1422
|
};
|
|
1392
|
-
const handleKeyDown = (
|
|
1393
|
-
if (
|
|
1423
|
+
const handleKeyDown = (event) => {
|
|
1424
|
+
if (event.key === "Enter") {
|
|
1394
1425
|
handleSave();
|
|
1395
|
-
} else if (
|
|
1426
|
+
} else if (event.key === "Escape") {
|
|
1396
1427
|
setIsEditing(false);
|
|
1397
1428
|
}
|
|
1398
|
-
if (
|
|
1399
|
-
|
|
1429
|
+
if (event.key === " " && !isEditing) {
|
|
1430
|
+
event.preventDefault();
|
|
1400
1431
|
setIsEditing(true);
|
|
1401
1432
|
}
|
|
1402
1433
|
};
|
|
@@ -1991,9 +2022,9 @@ function VariablesManagerPanel() {
|
|
|
1991
2022
|
}
|
|
1992
2023
|
var usePreventUnload = (isDirty) => {
|
|
1993
2024
|
(0, import_react11.useEffect)(() => {
|
|
1994
|
-
const handleBeforeUnload = (
|
|
2025
|
+
const handleBeforeUnload = (event) => {
|
|
1995
2026
|
if (isDirty) {
|
|
1996
|
-
|
|
2027
|
+
event.preventDefault();
|
|
1997
2028
|
}
|
|
1998
2029
|
};
|
|
1999
2030
|
window.addEventListener("beforeunload", handleBeforeUnload);
|
|
@@ -2266,7 +2297,7 @@ var EditConfirmationDialog = ({
|
|
|
2266
2297
|
import_ui16.Checkbox,
|
|
2267
2298
|
{
|
|
2268
2299
|
checked: dontShowAgain,
|
|
2269
|
-
onChange: (
|
|
2300
|
+
onChange: (event) => setDontShowAgain(event.target.checked),
|
|
2270
2301
|
size: "small"
|
|
2271
2302
|
}
|
|
2272
2303
|
),
|