@atlaskit/editor-plugin-layout 1.9.10 → 1.11.1
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 +32 -0
- package/dist/cjs/node-views/index.js +84 -0
- package/dist/cjs/plugin.js +21 -8
- package/dist/cjs/pm-plugins/resizing.js +30 -0
- package/dist/cjs/toolbar.js +35 -3
- package/dist/es2019/node-views/index.js +57 -0
- package/dist/es2019/plugin.js +13 -1
- package/dist/es2019/pm-plugins/resizing.js +22 -0
- package/dist/es2019/toolbar.js +35 -3
- package/dist/esm/node-views/index.js +77 -0
- package/dist/esm/plugin.js +21 -8
- package/dist/esm/pm-plugins/resizing.js +24 -0
- package/dist/esm/toolbar.js +35 -3
- package/dist/types/node-views/index.d.ts +42 -0
- package/dist/types/plugin.d.ts +8 -1
- package/dist/types/pm-plugins/resizing.d.ts +10 -0
- package/dist/types/types.d.ts +2 -1
- package/dist/types-ts4.5/node-views/index.d.ts +42 -0
- package/dist/types-ts4.5/plugin.d.ts +5 -1
- package/dist/types-ts4.5/pm-plugins/resizing.d.ts +10 -0
- package/dist/types-ts4.5/types.d.ts +2 -1
- package/package.json +12 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,37 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 1.11.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161230](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/161230)
|
|
8
|
+
[`70a438baa282b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/70a438baa282b) -
|
|
9
|
+
[ux] Add equal distribution button on layout toolbar
|
|
10
|
+
|
|
11
|
+
## 1.11.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#159018](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159018)
|
|
16
|
+
[`14d5e189df870`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/14d5e189df870) -
|
|
17
|
+
[ux] ED-25367-remove-copy-button-from-view-mode-when-its-the-only-item
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
23
|
+
## 1.10.0
|
|
24
|
+
|
|
25
|
+
### Minor Changes
|
|
26
|
+
|
|
27
|
+
- [#159777](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/159777)
|
|
28
|
+
[`64dae465493a4`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/64dae465493a4) -
|
|
29
|
+
Add Breakout Resizing component to editor-common, add support in Layout plugin
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies
|
|
34
|
+
|
|
3
35
|
## 1.9.10
|
|
4
36
|
|
|
5
37
|
### 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);
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
56
|
-
pos =
|
|
57
|
-
allowBreakout =
|
|
58
|
-
addSidebarLayouts =
|
|
59
|
-
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(
|
|
66
|
-
var 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
|
+
};
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -23,6 +23,7 @@ var _layoutTwoEqual = _interopRequireDefault(require("@atlaskit/icon/glyph/edito
|
|
|
23
23
|
var _layoutTwoLeftSidebar = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-two-left-sidebar"));
|
|
24
24
|
var _layoutTwoRightSidebar = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/layout-two-right-sidebar"));
|
|
25
25
|
var _remove = _interopRequireDefault(require("@atlaskit/icon/glyph/editor/remove"));
|
|
26
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
26
27
|
var _actions = require("./actions");
|
|
27
28
|
var _preRelease = require("./utils/preRelease");
|
|
28
29
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
@@ -66,9 +67,40 @@ var SIDEBAR_LAYOUT_TYPES = [{
|
|
|
66
67
|
icon: _layoutThreeColumnsSidebars.default,
|
|
67
68
|
iconFallback: _layoutThreeWithSidebars.default
|
|
68
69
|
}];
|
|
70
|
+
var LAYOUT_DISTRIBUTION_TYPES = [{
|
|
71
|
+
id: 'editor.layout.twoEquals',
|
|
72
|
+
type: 'two_equal',
|
|
73
|
+
title: _messages.layoutMessages.twoColumns,
|
|
74
|
+
icon: _layoutTwoColumns.default,
|
|
75
|
+
iconFallback: _layoutTwoEqual.default
|
|
76
|
+
}, {
|
|
77
|
+
id: 'editor.layout.twoRightSidebar',
|
|
78
|
+
type: 'two_right_sidebar',
|
|
79
|
+
title: _messages.layoutMessages.rightSidebar,
|
|
80
|
+
icon: _layoutTwoColumnsSidebarRight.default,
|
|
81
|
+
iconFallback: _layoutTwoRightSidebar.default
|
|
82
|
+
}, {
|
|
83
|
+
id: 'editor.layout.twoLeftSidebar',
|
|
84
|
+
type: 'two_left_sidebar',
|
|
85
|
+
title: _messages.layoutMessages.leftSidebar,
|
|
86
|
+
icon: _layoutTwoColumnsSidebarLeft.default,
|
|
87
|
+
iconFallback: _layoutTwoLeftSidebar.default
|
|
88
|
+
}, {
|
|
89
|
+
id: 'editor.layout.threeEquals',
|
|
90
|
+
type: 'three_equal',
|
|
91
|
+
title: _messages.layoutMessages.threeColumns,
|
|
92
|
+
icon: _layoutThreeColumns.default,
|
|
93
|
+
iconFallback: _layoutThreeEqual.default
|
|
94
|
+
}, {
|
|
95
|
+
id: 'editor.layout.threeWithSidebars',
|
|
96
|
+
type: 'three_with_sidebars',
|
|
97
|
+
title: _messages.layoutMessages.threeColumnsWithSidebars,
|
|
98
|
+
icon: _layoutThreeColumnsSidebars.default,
|
|
99
|
+
iconFallback: _layoutThreeWithSidebars.default
|
|
100
|
+
}];
|
|
69
101
|
var SIDEBAR_LAYOUT_TYPES_BY_COLUMNS = {
|
|
70
|
-
2: [
|
|
71
|
-
3: [
|
|
102
|
+
2: [LAYOUT_DISTRIBUTION_TYPES[0], LAYOUT_DISTRIBUTION_TYPES[1], LAYOUT_DISTRIBUTION_TYPES[2]],
|
|
103
|
+
3: [LAYOUT_DISTRIBUTION_TYPES[3], LAYOUT_DISTRIBUTION_TYPES[4]],
|
|
72
104
|
4: [],
|
|
73
105
|
5: []
|
|
74
106
|
};
|
|
@@ -175,7 +207,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
175
207
|
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
176
208
|
}) : []), [separator, {
|
|
177
209
|
type: 'copy-button',
|
|
178
|
-
supportsViewMode:
|
|
210
|
+
supportsViewMode: !(0, _platformFeatureFlags.fg)('platform_editor_remove_copy_button_from_view_mode'),
|
|
179
211
|
items: [{
|
|
180
212
|
state: state,
|
|
181
213
|
formatMessage: intl.formatMessage,
|
|
@@ -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
|
+
}
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -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
|
-
|
|
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
|
+
}));
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -14,6 +14,7 @@ import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
|
|
|
14
14
|
import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
|
|
15
15
|
import LayoutTwoRightSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-right-sidebar';
|
|
16
16
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
17
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
17
18
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from './actions';
|
|
18
19
|
import { isPreRelease2 } from './utils/preRelease';
|
|
19
20
|
const LAYOUT_TYPES = [{
|
|
@@ -55,9 +56,40 @@ const SIDEBAR_LAYOUT_TYPES = [{
|
|
|
55
56
|
icon: LayoutThreeColumnsSidebarsIcon,
|
|
56
57
|
iconFallback: LayoutThreeWithSidebarsIcon
|
|
57
58
|
}];
|
|
59
|
+
const LAYOUT_DISTRIBUTION_TYPES = [{
|
|
60
|
+
id: 'editor.layout.twoEquals',
|
|
61
|
+
type: 'two_equal',
|
|
62
|
+
title: toolbarMessages.twoColumns,
|
|
63
|
+
icon: LayoutTwoColumnsIcon,
|
|
64
|
+
iconFallback: LayoutTwoEqualIcon
|
|
65
|
+
}, {
|
|
66
|
+
id: 'editor.layout.twoRightSidebar',
|
|
67
|
+
type: 'two_right_sidebar',
|
|
68
|
+
title: toolbarMessages.rightSidebar,
|
|
69
|
+
icon: LayoutTwoColumnsSidebarRightIcon,
|
|
70
|
+
iconFallback: LayoutTwoRightSidebarIcon
|
|
71
|
+
}, {
|
|
72
|
+
id: 'editor.layout.twoLeftSidebar',
|
|
73
|
+
type: 'two_left_sidebar',
|
|
74
|
+
title: toolbarMessages.leftSidebar,
|
|
75
|
+
icon: LayoutTwoColumnsSidebarLeftIcon,
|
|
76
|
+
iconFallback: LayoutTwoLeftSidebarIcon
|
|
77
|
+
}, {
|
|
78
|
+
id: 'editor.layout.threeEquals',
|
|
79
|
+
type: 'three_equal',
|
|
80
|
+
title: toolbarMessages.threeColumns,
|
|
81
|
+
icon: LayoutThreeColumnsIcon,
|
|
82
|
+
iconFallback: LayoutThreeEqualIcon
|
|
83
|
+
}, {
|
|
84
|
+
id: 'editor.layout.threeWithSidebars',
|
|
85
|
+
type: 'three_with_sidebars',
|
|
86
|
+
title: toolbarMessages.threeColumnsWithSidebars,
|
|
87
|
+
icon: LayoutThreeColumnsSidebarsIcon,
|
|
88
|
+
iconFallback: LayoutThreeWithSidebarsIcon
|
|
89
|
+
}];
|
|
58
90
|
const SIDEBAR_LAYOUT_TYPES_BY_COLUMNS = {
|
|
59
|
-
2: [
|
|
60
|
-
3: [
|
|
91
|
+
2: [LAYOUT_DISTRIBUTION_TYPES[0], LAYOUT_DISTRIBUTION_TYPES[1], LAYOUT_DISTRIBUTION_TYPES[2]],
|
|
92
|
+
3: [LAYOUT_DISTRIBUTION_TYPES[3], LAYOUT_DISTRIBUTION_TYPES[4]],
|
|
61
93
|
4: [],
|
|
62
94
|
5: []
|
|
63
95
|
};
|
|
@@ -155,7 +187,7 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
155
187
|
testId: 'column-options-button'
|
|
156
188
|
}, sidebarTypesByColumns.length > 0 && separator] : []), ...layoutTypes.map(i => buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI)), ...(addSidebarLayouts ? isPreRelease2() ? sidebarTypesByColumns.map(i => buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI)) : SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI)) : []), separator, {
|
|
157
189
|
type: 'copy-button',
|
|
158
|
-
supportsViewMode:
|
|
190
|
+
supportsViewMode: !fg('platform_editor_remove_copy_button_from_view_mode'),
|
|
159
191
|
items: [{
|
|
160
192
|
state,
|
|
161
193
|
formatMessage: intl.formatMessage,
|
|
@@ -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);
|
package/dist/esm/plugin.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
44
|
-
pos =
|
|
45
|
-
allowBreakout =
|
|
46
|
-
addSidebarLayouts =
|
|
47
|
-
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(
|
|
54
|
-
var 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
|
+
});
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -15,6 +15,7 @@ import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
|
|
|
15
15
|
import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
|
|
16
16
|
import LayoutTwoRightSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-right-sidebar';
|
|
17
17
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
18
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
18
19
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from './actions';
|
|
19
20
|
import { isPreRelease2 } from './utils/preRelease';
|
|
20
21
|
var LAYOUT_TYPES = [{
|
|
@@ -56,9 +57,40 @@ var SIDEBAR_LAYOUT_TYPES = [{
|
|
|
56
57
|
icon: LayoutThreeColumnsSidebarsIcon,
|
|
57
58
|
iconFallback: LayoutThreeWithSidebarsIcon
|
|
58
59
|
}];
|
|
60
|
+
var LAYOUT_DISTRIBUTION_TYPES = [{
|
|
61
|
+
id: 'editor.layout.twoEquals',
|
|
62
|
+
type: 'two_equal',
|
|
63
|
+
title: toolbarMessages.twoColumns,
|
|
64
|
+
icon: LayoutTwoColumnsIcon,
|
|
65
|
+
iconFallback: LayoutTwoEqualIcon
|
|
66
|
+
}, {
|
|
67
|
+
id: 'editor.layout.twoRightSidebar',
|
|
68
|
+
type: 'two_right_sidebar',
|
|
69
|
+
title: toolbarMessages.rightSidebar,
|
|
70
|
+
icon: LayoutTwoColumnsSidebarRightIcon,
|
|
71
|
+
iconFallback: LayoutTwoRightSidebarIcon
|
|
72
|
+
}, {
|
|
73
|
+
id: 'editor.layout.twoLeftSidebar',
|
|
74
|
+
type: 'two_left_sidebar',
|
|
75
|
+
title: toolbarMessages.leftSidebar,
|
|
76
|
+
icon: LayoutTwoColumnsSidebarLeftIcon,
|
|
77
|
+
iconFallback: LayoutTwoLeftSidebarIcon
|
|
78
|
+
}, {
|
|
79
|
+
id: 'editor.layout.threeEquals',
|
|
80
|
+
type: 'three_equal',
|
|
81
|
+
title: toolbarMessages.threeColumns,
|
|
82
|
+
icon: LayoutThreeColumnsIcon,
|
|
83
|
+
iconFallback: LayoutThreeEqualIcon
|
|
84
|
+
}, {
|
|
85
|
+
id: 'editor.layout.threeWithSidebars',
|
|
86
|
+
type: 'three_with_sidebars',
|
|
87
|
+
title: toolbarMessages.threeColumnsWithSidebars,
|
|
88
|
+
icon: LayoutThreeColumnsSidebarsIcon,
|
|
89
|
+
iconFallback: LayoutThreeWithSidebarsIcon
|
|
90
|
+
}];
|
|
59
91
|
var SIDEBAR_LAYOUT_TYPES_BY_COLUMNS = {
|
|
60
|
-
2: [
|
|
61
|
-
3: [
|
|
92
|
+
2: [LAYOUT_DISTRIBUTION_TYPES[0], LAYOUT_DISTRIBUTION_TYPES[1], LAYOUT_DISTRIBUTION_TYPES[2]],
|
|
93
|
+
3: [LAYOUT_DISTRIBUTION_TYPES[3], LAYOUT_DISTRIBUTION_TYPES[4]],
|
|
62
94
|
4: [],
|
|
63
95
|
5: []
|
|
64
96
|
};
|
|
@@ -165,7 +197,7 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
165
197
|
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
166
198
|
}) : []), [separator, {
|
|
167
199
|
type: 'copy-button',
|
|
168
|
-
supportsViewMode:
|
|
200
|
+
supportsViewMode: !fg('platform_editor_remove_copy_button_from_view_mode'),
|
|
169
201
|
items: [{
|
|
170
202
|
state: state,
|
|
171
203
|
formatMessage: intl.formatMessage,
|
|
@@ -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 {};
|
package/dist/types/plugin.d.ts
CHANGED
|
@@ -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: [
|
|
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;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,14 +32,16 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
35
|
-
"@atlaskit/editor-common": "^94.
|
|
35
|
+
"@atlaskit/editor-common": "^94.13.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",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
42
|
-
"@atlaskit/tokens": "^2.
|
|
43
|
+
"@atlaskit/tmp-editor-statsig": "^2.12.0",
|
|
44
|
+
"@atlaskit/tokens": "^2.2.0",
|
|
43
45
|
"@babel/runtime": "^7.0.0",
|
|
44
46
|
"@emotion/react": "^11.7.1"
|
|
45
47
|
},
|
|
@@ -91,6 +93,12 @@
|
|
|
91
93
|
"platform-feature-flags": {
|
|
92
94
|
"platform_editor_advanced_layouts_pre_release_2": {
|
|
93
95
|
"type": "boolean"
|
|
96
|
+
},
|
|
97
|
+
"platform_editor_remove_copy_button_from_view_mode": {
|
|
98
|
+
"type": "boolean"
|
|
99
|
+
},
|
|
100
|
+
"platform_editor_advanced_layouts_breakout_resizing": {
|
|
101
|
+
"type": "boolean"
|
|
94
102
|
}
|
|
95
103
|
}
|
|
96
104
|
}
|