@atlaskit/editor-plugin-user-intent
Version:
UserIntent plugin for @atlaskit/editor-core
34 lines (33 loc) • 878 B
JavaScript
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.userIntentPlugin = void 0;
var _editorCommands = require("./editor-commands");
var _main = require("./pm-plugins/main");
var userIntentPlugin = exports.userIntentPlugin = function userIntentPlugin() {
return {
name: 'userIntent',
pmPlugins: function pmPlugins() {
return [{
name: 'userIntentPlugin',
plugin: _main.createPlugin
}];
},
getSharedState: function getSharedState(editorState) {
if (!editorState) {
return;
}
var pluginState = _main.userIntentPluginKey.getState(editorState);
if (!pluginState) {
return;
}
return {
currentUserIntent: pluginState.currentUserIntent
};
},
commands: {
setCurrentUserIntent: _editorCommands.setCurrentUserIntent
}
};
};
;