add decorationTag and decorationClass option

This commit is contained in:
Philipp Kühn 2021-01-20 10:47:31 +01:00
parent 5d1a2d6695
commit 8f95eb6aed

View File

@ -8,7 +8,8 @@ export interface SuggestionOptions {
char?: string,
allowSpaces?: boolean,
startOfLine?: boolean,
suggestionClass?: string,
decorationTag?: string,
decorationClass?: string,
command?: (props: {
editor: Editor,
range: Range,
@ -45,7 +46,8 @@ export function Suggestion({
char = '@',
allowSpaces = false,
startOfLine = false,
suggestionClass = 'suggestion',
decorationTag = 'span',
decorationClass = 'suggestion',
command = () => null,
items = () => [],
render = () => ({}),
@ -194,8 +196,8 @@ export function Suggestion({
return DecorationSet.create(state.doc, [
Decoration.inline(range.from, range.to, {
nodeName: 'span',
class: suggestionClass,
nodeName: decorationTag,
class: decorationClass,
'data-decoration-id': decorationId,
}),
])