0.10.8 • Published 18 days ago

@elementor/editor-app-bar v0.10.8

Weekly downloads
-
License
GPL-3.0-or-later
Repository
github
Last release
18 days ago

Editor App Bar

!WARNING Please refrain from accessing or depending on functions and variables starting with double underscores, as they are subject to change without notice. Naming convention involving double underscores (__) as a prefix to indicate that a function or variable is meant for internal use and should not be accessed or relied upon by third-party developers.

Usage

Menus

There are 5 types of menus:

  • mainMenu - Provides access to the main features and functionality of the application. Represented by an Elementor logo that changes to a hamburger.
  • toolsMenu - A menu where the user can access various editing tools (e.g. "add widget", "structure", etc.) for manipulating the data or interface in some way. This section may contain a limited number of buttons for common tools, as well as a dropdown menu for accessing additional ones.
  • utilitiesMenu - A menu where the user can access various utility features that are not directly related to the main functionality of the application. This may include options for accessing the finder, getting help, or accessing other miscellaneous features.
  • documentOptionsMenu - A menu where the user can access various options for saving the document. This may include options for saving as draft or conditional options related to the document (e.g. "display conditions", etc.).
  • integrationsMenu - A sub-menu inside the mainMenu where the user can access various options for integrating with other services. This may include options for connecting to a third-party service or accessing other miscellaneous features.

Each menu contains a list of items, each item can be:

  • Action - A button that performs an action.
  • Link - A link that navigates to a different page.
  • ToggleAction - A button that toggles between two states (checked or unchecked).

Let's extend the integrationsMenu with multiple examples that will cover all the types of items:

Action

import { integrationsMenu } from '@elementor/editor-app-bar';
import { PlusIcon } from '@elementor/icons';
import { __ } from '@wordpress/i18n';

integrationsMenu.registerAction( {
	id: 'example-action-id',
	props: {
		title: __( 'My Custom Action', 'elementor' ),
		icon: PlusIcon, // A react component that renders an SVG icon
		disabled: false, // Optional
		onClick: () => alert( 'Custom action triggered!' ), // Optional
	}
} );    

ToggleAction

import { integrationsMenu } from '@elementor/editor-app-bar';
import { EyeIcon } from '@elementor/icons';
import { __ } from '@wordpress/i18n';

integrationsMenu.registerToggleAction( {
	name: 'my-custom-toggle',
	useProps: () => {
		const [ isSelected, setIsSelected ] = useState( false );

		return {
			title: __( 'My Custom Toggle', 'elementor' ),
			icon: EyeIcon,
			selected: isSelected, // Optional
			onClick: () => setIsSelected( ( prev ) => ! prev ), // Optional
			disabled: false, // Optional
		};
	},
} );

Link

import { integrationsMenu } from '@elementor/editor-app-bar';
import { LinkIcon } from '@elementor/icons';
import { __ } from '@wordpress/i18n';

integrationsMenu.registerLink( {
	name: 'my-custom-link',
	props: {
		title: __( 'My Custom Link', 'elementor' ),
		icon: LinkIcon,
		href: 'https://elementor.com', // Optional
		target: '_blank', // Optional
	},
} );

!NOTE You can use either props or useProps (depending on your need) for all the items types:

  • props - An object with the action props.
  • useProps - A React hook that returns the action props and lets you make the props reactive.

!NOTE The icon property can be any React component that renders an SVG icon, it is recommended to use SVGIcon from @elementor/ui

Custom Locations

TBD

0.10.7

18 days ago

0.10.8

18 days ago

0.10.6

1 month ago

0.10.5

1 month ago

0.10.4

2 months ago

0.10.3

2 months ago

0.10.2

2 months ago

0.10.1

3 months ago

0.10.0

3 months ago

0.9.8

3 months ago

0.9.7

6 months ago

0.9.4

7 months ago

0.6.7

10 months ago

0.6.6

10 months ago

0.9.6

6 months ago

0.6.9

10 months ago

0.9.5

7 months ago

0.6.8

10 months ago

0.9.0

8 months ago

0.7.2

9 months ago

0.8.0

8 months ago

0.7.1

9 months ago

0.9.2

7 months ago

0.9.1

7 months ago

0.7.3

9 months ago

0.7.0

9 months ago

0.6.5

10 months ago

0.6.4

10 months ago

0.6.3

10 months ago

0.6.2

10 months ago

0.6.1

11 months ago

0.6.0

11 months ago

0.5.1

11 months ago

0.5.0

11 months ago

0.4.1

11 months ago

0.4.0

12 months ago

0.3.0

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.1.0

1 year ago