UNPKG

@atlaskit/editor-plugin-composition

Version:

Composition plugin for @atlaskit/editor-core

31 lines (30 loc) 890 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 var compositionPlugin = function compositionPlugin() { return { name: 'composition', getSharedState: function 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: function pmPlugins() { return [{ name: 'composition', plugin: function plugin() { return createPlugin(); } }]; } }; };