Skip to content

Commit

Permalink
fix: add correct type for parseOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
philippkuehn committed Apr 26, 2021
1 parent b8011dd commit 592892e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion packages/core/src/commands/setContent.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { TextSelection } from 'prosemirror-state'
import { ParseOptions } from 'prosemirror-model'
import createDocument from '../helpers/createDocument'
import { Command, RawCommands, Content } from '../types'

Expand All @@ -11,7 +12,7 @@ declare module '@tiptap/core' {
setContent: (
content: Content,
emitUpdate?: boolean,
parseOptions?: Record<string, any>,
parseOptions?: ParseOptions,
) => Command,
}
}
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/helpers/createDocument.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Schema, Node as ProseMirrorNode } from 'prosemirror-model'
import { Schema, Node as ProseMirrorNode, ParseOptions } from 'prosemirror-model'
import { Content } from '../types'
import createNodeFromContent from './createNodeFromContent'

export default function createDocument(
content: Content,
schema: Schema,
parseOptions: Record<string, any> = {},
parseOptions: ParseOptions = {},
): ProseMirrorNode {
return createNodeFromContent(content, schema, { slice: false, parseOptions }) as ProseMirrorNode
}
3 changes: 2 additions & 1 deletion packages/core/src/helpers/createNodeFromContent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ import {
DOMParser,
Node as ProseMirrorNode,
Fragment,
ParseOptions,
} from 'prosemirror-model'
import elementFromString from '../utilities/elementFromString'
import { Content } from '../types'

export type CreateNodeFromContentOptions = {
slice?: boolean,
parseOptions?: Record<string, any>,
parseOptions?: ParseOptions,
}

export default function createNodeFromContent(
Expand Down

0 comments on commit 592892e

Please sign in to comment.