mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-14 18:49:02 +08:00
feat(suggestions): async items and filter support added
This commit is contained in:
parent
2922a8feaf
commit
40cefaddd0
@ -95,7 +95,7 @@ export default function SuggestionsPlugin({
|
|||||||
|
|
||||||
view() {
|
view() {
|
||||||
return {
|
return {
|
||||||
update: (view, prevState) => {
|
update: async (view, prevState) => {
|
||||||
const prev = this.key.getState(prevState)
|
const prev = this.key.getState(prevState)
|
||||||
const next = this.key.getState(view.state)
|
const next = this.key.getState(view.state)
|
||||||
|
|
||||||
@ -133,7 +133,9 @@ export default function SuggestionsPlugin({
|
|||||||
text: state.text,
|
text: state.text,
|
||||||
decorationNode,
|
decorationNode,
|
||||||
virtualNode,
|
virtualNode,
|
||||||
items: onFilter(Array.isArray(items) ? items : items(), state.query),
|
items: (handleChange || handleStart)
|
||||||
|
? await onFilter(Array.isArray(items) ? items : await items(), state.query)
|
||||||
|
: [],
|
||||||
command: ({ range, attrs }) => {
|
command: ({ range, attrs }) => {
|
||||||
command({
|
command({
|
||||||
range,
|
range,
|
||||||
|
Loading…
Reference in New Issue
Block a user