@atlaskit/editor-plugin-layout 2.7.5 → 2.8.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 +30 -0
- package/dist/cjs/nodeviews/index.js +6 -1
- package/dist/cjs/ui/icons/LayoutColumnsIcon.js +36 -0
- package/dist/cjs/ui/toolbar.js +31 -5
- package/dist/es2019/nodeviews/index.js +6 -1
- package/dist/es2019/ui/icons/LayoutColumnsIcon.js +29 -0
- package/dist/es2019/ui/toolbar.js +31 -5
- package/dist/esm/nodeviews/index.js +6 -1
- package/dist/esm/ui/icons/LayoutColumnsIcon.js +28 -0
- package/dist/esm/ui/toolbar.js +31 -5
- package/dist/types/layoutPluginType.d.ts +3 -1
- package/dist/types/ui/icons/LayoutColumnsIcon.d.ts +3 -0
- package/dist/types-ts4.5/layoutPluginType.d.ts +3 -1
- package/dist/types-ts4.5/ui/icons/LayoutColumnsIcon.d.ts +3 -0
- package/package.json +8 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 2.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#161565](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/161565)
|
|
8
|
+
[`78560d0f96f90`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/78560d0f96f90) -
|
|
9
|
+
Disable layout resizer when platform_editor_breakout_resizer is enabled
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.8.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [#160582](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/160582)
|
|
17
|
+
[`63a34f82a6b4c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/63a34f82a6b4c) -
|
|
18
|
+
ED-25466 add icons to layout dropdown
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
24
|
+
## 2.7.6
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- [#159070](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/159070)
|
|
29
|
+
[`9857b771c1da1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9857b771c1da1) -
|
|
30
|
+
[ux] [ED-27778] Fix selection state hiding for tables, breakout buttons and layout
|
|
31
|
+
- Updated dependencies
|
|
32
|
+
|
|
3
33
|
## 2.7.5
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -17,6 +17,7 @@ var _reactNodeView = _interopRequireDefault(require("@atlaskit/editor-common/rea
|
|
|
17
17
|
var _resizer = require("@atlaskit/editor-common/resizer");
|
|
18
18
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
19
19
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
20
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
20
21
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
21
22
|
var _utils = require("../pm-plugins/utils");
|
|
22
23
|
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); }
|
|
@@ -69,6 +70,7 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
69
70
|
parentRef = _ref.parentRef;
|
|
70
71
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
71
72
|
editorDisabled = _useSharedState.editorDisabled;
|
|
73
|
+
var interactionState = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(pluginInjectionApi, 'interaction.interactionState');
|
|
72
74
|
var getEditorWidth = function getEditorWidth() {
|
|
73
75
|
var _pluginInjectionApi$w;
|
|
74
76
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
@@ -94,13 +96,16 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
94
96
|
// put the selection into the first column of the layout
|
|
95
97
|
(0, _utils.selectIntoLayout)(view, pos, 0);
|
|
96
98
|
}, [getPos, view]);
|
|
99
|
+
if (interactionState === 'hasNotHadInteraction' && (0, _platformFeatureFlags.fg)('platform_editor_hide_expand_selection_states')) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
97
102
|
return /*#__PURE__*/_react.default.createElement(_resizer.BreakoutResizer, {
|
|
98
103
|
getRef: forwardRef,
|
|
99
104
|
getPos: getPos,
|
|
100
105
|
editorView: view,
|
|
101
106
|
nodeType: "layoutSection",
|
|
102
107
|
getEditorWidth: getEditorWidth,
|
|
103
|
-
disabled: editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
108
|
+
disabled: (0, _experiments.editorExperiment)('platform_editor_breakout_resizing', true) ? true : editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
104
109
|
parentRef: parentRef,
|
|
105
110
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
106
111
|
displayGuidelines: (0, _experiments.editorExperiment)('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.EditorLayoutFourColumnsIcon = exports.EditorLayoutFiveColumnsIcon = void 0;
|
|
8
|
+
var _react = require("@emotion/react");
|
|
9
|
+
var _layoutFiveColumns = _interopRequireDefault(require("@atlaskit/icon-lab/core/layout-five-columns"));
|
|
10
|
+
var _layoutFourColumns = _interopRequireDefault(require("@atlaskit/icon-lab/core/layout-four-columns"));
|
|
11
|
+
/**
|
|
12
|
+
* @jsxRuntime classic
|
|
13
|
+
* @jsx jsx
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
17
|
+
|
|
18
|
+
var wrapperStyle = (0, _react.css)({
|
|
19
|
+
padding: '0 4px'
|
|
20
|
+
});
|
|
21
|
+
var Wrapper = function Wrapper(_ref) {
|
|
22
|
+
var children = _ref.children;
|
|
23
|
+
return (0, _react.jsx)("div", {
|
|
24
|
+
css: wrapperStyle
|
|
25
|
+
}, children);
|
|
26
|
+
};
|
|
27
|
+
var EditorLayoutFiveColumnsIcon = exports.EditorLayoutFiveColumnsIcon = function EditorLayoutFiveColumnsIcon() {
|
|
28
|
+
return (0, _react.jsx)(Wrapper, null, (0, _react.jsx)(_layoutFiveColumns.default, {
|
|
29
|
+
label: ""
|
|
30
|
+
}));
|
|
31
|
+
};
|
|
32
|
+
var EditorLayoutFourColumnsIcon = exports.EditorLayoutFourColumnsIcon = function EditorLayoutFourColumnsIcon() {
|
|
33
|
+
return (0, _react.jsx)(Wrapper, null, (0, _react.jsx)(_layoutFourColumns.default, {
|
|
34
|
+
label: ""
|
|
35
|
+
}));
|
|
36
|
+
};
|
package/dist/cjs/ui/toolbar.js
CHANGED
|
@@ -24,6 +24,7 @@ var _layoutTwoColumnsSidebarRightEditorLayoutTwoRightSidebar = _interopRequireDe
|
|
|
24
24
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
25
25
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
26
26
|
var _actions = require("../pm-plugins/actions");
|
|
27
|
+
var _LayoutColumnsIcon = require("./icons/LayoutColumnsIcon");
|
|
27
28
|
var _LayoutThreeWithLeftSidebars = require("./icons/LayoutThreeWithLeftSidebars");
|
|
28
29
|
var _LayoutThreeWithRightSidebars = require("./icons/LayoutThreeWithRightSidebars");
|
|
29
30
|
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); }
|
|
@@ -120,6 +121,31 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, ed
|
|
|
120
121
|
var layoutToolbarTitle = exports.layoutToolbarTitle = 'Layout floating controls';
|
|
121
122
|
var iconPlaceholder = _layoutTwoColumnsEditorLayoutTwoEqual.default; // TODO: ED-25466 - Replace with proper icon
|
|
122
123
|
|
|
124
|
+
var getLayoutColumnsIcons = function getLayoutColumnsIcons(colCount) {
|
|
125
|
+
if (!(0, _experiments.editorExperiment)('single_column_layouts', true)) {
|
|
126
|
+
return undefined;
|
|
127
|
+
}
|
|
128
|
+
switch (colCount) {
|
|
129
|
+
case 1:
|
|
130
|
+
return /*#__PURE__*/_react.default.createElement(_layoutOneColumnEditorLayoutSingle.default, {
|
|
131
|
+
label: ""
|
|
132
|
+
});
|
|
133
|
+
case 2:
|
|
134
|
+
return /*#__PURE__*/_react.default.createElement(_layoutTwoColumnsEditorLayoutTwoEqual.default, {
|
|
135
|
+
label: ""
|
|
136
|
+
});
|
|
137
|
+
case 3:
|
|
138
|
+
return /*#__PURE__*/_react.default.createElement(_layoutThreeColumnsEditorLayoutThreeEqual.default, {
|
|
139
|
+
label: ""
|
|
140
|
+
});
|
|
141
|
+
case 4:
|
|
142
|
+
return /*#__PURE__*/_react.default.createElement(_LayoutColumnsIcon.EditorLayoutFourColumnsIcon, null);
|
|
143
|
+
case 5:
|
|
144
|
+
return /*#__PURE__*/_react.default.createElement(_LayoutColumnsIcon.EditorLayoutFiveColumnsIcon, null);
|
|
145
|
+
default:
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
};
|
|
123
149
|
var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
124
150
|
var addSidebarLayouts = _ref.addSidebarLayouts,
|
|
125
151
|
intl = _ref.intl,
|
|
@@ -138,7 +164,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
138
164
|
count: 2
|
|
139
165
|
}),
|
|
140
166
|
//'2-columns',
|
|
141
|
-
icon: iconPlaceholder,
|
|
167
|
+
icon: getLayoutColumnsIcons(2) || iconPlaceholder,
|
|
142
168
|
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('two_equal'),
|
|
143
169
|
selected: numberOfColumns === 2
|
|
144
170
|
}, {
|
|
@@ -146,7 +172,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
146
172
|
count: 3
|
|
147
173
|
}),
|
|
148
174
|
//'3-columns'
|
|
149
|
-
icon: iconPlaceholder,
|
|
175
|
+
icon: getLayoutColumnsIcons(3) || iconPlaceholder,
|
|
150
176
|
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('three_equal'),
|
|
151
177
|
selected: numberOfColumns === 3
|
|
152
178
|
}, {
|
|
@@ -154,7 +180,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
154
180
|
count: 4
|
|
155
181
|
}),
|
|
156
182
|
//'4-columns'
|
|
157
|
-
icon: iconPlaceholder,
|
|
183
|
+
icon: getLayoutColumnsIcons(4) || iconPlaceholder,
|
|
158
184
|
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('four_equal'),
|
|
159
185
|
selected: numberOfColumns === 4
|
|
160
186
|
}, {
|
|
@@ -162,7 +188,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
162
188
|
count: 5
|
|
163
189
|
}),
|
|
164
190
|
//'5-columns'
|
|
165
|
-
icon: iconPlaceholder,
|
|
191
|
+
icon: getLayoutColumnsIcons(5) || iconPlaceholder,
|
|
166
192
|
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('five_equal'),
|
|
167
193
|
selected: numberOfColumns === 5
|
|
168
194
|
}];
|
|
@@ -171,7 +197,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
171
197
|
count: 1
|
|
172
198
|
}),
|
|
173
199
|
//'1-columns',
|
|
174
|
-
icon: iconPlaceholder,
|
|
200
|
+
icon: getLayoutColumnsIcons(1) || iconPlaceholder,
|
|
175
201
|
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('single'),
|
|
176
202
|
selected: numberOfColumns === 1
|
|
177
203
|
} : [];
|
|
@@ -4,6 +4,7 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
|
4
4
|
import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
|
|
5
5
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
6
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
8
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
8
9
|
import { selectIntoLayout } from '../pm-plugins/utils';
|
|
9
10
|
const layoutDynamicFullWidthGuidelineOffset = 16;
|
|
@@ -55,6 +56,7 @@ const LayoutBreakoutResizer = ({
|
|
|
55
56
|
const {
|
|
56
57
|
editorDisabled
|
|
57
58
|
} = useSharedState(pluginInjectionApi);
|
|
59
|
+
const interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
|
|
58
60
|
const getEditorWidth = () => {
|
|
59
61
|
var _pluginInjectionApi$w;
|
|
60
62
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
@@ -80,13 +82,16 @@ const LayoutBreakoutResizer = ({
|
|
|
80
82
|
// put the selection into the first column of the layout
|
|
81
83
|
selectIntoLayout(view, pos, 0);
|
|
82
84
|
}, [getPos, view]);
|
|
85
|
+
if (interactionState === 'hasNotHadInteraction' && fg('platform_editor_hide_expand_selection_states')) {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
83
88
|
return /*#__PURE__*/React.createElement(BreakoutResizer, {
|
|
84
89
|
getRef: forwardRef,
|
|
85
90
|
getPos: getPos,
|
|
86
91
|
editorView: view,
|
|
87
92
|
nodeType: "layoutSection",
|
|
88
93
|
getEditorWidth: getEditorWidth,
|
|
89
|
-
disabled: editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
94
|
+
disabled: editorExperiment('platform_editor_breakout_resizing', true) ? true : editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
90
95
|
parentRef: parentRef,
|
|
91
96
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 ? void 0 : (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
92
97
|
displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import LayoutFiveColumnsIcon from '@atlaskit/icon-lab/core/layout-five-columns';
|
|
9
|
+
import LayoutFourColumnsIcon from '@atlaskit/icon-lab/core/layout-four-columns';
|
|
10
|
+
const wrapperStyle = css({
|
|
11
|
+
padding: '0 4px'
|
|
12
|
+
});
|
|
13
|
+
const Wrapper = ({
|
|
14
|
+
children
|
|
15
|
+
}) => {
|
|
16
|
+
return jsx("div", {
|
|
17
|
+
css: wrapperStyle
|
|
18
|
+
}, children);
|
|
19
|
+
};
|
|
20
|
+
export const EditorLayoutFiveColumnsIcon = () => {
|
|
21
|
+
return jsx(Wrapper, null, jsx(LayoutFiveColumnsIcon, {
|
|
22
|
+
label: ""
|
|
23
|
+
}));
|
|
24
|
+
};
|
|
25
|
+
export const EditorLayoutFourColumnsIcon = () => {
|
|
26
|
+
return jsx(Wrapper, null, jsx(LayoutFourColumnsIcon, {
|
|
27
|
+
label: ""
|
|
28
|
+
}));
|
|
29
|
+
};
|
|
@@ -14,6 +14,7 @@ import LayoutTwoColumnsSidebarRightIcon from '@atlaskit/icon/core/migration/layo
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
16
16
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from '../pm-plugins/actions';
|
|
17
|
+
import { EditorLayoutFiveColumnsIcon, EditorLayoutFourColumnsIcon } from './icons/LayoutColumnsIcon';
|
|
17
18
|
import { LayoutThreeWithLeftSidebarsIcon } from './icons/LayoutThreeWithLeftSidebars';
|
|
18
19
|
import { LayoutThreeWithRightSidebarsIcon } from './icons/LayoutThreeWithRightSidebars';
|
|
19
20
|
const LAYOUT_TYPES = [{
|
|
@@ -104,6 +105,31 @@ const buildLayoutButton = (intl, item, currentLayout, editorAnalyticsAPI) => ({
|
|
|
104
105
|
export const layoutToolbarTitle = 'Layout floating controls';
|
|
105
106
|
const iconPlaceholder = LayoutTwoColumnsIcon; // TODO: ED-25466 - Replace with proper icon
|
|
106
107
|
|
|
108
|
+
const getLayoutColumnsIcons = colCount => {
|
|
109
|
+
if (!editorExperiment('single_column_layouts', true)) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
switch (colCount) {
|
|
113
|
+
case 1:
|
|
114
|
+
return /*#__PURE__*/React.createElement(LayoutOneColumnIcon, {
|
|
115
|
+
label: ""
|
|
116
|
+
});
|
|
117
|
+
case 2:
|
|
118
|
+
return /*#__PURE__*/React.createElement(LayoutTwoColumnsIcon, {
|
|
119
|
+
label: ""
|
|
120
|
+
});
|
|
121
|
+
case 3:
|
|
122
|
+
return /*#__PURE__*/React.createElement(LayoutThreeColumnsIcon, {
|
|
123
|
+
label: ""
|
|
124
|
+
});
|
|
125
|
+
case 4:
|
|
126
|
+
return /*#__PURE__*/React.createElement(EditorLayoutFourColumnsIcon, null);
|
|
127
|
+
case 5:
|
|
128
|
+
return /*#__PURE__*/React.createElement(EditorLayoutFiveColumnsIcon, null);
|
|
129
|
+
default:
|
|
130
|
+
return undefined;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
107
133
|
const getAdvancedLayoutItems = ({
|
|
108
134
|
addSidebarLayouts,
|
|
109
135
|
intl,
|
|
@@ -123,7 +149,7 @@ const getAdvancedLayoutItems = ({
|
|
|
123
149
|
count: 2
|
|
124
150
|
}),
|
|
125
151
|
//'2-columns',
|
|
126
|
-
icon: iconPlaceholder,
|
|
152
|
+
icon: getLayoutColumnsIcons(2) || iconPlaceholder,
|
|
127
153
|
onClick: setPresetLayout(editorAnalyticsAPI)('two_equal'),
|
|
128
154
|
selected: numberOfColumns === 2
|
|
129
155
|
}, {
|
|
@@ -131,7 +157,7 @@ const getAdvancedLayoutItems = ({
|
|
|
131
157
|
count: 3
|
|
132
158
|
}),
|
|
133
159
|
//'3-columns'
|
|
134
|
-
icon: iconPlaceholder,
|
|
160
|
+
icon: getLayoutColumnsIcons(3) || iconPlaceholder,
|
|
135
161
|
onClick: setPresetLayout(editorAnalyticsAPI)('three_equal'),
|
|
136
162
|
selected: numberOfColumns === 3
|
|
137
163
|
}, {
|
|
@@ -139,7 +165,7 @@ const getAdvancedLayoutItems = ({
|
|
|
139
165
|
count: 4
|
|
140
166
|
}),
|
|
141
167
|
//'4-columns'
|
|
142
|
-
icon: iconPlaceholder,
|
|
168
|
+
icon: getLayoutColumnsIcons(4) || iconPlaceholder,
|
|
143
169
|
onClick: setPresetLayout(editorAnalyticsAPI)('four_equal'),
|
|
144
170
|
selected: numberOfColumns === 4
|
|
145
171
|
}, {
|
|
@@ -147,7 +173,7 @@ const getAdvancedLayoutItems = ({
|
|
|
147
173
|
count: 5
|
|
148
174
|
}),
|
|
149
175
|
//'5-columns'
|
|
150
|
-
icon: iconPlaceholder,
|
|
176
|
+
icon: getLayoutColumnsIcons(5) || iconPlaceholder,
|
|
151
177
|
onClick: setPresetLayout(editorAnalyticsAPI)('five_equal'),
|
|
152
178
|
selected: numberOfColumns === 5
|
|
153
179
|
}];
|
|
@@ -156,7 +182,7 @@ const getAdvancedLayoutItems = ({
|
|
|
156
182
|
count: 1
|
|
157
183
|
}),
|
|
158
184
|
//'1-columns',
|
|
159
|
-
icon: iconPlaceholder,
|
|
185
|
+
icon: getLayoutColumnsIcons(1) || iconPlaceholder,
|
|
160
186
|
onClick: setPresetLayout(editorAnalyticsAPI)('single'),
|
|
161
187
|
selected: numberOfColumns === 1
|
|
162
188
|
} : [];
|
|
@@ -11,6 +11,7 @@ import ReactNodeView from '@atlaskit/editor-common/react-node-view';
|
|
|
11
11
|
import { BreakoutResizer, ignoreResizerMutations } from '@atlaskit/editor-common/resizer';
|
|
12
12
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
13
13
|
import { DOMSerializer } from '@atlaskit/editor-prosemirror/model';
|
|
14
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
14
15
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
15
16
|
import { selectIntoLayout } from '../pm-plugins/utils';
|
|
16
17
|
var layoutDynamicFullWidthGuidelineOffset = 16;
|
|
@@ -59,6 +60,7 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
59
60
|
parentRef = _ref.parentRef;
|
|
60
61
|
var _useSharedState = useSharedState(pluginInjectionApi),
|
|
61
62
|
editorDisabled = _useSharedState.editorDisabled;
|
|
63
|
+
var interactionState = useSharedPluginStateSelector(pluginInjectionApi, 'interaction.interactionState');
|
|
62
64
|
var getEditorWidth = function getEditorWidth() {
|
|
63
65
|
var _pluginInjectionApi$w;
|
|
64
66
|
return pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$w = pluginInjectionApi.width) === null || _pluginInjectionApi$w === void 0 ? void 0 : _pluginInjectionApi$w.sharedState.currentState();
|
|
@@ -84,13 +86,16 @@ var LayoutBreakoutResizer = function LayoutBreakoutResizer(_ref) {
|
|
|
84
86
|
// put the selection into the first column of the layout
|
|
85
87
|
selectIntoLayout(view, pos, 0);
|
|
86
88
|
}, [getPos, view]);
|
|
89
|
+
if (interactionState === 'hasNotHadInteraction' && fg('platform_editor_hide_expand_selection_states')) {
|
|
90
|
+
return null;
|
|
91
|
+
}
|
|
87
92
|
return /*#__PURE__*/React.createElement(BreakoutResizer, {
|
|
88
93
|
getRef: forwardRef,
|
|
89
94
|
getPos: getPos,
|
|
90
95
|
editorView: view,
|
|
91
96
|
nodeType: "layoutSection",
|
|
92
97
|
getEditorWidth: getEditorWidth,
|
|
93
|
-
disabled: editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
98
|
+
disabled: editorExperiment('platform_editor_breakout_resizing', true) ? true : editorDisabled === true || !isBreakoutAvailable(view.state.schema),
|
|
94
99
|
parentRef: parentRef,
|
|
95
100
|
editorAnalyticsApi: pluginInjectionApi === null || pluginInjectionApi === void 0 || (_pluginInjectionApi$a = pluginInjectionApi.analytics) === null || _pluginInjectionApi$a === void 0 ? void 0 : _pluginInjectionApi$a.actions,
|
|
96
101
|
displayGuidelines: editorExperiment('single_column_layouts', true) ? displayGuidelines : undefined,
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
|
+
import { css, jsx } from '@emotion/react';
|
|
8
|
+
import LayoutFiveColumnsIcon from '@atlaskit/icon-lab/core/layout-five-columns';
|
|
9
|
+
import LayoutFourColumnsIcon from '@atlaskit/icon-lab/core/layout-four-columns';
|
|
10
|
+
var wrapperStyle = css({
|
|
11
|
+
padding: '0 4px'
|
|
12
|
+
});
|
|
13
|
+
var Wrapper = function Wrapper(_ref) {
|
|
14
|
+
var children = _ref.children;
|
|
15
|
+
return jsx("div", {
|
|
16
|
+
css: wrapperStyle
|
|
17
|
+
}, children);
|
|
18
|
+
};
|
|
19
|
+
export var EditorLayoutFiveColumnsIcon = function EditorLayoutFiveColumnsIcon() {
|
|
20
|
+
return jsx(Wrapper, null, jsx(LayoutFiveColumnsIcon, {
|
|
21
|
+
label: ""
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
export var EditorLayoutFourColumnsIcon = function EditorLayoutFourColumnsIcon() {
|
|
25
|
+
return jsx(Wrapper, null, jsx(LayoutFourColumnsIcon, {
|
|
26
|
+
label: ""
|
|
27
|
+
}));
|
|
28
|
+
};
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -18,6 +18,7 @@ import LayoutTwoColumnsSidebarRightIcon from '@atlaskit/icon/core/migration/layo
|
|
|
18
18
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
19
19
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
20
20
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from '../pm-plugins/actions';
|
|
21
|
+
import { EditorLayoutFiveColumnsIcon, EditorLayoutFourColumnsIcon } from './icons/LayoutColumnsIcon';
|
|
21
22
|
import { LayoutThreeWithLeftSidebarsIcon } from './icons/LayoutThreeWithLeftSidebars';
|
|
22
23
|
import { LayoutThreeWithRightSidebarsIcon } from './icons/LayoutThreeWithRightSidebars';
|
|
23
24
|
var LAYOUT_TYPES = [{
|
|
@@ -110,6 +111,31 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, ed
|
|
|
110
111
|
export var layoutToolbarTitle = 'Layout floating controls';
|
|
111
112
|
var iconPlaceholder = LayoutTwoColumnsIcon; // TODO: ED-25466 - Replace with proper icon
|
|
112
113
|
|
|
114
|
+
var getLayoutColumnsIcons = function getLayoutColumnsIcons(colCount) {
|
|
115
|
+
if (!editorExperiment('single_column_layouts', true)) {
|
|
116
|
+
return undefined;
|
|
117
|
+
}
|
|
118
|
+
switch (colCount) {
|
|
119
|
+
case 1:
|
|
120
|
+
return /*#__PURE__*/React.createElement(LayoutOneColumnIcon, {
|
|
121
|
+
label: ""
|
|
122
|
+
});
|
|
123
|
+
case 2:
|
|
124
|
+
return /*#__PURE__*/React.createElement(LayoutTwoColumnsIcon, {
|
|
125
|
+
label: ""
|
|
126
|
+
});
|
|
127
|
+
case 3:
|
|
128
|
+
return /*#__PURE__*/React.createElement(LayoutThreeColumnsIcon, {
|
|
129
|
+
label: ""
|
|
130
|
+
});
|
|
131
|
+
case 4:
|
|
132
|
+
return /*#__PURE__*/React.createElement(EditorLayoutFourColumnsIcon, null);
|
|
133
|
+
case 5:
|
|
134
|
+
return /*#__PURE__*/React.createElement(EditorLayoutFiveColumnsIcon, null);
|
|
135
|
+
default:
|
|
136
|
+
return undefined;
|
|
137
|
+
}
|
|
138
|
+
};
|
|
113
139
|
var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
114
140
|
var addSidebarLayouts = _ref.addSidebarLayouts,
|
|
115
141
|
intl = _ref.intl,
|
|
@@ -128,7 +154,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
128
154
|
count: 2
|
|
129
155
|
}),
|
|
130
156
|
//'2-columns',
|
|
131
|
-
icon: iconPlaceholder,
|
|
157
|
+
icon: getLayoutColumnsIcons(2) || iconPlaceholder,
|
|
132
158
|
onClick: setPresetLayout(editorAnalyticsAPI)('two_equal'),
|
|
133
159
|
selected: numberOfColumns === 2
|
|
134
160
|
}, {
|
|
@@ -136,7 +162,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
136
162
|
count: 3
|
|
137
163
|
}),
|
|
138
164
|
//'3-columns'
|
|
139
|
-
icon: iconPlaceholder,
|
|
165
|
+
icon: getLayoutColumnsIcons(3) || iconPlaceholder,
|
|
140
166
|
onClick: setPresetLayout(editorAnalyticsAPI)('three_equal'),
|
|
141
167
|
selected: numberOfColumns === 3
|
|
142
168
|
}, {
|
|
@@ -144,7 +170,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
144
170
|
count: 4
|
|
145
171
|
}),
|
|
146
172
|
//'4-columns'
|
|
147
|
-
icon: iconPlaceholder,
|
|
173
|
+
icon: getLayoutColumnsIcons(4) || iconPlaceholder,
|
|
148
174
|
onClick: setPresetLayout(editorAnalyticsAPI)('four_equal'),
|
|
149
175
|
selected: numberOfColumns === 4
|
|
150
176
|
}, {
|
|
@@ -152,7 +178,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
152
178
|
count: 5
|
|
153
179
|
}),
|
|
154
180
|
//'5-columns'
|
|
155
|
-
icon: iconPlaceholder,
|
|
181
|
+
icon: getLayoutColumnsIcons(5) || iconPlaceholder,
|
|
156
182
|
onClick: setPresetLayout(editorAnalyticsAPI)('five_equal'),
|
|
157
183
|
selected: numberOfColumns === 5
|
|
158
184
|
}];
|
|
@@ -161,7 +187,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
161
187
|
count: 1
|
|
162
188
|
}),
|
|
163
189
|
//'1-columns',
|
|
164
|
-
icon: iconPlaceholder,
|
|
190
|
+
icon: getLayoutColumnsIcons(1) || iconPlaceholder,
|
|
165
191
|
onClick: setPresetLayout(editorAnalyticsAPI)('single'),
|
|
166
192
|
selected: numberOfColumns === 1
|
|
167
193
|
} : [];
|
|
@@ -3,6 +3,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
5
5
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
6
7
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
7
8
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
9
|
import type { insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
|
|
@@ -13,7 +14,8 @@ export type LayoutPluginDependencies = [
|
|
|
13
14
|
OptionalPlugin<AnalyticsPlugin>,
|
|
14
15
|
OptionalPlugin<WidthPlugin>,
|
|
15
16
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
16
|
-
OptionalPlugin<GuidelinePlugin
|
|
17
|
+
OptionalPlugin<GuidelinePlugin>,
|
|
18
|
+
OptionalPlugin<InteractionPlugin>
|
|
17
19
|
];
|
|
18
20
|
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
19
21
|
pluginConfiguration: LayoutPluginOptions | undefined;
|
|
@@ -3,6 +3,7 @@ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
|
3
3
|
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
4
4
|
import type { EditorDisabledPlugin } from '@atlaskit/editor-plugin-editor-disabled';
|
|
5
5
|
import type { GuidelinePlugin } from '@atlaskit/editor-plugin-guideline';
|
|
6
|
+
import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
6
7
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
7
8
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
8
9
|
import type { insertLayoutColumnsWithAnalytics } from './pm-plugins/actions';
|
|
@@ -13,7 +14,8 @@ export type LayoutPluginDependencies = [
|
|
|
13
14
|
OptionalPlugin<AnalyticsPlugin>,
|
|
14
15
|
OptionalPlugin<WidthPlugin>,
|
|
15
16
|
OptionalPlugin<EditorDisabledPlugin>,
|
|
16
|
-
OptionalPlugin<GuidelinePlugin
|
|
17
|
+
OptionalPlugin<GuidelinePlugin>,
|
|
18
|
+
OptionalPlugin<InteractionPlugin>
|
|
17
19
|
];
|
|
18
20
|
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
19
21
|
pluginConfiguration: LayoutPluginOptions | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -34,18 +34,20 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
37
|
-
"@atlaskit/editor-common": "^105.
|
|
37
|
+
"@atlaskit/editor-common": "^105.11.0",
|
|
38
38
|
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
39
39
|
"@atlaskit/editor-plugin-decorations": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-editor-disabled": "^2.0.0",
|
|
41
41
|
"@atlaskit/editor-plugin-guideline": "^2.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-interaction": "^1.1.0",
|
|
42
43
|
"@atlaskit/editor-plugin-selection": "^2.2.0",
|
|
43
44
|
"@atlaskit/editor-plugin-width": "^3.0.0",
|
|
44
45
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
45
46
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
46
47
|
"@atlaskit/icon": "^26.3.0",
|
|
48
|
+
"@atlaskit/icon-lab": "^4.16.0",
|
|
47
49
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
48
|
-
"@atlaskit/tmp-editor-statsig": "^5.
|
|
50
|
+
"@atlaskit/tmp-editor-statsig": "^5.1.0",
|
|
49
51
|
"@atlaskit/tokens": "^4.9.0",
|
|
50
52
|
"@babel/runtime": "^7.0.0",
|
|
51
53
|
"@emotion/react": "^11.7.1"
|
|
@@ -113,6 +115,9 @@
|
|
|
113
115
|
},
|
|
114
116
|
"platform_editor_controls_patch_8": {
|
|
115
117
|
"type": "boolean"
|
|
118
|
+
},
|
|
119
|
+
"platform_editor_hide_expand_selection_states": {
|
|
120
|
+
"type": "boolean"
|
|
116
121
|
}
|
|
117
122
|
}
|
|
118
123
|
}
|