UNPKG

@atlaskit/editor-plugin-primary-toolbar

Version:

Primary toolbar plugin for @atlaskit/editor-core

31 lines (30 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.primaryToolbarPluginKey = exports.createPlugin = void 0; var _safePlugin = require("@atlaskit/editor-common/safe-plugin"); var _state = require("@atlaskit/editor-prosemirror/state"); var _toolbarConfiguration = require("./toolbar-configuration"); var primaryToolbarPluginKey = exports.primaryToolbarPluginKey = new _state.PluginKey('primaryToolbar'); var createPlugin = exports.createPlugin = function createPlugin(_ref) { var componentRegistry = _ref.componentRegistry, contextualFormattingEnabled = _ref.contextualFormattingEnabled; return new _safePlugin.SafePlugin({ key: primaryToolbarPluginKey, state: { init: function init(_config, editorState) { return { components: (0, _toolbarConfiguration.getToolbarComponents)({ componentRegistry: componentRegistry, editorState: editorState, contextualFormattingEnabled: contextualFormattingEnabled }) }; }, apply: function apply(_tr, pluginState) { return pluginState; } } }); };