@elementor/editor-app-bar 0.1.0
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/LICENSE +674 -0
- package/README.md +5 -0
- package/dist/index.d.ts +234 -0
- package/dist/index.js +1047 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +1017 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +50 -0
- package/src/components/__tests__/top-bar.test.tsx +15 -0
- package/src/components/actions/action.tsx +33 -0
- package/src/components/actions/link.tsx +33 -0
- package/src/components/actions/toggle-action.tsx +35 -0
- package/src/components/app-bar.tsx +37 -0
- package/src/components/locations/__tests__/locations-components.test.tsx +37 -0
- package/src/components/locations/__tests__/menus.test.tsx +89 -0
- package/src/components/locations/main-menu-location.tsx +50 -0
- package/src/components/locations/page-indication-location.tsx +9 -0
- package/src/components/locations/primary-action-location.tsx +9 -0
- package/src/components/locations/responsive-location.tsx +9 -0
- package/src/components/locations/tools-menu-location.tsx +26 -0
- package/src/components/locations/utilities-menu-location.tsx +35 -0
- package/src/components/ui/popover-menu-item.tsx +39 -0
- package/src/components/ui/popover-menu.tsx +23 -0
- package/src/components/ui/toolbar-logo.tsx +80 -0
- package/src/components/ui/toolbar-menu-item.tsx +18 -0
- package/src/components/ui/toolbar-menu-more.tsx +29 -0
- package/src/components/ui/toolbar-menu-toggle-item.tsx +18 -0
- package/src/components/ui/toolbar-menu.tsx +15 -0
- package/src/contexts/menu-context.tsx +20 -0
- package/src/extensions/documents-indicator/components/__tests__/settings-button.test.tsx +46 -0
- package/src/extensions/documents-indicator/components/settings-button.tsx +43 -0
- package/src/extensions/documents-indicator/index.ts +12 -0
- package/src/extensions/documents-preview/hooks/__tests__/use-document-preview-props.test.ts +43 -0
- package/src/extensions/documents-preview/hooks/use-action-props.ts +17 -0
- package/src/extensions/documents-preview/index.ts +10 -0
- package/src/extensions/documents-save/components/__tests__/primary-action-menu.test.tsx +41 -0
- package/src/extensions/documents-save/components/__tests__/primary-action.test.tsx +176 -0
- package/src/extensions/documents-save/components/primary-action-menu.tsx +48 -0
- package/src/extensions/documents-save/components/primary-action.tsx +79 -0
- package/src/extensions/documents-save/hooks/__tests__/use-document-save-draft-props.test.ts +64 -0
- package/src/extensions/documents-save/hooks/__tests__/use-document-save-template-props.test.ts +27 -0
- package/src/extensions/documents-save/hooks/use-document-save-draft-props.ts +16 -0
- package/src/extensions/documents-save/hooks/use-document-save-template-props.ts +14 -0
- package/src/extensions/documents-save/index.ts +26 -0
- package/src/extensions/elements/hooks/__tests__/use-action-props.test.ts +33 -0
- package/src/extensions/elements/hooks/use-action-props.ts +15 -0
- package/src/extensions/elements/index.ts +13 -0
- package/src/extensions/elements/sync/__tests__/sync-panel-title.test.ts +92 -0
- package/src/extensions/elements/sync/sync-panel-title.ts +47 -0
- package/src/extensions/finder/hooks/__tests__/use-action-props.test.ts +36 -0
- package/src/extensions/finder/hooks/use-action-props.ts +18 -0
- package/src/extensions/finder/index.ts +10 -0
- package/src/extensions/help/index.ts +18 -0
- package/src/extensions/history/hooks/__tests__/use-action-props.test.ts +33 -0
- package/src/extensions/history/hooks/use-action-props.ts +15 -0
- package/src/extensions/history/index.ts +10 -0
- package/src/extensions/index.ts +34 -0
- package/src/extensions/keyboard-shortcuts/hooks/__tests__/use-action-props.test.ts +20 -0
- package/src/extensions/keyboard-shortcuts/hooks/use-action-props.ts +12 -0
- package/src/extensions/keyboard-shortcuts/index.ts +11 -0
- package/src/extensions/site-settings/components/__tests__/portalled-primary-action.test.tsx +94 -0
- package/src/extensions/site-settings/components/__tests__/primary-action.test.tsx +100 -0
- package/src/extensions/site-settings/components/portal.tsx +27 -0
- package/src/extensions/site-settings/components/portalled-primary-action.tsx +11 -0
- package/src/extensions/site-settings/components/primary-action.tsx +32 -0
- package/src/extensions/site-settings/hooks/__tests__/use-action-props.test.ts +49 -0
- package/src/extensions/site-settings/hooks/use-action-props.ts +22 -0
- package/src/extensions/site-settings/index.ts +18 -0
- package/src/extensions/structure/hooks/__tests__/use-action-props.test.ts +33 -0
- package/src/extensions/structure/hooks/use-action-props.ts +16 -0
- package/src/extensions/structure/index.ts +10 -0
- package/src/extensions/theme-builder/hooks/__tests__/use-action-props.test.ts +22 -0
- package/src/extensions/theme-builder/hooks/use-action-props.ts +12 -0
- package/src/extensions/theme-builder/index.ts +9 -0
- package/src/extensions/user-preferences/hooks/__tests__/use-action-props.test.ts +34 -0
- package/src/extensions/user-preferences/hooks/use-action-props.ts +16 -0
- package/src/extensions/user-preferences/index.ts +10 -0
- package/src/extensions/wordpress/index.ts +21 -0
- package/src/index.ts +13 -0
- package/src/init.ts +15 -0
- package/src/locations/__tests__/menus.test.tsx +229 -0
- package/src/locations/consts.ts +4 -0
- package/src/locations/index.ts +29 -0
- package/src/locations/menus.tsx +141 -0
- package/src/sync/__tests__/redirect-old-menus.test.ts +34 -0
- package/src/sync/redirect-old-menus.ts +9 -0
- package/src/types.ts +3 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1047 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
|
|
30
|
+
// src/index.ts
|
|
31
|
+
var src_exports = {};
|
|
32
|
+
__export(src_exports, {
|
|
33
|
+
documentOptionsMenu: () => documentOptionsMenu,
|
|
34
|
+
injectIntoPageIndication: () => injectIntoPageIndication,
|
|
35
|
+
injectIntoPrimaryAction: () => injectIntoPrimaryAction,
|
|
36
|
+
injectIntoResponsive: () => injectIntoResponsive,
|
|
37
|
+
mainMenu: () => mainMenu,
|
|
38
|
+
toolsMenu: () => toolsMenu,
|
|
39
|
+
utilitiesMenu: () => utilitiesMenu
|
|
40
|
+
});
|
|
41
|
+
module.exports = __toCommonJS(src_exports);
|
|
42
|
+
|
|
43
|
+
// src/locations/menus.tsx
|
|
44
|
+
var React8 = __toESM(require("react"));
|
|
45
|
+
var import_react2 = require("react");
|
|
46
|
+
var import_locations = require("@elementor/locations");
|
|
47
|
+
|
|
48
|
+
// src/components/actions/action.tsx
|
|
49
|
+
var React4 = __toESM(require("react"));
|
|
50
|
+
|
|
51
|
+
// src/contexts/menu-context.tsx
|
|
52
|
+
var React = __toESM(require("react"));
|
|
53
|
+
var import_react = require("react");
|
|
54
|
+
var MenuContext = (0, import_react.createContext)({ type: "toolbar" });
|
|
55
|
+
function MenuContextProvider({ type, children }) {
|
|
56
|
+
return /* @__PURE__ */ React.createElement(MenuContext.Provider, { value: { type } }, children);
|
|
57
|
+
}
|
|
58
|
+
function useMenuContext() {
|
|
59
|
+
return (0, import_react.useContext)(MenuContext);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
// src/components/ui/toolbar-menu-item.tsx
|
|
63
|
+
var React2 = __toESM(require("react"));
|
|
64
|
+
var import_ui = require("@elementor/ui");
|
|
65
|
+
function ToolbarMenuItem({ title, ...props }) {
|
|
66
|
+
return /* @__PURE__ */ React2.createElement(import_ui.Tooltip, { title }, /* @__PURE__ */ React2.createElement(import_ui.Box, { component: "span", "aria-label": void 0 }, /* @__PURE__ */ React2.createElement(import_ui.IconButton, { ...props, "aria-label": title, size: "small" })));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
// src/components/ui/popover-menu-item.tsx
|
|
70
|
+
var React3 = __toESM(require("react"));
|
|
71
|
+
var import_ui2 = require("@elementor/ui");
|
|
72
|
+
var import_icons = require("@elementor/icons");
|
|
73
|
+
var DirectionalArrowIcon = (0, import_ui2.withDirection)(import_icons.ArrowUpRightIcon);
|
|
74
|
+
function PopoverMenuItem({ text, icon, onClick, href, target, disabled, ...props }) {
|
|
75
|
+
const isExternalLink = href && target === "_blank";
|
|
76
|
+
return /* @__PURE__ */ React3.createElement(
|
|
77
|
+
import_ui2.MenuItem,
|
|
78
|
+
{
|
|
79
|
+
...props,
|
|
80
|
+
disabled,
|
|
81
|
+
onClick,
|
|
82
|
+
component: href ? "a" : "div",
|
|
83
|
+
href,
|
|
84
|
+
target
|
|
85
|
+
},
|
|
86
|
+
/* @__PURE__ */ React3.createElement(import_ui2.ListItemIcon, null, icon),
|
|
87
|
+
/* @__PURE__ */ React3.createElement(import_ui2.ListItemText, { primary: text }),
|
|
88
|
+
isExternalLink && /* @__PURE__ */ React3.createElement(DirectionalArrowIcon, null)
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// src/components/actions/action.tsx
|
|
93
|
+
function Action({ icon: Icon, title, visible = true, ...props }) {
|
|
94
|
+
const { type } = useMenuContext();
|
|
95
|
+
if (!visible) {
|
|
96
|
+
return null;
|
|
97
|
+
}
|
|
98
|
+
return type === "toolbar" ? /* @__PURE__ */ React4.createElement(ToolbarMenuItem, { title, ...props }, /* @__PURE__ */ React4.createElement(Icon, null)) : /* @__PURE__ */ React4.createElement(
|
|
99
|
+
PopoverMenuItem,
|
|
100
|
+
{
|
|
101
|
+
...props,
|
|
102
|
+
text: title,
|
|
103
|
+
icon: /* @__PURE__ */ React4.createElement(Icon, null)
|
|
104
|
+
}
|
|
105
|
+
);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// src/components/actions/toggle-action.tsx
|
|
109
|
+
var React6 = __toESM(require("react"));
|
|
110
|
+
|
|
111
|
+
// src/components/ui/toolbar-menu-toggle-item.tsx
|
|
112
|
+
var React5 = __toESM(require("react"));
|
|
113
|
+
var import_ui3 = require("@elementor/ui");
|
|
114
|
+
function ToolbarMenuToggleItem({ title, onClick, ...props }) {
|
|
115
|
+
return /* @__PURE__ */ React5.createElement(import_ui3.Tooltip, { title }, /* @__PURE__ */ React5.createElement(import_ui3.Box, { component: "span", "aria-label": void 0 }, /* @__PURE__ */ React5.createElement(import_ui3.ToggleButton, { ...props, onChange: onClick, "aria-label": title, size: "small" })));
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
// src/components/actions/toggle-action.tsx
|
|
119
|
+
function ToggleAction({ icon: Icon, title, value, visible = true, ...props }) {
|
|
120
|
+
const { type } = useMenuContext();
|
|
121
|
+
if (!visible) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return type === "toolbar" ? /* @__PURE__ */ React6.createElement(ToolbarMenuToggleItem, { value: value || title, title, ...props }, /* @__PURE__ */ React6.createElement(Icon, null)) : /* @__PURE__ */ React6.createElement(
|
|
125
|
+
PopoverMenuItem,
|
|
126
|
+
{
|
|
127
|
+
...props,
|
|
128
|
+
text: title,
|
|
129
|
+
icon: /* @__PURE__ */ React6.createElement(Icon, null)
|
|
130
|
+
}
|
|
131
|
+
);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// src/components/actions/link.tsx
|
|
135
|
+
var React7 = __toESM(require("react"));
|
|
136
|
+
function Link({ icon: Icon, title, visible = true, ...props }) {
|
|
137
|
+
const { type } = useMenuContext();
|
|
138
|
+
if (!visible) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
return type === "toolbar" ? /* @__PURE__ */ React7.createElement(ToolbarMenuItem, { title, ...props }, /* @__PURE__ */ React7.createElement(Icon, null)) : /* @__PURE__ */ React7.createElement(
|
|
142
|
+
PopoverMenuItem,
|
|
143
|
+
{
|
|
144
|
+
...props,
|
|
145
|
+
text: title,
|
|
146
|
+
icon: /* @__PURE__ */ React7.createElement(Icon, null)
|
|
147
|
+
}
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// src/locations/menus.tsx
|
|
152
|
+
function createMenu({ name: menuName, groups = [] }) {
|
|
153
|
+
const menuGroups = [
|
|
154
|
+
...groups,
|
|
155
|
+
"default"
|
|
156
|
+
];
|
|
157
|
+
const registerAction = createRegisterMenuItem({
|
|
158
|
+
menuName,
|
|
159
|
+
menuGroups,
|
|
160
|
+
component: Action
|
|
161
|
+
});
|
|
162
|
+
const registerToggleAction = createRegisterMenuItem({
|
|
163
|
+
menuName,
|
|
164
|
+
menuGroups,
|
|
165
|
+
component: ToggleAction
|
|
166
|
+
});
|
|
167
|
+
const registerLink = createRegisterMenuItem({
|
|
168
|
+
menuName,
|
|
169
|
+
menuGroups,
|
|
170
|
+
component: Link
|
|
171
|
+
});
|
|
172
|
+
const useMenuItems5 = createUseMenuItems({
|
|
173
|
+
menuName,
|
|
174
|
+
menuGroups
|
|
175
|
+
});
|
|
176
|
+
return {
|
|
177
|
+
registerAction,
|
|
178
|
+
registerToggleAction,
|
|
179
|
+
registerLink,
|
|
180
|
+
useMenuItems: useMenuItems5
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
function createRegisterMenuItem({ menuName, menuGroups, component }) {
|
|
184
|
+
return ({ group = "default", name, overwrite, priority, ...args }) => {
|
|
185
|
+
if (!menuGroups.includes(group)) {
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const useProps = "props" in args ? () => args.props : args.useProps;
|
|
189
|
+
const Component = component;
|
|
190
|
+
const Filler = (props) => {
|
|
191
|
+
const componentProps = useProps();
|
|
192
|
+
return /* @__PURE__ */ React8.createElement(Component, { ...props, ...componentProps });
|
|
193
|
+
};
|
|
194
|
+
const location = getMenuLocationId(menuName, group);
|
|
195
|
+
(0, import_locations.inject)({
|
|
196
|
+
location,
|
|
197
|
+
name,
|
|
198
|
+
filler: Filler,
|
|
199
|
+
options: {
|
|
200
|
+
priority,
|
|
201
|
+
overwrite
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
function createUseMenuItems({ menuName, menuGroups }) {
|
|
207
|
+
const locations = menuGroups.map((group) => getMenuLocationId(menuName, group));
|
|
208
|
+
return () => {
|
|
209
|
+
const injectionsGroups = (0, import_locations.useInjectionsOf)(locations);
|
|
210
|
+
return (0, import_react2.useMemo)(() => {
|
|
211
|
+
return injectionsGroups.reduce((acc, injections, index) => {
|
|
212
|
+
const groupName = menuGroups[index];
|
|
213
|
+
return {
|
|
214
|
+
...acc,
|
|
215
|
+
[groupName]: injections.map((injection) => ({
|
|
216
|
+
id: injection.id,
|
|
217
|
+
MenuItem: injection.filler
|
|
218
|
+
}))
|
|
219
|
+
};
|
|
220
|
+
}, {});
|
|
221
|
+
}, [injectionsGroups]);
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function getMenuLocationId(menu, group) {
|
|
225
|
+
return `editor/app-bar/${menu}/${group}`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
// src/locations/index.ts
|
|
229
|
+
var import_locations2 = require("@elementor/locations");
|
|
230
|
+
|
|
231
|
+
// src/locations/consts.ts
|
|
232
|
+
var LOCATION_PAGE_INDICATION = "editor/app-bar/page-indication";
|
|
233
|
+
var LOCATION_RESPONSIVE = "editor/app-bar/responsive";
|
|
234
|
+
var LOCATION_PRIMARY_ACTION = "editor/app-bar/primary-action";
|
|
235
|
+
|
|
236
|
+
// src/locations/index.ts
|
|
237
|
+
var injectIntoPageIndication = (0, import_locations2.createInjectorFor)(LOCATION_PAGE_INDICATION);
|
|
238
|
+
var injectIntoResponsive = (0, import_locations2.createInjectorFor)(LOCATION_RESPONSIVE);
|
|
239
|
+
var injectIntoPrimaryAction = (0, import_locations2.createInjectorFor)(LOCATION_PRIMARY_ACTION);
|
|
240
|
+
var mainMenu = createMenu({
|
|
241
|
+
name: "main",
|
|
242
|
+
groups: ["exits"]
|
|
243
|
+
});
|
|
244
|
+
var toolsMenu = createMenu({
|
|
245
|
+
name: "tools"
|
|
246
|
+
});
|
|
247
|
+
var utilitiesMenu = createMenu({
|
|
248
|
+
name: "utilities"
|
|
249
|
+
});
|
|
250
|
+
var documentOptionsMenu = createMenu({
|
|
251
|
+
name: "document-options",
|
|
252
|
+
groups: ["save"]
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// src/components/app-bar.tsx
|
|
256
|
+
var React19 = __toESM(require("react"));
|
|
257
|
+
var import_ui10 = require("@elementor/ui");
|
|
258
|
+
|
|
259
|
+
// src/components/locations/main-menu-location.tsx
|
|
260
|
+
var React11 = __toESM(require("react"));
|
|
261
|
+
var import_ui6 = require("@elementor/ui");
|
|
262
|
+
|
|
263
|
+
// src/components/ui/popover-menu.tsx
|
|
264
|
+
var React9 = __toESM(require("react"));
|
|
265
|
+
var import_ui4 = require("@elementor/ui");
|
|
266
|
+
function PopoverMenu({ children, ...props }) {
|
|
267
|
+
return /* @__PURE__ */ React9.createElement(MenuContextProvider, { type: "popover" }, /* @__PURE__ */ React9.createElement(
|
|
268
|
+
import_ui4.Menu,
|
|
269
|
+
{
|
|
270
|
+
PaperProps: {
|
|
271
|
+
sx: { mt: 4 }
|
|
272
|
+
},
|
|
273
|
+
...props,
|
|
274
|
+
MenuListProps: {
|
|
275
|
+
component: "div"
|
|
276
|
+
}
|
|
277
|
+
},
|
|
278
|
+
children
|
|
279
|
+
));
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// src/components/ui/toolbar-logo.tsx
|
|
283
|
+
var React10 = __toESM(require("react"));
|
|
284
|
+
var import_react3 = require("react");
|
|
285
|
+
var import_i18n = require("@wordpress/i18n");
|
|
286
|
+
var import_ui5 = require("@elementor/ui");
|
|
287
|
+
var ElementorLogo = (props) => {
|
|
288
|
+
return /* @__PURE__ */ React10.createElement(import_ui5.SvgIcon, { viewBox: "0 0 32 32", ...props }, /* @__PURE__ */ React10.createElement("g", null, /* @__PURE__ */ React10.createElement("circle", { cx: "16", cy: "16", r: "16" }), /* @__PURE__ */ React10.createElement("path", { d: "M11.7 9H9V22.3H11.7V9Z" }), /* @__PURE__ */ React10.createElement("path", { d: "M22.4 9H9V11.7H22.4V9Z" }), /* @__PURE__ */ React10.createElement("path", { d: "M22.4 14.4004H9V17.1004H22.4V14.4004Z" }), /* @__PURE__ */ React10.createElement("path", { d: "M22.4 19.6992H9V22.3992H22.4V19.6992Z" })));
|
|
289
|
+
};
|
|
290
|
+
var StyledToggleButton = (0, import_ui5.styled)(import_ui5.ToggleButton)(() => ({
|
|
291
|
+
padding: 0,
|
|
292
|
+
"&.MuiToggleButton-root:hover": {
|
|
293
|
+
backgroundColor: "initial"
|
|
294
|
+
},
|
|
295
|
+
"&.MuiToggleButton-root.Mui-selected": {
|
|
296
|
+
backgroundColor: "initial"
|
|
297
|
+
}
|
|
298
|
+
}));
|
|
299
|
+
var StyledElementorLogo = (0, import_ui5.styled)(ElementorLogo, {
|
|
300
|
+
shouldForwardProp: (prop) => prop !== "showMenuIcon"
|
|
301
|
+
})(({ theme, showMenuIcon }) => ({
|
|
302
|
+
width: "auto",
|
|
303
|
+
height: "100%",
|
|
304
|
+
"& path": {
|
|
305
|
+
fill: "initial",
|
|
306
|
+
transition: "all 0.2s linear",
|
|
307
|
+
transformOrigin: "bottom left",
|
|
308
|
+
"&:first-of-type": {
|
|
309
|
+
transitionDelay: !showMenuIcon && "0.2s",
|
|
310
|
+
transform: showMenuIcon && "translateY(-9px) scaleY(0)"
|
|
311
|
+
},
|
|
312
|
+
"&:not(:first-of-type)": {
|
|
313
|
+
// Emotion automatically change 4 to -4 in RTL moode.
|
|
314
|
+
transform: !showMenuIcon && `translateX(${theme.direction === "rtl" ? "4" : "9"}px) scaleX(0.6)`
|
|
315
|
+
},
|
|
316
|
+
"&:nth-of-type(2)": {
|
|
317
|
+
transitionDelay: showMenuIcon ? "0" : "0.2s"
|
|
318
|
+
},
|
|
319
|
+
"&:nth-of-type(3)": {
|
|
320
|
+
transitionDelay: "0.1s"
|
|
321
|
+
},
|
|
322
|
+
"&:nth-of-type(4)": {
|
|
323
|
+
transitionDelay: showMenuIcon ? "0.2s" : "0"
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}));
|
|
327
|
+
function ToolbarLogo(props) {
|
|
328
|
+
const [isHoverState, setIsHoverState] = (0, import_react3.useState)(false);
|
|
329
|
+
const showMenuIcon = props.selected || isHoverState;
|
|
330
|
+
return /* @__PURE__ */ React10.createElement(
|
|
331
|
+
StyledToggleButton,
|
|
332
|
+
{
|
|
333
|
+
...props,
|
|
334
|
+
value: "selected",
|
|
335
|
+
size: "small",
|
|
336
|
+
onMouseEnter: () => setIsHoverState(true),
|
|
337
|
+
onMouseLeave: () => setIsHoverState(false)
|
|
338
|
+
},
|
|
339
|
+
/* @__PURE__ */ React10.createElement(StyledElementorLogo, { titleAccess: (0, import_i18n.__)("Elementor Logo", "elementor"), showMenuIcon })
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
// src/components/locations/main-menu-location.tsx
|
|
344
|
+
var { useMenuItems } = mainMenu;
|
|
345
|
+
function MainMenuLocation() {
|
|
346
|
+
const menuItems = useMenuItems();
|
|
347
|
+
const orderedGroups = [
|
|
348
|
+
menuItems.default,
|
|
349
|
+
menuItems.exits
|
|
350
|
+
];
|
|
351
|
+
const popupState = (0, import_ui6.usePopupState)({
|
|
352
|
+
variant: "popover",
|
|
353
|
+
popupId: "elementor-v2-app-bar-main-menu"
|
|
354
|
+
});
|
|
355
|
+
return /* @__PURE__ */ React11.createElement(import_ui6.Stack, { sx: { paddingInlineStart: 4 }, direction: "row", alignItems: "center" }, /* @__PURE__ */ React11.createElement(
|
|
356
|
+
ToolbarLogo,
|
|
357
|
+
{
|
|
358
|
+
...(0, import_ui6.bindTrigger)(popupState),
|
|
359
|
+
selected: popupState.isOpen
|
|
360
|
+
}
|
|
361
|
+
), /* @__PURE__ */ React11.createElement(
|
|
362
|
+
PopoverMenu,
|
|
363
|
+
{
|
|
364
|
+
onClick: popupState.close,
|
|
365
|
+
...(0, import_ui6.bindMenu)(popupState),
|
|
366
|
+
PaperProps: {
|
|
367
|
+
sx: { mt: 4, marginInlineStart: -2 }
|
|
368
|
+
}
|
|
369
|
+
},
|
|
370
|
+
orderedGroups.filter((group) => group.length).map((group, index) => {
|
|
371
|
+
return [
|
|
372
|
+
index > 0 ? /* @__PURE__ */ React11.createElement(import_ui6.Divider, { key: index, orientation: "horizontal" }) : null,
|
|
373
|
+
...group.map(
|
|
374
|
+
({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React11.createElement(MenuItem2, { key: id })
|
|
375
|
+
)
|
|
376
|
+
];
|
|
377
|
+
})
|
|
378
|
+
));
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
// src/components/locations/tools-menu-location.tsx
|
|
382
|
+
var React14 = __toESM(require("react"));
|
|
383
|
+
|
|
384
|
+
// src/components/ui/toolbar-menu.tsx
|
|
385
|
+
var React12 = __toESM(require("react"));
|
|
386
|
+
var import_ui7 = require("@elementor/ui");
|
|
387
|
+
function ToolbarMenu({ children, ...props }) {
|
|
388
|
+
return /* @__PURE__ */ React12.createElement(MenuContextProvider, { type: "toolbar" }, /* @__PURE__ */ React12.createElement(import_ui7.Stack, { sx: { px: 4 }, spacing: 4, direction: "row", alignItems: "center", ...props }, children));
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
// src/components/ui/toolbar-menu-more.tsx
|
|
392
|
+
var React13 = __toESM(require("react"));
|
|
393
|
+
var import_ui8 = require("@elementor/ui");
|
|
394
|
+
var import_i18n2 = require("@wordpress/i18n");
|
|
395
|
+
var import_icons2 = require("@elementor/icons");
|
|
396
|
+
function ToolbarMenuMore({ children, id }) {
|
|
397
|
+
const popupState = (0, import_ui8.usePopupState)({
|
|
398
|
+
variant: "popover",
|
|
399
|
+
popupId: id
|
|
400
|
+
});
|
|
401
|
+
return /* @__PURE__ */ React13.createElement(React13.Fragment, null, /* @__PURE__ */ React13.createElement(ToolbarMenuItem, { ...(0, import_ui8.bindTrigger)(popupState), title: (0, import_i18n2.__)("More", "elementor") }, /* @__PURE__ */ React13.createElement(import_icons2.DotsVerticalIcon, null)), /* @__PURE__ */ React13.createElement(PopoverMenu, { onClick: popupState.close, ...(0, import_ui8.bindMenu)(popupState) }, children));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// src/components/locations/tools-menu-location.tsx
|
|
405
|
+
var MAX_TOOLBAR_ACTIONS = 5;
|
|
406
|
+
var { useMenuItems: useMenuItems2 } = toolsMenu;
|
|
407
|
+
function ToolsMenuLocation() {
|
|
408
|
+
const menuItems = useMenuItems2();
|
|
409
|
+
const toolbarMenuItems = menuItems.default.slice(0, MAX_TOOLBAR_ACTIONS);
|
|
410
|
+
const popoverMenuItems = menuItems.default.slice(MAX_TOOLBAR_ACTIONS);
|
|
411
|
+
return /* @__PURE__ */ React14.createElement(ToolbarMenu, null, toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React14.createElement(MenuItem2, { key: id })), popoverMenuItems.length > 0 && /* @__PURE__ */ React14.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-tools-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React14.createElement(MenuItem2, { key: id }))));
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/components/locations/utilities-menu-location.tsx
|
|
415
|
+
var React15 = __toESM(require("react"));
|
|
416
|
+
var import_react4 = require("react");
|
|
417
|
+
var import_ui9 = require("@elementor/ui");
|
|
418
|
+
var MAX_TOOLBAR_ACTIONS2 = 3;
|
|
419
|
+
var { useMenuItems: useMenuItems3 } = utilitiesMenu;
|
|
420
|
+
function UtilitiesMenuLocation() {
|
|
421
|
+
const menuItems = useMenuItems3();
|
|
422
|
+
const toolbarMenuItems = menuItems.default.slice(0, MAX_TOOLBAR_ACTIONS2);
|
|
423
|
+
const popoverMenuItems = menuItems.default.slice(MAX_TOOLBAR_ACTIONS2);
|
|
424
|
+
return /* @__PURE__ */ React15.createElement(ToolbarMenu, null, toolbarMenuItems.map(
|
|
425
|
+
({ MenuItem: MenuItem2, id }, index) => /* @__PURE__ */ React15.createElement(import_react4.Fragment, { key: id }, index === 0 && /* @__PURE__ */ React15.createElement(import_ui9.Divider, { orientation: "vertical" }), /* @__PURE__ */ React15.createElement(MenuItem2, null))
|
|
426
|
+
), popoverMenuItems.length > 0 && /* @__PURE__ */ React15.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React15.createElement(MenuItem2, { key: id }))));
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
// src/components/locations/primary-action-location.tsx
|
|
430
|
+
var React16 = __toESM(require("react"));
|
|
431
|
+
var import_locations6 = require("@elementor/locations");
|
|
432
|
+
function PrimaryActionLocation() {
|
|
433
|
+
return /* @__PURE__ */ React16.createElement(import_locations6.Slot, { location: LOCATION_PRIMARY_ACTION });
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
// src/components/locations/page-indication-location.tsx
|
|
437
|
+
var React17 = __toESM(require("react"));
|
|
438
|
+
var import_locations8 = require("@elementor/locations");
|
|
439
|
+
function PageIndicationLocation() {
|
|
440
|
+
return /* @__PURE__ */ React17.createElement(import_locations8.Slot, { location: LOCATION_PAGE_INDICATION });
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// src/components/locations/responsive-location.tsx
|
|
444
|
+
var React18 = __toESM(require("react"));
|
|
445
|
+
var import_locations10 = require("@elementor/locations");
|
|
446
|
+
function ResponsiveLocation() {
|
|
447
|
+
return /* @__PURE__ */ React18.createElement(import_locations10.Slot, { location: LOCATION_RESPONSIVE });
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
// src/components/app-bar.tsx
|
|
451
|
+
function AppBar() {
|
|
452
|
+
return /* @__PURE__ */ React19.createElement(import_ui10.ThemeProvider, { colorScheme: "dark" }, /* @__PURE__ */ React19.createElement(import_ui10.AppBar, { position: "sticky" }, /* @__PURE__ */ React19.createElement(import_ui10.Box, { display: "grid", gridTemplateColumns: "repeat(3, 1fr)" }, /* @__PURE__ */ React19.createElement(import_ui10.Grid, { container: true }, /* @__PURE__ */ React19.createElement(MainMenuLocation, null), /* @__PURE__ */ React19.createElement(ToolsMenuLocation, null)), /* @__PURE__ */ React19.createElement(import_ui10.Grid, { container: true, justifyContent: "center" }, /* @__PURE__ */ React19.createElement(ToolbarMenu, { spacing: 3 }, /* @__PURE__ */ React19.createElement(import_ui10.Divider, { orientation: "vertical" }), /* @__PURE__ */ React19.createElement(PageIndicationLocation, null), /* @__PURE__ */ React19.createElement(import_ui10.Divider, { orientation: "vertical" }), /* @__PURE__ */ React19.createElement(ResponsiveLocation, null), /* @__PURE__ */ React19.createElement(import_ui10.Divider, { orientation: "vertical" }))), /* @__PURE__ */ React19.createElement(import_ui10.Grid, { container: true, justifyContent: "flex-end" }, /* @__PURE__ */ React19.createElement(UtilitiesMenuLocation, null), /* @__PURE__ */ React19.createElement(PrimaryActionLocation, null)))));
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
// src/init.ts
|
|
456
|
+
var import_editor3 = require("@elementor/editor");
|
|
457
|
+
|
|
458
|
+
// src/sync/redirect-old-menus.ts
|
|
459
|
+
var import_editor_v1_adapters = require("@elementor/editor-v1-adapters");
|
|
460
|
+
function redirectOldMenus() {
|
|
461
|
+
(0, import_editor_v1_adapters.listenTo)((0, import_editor_v1_adapters.routeOpenEvent)("panel/menu"), () => {
|
|
462
|
+
(0, import_editor_v1_adapters.openRoute)("panel/elements/categories");
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
// src/extensions/documents-indicator/components/settings-button.tsx
|
|
467
|
+
var React20 = __toESM(require("react"));
|
|
468
|
+
var import_ui11 = require("@elementor/ui");
|
|
469
|
+
var import_i18n3 = require("@wordpress/i18n");
|
|
470
|
+
var import_editor_v1_adapters2 = require("@elementor/editor-v1-adapters");
|
|
471
|
+
var import_icons3 = require("@elementor/icons");
|
|
472
|
+
var import_editor_documents = require("@elementor/editor-documents");
|
|
473
|
+
function SettingsButton() {
|
|
474
|
+
const activeDocument = (0, import_editor_documents.useActiveDocument)();
|
|
475
|
+
const hostDocument = (0, import_editor_documents.useHostDocument)();
|
|
476
|
+
const document2 = activeDocument && activeDocument.type.value !== "kit" ? activeDocument : hostDocument;
|
|
477
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters2.useRouteStatus)("panel/page-settings");
|
|
478
|
+
if (!document2) {
|
|
479
|
+
return null;
|
|
480
|
+
}
|
|
481
|
+
const title = (0, import_i18n3.__)("%s Settings", "elementor").replace("%s", document2.type.label);
|
|
482
|
+
return /* @__PURE__ */ React20.createElement(import_ui11.Tooltip, { title }, /* @__PURE__ */ React20.createElement(import_ui11.Box, { component: "span", "aria-label": void 0 }, /* @__PURE__ */ React20.createElement(
|
|
483
|
+
import_ui11.ToggleButton,
|
|
484
|
+
{
|
|
485
|
+
value: "document-settings",
|
|
486
|
+
selected: isActive,
|
|
487
|
+
disabled: isBlocked,
|
|
488
|
+
onChange: () => (0, import_editor_v1_adapters2.openRoute)("panel/page-settings/settings"),
|
|
489
|
+
"aria-label": title,
|
|
490
|
+
size: "small"
|
|
491
|
+
},
|
|
492
|
+
/* @__PURE__ */ React20.createElement(import_icons3.SettingsIcon, null)
|
|
493
|
+
)));
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
// src/extensions/documents-indicator/index.ts
|
|
497
|
+
function init() {
|
|
498
|
+
injectIntoPageIndication({
|
|
499
|
+
name: "document-settings-button",
|
|
500
|
+
filler: SettingsButton,
|
|
501
|
+
options: {
|
|
502
|
+
priority: 20
|
|
503
|
+
// After document indicator.
|
|
504
|
+
}
|
|
505
|
+
});
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
// src/extensions/documents-preview/hooks/use-action-props.ts
|
|
509
|
+
var import_i18n4 = require("@wordpress/i18n");
|
|
510
|
+
var import_icons4 = require("@elementor/icons");
|
|
511
|
+
var import_editor_v1_adapters3 = require("@elementor/editor-v1-adapters");
|
|
512
|
+
var import_editor_documents2 = require("@elementor/editor-documents");
|
|
513
|
+
function useActionProps() {
|
|
514
|
+
const document2 = (0, import_editor_documents2.useActiveDocument)();
|
|
515
|
+
return {
|
|
516
|
+
icon: import_icons4.EyeIcon,
|
|
517
|
+
title: (0, import_i18n4.__)("Preview Changes", "elementor"),
|
|
518
|
+
onClick: () => document2 && (0, import_editor_v1_adapters3.runCommand)("editor/documents/preview", {
|
|
519
|
+
id: document2.id,
|
|
520
|
+
force: true
|
|
521
|
+
})
|
|
522
|
+
};
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
// src/extensions/documents-preview/index.ts
|
|
526
|
+
function init2() {
|
|
527
|
+
utilitiesMenu.registerAction({
|
|
528
|
+
name: "document-preview-button",
|
|
529
|
+
priority: 30,
|
|
530
|
+
// After help.
|
|
531
|
+
useProps: useActionProps
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// src/extensions/documents-save/hooks/use-document-save-draft-props.ts
|
|
536
|
+
var import_i18n5 = require("@wordpress/i18n");
|
|
537
|
+
var import_icons5 = require("@elementor/icons");
|
|
538
|
+
var import_editor_documents3 = require("@elementor/editor-documents");
|
|
539
|
+
function useDocumentSaveDraftProps() {
|
|
540
|
+
const document2 = (0, import_editor_documents3.useActiveDocument)();
|
|
541
|
+
const { saveDraft } = (0, import_editor_documents3.useActiveDocumentActions)();
|
|
542
|
+
return {
|
|
543
|
+
icon: import_icons5.FileReportIcon,
|
|
544
|
+
title: (0, import_i18n5.__)("Save Draft", "elementor"),
|
|
545
|
+
onClick: saveDraft,
|
|
546
|
+
disabled: !document2 || document2.isSaving || document2.isSavingDraft || !document2.isDirty
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
// src/extensions/documents-save/hooks/use-document-save-template-props.ts
|
|
551
|
+
var import_i18n6 = require("@wordpress/i18n");
|
|
552
|
+
var import_icons6 = require("@elementor/icons");
|
|
553
|
+
var import_editor_documents4 = require("@elementor/editor-documents");
|
|
554
|
+
function useDocumentSaveTemplateProps() {
|
|
555
|
+
const { saveTemplate } = (0, import_editor_documents4.useActiveDocumentActions)();
|
|
556
|
+
return {
|
|
557
|
+
icon: import_icons6.FolderIcon,
|
|
558
|
+
title: (0, import_i18n6.__)("Save as Template", "elementor"),
|
|
559
|
+
onClick: saveTemplate
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// src/extensions/documents-save/components/primary-action.tsx
|
|
564
|
+
var React22 = __toESM(require("react"));
|
|
565
|
+
var import_i18n7 = require("@wordpress/i18n");
|
|
566
|
+
|
|
567
|
+
// src/extensions/documents-save/components/primary-action-menu.tsx
|
|
568
|
+
var React21 = __toESM(require("react"));
|
|
569
|
+
var import_ui12 = require("@elementor/ui");
|
|
570
|
+
var { useMenuItems: useMenuItems4 } = documentOptionsMenu;
|
|
571
|
+
var StyledPopoverMenu = (0, import_ui12.styled)(PopoverMenu)`
|
|
572
|
+
& > .MuiPopover-paper > .MuiList-root > .MuiDivider-root {
|
|
573
|
+
&:only-child, /* A divider is being rendered lonely */
|
|
574
|
+
&:last-child, /* The last group renders empty but renders a divider */
|
|
575
|
+
& + .MuiDivider-root /* Multiple dividers due to multiple empty groups */ {
|
|
576
|
+
display: none;
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
`;
|
|
580
|
+
function PrimaryActionMenu(props) {
|
|
581
|
+
const { save: saveActions, default: defaultActions } = useMenuItems4();
|
|
582
|
+
return /* @__PURE__ */ React21.createElement(
|
|
583
|
+
StyledPopoverMenu,
|
|
584
|
+
{
|
|
585
|
+
...props,
|
|
586
|
+
anchorOrigin: {
|
|
587
|
+
vertical: "bottom",
|
|
588
|
+
horizontal: "right"
|
|
589
|
+
},
|
|
590
|
+
transformOrigin: {
|
|
591
|
+
vertical: "top",
|
|
592
|
+
horizontal: "right"
|
|
593
|
+
},
|
|
594
|
+
PaperProps: {
|
|
595
|
+
sx: { mt: 2, ml: 3 }
|
|
596
|
+
}
|
|
597
|
+
},
|
|
598
|
+
saveActions.map(({ MenuItem: MenuItem2, id }, index) => [
|
|
599
|
+
index > 0 && /* @__PURE__ */ React21.createElement(import_ui12.Divider, { key: `${id}-divider` }),
|
|
600
|
+
/* @__PURE__ */ React21.createElement(MenuItem2, { key: id })
|
|
601
|
+
]),
|
|
602
|
+
defaultActions.length > 0 && /* @__PURE__ */ React21.createElement(import_ui12.Divider, null),
|
|
603
|
+
defaultActions.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React21.createElement(MenuItem2, { key: id }))
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
// src/extensions/documents-save/components/primary-action.tsx
|
|
608
|
+
var import_ui13 = require("@elementor/ui");
|
|
609
|
+
var import_editor_documents5 = require("@elementor/editor-documents");
|
|
610
|
+
var import_icons7 = require("@elementor/icons");
|
|
611
|
+
function PrimaryAction() {
|
|
612
|
+
const document2 = (0, import_editor_documents5.useActiveDocument)();
|
|
613
|
+
const { save } = (0, import_editor_documents5.useActiveDocumentActions)();
|
|
614
|
+
const popupState = (0, import_ui13.usePopupState)({
|
|
615
|
+
variant: "popover",
|
|
616
|
+
popupId: "document-save-options"
|
|
617
|
+
});
|
|
618
|
+
if (!document2) {
|
|
619
|
+
return null;
|
|
620
|
+
}
|
|
621
|
+
const isDisabled = !isEnabled(document2);
|
|
622
|
+
const shouldShowSpinner = document2.isSaving && !isDisabled;
|
|
623
|
+
return /* @__PURE__ */ React22.createElement(React22.Fragment, null, /* @__PURE__ */ React22.createElement(import_ui13.ButtonGroup, { size: "large", variant: "contained" }, /* @__PURE__ */ React22.createElement(
|
|
624
|
+
import_ui13.Button,
|
|
625
|
+
{
|
|
626
|
+
onClick: () => !document2.isSaving && save(),
|
|
627
|
+
sx: { width: "120px" },
|
|
628
|
+
disabled: isDisabled
|
|
629
|
+
},
|
|
630
|
+
shouldShowSpinner ? /* @__PURE__ */ React22.createElement(import_ui13.CircularProgress, null) : getLabel(document2)
|
|
631
|
+
), /* @__PURE__ */ React22.createElement(
|
|
632
|
+
import_ui13.Tooltip,
|
|
633
|
+
{
|
|
634
|
+
title: (0, import_i18n7.__)("Save Options", "elementor"),
|
|
635
|
+
PopperProps: {
|
|
636
|
+
sx: {
|
|
637
|
+
"&.MuiTooltip-popper .MuiTooltip-tooltip.MuiTooltip-tooltipPlacementBottom": {
|
|
638
|
+
mt: 3,
|
|
639
|
+
mr: 1
|
|
640
|
+
}
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
/* @__PURE__ */ React22.createElement(import_ui13.Button, { sx: { px: 0 }, ...(0, import_ui13.bindTrigger)(popupState) }, /* @__PURE__ */ React22.createElement(import_icons7.ChevronDownIcon, null))
|
|
645
|
+
)), /* @__PURE__ */ React22.createElement(PrimaryActionMenu, { ...(0, import_ui13.bindMenu)(popupState), onClick: popupState.close }));
|
|
646
|
+
}
|
|
647
|
+
function getLabel(document2) {
|
|
648
|
+
return document2.userCan.publish ? (0, import_i18n7.__)("Publish", "elementor") : (0, import_i18n7.__)("Submit", "elementor");
|
|
649
|
+
}
|
|
650
|
+
function isEnabled(document2) {
|
|
651
|
+
if (document2.type.value === "kit") {
|
|
652
|
+
return false;
|
|
653
|
+
}
|
|
654
|
+
return document2.isDirty || document2.status.value === "draft";
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
// src/extensions/documents-save/index.ts
|
|
658
|
+
function init3() {
|
|
659
|
+
injectIntoPrimaryAction({
|
|
660
|
+
name: "document-primary-action",
|
|
661
|
+
filler: PrimaryAction
|
|
662
|
+
});
|
|
663
|
+
documentOptionsMenu.registerAction({
|
|
664
|
+
group: "save",
|
|
665
|
+
name: "document-save-draft",
|
|
666
|
+
priority: 10,
|
|
667
|
+
// Before save as template.
|
|
668
|
+
useProps: useDocumentSaveDraftProps
|
|
669
|
+
});
|
|
670
|
+
documentOptionsMenu.registerAction({
|
|
671
|
+
group: "save",
|
|
672
|
+
name: "document-save-as-template",
|
|
673
|
+
priority: 20,
|
|
674
|
+
// After save draft.
|
|
675
|
+
useProps: useDocumentSaveTemplateProps
|
|
676
|
+
});
|
|
677
|
+
}
|
|
678
|
+
|
|
679
|
+
// src/extensions/elements/sync/sync-panel-title.ts
|
|
680
|
+
var import_i18n8 = require("@wordpress/i18n");
|
|
681
|
+
var import_editor_v1_adapters4 = require("@elementor/editor-v1-adapters");
|
|
682
|
+
function syncPanelTitle() {
|
|
683
|
+
const panelTitle = (0, import_i18n8.__)("Elements", "elementor");
|
|
684
|
+
const tabTitle = (0, import_i18n8.__)("Widgets", "elementor");
|
|
685
|
+
(0, import_editor_v1_adapters4.listenTo)(
|
|
686
|
+
(0, import_editor_v1_adapters4.routeOpenEvent)("panel/elements"),
|
|
687
|
+
() => {
|
|
688
|
+
setPanelTitle(panelTitle);
|
|
689
|
+
setTabTitle(tabTitle);
|
|
690
|
+
}
|
|
691
|
+
);
|
|
692
|
+
(0, import_editor_v1_adapters4.listenTo)(
|
|
693
|
+
(0, import_editor_v1_adapters4.v1ReadyEvent)(),
|
|
694
|
+
() => {
|
|
695
|
+
if ((0, import_editor_v1_adapters4.isRouteActive)("panel/elements")) {
|
|
696
|
+
setPanelTitle(panelTitle);
|
|
697
|
+
setTabTitle(tabTitle);
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
function setPanelTitle(title) {
|
|
703
|
+
window.elementor?.getPanelView?.()?.getHeaderView?.()?.setTitle?.(title);
|
|
704
|
+
}
|
|
705
|
+
function setTabTitle(title) {
|
|
706
|
+
const tab = document.querySelector('.elementor-component-tab[data-tab="categories"]');
|
|
707
|
+
if (tab) {
|
|
708
|
+
tab.textContent = title;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
// src/extensions/elements/hooks/use-action-props.ts
|
|
713
|
+
var import_icons8 = require("@elementor/icons");
|
|
714
|
+
var import_i18n9 = require("@wordpress/i18n");
|
|
715
|
+
var import_editor_v1_adapters5 = require("@elementor/editor-v1-adapters");
|
|
716
|
+
function useActionProps2() {
|
|
717
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters5.useRouteStatus)("panel/elements");
|
|
718
|
+
return {
|
|
719
|
+
title: (0, import_i18n9.__)("Add Element", "elementor"),
|
|
720
|
+
icon: import_icons8.PlusIcon,
|
|
721
|
+
onClick: () => (0, import_editor_v1_adapters5.openRoute)("panel/elements/categories"),
|
|
722
|
+
selected: isActive,
|
|
723
|
+
disabled: isBlocked
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
// src/extensions/elements/index.ts
|
|
728
|
+
function init4() {
|
|
729
|
+
syncPanelTitle();
|
|
730
|
+
toolsMenu.registerToggleAction({
|
|
731
|
+
name: "open-elements-panel",
|
|
732
|
+
priority: 1,
|
|
733
|
+
useProps: useActionProps2
|
|
734
|
+
});
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
// src/extensions/finder/hooks/use-action-props.ts
|
|
738
|
+
var import_i18n10 = require("@wordpress/i18n");
|
|
739
|
+
var import_icons9 = require("@elementor/icons");
|
|
740
|
+
var import_editor_v1_adapters6 = require("@elementor/editor-v1-adapters");
|
|
741
|
+
function useActionProps3() {
|
|
742
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters6.useRouteStatus)("finder", {
|
|
743
|
+
blockOnKitRoutes: false,
|
|
744
|
+
blockOnPreviewMode: false
|
|
745
|
+
});
|
|
746
|
+
return {
|
|
747
|
+
title: (0, import_i18n10.__)("Finder", "elementor"),
|
|
748
|
+
icon: import_icons9.SearchIcon,
|
|
749
|
+
onClick: () => (0, import_editor_v1_adapters6.runCommand)("finder/toggle"),
|
|
750
|
+
selected: isActive,
|
|
751
|
+
disabled: isBlocked
|
|
752
|
+
};
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
// src/extensions/finder/index.ts
|
|
756
|
+
function init5() {
|
|
757
|
+
utilitiesMenu.registerToggleAction({
|
|
758
|
+
name: "toggle-finder",
|
|
759
|
+
priority: 10,
|
|
760
|
+
// Before help.
|
|
761
|
+
useProps: useActionProps3
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
|
|
765
|
+
// src/extensions/help/index.ts
|
|
766
|
+
var import_i18n11 = require("@wordpress/i18n");
|
|
767
|
+
var import_icons10 = require("@elementor/icons");
|
|
768
|
+
function init6() {
|
|
769
|
+
utilitiesMenu.registerLink({
|
|
770
|
+
name: "open-help-center",
|
|
771
|
+
priority: 20,
|
|
772
|
+
// After Finder.
|
|
773
|
+
useProps: () => {
|
|
774
|
+
return {
|
|
775
|
+
title: (0, import_i18n11.__)("Help", "elementor"),
|
|
776
|
+
href: "https://go.elementor.com/editor-top-bar-learn/",
|
|
777
|
+
icon: import_icons10.HelpIcon,
|
|
778
|
+
target: "_blank"
|
|
779
|
+
};
|
|
780
|
+
}
|
|
781
|
+
});
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
// src/extensions/history/hooks/use-action-props.ts
|
|
785
|
+
var import_icons11 = require("@elementor/icons");
|
|
786
|
+
var import_i18n12 = require("@wordpress/i18n");
|
|
787
|
+
var import_editor_v1_adapters7 = require("@elementor/editor-v1-adapters");
|
|
788
|
+
function useActionProps4() {
|
|
789
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters7.useRouteStatus)("panel/history");
|
|
790
|
+
return {
|
|
791
|
+
title: (0, import_i18n12.__)("History", "elementor"),
|
|
792
|
+
icon: import_icons11.HistoryIcon,
|
|
793
|
+
onClick: () => (0, import_editor_v1_adapters7.openRoute)("panel/history/actions"),
|
|
794
|
+
selected: isActive,
|
|
795
|
+
disabled: isBlocked
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/extensions/history/index.ts
|
|
800
|
+
function init7() {
|
|
801
|
+
mainMenu.registerToggleAction({
|
|
802
|
+
name: "open-history",
|
|
803
|
+
priority: 20,
|
|
804
|
+
useProps: useActionProps4
|
|
805
|
+
});
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
// src/extensions/keyboard-shortcuts/hooks/use-action-props.ts
|
|
809
|
+
var import_i18n13 = require("@wordpress/i18n");
|
|
810
|
+
var import_icons12 = require("@elementor/icons");
|
|
811
|
+
var import_editor_v1_adapters8 = require("@elementor/editor-v1-adapters");
|
|
812
|
+
function useActionProps5() {
|
|
813
|
+
return {
|
|
814
|
+
icon: import_icons12.KeyboardIcon,
|
|
815
|
+
title: (0, import_i18n13.__)("Keyboard Shortcuts", "elementor"),
|
|
816
|
+
onClick: () => (0, import_editor_v1_adapters8.runCommand)("shortcuts/open")
|
|
817
|
+
};
|
|
818
|
+
}
|
|
819
|
+
|
|
820
|
+
// src/extensions/keyboard-shortcuts/index.ts
|
|
821
|
+
function init8() {
|
|
822
|
+
mainMenu.registerAction({
|
|
823
|
+
name: "open-keyboard-shortcuts",
|
|
824
|
+
group: "default",
|
|
825
|
+
priority: 40,
|
|
826
|
+
// After user preferences.
|
|
827
|
+
useProps: useActionProps5
|
|
828
|
+
});
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
// src/extensions/site-settings/index.ts
|
|
832
|
+
var import_editor = require("@elementor/editor");
|
|
833
|
+
|
|
834
|
+
// src/extensions/site-settings/components/portalled-primary-action.tsx
|
|
835
|
+
var React25 = __toESM(require("react"));
|
|
836
|
+
|
|
837
|
+
// src/extensions/site-settings/components/portal.tsx
|
|
838
|
+
var React23 = __toESM(require("react"));
|
|
839
|
+
var import_ui14 = require("@elementor/ui");
|
|
840
|
+
var import_editor_v1_adapters9 = require("@elementor/editor-v1-adapters");
|
|
841
|
+
function Portal(props) {
|
|
842
|
+
const containerRef = (0, import_editor_v1_adapters9.useListenTo)(
|
|
843
|
+
[
|
|
844
|
+
(0, import_editor_v1_adapters9.routeOpenEvent)("panel/global"),
|
|
845
|
+
(0, import_editor_v1_adapters9.routeCloseEvent)("panel/global")
|
|
846
|
+
],
|
|
847
|
+
getContainerRef
|
|
848
|
+
);
|
|
849
|
+
if (!containerRef.current) {
|
|
850
|
+
return null;
|
|
851
|
+
}
|
|
852
|
+
return /* @__PURE__ */ React23.createElement(import_ui14.Portal, { container: containerRef.current, ...props });
|
|
853
|
+
}
|
|
854
|
+
function getContainerRef() {
|
|
855
|
+
return (0, import_editor_v1_adapters9.isRouteActive)("panel/global") ? { current: document.querySelector("#elementor-panel-inner") } : { current: null };
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// src/extensions/site-settings/components/primary-action.tsx
|
|
859
|
+
var React24 = __toESM(require("react"));
|
|
860
|
+
var import_editor_documents6 = require("@elementor/editor-documents");
|
|
861
|
+
var import_ui15 = require("@elementor/ui");
|
|
862
|
+
var import_i18n14 = require("@wordpress/i18n");
|
|
863
|
+
function PrimaryAction2() {
|
|
864
|
+
const document2 = (0, import_editor_documents6.useActiveDocument)();
|
|
865
|
+
const { save } = (0, import_editor_documents6.useActiveDocumentActions)();
|
|
866
|
+
return /* @__PURE__ */ React24.createElement(import_ui15.Paper, { sx: {
|
|
867
|
+
px: 5,
|
|
868
|
+
py: 4,
|
|
869
|
+
borderTop: 1,
|
|
870
|
+
borderColor: "divider"
|
|
871
|
+
} }, /* @__PURE__ */ React24.createElement(
|
|
872
|
+
import_ui15.Button,
|
|
873
|
+
{
|
|
874
|
+
variant: "contained",
|
|
875
|
+
disabled: !document2 || !document2.isDirty,
|
|
876
|
+
size: "medium",
|
|
877
|
+
sx: { width: "100%" },
|
|
878
|
+
onClick: () => document2 && !document2.isSaving ? save() : null
|
|
879
|
+
},
|
|
880
|
+
document2?.isSaving ? /* @__PURE__ */ React24.createElement(import_ui15.CircularProgress, null) : (0, import_i18n14.__)("Save Changes", "elementor")
|
|
881
|
+
));
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
// src/extensions/site-settings/components/portalled-primary-action.tsx
|
|
885
|
+
function PortalledPrimaryAction() {
|
|
886
|
+
return /* @__PURE__ */ React25.createElement(Portal, null, /* @__PURE__ */ React25.createElement(PrimaryAction2, null));
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
// src/extensions/site-settings/hooks/use-action-props.ts
|
|
890
|
+
var import_i18n15 = require("@wordpress/i18n");
|
|
891
|
+
var import_editor_v1_adapters10 = require("@elementor/editor-v1-adapters");
|
|
892
|
+
var import_icons13 = require("@elementor/icons");
|
|
893
|
+
function useActionProps6() {
|
|
894
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters10.useRouteStatus)("panel/global", {
|
|
895
|
+
blockOnKitRoutes: false
|
|
896
|
+
});
|
|
897
|
+
return {
|
|
898
|
+
title: (0, import_i18n15.__)("Site Settings", "elementor"),
|
|
899
|
+
icon: import_icons13.AdjustmentsHorizontalIcon,
|
|
900
|
+
onClick: () => isActive ? (0, import_editor_v1_adapters10.runCommand)("panel/global/close") : (0, import_editor_v1_adapters10.runCommand)("panel/global/open"),
|
|
901
|
+
selected: isActive,
|
|
902
|
+
disabled: isBlocked
|
|
903
|
+
};
|
|
904
|
+
}
|
|
905
|
+
|
|
906
|
+
// src/extensions/site-settings/index.ts
|
|
907
|
+
function init9() {
|
|
908
|
+
(0, import_editor.injectIntoTop)({
|
|
909
|
+
name: "site-settings-primary-action-portal",
|
|
910
|
+
filler: PortalledPrimaryAction
|
|
911
|
+
});
|
|
912
|
+
toolsMenu.registerToggleAction({
|
|
913
|
+
name: "toggle-site-settings",
|
|
914
|
+
priority: 2,
|
|
915
|
+
useProps: useActionProps6
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
// src/extensions/structure/hooks/use-action-props.ts
|
|
920
|
+
var import_i18n16 = require("@wordpress/i18n");
|
|
921
|
+
var import_editor_v1_adapters11 = require("@elementor/editor-v1-adapters");
|
|
922
|
+
var import_icons14 = require("@elementor/icons");
|
|
923
|
+
function useActionProps7() {
|
|
924
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters11.useRouteStatus)("navigator");
|
|
925
|
+
return {
|
|
926
|
+
title: (0, import_i18n16.__)("Structure", "elementor"),
|
|
927
|
+
icon: import_icons14.StructureIcon,
|
|
928
|
+
onClick: () => (0, import_editor_v1_adapters11.runCommand)("navigator/toggle"),
|
|
929
|
+
selected: isActive,
|
|
930
|
+
disabled: isBlocked
|
|
931
|
+
};
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
// src/extensions/structure/index.ts
|
|
935
|
+
function init10() {
|
|
936
|
+
toolsMenu.registerToggleAction({
|
|
937
|
+
name: "toggle-structure-view",
|
|
938
|
+
priority: 3,
|
|
939
|
+
useProps: useActionProps7
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
|
|
943
|
+
// src/extensions/theme-builder/hooks/use-action-props.ts
|
|
944
|
+
var import_i18n17 = require("@wordpress/i18n");
|
|
945
|
+
var import_icons15 = require("@elementor/icons");
|
|
946
|
+
var import_editor_v1_adapters12 = require("@elementor/editor-v1-adapters");
|
|
947
|
+
function useActionProps8() {
|
|
948
|
+
return {
|
|
949
|
+
icon: import_icons15.ThemeBuilderIcon,
|
|
950
|
+
title: (0, import_i18n17.__)("Theme Builder", "elementor"),
|
|
951
|
+
onClick: () => (0, import_editor_v1_adapters12.runCommand)("app/open")
|
|
952
|
+
};
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
// src/extensions/theme-builder/index.ts
|
|
956
|
+
function init11() {
|
|
957
|
+
mainMenu.registerAction({
|
|
958
|
+
name: "open-theme-builder",
|
|
959
|
+
useProps: useActionProps8
|
|
960
|
+
});
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
// src/extensions/user-preferences/hooks/use-action-props.ts
|
|
964
|
+
var import_i18n18 = require("@wordpress/i18n");
|
|
965
|
+
var import_icons16 = require("@elementor/icons");
|
|
966
|
+
var import_editor_v1_adapters13 = require("@elementor/editor-v1-adapters");
|
|
967
|
+
function useActionProps9() {
|
|
968
|
+
const { isActive, isBlocked } = (0, import_editor_v1_adapters13.useRouteStatus)("panel/editor-preferences");
|
|
969
|
+
return {
|
|
970
|
+
icon: import_icons16.ToggleRightIcon,
|
|
971
|
+
title: (0, import_i18n18.__)("User Preferences", "elementor"),
|
|
972
|
+
onClick: () => (0, import_editor_v1_adapters13.openRoute)("panel/editor-preferences"),
|
|
973
|
+
selected: isActive,
|
|
974
|
+
disabled: isBlocked
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// src/extensions/user-preferences/index.ts
|
|
979
|
+
function init12() {
|
|
980
|
+
mainMenu.registerToggleAction({
|
|
981
|
+
name: "open-user-preferences",
|
|
982
|
+
priority: 30,
|
|
983
|
+
// After history.
|
|
984
|
+
useProps: useActionProps9
|
|
985
|
+
});
|
|
986
|
+
}
|
|
987
|
+
|
|
988
|
+
// src/extensions/wordpress/index.ts
|
|
989
|
+
var import_editor2 = require("@elementor/editor");
|
|
990
|
+
var import_i18n19 = require("@wordpress/i18n");
|
|
991
|
+
var import_icons17 = require("@elementor/icons");
|
|
992
|
+
function init13() {
|
|
993
|
+
mainMenu.registerLink({
|
|
994
|
+
name: "manage-website",
|
|
995
|
+
group: "exits",
|
|
996
|
+
useProps: () => {
|
|
997
|
+
const { urls } = (0, import_editor2.useSettings)();
|
|
998
|
+
return {
|
|
999
|
+
title: (0, import_i18n19.__)("Manage Website", "elementor"),
|
|
1000
|
+
href: urls.admin,
|
|
1001
|
+
icon: import_icons17.WordpressIcon,
|
|
1002
|
+
target: "_blank"
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
// src/extensions/index.ts
|
|
1009
|
+
function init14() {
|
|
1010
|
+
init();
|
|
1011
|
+
init2();
|
|
1012
|
+
init3();
|
|
1013
|
+
init4();
|
|
1014
|
+
init5();
|
|
1015
|
+
init6();
|
|
1016
|
+
init7();
|
|
1017
|
+
init8();
|
|
1018
|
+
init9();
|
|
1019
|
+
init10();
|
|
1020
|
+
init11();
|
|
1021
|
+
init12();
|
|
1022
|
+
init13();
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
// src/init.ts
|
|
1026
|
+
function init15() {
|
|
1027
|
+
redirectOldMenus();
|
|
1028
|
+
init14();
|
|
1029
|
+
(0, import_editor3.injectIntoTop)({
|
|
1030
|
+
name: "app-bar",
|
|
1031
|
+
filler: AppBar
|
|
1032
|
+
});
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
// src/index.ts
|
|
1036
|
+
init15();
|
|
1037
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
1038
|
+
0 && (module.exports = {
|
|
1039
|
+
documentOptionsMenu,
|
|
1040
|
+
injectIntoPageIndication,
|
|
1041
|
+
injectIntoPrimaryAction,
|
|
1042
|
+
injectIntoResponsive,
|
|
1043
|
+
mainMenu,
|
|
1044
|
+
toolsMenu,
|
|
1045
|
+
utilitiesMenu
|
|
1046
|
+
});
|
|
1047
|
+
//# sourceMappingURL=index.js.map
|