kaori před 4 roky
rodič
revize
fe79ffa31c

+ 2 - 2
packages/app/src/components/Navbar/GrowiContextualSubNavigation.tsx

@@ -184,8 +184,8 @@ const GrowiContextualSubNavigation = (props) => {
   }, [pageId]);
 
   const duplicateItemClickedHandler = useCallback(async(page: IPageForPageDuplicateModal) => {
-    const duplicatedHandler: OnDuplicatedFunction = (path, pageId) => {
-      window.location.href = pageId;
+    const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
+      window.location.href = toPath;
     };
     openDuplicateModal(page, { onDuplicated: duplicatedHandler });
   }, [openDuplicateModal]);

+ 4 - 1
packages/app/src/components/PageDuplicateModal.jsx

@@ -114,8 +114,11 @@ const PageDuplicateModal = (props) => {
     try {
       const { data } = await appContainer.apiv3Post('/pages/duplicate', { pageId, pageNameInput, isRecursively: isDuplicateRecursively });
       const onDuplicated = duplicateModalData.opts?.onDuplicated;
+      const fromPath = path;
+      const toPath = data.page.path;
+
       if (onDuplicated != null) {
-        onDuplicated(path, data.page._id);
+        onDuplicated(fromPath, toPath);
       }
       closeDuplicateModal();
     }

+ 2 - 2
packages/app/src/components/SearchPage/SearchResultContent.tsx

@@ -121,8 +121,8 @@ export const SearchResultContent: FC<Props> = (props: Props) => {
 
   const duplicateItemClickedHandler = useCallback(async(pageToDuplicate) => {
     // eslint-disable-next-line @typescript-eslint/no-unused-vars
-    const duplicatedHandler: OnDuplicatedFunction = (path, pageId) => {
-      toastSuccess(t('duplicated_pages', { path }));
+    const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
+      toastSuccess(t('duplicated_pages', { fromPath }));
 
       advancePt();
       advanceFts();

+ 2 - 2
packages/app/src/components/Sidebar/PageTree/ItemsTree.tsx

@@ -144,8 +144,8 @@ const ItemsTree: FC<ItemsTreeProps> = (props: ItemsTreeProps) => {
 
   const onClickDuplicateMenuItem = (pageToDuplicate: IPageForPageDuplicateModal) => {
     // eslint-disable-next-line @typescript-eslint/no-unused-vars
-    const duplicatedHandler: OnDuplicatedFunction = (path, pageId) => {
-      toastSuccess(t('duplicated_pages', { path }));
+    const duplicatedHandler: OnDuplicatedFunction = (fromPath, toPath) => {
+      toastSuccess(t('duplicated_pages', { fromPath }));
 
       advancePt();
       advanceFts();

+ 1 - 1
packages/app/src/interfaces/ui.ts

@@ -23,4 +23,4 @@ export type ICustomNavTabMappings = { [key: string]: ICustomTabContent };
 
 export type OnDeletedFunction = (idOrPaths: string | string[], isRecursively: Nullable<true>, isCompletely: Nullable<true>) => void;
 export type OnRenamedFunction = (path: string) => void;
-export type OnDuplicatedFunction = (path: string, pageId: string) => void;
+export type OnDuplicatedFunction = (fromPath: string, toPath: string) => void;