UNPKG

@atlaskit/editor-plugin-breakout

Version:

Breakout plugin for @atlaskit/editor-core

58 lines • 1.86 kB
import React from 'react'; import { breakout } from '@atlaskit/adf-schema/breakout'; import { createResizingPlugin, resizingPluginKey } from './pm-plugins/resizing-plugin'; import { GuidelineLabel } from './ui/GuidelineLabel'; export var breakoutPlugin = function breakoutPlugin(_ref) { var options = _ref.config, api = _ref.api; return { name: 'breakout', pmPlugins: function pmPlugins() { return [{ name: 'breakout-resizing', plugin: function plugin(_ref2) { var getIntl = _ref2.getIntl, nodeViewPortalProviderAPI = _ref2.nodeViewPortalProviderAPI; return createResizingPlugin(api, getIntl, nodeViewPortalProviderAPI, options); } }]; }, marks: function marks() { return [{ name: 'breakout', mark: breakout }]; }, getSharedState: function getSharedState(editorState) { if (!editorState) { return { breakoutNode: undefined }; } var resizingPluginState = resizingPluginKey.getState(editorState); if (!resizingPluginState) { return { breakoutNode: undefined, activeGuidelineKey: undefined }; } return resizingPluginState; }, contentComponent: function contentComponent(_ref3) { var editorView = _ref3.editorView, popupsMountPoint = _ref3.popupsMountPoint, popupsBoundariesElement = _ref3.popupsBoundariesElement, popupsScrollableElement = _ref3.popupsScrollableElement; if (!editorView) { return null; } return /*#__PURE__*/React.createElement(GuidelineLabel, { api: api, editorView: editorView, mountPoint: popupsMountPoint, boundariesElement: popupsBoundariesElement, scrollableElement: popupsScrollableElement }); } }; };