Skip to content

Commit

Permalink
feat: add includeChildren option to placeholder extension (#1416)
Browse files Browse the repository at this point in the history
  • Loading branch information
nickdbush committed Sep 8, 2021
1 parent 14e458e commit 1799b90
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/extension-placeholder/src/placeholder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface PlaceholderOptions {
}) => string) | string,
showOnlyWhenEditable: boolean,
showOnlyCurrent: boolean,
includeChildren: boolean,
}

export const Placeholder = Extension.create<PlaceholderOptions>({
Expand All @@ -23,6 +24,7 @@ export const Placeholder = Extension.create<PlaceholderOptions>({
placeholder: 'Write something …',
showOnlyWhenEditable: true,
showOnlyCurrent: true,
includeChildren: false,
},

addProseMirrorPlugins() {
Expand Down Expand Up @@ -62,7 +64,7 @@ export const Placeholder = Extension.create<PlaceholderOptions>({
decorations.push(decoration)
}

return false
return this.options.includeChildren
})

return DecorationSet.create(doc, decorations)
Expand Down

0 comments on commit 1799b90

Please sign in to comment.