import { autocompletePluginKey, createAutocompletePlugin } from './pm-plugins/autocomplete-plugin';
export const autocompletePlugin = ({
  config: options,
  api
}) => {
  return {
    name: 'autocomplete',
    getSharedState(editorState) {
      if (!editorState) {
        return undefined;
      }
      return autocompletePluginKey.getState(editorState);
    },
    pmPlugins() {
      return [{
        name: 'autocomplete',
        plugin: () => createAutocompletePlugin(options, api)
      }];
    }
  };
};