@elementor/editor-site-navigation 0.14.0 → 0.15.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.15.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.14.0...@elementor/editor-site-navigation@0.15.0) (2023-07-30)
7
+
8
+
9
+ ### Features
10
+
11
+ * **site-navigation:** add duplicate action to pages panel - fix [ED-10867] ([#96](https://github.com/elementor/elementor-packages/issues/96)) ([a1ece1b](https://github.com/elementor/elementor-packages/commit/a1ece1bf08657e8bc905cad59e3f9f65064b2f9a))
12
+
13
+
14
+
15
+
16
+
6
17
  # [0.14.0](https://github.com/elementor/elementor-packages/compare/@elementor/editor-site-navigation@0.13.0...@elementor/editor-site-navigation@0.14.0) (2023-07-27)
7
18
 
8
19
 
package/dist/index.js CHANGED
@@ -566,7 +566,7 @@ function ListItemCreate() {
566
566
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
567
567
  var React11 = __toESM(require("react"));
568
568
  var import_i18n6 = require("@wordpress/i18n");
569
- function ListItemDuplicate({ post }) {
569
+ function ListItemDuplicate() {
570
570
  const { type, editMode, resetEditMode } = usePostListContext();
571
571
  const { duplicatePost } = usePostActions(type);
572
572
  if ("duplicate" !== editMode.mode) {
@@ -574,7 +574,7 @@ function ListItemDuplicate({ post }) {
574
574
  }
575
575
  const duplicatePostCallback = (inputValue) => {
576
576
  duplicatePost.mutateAsync({
577
- id: post.id,
577
+ id: editMode.details.postId,
578
578
  title: inputValue
579
579
  }, {
580
580
  onSuccess: () => {
@@ -833,8 +833,8 @@ function PostListItem2({ post }) {
833
833
  if ("create" === editMode.mode && !post) {
834
834
  return /* @__PURE__ */ React21.createElement(ListItemCreate, null);
835
835
  }
836
- if ("duplicate" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
837
- return /* @__PURE__ */ React21.createElement(ListItemDuplicate, { post });
836
+ if ("duplicate" === editMode.mode && !post) {
837
+ return /* @__PURE__ */ React21.createElement(ListItemDuplicate, null);
838
838
  }
839
839
  if (!post) {
840
840
  return null;
package/dist/index.mjs CHANGED
@@ -555,7 +555,7 @@ function ListItemCreate() {
555
555
  // src/components/panel/posts-list/list-items/list-item-duplicate.tsx
556
556
  import * as React11 from "react";
557
557
  import { __ as __6 } from "@wordpress/i18n";
558
- function ListItemDuplicate({ post }) {
558
+ function ListItemDuplicate() {
559
559
  const { type, editMode, resetEditMode } = usePostListContext();
560
560
  const { duplicatePost } = usePostActions(type);
561
561
  if ("duplicate" !== editMode.mode) {
@@ -563,7 +563,7 @@ function ListItemDuplicate({ post }) {
563
563
  }
564
564
  const duplicatePostCallback = (inputValue) => {
565
565
  duplicatePost.mutateAsync({
566
- id: post.id,
566
+ id: editMode.details.postId,
567
567
  title: inputValue
568
568
  }, {
569
569
  onSuccess: () => {
@@ -833,8 +833,8 @@ function PostListItem2({ post }) {
833
833
  if ("create" === editMode.mode && !post) {
834
834
  return /* @__PURE__ */ React21.createElement(ListItemCreate, null);
835
835
  }
836
- if ("duplicate" === editMode.mode && post?.id && post?.id === editMode.details.postId) {
837
- return /* @__PURE__ */ React21.createElement(ListItemDuplicate, { post });
836
+ if ("duplicate" === editMode.mode && !post) {
837
+ return /* @__PURE__ */ React21.createElement(ListItemDuplicate, null);
838
838
  }
839
839
  if (!post) {
840
840
  return null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elementor/editor-site-navigation",
3
- "version": "0.14.0",
3
+ "version": "0.15.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": "025f7ec0942da99205377c41e713afe1e8f7898d"
52
+ "gitHead": "78d26926d1e887adf068cfc7974b36aaf46c0e5c"
53
53
  }
@@ -3,13 +3,8 @@ import { __ } from '@wordpress/i18n';
3
3
  import { usePostListContext } from '../../../../contexts/post-list-context';
4
4
  import { usePostActions } from '../../../../hooks/use-posts-actions';
5
5
  import EditModeTemplate from './edit-mode-template';
6
- import { Post } from '../../../../types';
7
6
 
8
- type Props = {
9
- post: Post,
10
- }
11
-
12
- export default function ListItemDuplicate( { post }: Props ) {
7
+ export default function ListItemDuplicate() {
13
8
  const { type, editMode, resetEditMode } = usePostListContext();
14
9
  const { duplicatePost } = usePostActions( type );
15
10
 
@@ -19,7 +14,7 @@ export default function ListItemDuplicate( { post }: Props ) {
19
14
 
20
15
  const duplicatePostCallback = ( inputValue: string ) => {
21
16
  duplicatePost.mutateAsync( {
22
- id: post.id,
17
+ id: editMode.details.postId,
23
18
  title: inputValue,
24
19
  }, {
25
20
  onSuccess: () => {
@@ -17,8 +17,8 @@ export default function PostListItem( { post }: { post?: Post } ) {
17
17
  return <ListItemCreate />;
18
18
  }
19
19
 
20
- if ( 'duplicate' === editMode.mode && post?.id && post?.id === editMode.details.postId ) {
21
- return <ListItemDuplicate post={ post } />;
20
+ if ( 'duplicate' === editMode.mode && ! post ) {
21
+ return <ListItemDuplicate />;
22
22
  }
23
23
 
24
24
  if ( ! post ) {