UNPKG

@atlaskit/editor-plugin-composition

Version:

Composition plugin for @atlaskit/editor-core

29 lines (28 loc) 782 B
import createPlugin from './pm-plugins/main'; import { pluginKey } from './pm-plugins/plugin-key'; /** * Composition plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor` * from `@atlaskit/editor-core`. */ export const compositionPlugin = () => { return { name: 'composition', getSharedState(editorState) { var _pluginKey$getState; if (!editorState) { return { isComposing: false }; } return { isComposing: !!((_pluginKey$getState = pluginKey.getState(editorState)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.isComposing) }; }, pmPlugins() { return [{ name: 'composition', plugin: () => createPlugin() }]; } }; };