feat: add includeChildren option to placeholder extension (#1416)

This commit is contained in:
Nicholas Bush 2021-09-08 08:38:57 +01:00 committed by GitHub
parent 14e458ea7d
commit 1799b907ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -12,6 +12,7 @@ export interface PlaceholderOptions {
}) => string) | string,
showOnlyWhenEditable: boolean,
showOnlyCurrent: boolean,
includeChildren: boolean,
}
export const Placeholder = Extension.create<PlaceholderOptions>({
@ -23,6 +24,7 @@ export const Placeholder = Extension.create<PlaceholderOptions>({
placeholder: 'Write something …',
showOnlyWhenEditable: true,
showOnlyCurrent: true,
includeChildren: false,
},
addProseMirrorPlugins() {
@ -62,7 +64,7 @@ export const Placeholder = Extension.create<PlaceholderOptions>({
decorations.push(decoration)
}
return false
return this.options.includeChildren
})
return DecorationSet.create(doc, decorations)