@elementor/editor-site-navigation 0.34.0 → 0.35.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/CHANGELOG.md +6 -0
- package/dist/index.js +15 -3
- package/dist/index.mjs +15 -3
- package/package.json +1 -1
- package/src/hooks/use-toggle-button-props.ts +20 -4
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -1307,13 +1307,25 @@ var { env } = (0, import_env.parseEnv)("@elementor/editor-site-navigation", (env
|
|
|
1307
1307
|
var import_icons16 = require("@elementor/icons");
|
|
1308
1308
|
var import_i18n16 = require("@wordpress/i18n");
|
|
1309
1309
|
function useToggleButtonProps() {
|
|
1310
|
-
const { isOpen, isBlocked } = usePanelStatus();
|
|
1310
|
+
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1311
1311
|
const { open, close } = usePanelActions();
|
|
1312
1312
|
return {
|
|
1313
1313
|
title: (0, import_i18n16.__)("Pages", "elementor"),
|
|
1314
1314
|
icon: import_icons16.PagesIcon,
|
|
1315
|
-
onClick: () =>
|
|
1316
|
-
|
|
1315
|
+
onClick: () => {
|
|
1316
|
+
const extendedWindow = window;
|
|
1317
|
+
const config = extendedWindow?.elementor?.editorEvents?.config;
|
|
1318
|
+
if (config) {
|
|
1319
|
+
extendedWindow.elementor.editorEvents.dispatchEvent("top_bar_pages", {
|
|
1320
|
+
location: config.locations.topBar,
|
|
1321
|
+
secondaryLocation: config.secondaryLocations.elementorLogo,
|
|
1322
|
+
trigger: config.triggers.click,
|
|
1323
|
+
element: config.elements.buttonIcon
|
|
1324
|
+
});
|
|
1325
|
+
}
|
|
1326
|
+
return selectedState ? close() : open();
|
|
1327
|
+
},
|
|
1328
|
+
selected: selectedState,
|
|
1317
1329
|
disabled: isBlocked
|
|
1318
1330
|
};
|
|
1319
1331
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -1322,13 +1322,25 @@ var { env } = parseEnv("@elementor/editor-site-navigation", (envData) => {
|
|
|
1322
1322
|
import { PagesIcon } from "@elementor/icons";
|
|
1323
1323
|
import { __ as __16 } from "@wordpress/i18n";
|
|
1324
1324
|
function useToggleButtonProps() {
|
|
1325
|
-
const { isOpen, isBlocked } = usePanelStatus();
|
|
1325
|
+
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
1326
1326
|
const { open, close } = usePanelActions();
|
|
1327
1327
|
return {
|
|
1328
1328
|
title: __16("Pages", "elementor"),
|
|
1329
1329
|
icon: PagesIcon,
|
|
1330
|
-
onClick: () =>
|
|
1331
|
-
|
|
1330
|
+
onClick: () => {
|
|
1331
|
+
const extendedWindow = window;
|
|
1332
|
+
const config = extendedWindow?.elementor?.editorEvents?.config;
|
|
1333
|
+
if (config) {
|
|
1334
|
+
extendedWindow.elementor.editorEvents.dispatchEvent("top_bar_pages", {
|
|
1335
|
+
location: config.locations.topBar,
|
|
1336
|
+
secondaryLocation: config.secondaryLocations.elementorLogo,
|
|
1337
|
+
trigger: config.triggers.click,
|
|
1338
|
+
element: config.elements.buttonIcon
|
|
1339
|
+
});
|
|
1340
|
+
}
|
|
1341
|
+
return selectedState ? close() : open();
|
|
1342
|
+
},
|
|
1343
|
+
selected: selectedState,
|
|
1332
1344
|
disabled: isBlocked
|
|
1333
1345
|
};
|
|
1334
1346
|
}
|
package/package.json
CHANGED
|
@@ -1,17 +1,33 @@
|
|
|
1
|
+
import { type ToggleActionProps } from '@elementor/editor-app-bar';
|
|
1
2
|
import { PagesIcon } from '@elementor/icons';
|
|
2
3
|
import { __ } from '@wordpress/i18n';
|
|
3
4
|
|
|
4
5
|
import { usePanelActions, usePanelStatus } from '../components/panel/panel';
|
|
6
|
+
import { type ExtendedWindow } from '../types';
|
|
5
7
|
|
|
6
|
-
export function useToggleButtonProps() {
|
|
7
|
-
const { isOpen, isBlocked } = usePanelStatus();
|
|
8
|
+
export function useToggleButtonProps(): ToggleActionProps {
|
|
9
|
+
const { isOpen: selectedState, isBlocked } = usePanelStatus();
|
|
8
10
|
const { open, close } = usePanelActions();
|
|
9
11
|
|
|
10
12
|
return {
|
|
11
13
|
title: __( 'Pages', 'elementor' ),
|
|
12
14
|
icon: PagesIcon,
|
|
13
|
-
onClick: () =>
|
|
14
|
-
|
|
15
|
+
onClick: () => {
|
|
16
|
+
const extendedWindow = window as unknown as ExtendedWindow;
|
|
17
|
+
const config = extendedWindow?.elementor?.editorEvents?.config;
|
|
18
|
+
|
|
19
|
+
if ( config ) {
|
|
20
|
+
extendedWindow.elementor.editorEvents.dispatchEvent( 'top_bar_pages', {
|
|
21
|
+
location: config.locations.topBar,
|
|
22
|
+
secondaryLocation: config.secondaryLocations.elementorLogo,
|
|
23
|
+
trigger: config.triggers.click,
|
|
24
|
+
element: config.elements.buttonIcon,
|
|
25
|
+
} );
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return selectedState ? close() : open();
|
|
29
|
+
},
|
|
30
|
+
selected: selectedState,
|
|
15
31
|
disabled: isBlocked,
|
|
16
32
|
};
|
|
17
33
|
}
|