-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from nytimes/portal-tree-plugin
Use a Plugin to assist in nesting node views according to node hierarchy fixes #66
- Loading branch information
Showing
18 changed files
with
502 additions
and
105 deletions.
There are no files selected for viewing
This file contains 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 @@ | ||
releases: | ||
"@nytimes/react-prosemirror": patch |
This file contains 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 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 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 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 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 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,22 @@ | ||
import { ReactPortal, createContext } from "react"; | ||
|
||
import { NodeKey } from "../plugins/react.js"; | ||
|
||
export type RegisteredPortal = { | ||
getPos: () => number; | ||
portal: ReactPortal; | ||
}; | ||
|
||
export type PortalRegistry = Record<NodeKey, RegisteredPortal[]>; | ||
|
||
/** | ||
* A map of node view keys to portals. | ||
* | ||
* Each node view registers a portal under its parent's | ||
* key. Each can then retrieve the list of portals under their | ||
* key, allowing portals to be rendered with the appropriate | ||
* hierarchy. | ||
*/ | ||
export const PortalRegistryContext = createContext<PortalRegistry>( | ||
null as unknown as PortalRegistry | ||
); |
Oops, something went wrong.