UNPKG

@atlaskit/editor-plugin-code-bidi-warning

Version:

Code bidi warning plugin for @atlaskit/editor-core.

37 lines 1.53 kB
import { codeBidiWarningMessages } from '@atlaskit/editor-common/messages'; import { SafePlugin } from '@atlaskit/editor-common/safe-plugin'; import { createBidiWarningsDecorationSetFromDoc, pluginFactoryCreator } from './plugin-factory'; import { codeBidiWarningPluginKey } from './plugin-key'; export var createPlugin = function createPlugin(_ref, _ref2) { var dispatch = _ref.dispatch, getIntl = _ref.getIntl, nodeViewPortalProviderAPI = _ref.nodeViewPortalProviderAPI; var appearance = _ref2.appearance; var intl = getIntl(); var codeBidiWarningLabel = intl.formatMessage(codeBidiWarningMessages.label); var _pluginFactoryCreator = pluginFactoryCreator(nodeViewPortalProviderAPI), createPluginState = _pluginFactoryCreator.createPluginState, getPluginState = _pluginFactoryCreator.getPluginState; return new SafePlugin({ key: codeBidiWarningPluginKey, state: createPluginState(dispatch, function (state) { return { decorationSet: createBidiWarningsDecorationSetFromDoc({ doc: state.doc, codeBidiWarningLabel: codeBidiWarningLabel, tooltipEnabled: true, nodeViewPortalProviderAPI: nodeViewPortalProviderAPI }), codeBidiWarningLabel: codeBidiWarningLabel, tooltipEnabled: true }; }), props: { decorations: function decorations(state) { var _getPluginState = getPluginState(state), decorationSet = _getPluginState.decorationSet; return decorationSet; } } }); };