@atlaskit/editor-plugin-user-intent
Version:
UserIntent plugin for @atlaskit/editor-core
26 lines • 610 B
JavaScript
import { setCurrentUserIntent } from './editor-commands';
import { createPlugin, userIntentPluginKey } from './pm-plugins/main';
export const userIntentPlugin = () => ({
name: 'userIntent',
pmPlugins() {
return [{
name: 'userIntentPlugin',
plugin: createPlugin
}];
},
getSharedState: editorState => {
if (!editorState) {
return;
}
const pluginState = userIntentPluginKey.getState(editorState);
if (!pluginState) {
return;
}
return {
currentUserIntent: pluginState.currentUserIntent
};
},
commands: {
setCurrentUserIntent
}
});