allow functions for items in mention node

This commit is contained in:
Philipp Kühn
2018-11-08 16:50:23 +01:00
parent c5d7ef4e79
commit 42c177f59e
2 changed files with 2 additions and 2 deletions

View File

@@ -63,7 +63,7 @@ export default {
new HeadingNode({ maxLevel: 3 }),
new MentionNode({
// a list of all suggested items
items: [
items: () => [
{ id: 1, name: 'Philipp Kühn' },
{ id: 2, name: 'Hans Pagel' },
{ id: 3, name: 'Kris Siepert' },

View File

@@ -127,7 +127,7 @@ export default function SuggestionsPlugin({
text: state.text,
decorationNode,
virtualNode,
items: onFilter(items, state.query),
items: onFilter(Array.isArray(items) ? items : items(), state.query),
command: ({ range, attrs }) => {
command({
range,