@elementor/editor-site-navigation 0.12.0 → 0.13.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 CHANGED
@@ -3,6 +3,17 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.13.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.12.0...@elementor/editor-site-navigation@0.13.0) (2023-07-26)
7
+
8
+
9
+ ### Features
10
+
11
+ * added view page action to pages panel [ED-10869] ([#66](https://github.com/elementor/elementor-packages/issues/66)) ([dfefd2f](https://github.com/elementor/elementor-packages/commit/dfefd2f90435c8ecf45c897c4329bd9c5a262a6c))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.12.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.11.0...@elementor/editor-site-navigation@0.12.0) (2023-07-24)
7
18
 
8
19
 
package/dist/index.js CHANGED
@@ -249,7 +249,7 @@ function RecentlyEdited() {
249
249
  // src/init.ts
250
250
  var import_editor_app_bar = require("@elementor/editor-app-bar");
251
251
 
252
- // src/hooks/useToggleButtonProps.ts
252
+ // src/hooks/use-toggle-button-props.ts
253
253
  var import_i18n14 = require("@wordpress/i18n");
254
254
  var import_icons15 = require("@elementor/icons");
255
255
 
@@ -724,7 +724,7 @@ function View({ post }) {
724
724
  title,
725
725
  icon: import_icons10.EyeIcon,
726
726
  onClick: () => {
727
- console.log(post);
727
+ window.open(post.link, "_blank");
728
728
  }
729
729
  }
730
730
  );
@@ -891,7 +891,7 @@ var {
891
891
  component: shell_default
892
892
  });
893
893
 
894
- // src/hooks/useToggleButtonProps.ts
894
+ // src/hooks/use-toggle-button-props.ts
895
895
  function useToggleButtonProps() {
896
896
  const { isOpen, isBlocked } = usePanelStatus();
897
897
  const { open, close } = usePanelActions();
package/dist/index.mjs CHANGED
@@ -231,7 +231,7 @@ function RecentlyEdited() {
231
231
  // src/init.ts
232
232
  import { injectIntoPageIndication, toolsMenu } from "@elementor/editor-app-bar";
233
233
 
234
- // src/hooks/useToggleButtonProps.ts
234
+ // src/hooks/use-toggle-button-props.ts
235
235
  import { __ as __14 } from "@wordpress/i18n";
236
236
  import { PagesIcon } from "@elementor/icons";
237
237
 
@@ -724,7 +724,7 @@ function View({ post }) {
724
724
  title,
725
725
  icon: EyeIcon,
726
726
  onClick: () => {
727
- console.log(post);
727
+ window.open(post.link, "_blank");
728
728
  }
729
729
  }
730
730
  );
@@ -891,7 +891,7 @@ var {
891
891
  component: shell_default
892
892
  });
893
893
 
894
- // src/hooks/useToggleButtonProps.ts
894
+ // src/hooks/use-toggle-button-props.ts
895
895
  function useToggleButtonProps() {
896
896
  const { isOpen, isBlocked } = usePanelStatus();
897
897
  const { open, close } = usePanelActions();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-site-navigation",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "private": false,
5
5
  "author": "Elementor Team",
6
6
  "homepage": "https://elementor.com/",
@@ -49,5 +49,5 @@
49
49
  "elementor": {
50
50
  "type": "extension"
51
51
  },
52
- "gitHead": "e8add4d4645e1c8f62a11ddac8d26d50341b6ed2"
52
+ "gitHead": "eb0ac23904894e5643c30e5b66b91541032bb8a0"
53
53
  }
@@ -0,0 +1,36 @@
1
+ import * as React from 'react';
2
+ import { act, render, screen } from '@testing-library/react';
3
+ import View from '../view';
4
+ import { Post } from '../../../../../types';
5
+
6
+ describe( '@elementor/editor-site-navigation - View', () => {
7
+ afterAll( () => {
8
+ jest.clearAllMocks();
9
+ } );
10
+
11
+ it( 'should open page in a different tab', () => {
12
+ // Arrange.
13
+ const spy = jest.spyOn( window, 'open' );
14
+ spy.mockImplementation( () => null );
15
+ const page: Post = {
16
+ id: 1,
17
+ title: { rendered: 'Page Title' },
18
+ link: 'mocklink',
19
+ status: 'publish',
20
+ type: 'page',
21
+ };
22
+
23
+ // Act.
24
+ render( <View post={ page } /> );
25
+ const button = screen.getByRole( 'button' );
26
+
27
+ act( () => {
28
+ // Open menu
29
+ button.click();
30
+ } );
31
+
32
+ // Assert.
33
+ expect( spy ).toHaveBeenCalledTimes( 1 );
34
+ expect( spy ).toHaveBeenCalledWith( 'mocklink', '_blank' );
35
+ } );
36
+ } );
@@ -17,8 +17,7 @@ export default function View( { post }: { post: Post } ) {
17
17
  title={ title }
18
18
  icon={ EyeIcon }
19
19
  onClick={ () => {
20
- // eslint-disable-next-line no-console
21
- console.log( post );
20
+ window.open( post.link, '_blank' );
22
21
  } }
23
22
  />
24
23
  );
package/src/init.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import RecentlyEdited from './components/top-bar/recently-edited';
2
2
  import { injectIntoPageIndication, toolsMenu } from '@elementor/editor-app-bar';
3
- import { useToggleButtonProps } from './hooks/useToggleButtonProps';
3
+ import { useToggleButtonProps } from './hooks/use-toggle-button-props';
4
4
  import { registerPanel } from '@elementor/editor-panels';
5
5
  import { panel } from './components/panel/panel';
6
6
  import { env } from './env';
package/src/types.ts CHANGED
@@ -7,7 +7,7 @@ export type Post = {
7
7
  title: {
8
8
  rendered: string;
9
9
  }
10
- }
10
+ };
11
11
 
12
12
  export type PostType = {
13
13
  name: string;