UNPKG

@atlaskit/editor-plugin-type-ahead

Version:

Type-ahead plugin for @atlaskit/editor-core

16 lines 531 B
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin'; import { ACTIONS } from './actions'; import { isInsertionTransaction } from './isInsertionTransaction'; export function createPlugin() { return new SafePlugin({ appendTransaction(transactions, _oldState, newState) { const insertItemCallback = isInsertionTransaction(transactions, ACTIONS.INSERT_ITEM); if (insertItemCallback) { const tr = insertItemCallback(newState); if (tr) { return tr; } } } }); }