Initial commit: Plane
Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Some checks failed
Branch Build CE / Build Setup (push) Has been cancelled
Branch Build CE / Build-Push Admin Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Web Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Space Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Live Collaboration Docker Image (push) Has been cancelled
Branch Build CE / Build-Push API Server Docker Image (push) Has been cancelled
Branch Build CE / Build-Push Proxy Docker Image (push) Has been cancelled
Branch Build CE / Build-Push AIO Docker Image (push) Has been cancelled
Branch Build CE / Upload Build Assets (push) Has been cancelled
Branch Build CE / Build Release (push) Has been cancelled
CodeQL / Analyze (javascript) (push) Has been cancelled
CodeQL / Analyze (python) (push) Has been cancelled
Codespell / Check for spelling errors (push) Has been cancelled
Sync Repositories / sync_changes (push) Has been cancelled
Synced from upstream: 8853637e981ed7d8a6cff32bd98e7afe20f54362
This commit is contained in:
2
apps/web/ce/hooks/pages/index.ts
Normal file
2
apps/web/ce/hooks/pages/index.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./use-pages-pane-extensions";
|
||||
export * from "./use-extended-editor-extensions";
|
||||
20
apps/web/ce/hooks/pages/use-extended-editor-extensions.ts
Normal file
20
apps/web/ce/hooks/pages/use-extended-editor-extensions.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { IEditorPropsExtended } from "@plane/editor";
|
||||
import type { TSearchEntityRequestPayload, TSearchResponse } from "@plane/types";
|
||||
import type { TPageInstance } from "@/store/pages/base-page";
|
||||
import type { EPageStoreType } from "../store";
|
||||
|
||||
export type TExtendedEditorExtensionsHookParams = {
|
||||
workspaceSlug: string;
|
||||
page: TPageInstance;
|
||||
storeType: EPageStoreType;
|
||||
fetchEntity: (payload: TSearchEntityRequestPayload) => Promise<TSearchResponse>;
|
||||
getRedirectionLink: (pageId?: string) => string;
|
||||
extensionHandlers?: Map<string, unknown>;
|
||||
projectId?: string;
|
||||
};
|
||||
|
||||
export type TExtendedEditorExtensionsConfig = IEditorPropsExtended;
|
||||
|
||||
export const useExtendedEditorProps = (
|
||||
_params: TExtendedEditorExtensionsHookParams
|
||||
): TExtendedEditorExtensionsConfig => ({});
|
||||
62
apps/web/ce/hooks/pages/use-pages-pane-extensions.ts
Normal file
62
apps/web/ce/hooks/pages/use-pages-pane-extensions.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { useCallback, useMemo } from "react";
|
||||
import type { RefObject } from "react";
|
||||
import { useSearchParams } from "next/navigation";
|
||||
import type { EditorRefApi } from "@plane/editor";
|
||||
import {
|
||||
PAGE_NAVIGATION_PANE_TAB_KEYS,
|
||||
PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM,
|
||||
PAGE_NAVIGATION_PANE_VERSION_QUERY_PARAM,
|
||||
} from "@/components/pages/navigation-pane";
|
||||
import { useAppRouter } from "@/hooks/use-app-router";
|
||||
import { useQueryParams } from "@/hooks/use-query-params";
|
||||
import type { TPageNavigationPaneTab } from "@/plane-web/components/pages/navigation-pane";
|
||||
import type { INavigationPaneExtension } from "@/plane-web/types/pages/pane-extensions";
|
||||
import type { TPageInstance } from "@/store/pages/base-page";
|
||||
|
||||
export type TPageExtensionHookParams = {
|
||||
page: TPageInstance;
|
||||
editorRef: RefObject<EditorRefApi>;
|
||||
};
|
||||
|
||||
export const usePagesPaneExtensions = (_params: TPageExtensionHookParams) => {
|
||||
const router = useAppRouter();
|
||||
const { updateQueryParams } = useQueryParams();
|
||||
const searchParams = useSearchParams();
|
||||
|
||||
// Generic navigation pane logic - hook manages feature-specific routing
|
||||
const navigationPaneQueryParam = searchParams.get(
|
||||
PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM
|
||||
) as TPageNavigationPaneTab | null;
|
||||
|
||||
const isNavigationPaneOpen =
|
||||
!!navigationPaneQueryParam && PAGE_NAVIGATION_PANE_TAB_KEYS.includes(navigationPaneQueryParam);
|
||||
|
||||
const handleOpenNavigationPane = useCallback(() => {
|
||||
const updatedRoute = updateQueryParams({
|
||||
paramsToAdd: { [PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM]: "outline" },
|
||||
});
|
||||
router.push(updatedRoute);
|
||||
}, [router, updateQueryParams]);
|
||||
|
||||
const editorExtensionHandlers: Map<string, unknown> = useMemo(() => {
|
||||
const map: Map<string, unknown> = new Map();
|
||||
return map;
|
||||
}, []);
|
||||
|
||||
const navigationPaneExtensions: INavigationPaneExtension[] = [];
|
||||
|
||||
const handleCloseNavigationPane = useCallback(() => {
|
||||
const updatedRoute = updateQueryParams({
|
||||
paramsToRemove: [PAGE_NAVIGATION_PANE_TABS_QUERY_PARAM, PAGE_NAVIGATION_PANE_VERSION_QUERY_PARAM],
|
||||
});
|
||||
router.push(updatedRoute);
|
||||
}, [router, updateQueryParams]);
|
||||
|
||||
return {
|
||||
editorExtensionHandlers,
|
||||
navigationPaneExtensions,
|
||||
handleOpenNavigationPane,
|
||||
isNavigationPaneOpen,
|
||||
handleCloseNavigationPane,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user