@atlaskit/editor-plugin-layout 1.9.10 → 1.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 1.10.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#159777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159777)
8
+ [`64dae465493a4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/64dae465493a4) -
9
+ Add Breakout Resizing component to editor-common, add support in Layout plugin
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 1.9.10
4
16
 
5
17
  ### Patch Changes
@@ -0,0 +1,84 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.LayoutSectionView = void 0;
8
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
11
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
12
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
13
+ var _react = _interopRequireDefault(require("react"));
14
+ var _hooks = require("@atlaskit/editor-common/hooks");
15
+ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/react-node-view"));
16
+ var _resizer = require("@atlaskit/editor-common/resizer");
17
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2.default)(t); if (r) { var s = (0, _getPrototypeOf2.default)(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2.default)(this, e); }; }
18
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
19
+ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
20
+ var pluginInjectionApi = _ref.pluginInjectionApi,
21
+ forwardRef = _ref.forwardRef,
22
+ getPos = _ref.getPos,
23
+ view = _ref.view;
24
+ var _useSharedPluginState = (0, _hooks.useSharedPluginState)(pluginInjectionApi, ['editorDisabled']),
25
+ editorDisabledState = _useSharedPluginState.editorDisabledState;
26
+ var getEditorWidth = function getEditorWidth() {
27
+ var _pluginInjectionApi$w;
28
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
29
+ };
30
+ return /*#__PURE__*/_react.default.createElement(_resizer.BreakoutResizer, {
31
+ getRef: forwardRef,
32
+ getPos: getPos,
33
+ editorView: view,
34
+ node: "layoutSection",
35
+ getEditorWidth: getEditorWidth,
36
+ disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true
37
+ });
38
+ };
39
+ var LayoutSectionView = exports.LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
40
+ (0, _inherits2.default)(LayoutSectionView, _ReactNodeView);
41
+ var _super = _createSuper(LayoutSectionView);
42
+ function LayoutSectionView(props) {
43
+ var _this;
44
+ (0, _classCallCheck2.default)(this, LayoutSectionView);
45
+ _this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
46
+ _this.options = props.options;
47
+ return _this;
48
+ }
49
+ (0, _createClass2.default)(LayoutSectionView, [{
50
+ key: "getContentDOM",
51
+ value: function getContentDOM() {
52
+ var dom = document.createElement('div');
53
+ dom.setAttribute('data-layout-section', 'true');
54
+ this.layoutDOM = dom;
55
+ this.layoutDOM.setAttribute('data-column-rule-style', this.node.attrs.columnRuleStyle);
56
+ return {
57
+ dom: dom
58
+ };
59
+ }
60
+ }, {
61
+ key: "setDomAttrs",
62
+ value: function setDomAttrs(node, element) {
63
+ if (this.layoutDOM) {
64
+ this.layoutDOM.setAttribute('data-column-rule-style', node.attrs.columnRuleStyle);
65
+ }
66
+ }
67
+ }, {
68
+ key: "render",
69
+ value: function render(props, forwardRef) {
70
+ return /*#__PURE__*/_react.default.createElement(LayoutBreakoutResizer, {
71
+ pluginInjectionApi: props.pluginInjectionApi,
72
+ forwardRef: forwardRef,
73
+ getPos: props.getPos,
74
+ view: props.view
75
+ });
76
+ }
77
+ }, {
78
+ key: "ignoreMutation",
79
+ value: function ignoreMutation(mutation) {
80
+ return (0, _resizer.ignoreResizerMutations)(mutation);
81
+ }
82
+ }]);
83
+ return LayoutSectionView;
84
+ }(_reactNodeView.default);
@@ -17,9 +17,11 @@ var _schema = require("@atlaskit/adf-schema/schema");
17
17
  var _analytics = require("@atlaskit/editor-common/analytics");
18
18
  var _messages = require("@atlaskit/editor-common/messages");
19
19
  var _quickInsert = require("@atlaskit/editor-common/quick-insert");
20
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
20
21
  var _actions = require("./actions");
21
22
  var _main = _interopRequireDefault(require("./pm-plugins/main"));
22
23
  var _pluginKey = require("./pm-plugins/plugin-key");
24
+ var _resizing = _interopRequireDefault(require("./pm-plugins/resizing"));
23
25
  var _toolbar = require("./toolbar");
24
26
  var _globalStyles = require("./ui/global-styles");
25
27
  var _preRelease = require("./utils/preRelease");
@@ -40,30 +42,41 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
40
42
  }];
41
43
  },
42
44
  pmPlugins: function pmPlugins() {
43
- return [{
45
+ var plugins = [{
44
46
  name: 'layout',
45
47
  plugin: function plugin() {
46
48
  return (0, _main.default)(options);
47
49
  }
48
50
  }];
51
+ if ((options.editorAppearance === 'full-page' || options.editorAppearance === 'full-width') && api && (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_breakout_resizing')) {
52
+ plugins.push({
53
+ name: 'layoutResizing',
54
+ plugin: function plugin(_ref2) {
55
+ var portalProviderAPI = _ref2.portalProviderAPI,
56
+ eventDispatcher = _ref2.eventDispatcher;
57
+ return (0, _resizing.default)(options, api, portalProviderAPI, eventDispatcher);
58
+ }
59
+ });
60
+ }
61
+ return plugins;
49
62
  },
50
63
  actions: {
51
64
  insertLayoutColumns: (0, _actions.insertLayoutColumnsWithAnalytics)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
52
65
  },
53
66
  pluginsOptions: {
54
67
  floatingToolbar: function floatingToolbar(state, intl) {
55
- var _ref2 = _pluginKey.pluginKey.getState(state),
56
- pos = _ref2.pos,
57
- allowBreakout = _ref2.allowBreakout,
58
- addSidebarLayouts = _ref2.addSidebarLayouts,
59
- allowSingleColumnLayout = _ref2.allowSingleColumnLayout;
68
+ var _ref3 = _pluginKey.pluginKey.getState(state),
69
+ pos = _ref3.pos,
70
+ allowBreakout = _ref3.allowBreakout,
71
+ addSidebarLayouts = _ref3.addSidebarLayouts,
72
+ allowSingleColumnLayout = _ref3.allowSingleColumnLayout;
60
73
  if (pos !== null) {
61
74
  return (0, _toolbar.buildToolbar)(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api);
62
75
  }
63
76
  return undefined;
64
77
  },
65
- quickInsert: function quickInsert(_ref3) {
66
- var formatMessage = _ref3.formatMessage;
78
+ quickInsert: function quickInsert(_ref4) {
79
+ var formatMessage = _ref4.formatMessage;
67
80
  return (0, _preRelease.isPreRelease2)() ? [{
68
81
  id: 'twocolumnslayout',
69
82
  title: formatMessage(_messages.layoutMessages.twoColumns),
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pluginKey = exports.default = void 0;
7
+ var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
+ var _state = require("@atlaskit/editor-prosemirror/state");
9
+ var _nodeViews = require("../node-views");
10
+ var pluginKey = exports.pluginKey = new _state.PluginKey('layoutResizingPlugin');
11
+ var _default = exports.default = function _default(options, pluginInjectionApi, portalProviderAPI, eventDispatcher) {
12
+ return new _safePlugin.SafePlugin({
13
+ key: pluginKey,
14
+ props: {
15
+ nodeViews: {
16
+ layoutSection: function layoutSection(node, view, getPos) {
17
+ return new _nodeViews.LayoutSectionView({
18
+ node: node,
19
+ view: view,
20
+ getPos: getPos,
21
+ portalProviderAPI: portalProviderAPI,
22
+ eventDispatcher: eventDispatcher,
23
+ pluginInjectionApi: pluginInjectionApi,
24
+ options: options
25
+ }).init();
26
+ }
27
+ }
28
+ }
29
+ });
30
+ };
@@ -0,0 +1,57 @@
1
+ import React from 'react';
2
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
3
+ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
4
+ import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
5
+ const LayoutBreakoutResizer = ({
6
+ pluginInjectionApi,
7
+ forwardRef,
8
+ getPos,
9
+ view
10
+ }) => {
11
+ const {
12
+ editorDisabledState
13
+ } = useSharedPluginState(pluginInjectionApi, ['editorDisabled']);
14
+ const getEditorWidth = () => {
15
+ var _pluginInjectionApi$w;
16
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
17
+ };
18
+ return /*#__PURE__*/React.createElement(BreakoutResizer, {
19
+ getRef: forwardRef,
20
+ getPos: getPos,
21
+ editorView: view,
22
+ node: "layoutSection",
23
+ getEditorWidth: getEditorWidth,
24
+ disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true
25
+ });
26
+ };
27
+ export class LayoutSectionView extends ReactNodeView {
28
+ constructor(props) {
29
+ super(props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
30
+ this.options = props.options;
31
+ }
32
+ getContentDOM() {
33
+ const dom = document.createElement('div');
34
+ dom.setAttribute('data-layout-section', 'true');
35
+ this.layoutDOM = dom;
36
+ this.layoutDOM.setAttribute('data-column-rule-style', this.node.attrs.columnRuleStyle);
37
+ return {
38
+ dom
39
+ };
40
+ }
41
+ setDomAttrs(node, element) {
42
+ if (this.layoutDOM) {
43
+ this.layoutDOM.setAttribute('data-column-rule-style', node.attrs.columnRuleStyle);
44
+ }
45
+ }
46
+ render(props, forwardRef) {
47
+ return /*#__PURE__*/React.createElement(LayoutBreakoutResizer, {
48
+ pluginInjectionApi: props.pluginInjectionApi,
49
+ forwardRef: forwardRef,
50
+ getPos: props.getPos,
51
+ view: props.view
52
+ });
53
+ }
54
+ ignoreMutation(mutation) {
55
+ return ignoreResizerMutations(mutation);
56
+ }
57
+ }
@@ -4,9 +4,11 @@ import { layoutSectionWithSingleColumn } from '@atlaskit/adf-schema/schema';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { layoutMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
8
9
  import { default as createLayoutPlugin } from './pm-plugins/main';
9
10
  import { pluginKey } from './pm-plugins/plugin-key';
11
+ import { default as createLayoutResizingPlugin } from './pm-plugins/resizing';
10
12
  import { buildToolbar } from './toolbar';
11
13
  import { GlobalStylesWrapper } from './ui/global-styles';
12
14
  import { isPreRelease2 } from './utils/preRelease';
@@ -28,10 +30,20 @@ export const layoutPlugin = ({
28
30
  }];
29
31
  },
30
32
  pmPlugins() {
31
- return [{
33
+ const plugins = [{
32
34
  name: 'layout',
33
35
  plugin: () => createLayoutPlugin(options)
34
36
  }];
37
+ if ((options.editorAppearance === 'full-page' || options.editorAppearance === 'full-width') && api && fg('platform_editor_advanced_layouts_breakout_resizing')) {
38
+ plugins.push({
39
+ name: 'layoutResizing',
40
+ plugin: ({
41
+ portalProviderAPI,
42
+ eventDispatcher
43
+ }) => createLayoutResizingPlugin(options, api, portalProviderAPI, eventDispatcher)
44
+ });
45
+ }
46
+ return plugins;
35
47
  },
36
48
  actions: {
37
49
  insertLayoutColumns: insertLayoutColumnsWithAnalytics(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
@@ -0,0 +1,22 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { LayoutSectionView } from '../node-views';
4
+ export const pluginKey = new PluginKey('layoutResizingPlugin');
5
+ export default ((options, pluginInjectionApi, portalProviderAPI, eventDispatcher) => new SafePlugin({
6
+ key: pluginKey,
7
+ props: {
8
+ nodeViews: {
9
+ layoutSection: (node, view, getPos) => {
10
+ return new LayoutSectionView({
11
+ node,
12
+ view,
13
+ getPos,
14
+ portalProviderAPI,
15
+ eventDispatcher,
16
+ pluginInjectionApi,
17
+ options
18
+ }).init();
19
+ }
20
+ }
21
+ }
22
+ }));
@@ -0,0 +1,77 @@
1
+ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
2
+ import _createClass from "@babel/runtime/helpers/createClass";
3
+ import _inherits from "@babel/runtime/helpers/inherits";
4
+ import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
5
+ import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
6
+ function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = _getPrototypeOf(t); if (r) { var s = _getPrototypeOf(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return _possibleConstructorReturn(this, e); }; }
7
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
8
+ import React from 'react';
9
+ import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
10
+ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
11
+ import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
12
+ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
13
+ var pluginInjectionApi = _ref.pluginInjectionApi,
14
+ forwardRef = _ref.forwardRef,
15
+ getPos = _ref.getPos,
16
+ view = _ref.view;
17
+ var _useSharedPluginState = useSharedPluginState(pluginInjectionApi, ['editorDisabled']),
18
+ editorDisabledState = _useSharedPluginState.editorDisabledState;
19
+ var getEditorWidth = function getEditorWidth() {
20
+ var _pluginInjectionApi$w;
21
+ return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
22
+ };
23
+ return /*#__PURE__*/React.createElement(BreakoutResizer, {
24
+ getRef: forwardRef,
25
+ getPos: getPos,
26
+ editorView: view,
27
+ node: "layoutSection",
28
+ getEditorWidth: getEditorWidth,
29
+ disabled: (editorDisabledState === null || editorDisabledState === void 0 ? void 0 : editorDisabledState.editorDisabled) === true
30
+ });
31
+ };
32
+ export var LayoutSectionView = /*#__PURE__*/function (_ReactNodeView) {
33
+ _inherits(LayoutSectionView, _ReactNodeView);
34
+ var _super = _createSuper(LayoutSectionView);
35
+ function LayoutSectionView(props) {
36
+ var _this;
37
+ _classCallCheck(this, LayoutSectionView);
38
+ _this = _super.call(this, props.node, props.view, props.getPos, props.portalProviderAPI, props.eventDispatcher, props);
39
+ _this.options = props.options;
40
+ return _this;
41
+ }
42
+ _createClass(LayoutSectionView, [{
43
+ key: "getContentDOM",
44
+ value: function getContentDOM() {
45
+ var dom = document.createElement('div');
46
+ dom.setAttribute('data-layout-section', 'true');
47
+ this.layoutDOM = dom;
48
+ this.layoutDOM.setAttribute('data-column-rule-style', this.node.attrs.columnRuleStyle);
49
+ return {
50
+ dom: dom
51
+ };
52
+ }
53
+ }, {
54
+ key: "setDomAttrs",
55
+ value: function setDomAttrs(node, element) {
56
+ if (this.layoutDOM) {
57
+ this.layoutDOM.setAttribute('data-column-rule-style', node.attrs.columnRuleStyle);
58
+ }
59
+ }
60
+ }, {
61
+ key: "render",
62
+ value: function render(props, forwardRef) {
63
+ return /*#__PURE__*/React.createElement(LayoutBreakoutResizer, {
64
+ pluginInjectionApi: props.pluginInjectionApi,
65
+ forwardRef: forwardRef,
66
+ getPos: props.getPos,
67
+ view: props.view
68
+ });
69
+ }
70
+ }, {
71
+ key: "ignoreMutation",
72
+ value: function ignoreMutation(mutation) {
73
+ return ignoreResizerMutations(mutation);
74
+ }
75
+ }]);
76
+ return LayoutSectionView;
77
+ }(ReactNodeView);
@@ -4,9 +4,11 @@ import { layoutSectionWithSingleColumn } from '@atlaskit/adf-schema/schema';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { layoutMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
6
6
  import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
7
+ import { fg } from '@atlaskit/platform-feature-flags';
7
8
  import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
8
9
  import { default as createLayoutPlugin } from './pm-plugins/main';
9
10
  import { pluginKey } from './pm-plugins/plugin-key';
11
+ import { default as createLayoutResizingPlugin } from './pm-plugins/resizing';
10
12
  import { buildToolbar } from './toolbar';
11
13
  import { GlobalStylesWrapper } from './ui/global-styles';
12
14
  import { isPreRelease2 } from './utils/preRelease';
@@ -28,30 +30,41 @@ export var layoutPlugin = function layoutPlugin(_ref) {
28
30
  }];
29
31
  },
30
32
  pmPlugins: function pmPlugins() {
31
- return [{
33
+ var plugins = [{
32
34
  name: 'layout',
33
35
  plugin: function plugin() {
34
36
  return createLayoutPlugin(options);
35
37
  }
36
38
  }];
39
+ if ((options.editorAppearance === 'full-page' || options.editorAppearance === 'full-width') && api && fg('platform_editor_advanced_layouts_breakout_resizing')) {
40
+ plugins.push({
41
+ name: 'layoutResizing',
42
+ plugin: function plugin(_ref2) {
43
+ var portalProviderAPI = _ref2.portalProviderAPI,
44
+ eventDispatcher = _ref2.eventDispatcher;
45
+ return createLayoutResizingPlugin(options, api, portalProviderAPI, eventDispatcher);
46
+ }
47
+ });
48
+ }
49
+ return plugins;
37
50
  },
38
51
  actions: {
39
52
  insertLayoutColumns: insertLayoutColumnsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
40
53
  },
41
54
  pluginsOptions: {
42
55
  floatingToolbar: function floatingToolbar(state, intl) {
43
- var _ref2 = pluginKey.getState(state),
44
- pos = _ref2.pos,
45
- allowBreakout = _ref2.allowBreakout,
46
- addSidebarLayouts = _ref2.addSidebarLayouts,
47
- allowSingleColumnLayout = _ref2.allowSingleColumnLayout;
56
+ var _ref3 = pluginKey.getState(state),
57
+ pos = _ref3.pos,
58
+ allowBreakout = _ref3.allowBreakout,
59
+ addSidebarLayouts = _ref3.addSidebarLayouts,
60
+ allowSingleColumnLayout = _ref3.allowSingleColumnLayout;
48
61
  if (pos !== null) {
49
62
  return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api);
50
63
  }
51
64
  return undefined;
52
65
  },
53
- quickInsert: function quickInsert(_ref3) {
54
- var formatMessage = _ref3.formatMessage;
66
+ quickInsert: function quickInsert(_ref4) {
67
+ var formatMessage = _ref4.formatMessage;
55
68
  return isPreRelease2() ? [{
56
69
  id: 'twocolumnslayout',
57
70
  title: formatMessage(layoutMessages.twoColumns),
@@ -0,0 +1,24 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
3
+ import { LayoutSectionView } from '../node-views';
4
+ export var pluginKey = new PluginKey('layoutResizingPlugin');
5
+ export default (function (options, pluginInjectionApi, portalProviderAPI, eventDispatcher) {
6
+ return new SafePlugin({
7
+ key: pluginKey,
8
+ props: {
9
+ nodeViews: {
10
+ layoutSection: function layoutSection(node, view, getPos) {
11
+ return new LayoutSectionView({
12
+ node: node,
13
+ view: view,
14
+ getPos: getPos,
15
+ portalProviderAPI: portalProviderAPI,
16
+ eventDispatcher: eventDispatcher,
17
+ pluginInjectionApi: pluginInjectionApi,
18
+ options: options
19
+ }).init();
20
+ }
21
+ }
22
+ }
23
+ });
24
+ });
@@ -0,0 +1,42 @@
1
+ /// <reference types="react" />
2
+ import { type EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
+ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
+ import { type ExtractInjectionAPI, type getPosHandlerNode } from '@atlaskit/editor-common/types';
6
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
8
+ import { type LayoutPlugin } from '../plugin';
9
+ import { type LayoutPluginOptions } from '../types';
10
+ type LayoutSectionViewProps = {
11
+ node: PMNode;
12
+ view: EditorView;
13
+ getPos: getPosHandlerNode;
14
+ portalProviderAPI: PortalProviderAPI;
15
+ eventDispatcher: EventDispatcher;
16
+ pluginInjectionApi?: ExtractInjectionAPI<LayoutPlugin>;
17
+ options: LayoutPluginOptions;
18
+ };
19
+ type ForwardRef = (ref: HTMLElement | null) => void;
20
+ export declare class LayoutSectionView extends ReactNodeView<LayoutSectionViewProps> {
21
+ options: LayoutPluginOptions;
22
+ layoutDOM?: HTMLElement;
23
+ constructor(props: {
24
+ node: PMNode;
25
+ view: EditorView;
26
+ getPos: getPosHandlerNode;
27
+ portalProviderAPI: PortalProviderAPI;
28
+ eventDispatcher: EventDispatcher;
29
+ pluginInjectionApi: ExtractInjectionAPI<LayoutPlugin>;
30
+ options: LayoutPluginOptions;
31
+ });
32
+ getContentDOM(): {
33
+ dom: HTMLDivElement;
34
+ };
35
+ setDomAttrs(node: PMNode, element: HTMLElement): void;
36
+ render(props: LayoutSectionViewProps, forwardRef: ForwardRef): JSX.Element;
37
+ ignoreMutation(mutation: MutationRecord | {
38
+ type: 'selection';
39
+ target: Element;
40
+ }): boolean;
41
+ }
42
+ export {};
@@ -1,13 +1,20 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
+ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
4
6
  import { insertLayoutColumnsWithAnalytics } from './actions';
5
7
  import { pluginKey } from './pm-plugins/plugin-key';
6
8
  import type { LayoutPluginOptions } from './types';
7
9
  export { pluginKey };
8
10
  export type LayoutPlugin = NextEditorPlugin<'layout', {
9
11
  pluginConfiguration: LayoutPluginOptions | undefined;
10
- dependencies: [DecorationsPlugin, OptionalPlugin<AnalyticsPlugin>];
12
+ dependencies: [
13
+ DecorationsPlugin,
14
+ OptionalPlugin<AnalyticsPlugin>,
15
+ OptionalPlugin<WidthPlugin>,
16
+ OptionalPlugin<EditorDisabledPlugin>
17
+ ];
11
18
  actions: {
12
19
  insertLayoutColumns: ReturnType<typeof insertLayoutColumnsWithAnalytics>;
13
20
  };
@@ -0,0 +1,10 @@
1
+ import { type EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import { type LayoutPlugin } from '../plugin';
7
+ import type { LayoutPluginOptions } from '../types';
8
+ export declare const pluginKey: PluginKey<any>;
9
+ declare const _default: (options: LayoutPluginOptions, pluginInjectionApi: ExtractInjectionAPI<LayoutPlugin>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher) => SafePlugin<undefined>;
10
+ export default _default;
@@ -1,9 +1,10 @@
1
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
1
+ import type { EditorAppearance, LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
2
2
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
4
4
  allowBreakout?: boolean;
5
5
  UNSAFE_addSidebarLayouts?: boolean;
6
6
  UNSAFE_allowSingleColumnLayout?: boolean;
7
+ editorAppearance?: EditorAppearance;
7
8
  }
8
9
  export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars' | 'four_equal' | 'five_equal';
9
10
  export interface Change {
@@ -0,0 +1,42 @@
1
+ /// <reference types="react" />
2
+ import { type EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
3
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
4
+ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
5
+ import { type ExtractInjectionAPI, type getPosHandlerNode } from '@atlaskit/editor-common/types';
6
+ import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
7
+ import { type EditorView } from '@atlaskit/editor-prosemirror/view';
8
+ import { type LayoutPlugin } from '../plugin';
9
+ import { type LayoutPluginOptions } from '../types';
10
+ type LayoutSectionViewProps = {
11
+ node: PMNode;
12
+ view: EditorView;
13
+ getPos: getPosHandlerNode;
14
+ portalProviderAPI: PortalProviderAPI;
15
+ eventDispatcher: EventDispatcher;
16
+ pluginInjectionApi?: ExtractInjectionAPI<LayoutPlugin>;
17
+ options: LayoutPluginOptions;
18
+ };
19
+ type ForwardRef = (ref: HTMLElement | null) => void;
20
+ export declare class LayoutSectionView extends ReactNodeView<LayoutSectionViewProps> {
21
+ options: LayoutPluginOptions;
22
+ layoutDOM?: HTMLElement;
23
+ constructor(props: {
24
+ node: PMNode;
25
+ view: EditorView;
26
+ getPos: getPosHandlerNode;
27
+ portalProviderAPI: PortalProviderAPI;
28
+ eventDispatcher: EventDispatcher;
29
+ pluginInjectionApi: ExtractInjectionAPI<LayoutPlugin>;
30
+ options: LayoutPluginOptions;
31
+ });
32
+ getContentDOM(): {
33
+ dom: HTMLDivElement;
34
+ };
35
+ setDomAttrs(node: PMNode, element: HTMLElement): void;
36
+ render(props: LayoutSectionViewProps, forwardRef: ForwardRef): JSX.Element;
37
+ ignoreMutation(mutation: MutationRecord | {
38
+ type: 'selection';
39
+ target: Element;
40
+ }): boolean;
41
+ }
42
+ export {};
@@ -1,6 +1,8 @@
1
1
  import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
2
2
  import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
3
3
  import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
4
+ import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
5
+ import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
4
6
  import { insertLayoutColumnsWithAnalytics } from './actions';
5
7
  import { pluginKey } from './pm-plugins/plugin-key';
6
8
  import type { LayoutPluginOptions } from './types';
@@ -9,7 +11,9 @@ export type LayoutPlugin = NextEditorPlugin<'layout', {
9
11
  pluginConfiguration: LayoutPluginOptions | undefined;
10
12
  dependencies: [
11
13
  DecorationsPlugin,
12
- OptionalPlugin<AnalyticsPlugin>
14
+ OptionalPlugin<AnalyticsPlugin>,
15
+ OptionalPlugin<WidthPlugin>,
16
+ OptionalPlugin<EditorDisabledPlugin>
13
17
  ];
14
18
  actions: {
15
19
  insertLayoutColumns: ReturnType<typeof insertLayoutColumnsWithAnalytics>;
@@ -0,0 +1,10 @@
1
+ import { type EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
2
+ import { type PortalProviderAPI } from '@atlaskit/editor-common/portal';
3
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
4
+ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
5
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
6
+ import { type LayoutPlugin } from '../plugin';
7
+ import type { LayoutPluginOptions } from '../types';
8
+ export declare const pluginKey: PluginKey<any>;
9
+ declare const _default: (options: LayoutPluginOptions, pluginInjectionApi: ExtractInjectionAPI<LayoutPlugin>, portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher) => SafePlugin<undefined>;
10
+ export default _default;
@@ -1,9 +1,10 @@
1
- import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
1
+ import type { EditorAppearance, LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
2
2
  import type { Slice } from '@atlaskit/editor-prosemirror/model';
3
3
  export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
4
4
  allowBreakout?: boolean;
5
5
  UNSAFE_addSidebarLayouts?: boolean;
6
6
  UNSAFE_allowSingleColumnLayout?: boolean;
7
+ editorAppearance?: EditorAppearance;
7
8
  }
8
9
  export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars' | 'four_equal' | 'five_equal';
9
10
  export interface Change {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "1.9.10",
3
+ "version": "1.10.0",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,9 +32,11 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^44.2.0",
35
- "@atlaskit/editor-common": "^94.11.0",
35
+ "@atlaskit/editor-common": "^94.12.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-decorations": "^1.3.0",
38
+ "@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
39
+ "@atlaskit/editor-plugin-width": "^1.3.0",
38
40
  "@atlaskit/editor-prosemirror": "6.0.0",
39
41
  "@atlaskit/icon": "^22.24.0",
40
42
  "@atlaskit/platform-feature-flags": "^0.3.0",
@@ -91,6 +93,9 @@
91
93
  "platform-feature-flags": {
92
94
  "platform_editor_advanced_layouts_pre_release_2": {
93
95
  "type": "boolean"
96
+ },
97
+ "platform_editor_advanced_layouts_breakout_resizing": {
98
+ "type": "boolean"
94
99
  }
95
100
  }
96
101
  }