-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WIKI-511] [WIKI-572] fix: extended page root and editor body #7661
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
b729d64
fix: better refactoring of page root and editor body
Palanikannan1437 268f987
fix: editor sideeffects
Palanikannan1437 9ae11f7
fix: add comments json field
Palanikannan1437 24fb0d9
fix: props name
Palanikannan1437 aaf42a3
fix: review changes
Palanikannan1437 920c6ce
fix: extra checks
Palanikannan1437 b7fc21a
fix: type changes
Palanikannan1437 539c761
fix: remove editor ref current
Palanikannan1437 f37b4fe
fix: renaming
Palanikannan1437 84fddfb
fix: link check
Palanikannan1437 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| export * from "./move-page-modal"; | ||
| export * from "./modals"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| "use client"; | ||
|
|
||
| import React from "react"; | ||
| import { observer } from "mobx-react"; | ||
| // components | ||
| import { EPageStoreType } from "@/plane-web/hooks/store"; | ||
| // store | ||
| import { TPageInstance } from "@/store/pages/base-page"; | ||
|
|
||
| export type TPageModalsProps = { | ||
| page: TPageInstance; | ||
| storeType: EPageStoreType; | ||
| }; | ||
|
|
||
| export const PageModals: React.FC<TPageModalsProps> = observer((props) => null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| export * from "./use-pages-pane-extensions"; | ||
| export * from "./use-extended-editor-extensions"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 { EPageStoreType } from "../store"; | ||
|
|
||
| export type TExtendedEditorExtensionsHookParams = { | ||
| workspaceSlug: string; | ||
| page: TPageInstance; | ||
| storeType: EPageStoreType; | ||
| fetchEntity: (payload: TSearchEntityRequestPayload) => Promise<TSearchResponse>; | ||
| getRedirectionLink: (pageId?: string) => string; | ||
Palanikannan1437 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| extensionHandlers?: Map<string, unknown>; | ||
| projectId?: string; | ||
| }; | ||
|
|
||
| export type TExtendedEditorExtensionsConfig = IEditorPropsExtended; | ||
|
|
||
| export const useExtendedEditorProps = ( | ||
| _params: TExtendedEditorExtensionsHookParams | ||
| ): TExtendedEditorExtensionsConfig => ({}); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| import { useCallback, useMemo, 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, | ||
| } 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 { 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[] = []; | ||
|
|
||
| return { | ||
| editorExtensionHandlers, | ||
| navigationPaneExtensions, | ||
| handleOpenNavigationPane, | ||
| isNavigationPaneOpen, | ||
| }; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| import { | ||
| type INavigationPaneExtension as ICoreNavigationPaneExtension, | ||
| type INavigationPaneExtensionComponent, | ||
| } from "@/components/pages/navigation-pane"; | ||
|
|
||
| // EE Union/map of extension data types (keyed by extension id) | ||
| export type TNavigationPaneExtensionData = Record<string, unknown>; | ||
|
|
||
| // EE Navigation pane extension configuration | ||
| export interface INavigationPaneExtension< | ||
| T extends keyof TNavigationPaneExtensionData = keyof TNavigationPaneExtensionData, | ||
| > extends Omit<ICoreNavigationPaneExtension<TNavigationPaneExtensionData[T]>, "id" | "data" | "component"> { | ||
| id: T; | ||
| component: INavigationPaneExtensionComponent<TNavigationPaneExtensionData[T]>; | ||
| data?: TNavigationPaneExtensionData[T]; | ||
| } | ||
Palanikannan1437 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.