-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WIKI-632] chore: accept additional props for document collaborative editor #7718
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
sriramveeraghanta
merged 5 commits into
preview
from
chore/add-collaborative-extended-props
Sep 11, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
0de2375
chore: add collaborative document editor extended props
1akhanBaheti 9a2ece5
fix: additional rich text extension props
1akhanBaheti 2994e51
fix: formatting
1akhanBaheti a858c7d
Merge branch 'preview' of https://github.com/makeplane/plane into cho…
aaryan610 ef7d430
chore: add types to the trailing node extension
aaryan610 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
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,69 @@ | ||||||||||||||
| import { Extension } from "@tiptap/core"; | ||||||||||||||
| import { NodeType, Node as ProseMirrorNode } from "@tiptap/pm/model"; | ||||||||||||||
| import { Plugin, PluginKey } from "@tiptap/pm/state"; | ||||||||||||||
| // constants | ||||||||||||||
| import { CORE_EXTENSIONS } from "@/constants/extension"; | ||||||||||||||
|
|
||||||||||||||
| function nodeEqualsType({ types, node }: { types: NodeType[]; node: ProseMirrorNode | null }) { | ||||||||||||||
| // TODO: check this logic, might be wrong | ||||||||||||||
| // @ts-expect-error - logic might be wrong | ||||||||||||||
| return (Array.isArray(types) && types.includes(node?.type)) || node?.type === types; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| export interface TrailingNodeOptions { | ||||||||||||||
| node: string; | ||||||||||||||
| notAfter: string[]; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| export const TrailingNode = Extension.create<TrailingNodeOptions>({ | ||||||||||||||
| name: "trailingNode", | ||||||||||||||
|
|
||||||||||||||
| addOptions() { | ||||||||||||||
| return { | ||||||||||||||
| node: CORE_EXTENSIONS.PARAGRAPH, | ||||||||||||||
| notAfter: [CORE_EXTENSIONS.PARAGRAPH], | ||||||||||||||
| }; | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| addProseMirrorPlugins() { | ||||||||||||||
| const plugin = new PluginKey(this.name); | ||||||||||||||
| const disabledNodes = Object.entries(this.editor.schema.nodes) | ||||||||||||||
| .map(([, value]) => value) | ||||||||||||||
| .filter((node) => this.options.notAfter.includes(node.name)); | ||||||||||||||
|
|
||||||||||||||
| return [ | ||||||||||||||
| new Plugin({ | ||||||||||||||
| key: plugin, | ||||||||||||||
| appendTransaction: (_, __, state) => { | ||||||||||||||
| const { doc, tr, schema } = state; | ||||||||||||||
| const shouldInsertNodeAtEnd = plugin.getState(state); | ||||||||||||||
| const endPosition = doc.content.size; | ||||||||||||||
| const type = schema.nodes[this.options.node]; | ||||||||||||||
|
|
||||||||||||||
| if (!shouldInsertNodeAtEnd) { | ||||||||||||||
| return; | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| // eslint-disable-next-line consistent-return | ||||||||||||||
|
Comment on lines
+44
to
+47
|
||||||||||||||
| return; | |
| } | |
| // eslint-disable-next-line consistent-return | |
| return null; | |
| } |
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
coderabbitai[bot] 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
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.