Make TextNode public #78

Closed
torifat wants to merge 1 commit from patch-1 into master
torifat commented 2023-05-27 10:15:06 +02:00 (Migrated from github.com)

Exposing TextNode so it can be used in scenarios like:

// prosemirror-markdown:src/from_markdown.ts
function maybeMerge(a: Node, b: Node): Node | undefined {
  if (a.isText && b.isText && Mark.sameSet(a.marks, b.marks))
    return (a as any).withText(a.text! + b.text!)
}

I can change it to export type {TextNode} from "./node" if you prefer not exposing it as a public API.

Exposing `TextNode` so it can be used in [scenarios like](https://github.com/ProseMirror/prosemirror-markdown/blob/master/src/from_markdown.ts#LL9C50-L9C50): ``` // prosemirror-markdown:src/from_markdown.ts function maybeMerge(a: Node, b: Node): Node | undefined { if (a.isText && b.isText && Mark.sameSet(a.marks, b.marks)) return (a as any).withText(a.text! + b.text!) } ``` I can change it to `export type {TextNode} from "./node"` if you prefer not exposing it as a public API.
marijnh commented 2023-05-31 10:05:58 +02:00 (Migrated from github.com)

This type is intentionally not public. You should be able to do what withText does pretty easily without changing the library interface.

This type is intentionally not public. You should be able to do what `withText` does pretty easily without changing the library interface.

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-model!78
No description provided.