@elementor/editor-app-bar 4.3.0-999 → 4.3.0-beta2
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +72 -24
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +70 -22
- package/dist/index.mjs.map +1 -1
- package/package.json +12 -12
- package/src/components/actions/toggle-action.tsx +1 -0
- package/src/components/locations/utilities-menu-location.tsx +6 -6
- package/src/constants.ts +2 -2
- package/src/extensions/angie/components/angie-guide-location.tsx +1 -1
- package/src/extensions/angie/hooks/use-action-props.ts +2 -2
- package/src/extensions/documents-settings/index.ts +1 -1
- package/src/extensions/elements/hooks/use-action-props.ts +1 -0
- package/src/extensions/help/hooks/use-action-props.ts +34 -12
- package/src/extensions/history/index.ts +1 -1
- package/src/hooks/use-is-angie-available.ts +33 -0
package/dist/index.mjs
CHANGED
|
@@ -197,8 +197,8 @@ import { AppBar as BaseAppBar, Box as Box3, Divider as Divider2, Grid, ThemeProv
|
|
|
197
197
|
// src/constants.ts
|
|
198
198
|
var MIN_APP_BAR_WIDTH = 800;
|
|
199
199
|
var DEFAULT_MAX_TOOLBAR_ACTIONS = {
|
|
200
|
-
tools:
|
|
201
|
-
utilities:
|
|
200
|
+
tools: 6,
|
|
201
|
+
utilities: 5
|
|
202
202
|
};
|
|
203
203
|
|
|
204
204
|
// src/contexts/app-bar-size-context.tsx
|
|
@@ -512,7 +512,7 @@ function AngieGuideLocation() {
|
|
|
512
512
|
]
|
|
513
513
|
}
|
|
514
514
|
},
|
|
515
|
-
/* @__PURE__ */ React16.createElement("span",
|
|
515
|
+
/* @__PURE__ */ React16.createElement("span", { style: { display: "contents" } })
|
|
516
516
|
));
|
|
517
517
|
}
|
|
518
518
|
|
|
@@ -730,10 +730,10 @@ var { useMenuItems: useMenuItems4 } = utilitiesMenu;
|
|
|
730
730
|
function UtilitiesMenuLocation() {
|
|
731
731
|
const menuItems = useMenuItems4();
|
|
732
732
|
const { utilities: maxToolbarActions } = useMaxToolbarActions();
|
|
733
|
-
const shouldUsePopover = menuItems.default.length > maxToolbarActions
|
|
733
|
+
const shouldUsePopover = menuItems.default.length > maxToolbarActions;
|
|
734
734
|
const toolbarMenuItems = shouldUsePopover ? menuItems.default.slice(0, maxToolbarActions) : menuItems.default;
|
|
735
735
|
const popoverMenuItems = shouldUsePopover ? menuItems.default.slice(maxToolbarActions) : [];
|
|
736
|
-
return /* @__PURE__ */ React22.createElement(ToolbarMenu, null,
|
|
736
|
+
return /* @__PURE__ */ React22.createElement(ToolbarMenu, null, popoverMenuItems.length > 0 && /* @__PURE__ */ React22.createElement(ToolbarMenuMore, { id: "elementor-editor-app-bar-utilities-more" }, popoverMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React22.createElement(MenuItem2, { key: id }))), toolbarMenuItems.map(({ MenuItem: MenuItem2, id }) => /* @__PURE__ */ React22.createElement(Fragment4, { key: id }, /* @__PURE__ */ React22.createElement(MenuItem2, null))));
|
|
737
737
|
}
|
|
738
738
|
|
|
739
739
|
// src/components/app-bar.tsx
|
|
@@ -766,15 +766,44 @@ function AppBar() {
|
|
|
766
766
|
}
|
|
767
767
|
|
|
768
768
|
// src/extensions/angie/hooks/use-action-props.ts
|
|
769
|
-
import { useEffect as
|
|
770
|
-
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
769
|
+
import { useEffect as useEffect6 } from "react";
|
|
771
770
|
import { trackEvent } from "@elementor/events";
|
|
772
771
|
import { AngieIcon } from "@elementor/icons";
|
|
773
772
|
import { __ as __7 } from "@wordpress/i18n";
|
|
773
|
+
|
|
774
|
+
// src/hooks/use-is-angie-available.ts
|
|
775
|
+
import { useEffect as useEffect5, useState as useState5 } from "react";
|
|
776
|
+
import { isAngieAvailable } from "@elementor/editor-mcp";
|
|
777
|
+
function useIsAngieAvailable() {
|
|
778
|
+
const [available, setAvailable] = useState5(() => isAngieAvailable());
|
|
779
|
+
useEffect5(() => {
|
|
780
|
+
if (available) {
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
if (isAngieAvailable()) {
|
|
784
|
+
setAvailable(true);
|
|
785
|
+
return;
|
|
786
|
+
}
|
|
787
|
+
const observer = new MutationObserver(() => {
|
|
788
|
+
if (isAngieAvailable()) {
|
|
789
|
+
observer.disconnect();
|
|
790
|
+
setAvailable(true);
|
|
791
|
+
}
|
|
792
|
+
});
|
|
793
|
+
observer.observe(document.body, {
|
|
794
|
+
childList: true,
|
|
795
|
+
subtree: true
|
|
796
|
+
});
|
|
797
|
+
return () => observer.disconnect();
|
|
798
|
+
}, [available]);
|
|
799
|
+
return available;
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// src/extensions/angie/hooks/use-action-props.ts
|
|
774
803
|
function useActionProps() {
|
|
775
|
-
const hasAngieInstalled =
|
|
804
|
+
const hasAngieInstalled = useIsAngieAvailable();
|
|
776
805
|
const visible = !hasAngieInstalled;
|
|
777
|
-
|
|
806
|
+
useEffect6(() => {
|
|
778
807
|
if (!visible) {
|
|
779
808
|
return;
|
|
780
809
|
}
|
|
@@ -1287,7 +1316,7 @@ function useActionProps3() {
|
|
|
1287
1316
|
function init5() {
|
|
1288
1317
|
toolsMenu.registerToggleAction({
|
|
1289
1318
|
id: "document-settings-button",
|
|
1290
|
-
priority:
|
|
1319
|
+
priority: 5,
|
|
1291
1320
|
useProps: useActionProps3
|
|
1292
1321
|
});
|
|
1293
1322
|
}
|
|
@@ -1304,6 +1333,7 @@ function useActionProps4() {
|
|
|
1304
1333
|
return {
|
|
1305
1334
|
title: __16("Add Element", "elementor"),
|
|
1306
1335
|
icon: PlusIcon,
|
|
1336
|
+
id: "ele-add-element",
|
|
1307
1337
|
onClick: () => {
|
|
1308
1338
|
const extendedWindow = window;
|
|
1309
1339
|
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
@@ -1423,25 +1453,43 @@ function init8() {
|
|
|
1423
1453
|
}
|
|
1424
1454
|
|
|
1425
1455
|
// src/extensions/help/hooks/use-action-props.ts
|
|
1456
|
+
import { isAngieAvailable as isAngieAvailable2, openAngieInAskMode } from "@elementor/editor-mcp";
|
|
1426
1457
|
import { HelpIcon } from "@elementor/icons";
|
|
1427
1458
|
import { __ as __20 } from "@wordpress/i18n";
|
|
1459
|
+
var HELP_CENTER_URL = "https://go.elementor.com/editor-top-bar-learn/";
|
|
1460
|
+
var HELP_CENTER_ANGIE_PROMPT = `${__20("Help me with", "elementor")} `;
|
|
1461
|
+
var dispatchHelpClickEvent = () => {
|
|
1462
|
+
const extendedWindow = window;
|
|
1463
|
+
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
1464
|
+
if (config) {
|
|
1465
|
+
extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.help, {
|
|
1466
|
+
location: config.locations.topBar,
|
|
1467
|
+
secondaryLocation: config.secondaryLocations.help,
|
|
1468
|
+
trigger: config.triggers.click,
|
|
1469
|
+
element: config.elements.buttonIcon
|
|
1470
|
+
});
|
|
1471
|
+
}
|
|
1472
|
+
};
|
|
1428
1473
|
function useActionProps6() {
|
|
1474
|
+
const hasAngieActive = isAngieAvailable2();
|
|
1475
|
+
if (hasAngieActive) {
|
|
1476
|
+
return {
|
|
1477
|
+
title: __20("Help Center", "elementor"),
|
|
1478
|
+
icon: HelpIcon,
|
|
1479
|
+
onClick: (event) => {
|
|
1480
|
+
event.preventDefault();
|
|
1481
|
+
dispatchHelpClickEvent();
|
|
1482
|
+
openAngieInAskMode(HELP_CENTER_ANGIE_PROMPT);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
}
|
|
1429
1486
|
return {
|
|
1430
1487
|
title: __20("Help Center", "elementor"),
|
|
1431
|
-
href:
|
|
1488
|
+
href: HELP_CENTER_URL,
|
|
1432
1489
|
icon: HelpIcon,
|
|
1433
1490
|
target: "_blank",
|
|
1434
1491
|
onClick: () => {
|
|
1435
|
-
|
|
1436
|
-
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
1437
|
-
if (config) {
|
|
1438
|
-
extendedWindow.elementorCommon.eventsManager.dispatchEvent(config.names.topBar.help, {
|
|
1439
|
-
location: config.locations.topBar,
|
|
1440
|
-
secondaryLocation: config.secondaryLocations.help,
|
|
1441
|
-
trigger: config.triggers.click,
|
|
1442
|
-
element: config.elements.buttonIcon
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1492
|
+
dispatchHelpClickEvent();
|
|
1445
1493
|
}
|
|
1446
1494
|
};
|
|
1447
1495
|
}
|
|
@@ -1490,7 +1538,7 @@ function useActionProps7() {
|
|
|
1490
1538
|
function init10() {
|
|
1491
1539
|
toolsMenu.registerToggleAction({
|
|
1492
1540
|
id: "open-history",
|
|
1493
|
-
priority:
|
|
1541
|
+
priority: 3,
|
|
1494
1542
|
useProps: useActionProps7
|
|
1495
1543
|
});
|
|
1496
1544
|
}
|