UNPKG

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

Version:

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

43 lines (42 loc) 1.66 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createPlugin = void 0; var _messages = require("@atlaskit/editor-common/messages"); var _safePlugin = require("@atlaskit/editor-common/safe-plugin"); var _pluginFactory = require("./plugin-factory"); var _pluginKey = require("./plugin-key"); var createPlugin = exports.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(_messages.codeBidiWarningMessages.label); var _pluginFactoryCreator = (0, _pluginFactory.pluginFactoryCreator)(nodeViewPortalProviderAPI), createPluginState = _pluginFactoryCreator.createPluginState, getPluginState = _pluginFactoryCreator.getPluginState; return new _safePlugin.SafePlugin({ key: _pluginKey.codeBidiWarningPluginKey, state: createPluginState(dispatch, function (state) { return { decorationSet: (0, _pluginFactory.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; } } }); };