@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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elementor/editor-app-bar",
|
|
3
3
|
"description": "App Bar extension for @elementor/editor",
|
|
4
|
-
"version": "4.3.0-
|
|
4
|
+
"version": "4.3.0-beta2",
|
|
5
5
|
"private": false,
|
|
6
6
|
"author": "Elementor Team",
|
|
7
7
|
"homepage": "https://elementor.com/",
|
|
@@ -40,18 +40,18 @@
|
|
|
40
40
|
"dev": "tsup --config=../../tsup.dev.ts"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@elementor/editor-current-user": "4.3.0-
|
|
44
|
-
"@elementor/editor-ui": "4.3.0-
|
|
45
|
-
"@elementor/http-client": "4.3.0-
|
|
46
|
-
"@elementor/editor": "4.3.0-
|
|
47
|
-
"@elementor/editor-documents": "4.3.0-
|
|
48
|
-
"@elementor/editor-mcp": "4.3.0-
|
|
49
|
-
"@elementor/editor-responsive": "4.3.0-
|
|
50
|
-
"@elementor/editor-v1-adapters": "4.3.0-
|
|
43
|
+
"@elementor/editor-current-user": "4.3.0-beta2",
|
|
44
|
+
"@elementor/editor-ui": "4.3.0-beta2",
|
|
45
|
+
"@elementor/http-client": "4.3.0-beta2",
|
|
46
|
+
"@elementor/editor": "4.3.0-beta2",
|
|
47
|
+
"@elementor/editor-documents": "4.3.0-beta2",
|
|
48
|
+
"@elementor/editor-mcp": "4.3.0-beta2",
|
|
49
|
+
"@elementor/editor-responsive": "4.3.0-beta2",
|
|
50
|
+
"@elementor/editor-v1-adapters": "4.3.0-beta2",
|
|
51
51
|
"@elementor/icons": "~1.75.1",
|
|
52
|
-
"@elementor/locations": "4.3.0-
|
|
53
|
-
"@elementor/menus": "4.3.0-
|
|
54
|
-
"@elementor/events": "4.3.0-
|
|
52
|
+
"@elementor/locations": "4.3.0-beta2",
|
|
53
|
+
"@elementor/menus": "4.3.0-beta2",
|
|
54
|
+
"@elementor/events": "4.3.0-beta2",
|
|
55
55
|
"@elementor/ui": "1.37.5",
|
|
56
56
|
"@wordpress/i18n": "^5.13.0"
|
|
57
57
|
},
|
|
@@ -14,18 +14,13 @@ export default function UtilitiesMenuLocation() {
|
|
|
14
14
|
|
|
15
15
|
// If there are more items than the allowed max, show the max inline and the rest in the popover.
|
|
16
16
|
// Otherwise, display all items inline.
|
|
17
|
-
const shouldUsePopover = menuItems.default.length > maxToolbarActions
|
|
17
|
+
const shouldUsePopover = menuItems.default.length > maxToolbarActions;
|
|
18
18
|
|
|
19
19
|
const toolbarMenuItems = shouldUsePopover ? menuItems.default.slice( 0, maxToolbarActions ) : menuItems.default;
|
|
20
20
|
const popoverMenuItems = shouldUsePopover ? menuItems.default.slice( maxToolbarActions ) : [];
|
|
21
21
|
|
|
22
22
|
return (
|
|
23
23
|
<ToolbarMenu>
|
|
24
|
-
{ toolbarMenuItems.map( ( { MenuItem, id } ) => (
|
|
25
|
-
<Fragment key={ id }>
|
|
26
|
-
<MenuItem />
|
|
27
|
-
</Fragment>
|
|
28
|
-
) ) }
|
|
29
24
|
{ popoverMenuItems.length > 0 && (
|
|
30
25
|
<ToolbarMenuMore id="elementor-editor-app-bar-utilities-more">
|
|
31
26
|
{ popoverMenuItems.map( ( { MenuItem, id } ) => (
|
|
@@ -33,6 +28,11 @@ export default function UtilitiesMenuLocation() {
|
|
|
33
28
|
) ) }
|
|
34
29
|
</ToolbarMenuMore>
|
|
35
30
|
) }
|
|
31
|
+
{ toolbarMenuItems.map( ( { MenuItem, id } ) => (
|
|
32
|
+
<Fragment key={ id }>
|
|
33
|
+
<MenuItem />
|
|
34
|
+
</Fragment>
|
|
35
|
+
) ) }
|
|
36
36
|
</ToolbarMenu>
|
|
37
37
|
);
|
|
38
38
|
}
|
package/src/constants.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { useEffect } from 'react';
|
|
2
|
-
import { isAngieAvailable } from '@elementor/editor-mcp';
|
|
3
2
|
import { trackEvent } from '@elementor/events';
|
|
4
3
|
import { AngieIcon } from '@elementor/icons';
|
|
5
4
|
import { __ } from '@wordpress/i18n';
|
|
6
5
|
|
|
6
|
+
import { useIsAngieAvailable } from '../../../hooks/use-is-angie-available';
|
|
7
7
|
import { AI_WIDGET_CTA_VIEWED_EVENT, ANGIE_GUIDE_TOGGLE_EVENT } from '../angie-consts';
|
|
8
8
|
|
|
9
9
|
export function useActionProps() {
|
|
10
|
-
const hasAngieInstalled =
|
|
10
|
+
const hasAngieInstalled = useIsAngieAvailable();
|
|
11
11
|
const visible = ! hasAngieInstalled;
|
|
12
12
|
|
|
13
13
|
useEffect( () => {
|
|
@@ -13,6 +13,7 @@ export default function useActionProps() {
|
|
|
13
13
|
return {
|
|
14
14
|
title: __( 'Add Element', 'elementor' ),
|
|
15
15
|
icon: PlusIcon,
|
|
16
|
+
id: 'ele-add-element',
|
|
16
17
|
onClick: () => {
|
|
17
18
|
const extendedWindow = window as unknown as ExtendedWindow;
|
|
18
19
|
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
@@ -1,26 +1,48 @@
|
|
|
1
|
+
import { isAngieAvailable, openAngieInAskMode } from '@elementor/editor-mcp';
|
|
1
2
|
import { HelpIcon } from '@elementor/icons';
|
|
2
3
|
import { __ } from '@wordpress/i18n';
|
|
3
4
|
|
|
4
5
|
import { type ExtendedWindow } from '../../../types';
|
|
5
6
|
|
|
7
|
+
const HELP_CENTER_URL = 'https://go.elementor.com/editor-top-bar-learn/';
|
|
8
|
+
const HELP_CENTER_ANGIE_PROMPT = `${ __( 'Help me with', 'elementor' ) } `;
|
|
9
|
+
|
|
10
|
+
const dispatchHelpClickEvent = () => {
|
|
11
|
+
const extendedWindow = window as unknown as ExtendedWindow;
|
|
12
|
+
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
13
|
+
|
|
14
|
+
if ( config ) {
|
|
15
|
+
extendedWindow.elementorCommon.eventsManager.dispatchEvent( config.names.topBar.help, {
|
|
16
|
+
location: config.locations.topBar,
|
|
17
|
+
secondaryLocation: config.secondaryLocations.help,
|
|
18
|
+
trigger: config.triggers.click,
|
|
19
|
+
element: config.elements.buttonIcon,
|
|
20
|
+
} );
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
6
24
|
export default function useActionProps() {
|
|
25
|
+
const hasAngieActive = isAngieAvailable();
|
|
26
|
+
|
|
27
|
+
if ( hasAngieActive ) {
|
|
28
|
+
return {
|
|
29
|
+
title: __( 'Help Center', 'elementor' ),
|
|
30
|
+
icon: HelpIcon,
|
|
31
|
+
onClick: ( event: React.MouseEvent ) => {
|
|
32
|
+
event.preventDefault();
|
|
33
|
+
dispatchHelpClickEvent();
|
|
34
|
+
openAngieInAskMode( HELP_CENTER_ANGIE_PROMPT );
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
|
|
7
39
|
return {
|
|
8
40
|
title: __( 'Help Center', 'elementor' ),
|
|
9
|
-
href:
|
|
41
|
+
href: HELP_CENTER_URL,
|
|
10
42
|
icon: HelpIcon,
|
|
11
43
|
target: '_blank',
|
|
12
44
|
onClick: () => {
|
|
13
|
-
|
|
14
|
-
const config = extendedWindow?.elementorCommon?.eventsManager?.config;
|
|
15
|
-
|
|
16
|
-
if ( config ) {
|
|
17
|
-
extendedWindow.elementorCommon.eventsManager.dispatchEvent( config.names.topBar.help, {
|
|
18
|
-
location: config.locations.topBar,
|
|
19
|
-
secondaryLocation: config.secondaryLocations.help,
|
|
20
|
-
trigger: config.triggers.click,
|
|
21
|
-
element: config.elements.buttonIcon,
|
|
22
|
-
} );
|
|
23
|
-
}
|
|
45
|
+
dispatchHelpClickEvent();
|
|
24
46
|
},
|
|
25
47
|
};
|
|
26
48
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useEffect, useState } from 'react';
|
|
2
|
+
import { isAngieAvailable } from '@elementor/editor-mcp';
|
|
3
|
+
|
|
4
|
+
export function useIsAngieAvailable(): boolean {
|
|
5
|
+
const [ available, setAvailable ] = useState( () => isAngieAvailable() );
|
|
6
|
+
|
|
7
|
+
useEffect( () => {
|
|
8
|
+
if ( available ) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
if ( isAngieAvailable() ) {
|
|
13
|
+
setAvailable( true );
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const observer = new MutationObserver( () => {
|
|
18
|
+
if ( isAngieAvailable() ) {
|
|
19
|
+
observer.disconnect();
|
|
20
|
+
setAvailable( true );
|
|
21
|
+
}
|
|
22
|
+
} );
|
|
23
|
+
|
|
24
|
+
observer.observe( document.body, {
|
|
25
|
+
childList: true,
|
|
26
|
+
subtree: true,
|
|
27
|
+
} );
|
|
28
|
+
|
|
29
|
+
return () => observer.disconnect();
|
|
30
|
+
}, [ available ] );
|
|
31
|
+
|
|
32
|
+
return available;
|
|
33
|
+
}
|