@atlaskit/editor-plugin-composition
Version:
Composition plugin for @atlaskit/editor-core
37 lines (36 loc) • 1.15 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.compositionPlugin = void 0;
var _main = _interopRequireDefault(require("./pm-plugins/main"));
var _pluginKey = require("./pm-plugins/plugin-key");
/**
* Composition plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
* from `@atlaskit/editor-core`.
*/
var compositionPlugin = exports.compositionPlugin = function compositionPlugin() {
return {
name: 'composition',
getSharedState: function getSharedState(editorState) {
var _pluginKey$getState;
if (!editorState) {
return {
isComposing: false
};
}
return {
isComposing: !!((_pluginKey$getState = _pluginKey.pluginKey.getState(editorState)) !== null && _pluginKey$getState !== void 0 && _pluginKey$getState.isComposing)
};
},
pmPlugins: function pmPlugins() {
return [{
name: 'composition',
plugin: function plugin() {
return (0, _main.default)();
}
}];
}
};
};