mirror of
https://github.com/docmost/docmost.git
synced 2025-11-13 11:32:39 +10:00
feat: move page between spaces (#988)
* feat: Move the page to another space - The ability to move a page to another space has been added * feat: Move the page to another space * feat: Move the page to another space - Correction of the visibility attribute of elements that extend beyond the boundaries of the space selection modal window * feat: Move the page to another space - Added removal of query keys when moving pages * feat: Move the page to another space - Fix locales * feat: Move the page to another space * feat: Move the page to another space - Fix docker compose * feat: Move the page to another space * feat: Move the page to another space - Some refactor * feat: Move the page to another space - Attachments update * feat: Move the page to another space - The function of searching for attachments by page ID and updating attachments has been combined * feat: Move the page to another space - Fix variable name * feat: Move the page to another space - Move current space to parameter of component SpaceSelectionModal * refactor ui --------- Co-authored-by: plekhanov <astecom@mail.ru>
This commit is contained in:
@ -7,11 +7,12 @@ import {
|
||||
usePageQuery,
|
||||
useUpdatePageMutation,
|
||||
} from "@/features/page/queries/page-query.ts";
|
||||
import React, { useEffect, useRef } from "react";
|
||||
import { useEffect, useRef } from "react";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import classes from "@/features/page/tree/styles/tree.module.css";
|
||||
import { ActionIcon, Menu, rem } from "@mantine/core";
|
||||
import {
|
||||
IconArrowRight,
|
||||
IconChevronDown,
|
||||
IconChevronRight,
|
||||
IconDotsVertical,
|
||||
@ -56,6 +57,7 @@ import { extractPageSlugId } from "@/lib";
|
||||
import { useDeletePageModal } from "@/features/page/hooks/use-delete-page-modal.tsx";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import ExportModal from "@/components/common/export-modal";
|
||||
import MovePageModal from "../../components/move-page-modal.tsx";
|
||||
|
||||
interface SpaceTreeProps {
|
||||
spaceId: string;
|
||||
@ -234,6 +236,7 @@ function Node({ node, style, dragHandle, tree }: NodeRendererProps<any>) {
|
||||
const emit = useQueryEmit();
|
||||
const { spaceSlug } = useParams();
|
||||
const timerRef = useRef(null);
|
||||
const { t } = useTranslation();
|
||||
|
||||
const prefetchPage = () => {
|
||||
timerRef.current = setTimeout(() => {
|
||||
@ -369,7 +372,7 @@ function Node({ node, style, dragHandle, tree }: NodeRendererProps<any>) {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<span className={classes.text}>{node.data.name || "untitled"}</span>
|
||||
<span className={classes.text}>{node.data.name || t("untitled")}</span>
|
||||
|
||||
<div className={classes.actions}>
|
||||
<NodeMenu node={node} treeApi={tree} />
|
||||
@ -434,6 +437,10 @@ function NodeMenu({ node, treeApi }: NodeMenuProps) {
|
||||
const { openDeleteModal } = useDeletePageModal();
|
||||
const [exportOpened, { open: openExportModal, close: closeExportModal }] =
|
||||
useDisclosure(false);
|
||||
const [
|
||||
movePageModalOpened,
|
||||
{ open: openMovePageModal, close: closeMoveSpaceModal },
|
||||
] = useDisclosure(false);
|
||||
|
||||
const handleCopyLink = () => {
|
||||
const pageUrl =
|
||||
@ -486,8 +493,18 @@ function NodeMenu({ node, treeApi }: NodeMenuProps) {
|
||||
|
||||
{!(treeApi.props.disableEdit as boolean) && (
|
||||
<>
|
||||
<Menu.Divider />
|
||||
<Menu.Item
|
||||
leftSection={<IconArrowRight size={16} />}
|
||||
onClick={(e) => {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
openMovePageModal();
|
||||
}}
|
||||
>
|
||||
{t("Move")}
|
||||
</Menu.Item>
|
||||
|
||||
<Menu.Divider />
|
||||
<Menu.Item
|
||||
c="red"
|
||||
leftSection={<IconTrash size={16} />}
|
||||
@ -504,6 +521,14 @@ function NodeMenu({ node, treeApi }: NodeMenuProps) {
|
||||
</Menu.Dropdown>
|
||||
</Menu>
|
||||
|
||||
<MovePageModal
|
||||
pageId={node.id}
|
||||
slugId={node.data.slugId}
|
||||
currentSpaceSlug={spaceSlug}
|
||||
onClose={closeMoveSpaceModal}
|
||||
open={movePageModalOpened}
|
||||
/>
|
||||
|
||||
<ExportModal
|
||||
type="page"
|
||||
id={node.id}
|
||||
|
||||
Reference in New Issue
Block a user