@atlaskit/editor-plugin-insert-block
Version:
Insert block plugin for @atlaskit/editor-core
24 lines • 735 B
JavaScript
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
export var toggleInsertBlockPmKey = new PluginKey('toggleInsertBlockPmKey');
export var toggleInsertBlockPmPlugin = function toggleInsertBlockPmPlugin() {
return new SafePlugin({
key: toggleInsertBlockPmKey,
state: {
init: function init() {
return {
showElementBrowser: false
};
},
apply: function apply(tr, pluginState) {
var meta = tr.getMeta(toggleInsertBlockPmKey);
if (!meta) {
return pluginState;
}
return {
showElementBrowser: !pluginState.showElementBrowser
};
}
}
});
};