UNPKG

@atlaskit/editor-plugin-user-intent

Version:

UserIntent plugin for @atlaskit/editor-core

28 lines 750 B
import { setCurrentUserIntent } from './editor-commands'; import { createPlugin, userIntentPluginKey } from './pm-plugins/main'; export var userIntentPlugin = function userIntentPlugin() { return { name: 'userIntent', pmPlugins: function pmPlugins() { return [{ name: 'userIntentPlugin', plugin: createPlugin }]; }, getSharedState: function getSharedState(editorState) { if (!editorState) { return; } var pluginState = userIntentPluginKey.getState(editorState); if (!pluginState) { return; } return { currentUserIntent: pluginState.currentUserIntent }; }, commands: { setCurrentUserIntent: setCurrentUserIntent } }; };