WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit eea7190

Browse files
authored
Fix/trailing node default node (#7278)
* fix: trailing node should use default node option over prosemirror default node type * add changeset
1 parent d0c4264 commit eea7190

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

.changeset/wicked-elephants-jam.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tiptap/extensions': patch
3+
---
4+
5+
Fixed a bug where the TrailingNode extension would not use the node option to assume the default node type

packages/extensions/src/trailing-node/trailing-node.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export interface TrailingNodeOptions {
1717
* The node type that should be inserted at the end of the document.
1818
* @note the node will always be added to the `notAfter` lists to
1919
* prevent an infinite loop.
20-
* @default 'paragraph'
20+
* @default undefined
2121
*/
2222
node?: string
2323
/**
@@ -44,7 +44,7 @@ export const TrailingNode = Extension.create<TrailingNodeOptions>({
4444
addProseMirrorPlugins() {
4545
const plugin = new PluginKey(this.name)
4646
const defaultNode =
47-
this.editor.schema.topNodeType.contentMatch.defaultType?.name || this.options.node || 'paragraph'
47+
this.options.node || this.editor.schema.topNodeType.contentMatch.defaultType?.name || 'paragraph'
4848

4949
const disabledNodes = Object.entries(this.editor.schema.nodes)
5050
.map(([, value]) => value)

0 commit comments

Comments
 (0)