@atlaskit/editor-plugin-layout 1.9.4 → 1.9.6
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 +24 -0
- package/dist/cjs/actions.js +53 -21
- package/dist/cjs/plugin.js +14 -9
- package/dist/cjs/toolbar.js +54 -3
- package/dist/cjs/ui/global-styles.js +29 -0
- package/dist/es2019/actions.js +54 -20
- package/dist/es2019/plugin.js +15 -10
- package/dist/es2019/toolbar.js +55 -4
- package/dist/es2019/ui/global-styles.js +22 -0
- package/dist/esm/actions.js +53 -21
- package/dist/esm/plugin.js +15 -10
- package/dist/esm/toolbar.js +55 -4
- package/dist/esm/ui/global-styles.js +22 -0
- package/dist/types/actions.d.ts +6 -5
- package/dist/types/ui/global-styles.d.ts +6 -0
- package/dist/types-ts4.5/actions.d.ts +6 -5
- package/dist/types-ts4.5/ui/global-styles.d.ts +6 -0
- package/package.json +7 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 1.9.6
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#155293](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155293)
|
|
8
|
+
[`28161e3c04419`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/28161e3c04419) -
|
|
9
|
+
[ux] Implement toolbar options on layout for setting number of columns
|
|
10
|
+
- [#156078](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156078)
|
|
11
|
+
[`2b70196727715`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/2b70196727715) -
|
|
12
|
+
[ux] Update text for inserting multi column layout
|
|
13
|
+
- [#156137](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/156137)
|
|
14
|
+
[`485e094b29aa9`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/485e094b29aa9) -
|
|
15
|
+
Use stage0 layout node spec behind adv layout experiment
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
18
|
+
## 1.9.5
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- [#155345](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155345)
|
|
23
|
+
[`9f00717c4915b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9f00717c4915b) -
|
|
24
|
+
[ux] Add layout placeholder behind feature gate
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 1.9.4
|
|
4
28
|
|
|
5
29
|
### Patch Changes
|
package/dist/cjs/actions.js
CHANGED
|
@@ -10,12 +10,14 @@ exports.setPresetLayout = exports.insertLayoutColumnsWithAnalytics = exports.ins
|
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
12
|
var _editorAnalytics = require("@atlaskit/editor-common/editor-analytics");
|
|
13
|
+
var _messages = require("@atlaskit/editor-common/messages");
|
|
13
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
15
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
18
|
var _consts = require("./consts");
|
|
18
19
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
20
|
+
var _preRelease = require("./utils/preRelease");
|
|
19
21
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
20
22
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
21
23
|
var ONE_COL_LAYOUTS = exports.ONE_COL_LAYOUTS = ['single'];
|
|
@@ -68,33 +70,46 @@ var getSelectedLayout = exports.getSelectedLayout = function getSelectedLayout(m
|
|
|
68
70
|
}
|
|
69
71
|
return current;
|
|
70
72
|
};
|
|
71
|
-
var
|
|
72
|
-
|
|
73
|
+
var createPlaceholderNode = function createPlaceholderNode(schema, formatMessage) {
|
|
74
|
+
if (!formatMessage) {
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
var _schema$nodes = schema.nodes,
|
|
78
|
+
paragraph = _schema$nodes.paragraph,
|
|
79
|
+
placeholder = _schema$nodes.placeholder;
|
|
80
|
+
//create a paragraph node with content of placeholder node
|
|
81
|
+
var placeholderNode = placeholder.createChecked({
|
|
82
|
+
text: formatMessage(_messages.layoutMessages.layoutPlaceholder)
|
|
83
|
+
});
|
|
84
|
+
return paragraph.createAndFill(undefined, placeholderNode);
|
|
85
|
+
};
|
|
86
|
+
var createMultiColumnLayoutSection = exports.createMultiColumnLayoutSection = function createMultiColumnLayoutSection(state, numberOfColumns, formatMessage) {
|
|
73
87
|
var _state$schema$nodes = state.schema.nodes,
|
|
74
88
|
layoutSection = _state$schema$nodes.layoutSection,
|
|
75
89
|
layoutColumn = _state$schema$nodes.layoutColumn;
|
|
76
|
-
|
|
77
|
-
|
|
90
|
+
var placeholder = createPlaceholderNode(state.schema, formatMessage);
|
|
91
|
+
var layoutColumnNode = layoutColumn.createAndFill({
|
|
92
|
+
width: _consts.EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
93
|
+
}, placeholder);
|
|
78
94
|
var columns = _model.Fragment.fromArray(Array.from({
|
|
79
95
|
length: numberOfColumns
|
|
80
96
|
}, function () {
|
|
81
|
-
return
|
|
82
|
-
width: _consts.EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
83
|
-
});
|
|
97
|
+
return layoutColumnNode;
|
|
84
98
|
}));
|
|
85
99
|
return layoutSection.createAndFill(undefined, columns);
|
|
86
100
|
};
|
|
87
|
-
var createDefaultLayoutSection = exports.createDefaultLayoutSection = function createDefaultLayoutSection(state) {
|
|
101
|
+
var createDefaultLayoutSection = exports.createDefaultLayoutSection = function createDefaultLayoutSection(state, formatMessage) {
|
|
88
102
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
89
103
|
layoutSection = _state$schema$nodes2.layoutSection,
|
|
90
104
|
layoutColumn = _state$schema$nodes2.layoutColumn;
|
|
105
|
+
var placeholder = (0, _preRelease.isPreRelease2)() ? createPlaceholderNode(state.schema, formatMessage) : undefined;
|
|
91
106
|
|
|
92
107
|
// create a 50-50 layout by default
|
|
93
108
|
var columns = _model.Fragment.fromArray([layoutColumn.createAndFill({
|
|
94
109
|
width: 50
|
|
95
|
-
}), layoutColumn.createAndFill({
|
|
110
|
+
}, placeholder), layoutColumn.createAndFill({
|
|
96
111
|
width: 50
|
|
97
|
-
})]);
|
|
112
|
+
}, placeholder)]);
|
|
98
113
|
return layoutSection.createAndFill(undefined, columns);
|
|
99
114
|
};
|
|
100
115
|
var insertLayoutColumns = exports.insertLayoutColumns = function insertLayoutColumns(state, dispatch) {
|
|
@@ -104,7 +119,7 @@ var insertLayoutColumns = exports.insertLayoutColumns = function insertLayoutCol
|
|
|
104
119
|
return true;
|
|
105
120
|
};
|
|
106
121
|
var insertLayoutColumnsWithAnalytics = exports.insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAnalytics(editorAnalyticsAPI) {
|
|
107
|
-
return function (inputMethod) {
|
|
122
|
+
return function (inputMethod, formatMessage) {
|
|
108
123
|
return (0, _editorAnalytics.withAnalytics)(editorAnalyticsAPI, {
|
|
109
124
|
action: _analytics.ACTION.INSERTED,
|
|
110
125
|
actionSubject: _analytics.ACTION_SUBJECT.DOCUMENT,
|
|
@@ -113,21 +128,38 @@ var insertLayoutColumnsWithAnalytics = exports.insertLayoutColumnsWithAnalytics
|
|
|
113
128
|
inputMethod: inputMethod
|
|
114
129
|
},
|
|
115
130
|
eventType: _analytics.EVENT_TYPE.TRACK
|
|
116
|
-
})(
|
|
131
|
+
})(function (state, dispatch) {
|
|
132
|
+
if (dispatch) {
|
|
133
|
+
dispatch((0, _utils2.safeInsert)(createDefaultLayoutSection(state, formatMessage))(state.tr));
|
|
134
|
+
}
|
|
135
|
+
return true;
|
|
136
|
+
});
|
|
117
137
|
};
|
|
118
138
|
};
|
|
119
139
|
|
|
120
140
|
/**
|
|
121
141
|
* Add a column to the right of existing layout
|
|
122
142
|
*/
|
|
123
|
-
function addColumn(schema, pos) {
|
|
143
|
+
function addColumn(schema, pos, formatMessage) {
|
|
144
|
+
if (!(0, _preRelease.isPreRelease2)()) {
|
|
145
|
+
return function (tr) {
|
|
146
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
var placeholder = createPlaceholderNode(schema, formatMessage);
|
|
124
150
|
return function (tr) {
|
|
125
|
-
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
151
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill(undefined, placeholder));
|
|
126
152
|
};
|
|
127
153
|
}
|
|
154
|
+
var containPlaceholderOnly = function containPlaceholderOnly(node, schema) {
|
|
155
|
+
var _node$firstChild, _node$firstChild2;
|
|
156
|
+
return node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.childCount) === 1 && ((_node$firstChild2 = node.firstChild) === null || _node$firstChild2 === void 0 || (_node$firstChild2 = _node$firstChild2.firstChild) === null || _node$firstChild2 === void 0 ? void 0 : _node$firstChild2.type) === schema.nodes.placeholder;
|
|
157
|
+
};
|
|
128
158
|
function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
|
|
129
159
|
return function (tr) {
|
|
130
|
-
if
|
|
160
|
+
// check if the column only contains a paragraph with a placeholder text
|
|
161
|
+
// if so, remove the whole column, otherwise just remove the paragraph
|
|
162
|
+
if ((0, _utils.isEmptyDocument)(column) || containPlaceholderOnly(column, tr.doc.type.schema)) {
|
|
131
163
|
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), _model.Slice.empty);
|
|
132
164
|
} else {
|
|
133
165
|
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), _model.Slice.empty);
|
|
@@ -157,7 +189,7 @@ var fromThreeColstoOne = function fromThreeColstoOne(node, tr, insideRightEdgePo
|
|
|
157
189
|
* Switching from 3 -> 2 moves all the content of the third col inside the second before
|
|
158
190
|
* removing it
|
|
159
191
|
*/
|
|
160
|
-
function forceColumnStructure(state, node, pos, presetLayout) {
|
|
192
|
+
function forceColumnStructure(state, node, pos, presetLayout, formatMessage) {
|
|
161
193
|
var tr = state.tr;
|
|
162
194
|
var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
|
|
163
195
|
var numCols = node.childCount;
|
|
@@ -170,7 +202,7 @@ function forceColumnStructure(state, node, pos, presetLayout) {
|
|
|
170
202
|
|
|
171
203
|
// 2 columns -> 3 columns
|
|
172
204
|
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
173
|
-
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
|
|
205
|
+
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection, formatMessage)(tr);
|
|
174
206
|
|
|
175
207
|
// 2 columns -> 1 column
|
|
176
208
|
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
@@ -213,8 +245,8 @@ function forceColumnWidths(state, tr, pos, presetLayout) {
|
|
|
213
245
|
}
|
|
214
246
|
return tr.replaceWith(pos + 1, pos + node.nodeSize - 1, columnWidth(node, state.schema, getWidthsForPreset(presetLayout)));
|
|
215
247
|
}
|
|
216
|
-
function forceSectionToPresetLayout(state, node, pos, presetLayout) {
|
|
217
|
-
var tr = forceColumnStructure(state, node, pos, presetLayout);
|
|
248
|
+
function forceSectionToPresetLayout(state, node, pos, presetLayout, formatMessage) {
|
|
249
|
+
var tr = forceColumnStructure(state, node, pos, presetLayout, formatMessage);
|
|
218
250
|
|
|
219
251
|
// save the selection here, since forcing column widths causes a change over the
|
|
220
252
|
// entire layoutSection, which remaps selection to the end. not remapping here
|
|
@@ -225,7 +257,7 @@ function forceSectionToPresetLayout(state, node, pos, presetLayout) {
|
|
|
225
257
|
return tr.setSelection(state.selection instanceof _state.NodeSelection ? new _state.NodeSelection(selectionPos$) : new _state.TextSelection(selectionPos$));
|
|
226
258
|
}
|
|
227
259
|
var setPresetLayout = exports.setPresetLayout = function setPresetLayout(editorAnalyticsAPI) {
|
|
228
|
-
return function (layout) {
|
|
260
|
+
return function (layout, formatMessage) {
|
|
229
261
|
return function (state, dispatch) {
|
|
230
262
|
var _ref = _pluginKey.pluginKey.getState(state),
|
|
231
263
|
pos = _ref.pos,
|
|
@@ -237,7 +269,7 @@ var setPresetLayout = exports.setPresetLayout = function setPresetLayout(editorA
|
|
|
237
269
|
if (!node) {
|
|
238
270
|
return false;
|
|
239
271
|
}
|
|
240
|
-
var tr = forceSectionToPresetLayout(state, node, pos, layout);
|
|
272
|
+
var tr = forceSectionToPresetLayout(state, node, pos, layout, formatMessage);
|
|
241
273
|
if (tr) {
|
|
242
274
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
243
275
|
action: _analytics.ACTION.CHANGED_LAYOUT,
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -13,6 +13,7 @@ Object.defineProperty(exports, "pluginKey", {
|
|
|
13
13
|
});
|
|
14
14
|
var _react = _interopRequireDefault(require("react"));
|
|
15
15
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
16
|
+
var _schema = require("@atlaskit/adf-schema/schema");
|
|
16
17
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
17
18
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
18
19
|
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
@@ -20,6 +21,7 @@ var _actions = require("./actions");
|
|
|
20
21
|
var _main = _interopRequireDefault(require("./pm-plugins/main"));
|
|
21
22
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
22
23
|
var _toolbar = require("./toolbar");
|
|
24
|
+
var _globalStyles = require("./ui/global-styles");
|
|
23
25
|
var _preRelease = require("./utils/preRelease");
|
|
24
26
|
var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
25
27
|
var _api$analytics;
|
|
@@ -31,7 +33,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
31
33
|
nodes: function nodes() {
|
|
32
34
|
return [{
|
|
33
35
|
name: 'layoutSection',
|
|
34
|
-
node: _adfSchema.layoutSection
|
|
36
|
+
node: (0, _preRelease.isPreRelease2)() ? _schema.layoutSectionWithSingleColumn : _adfSchema.layoutSection
|
|
35
37
|
}, {
|
|
36
38
|
name: 'layoutColumn',
|
|
37
39
|
node: _adfSchema.layoutColumn
|
|
@@ -64,7 +66,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
64
66
|
var formatMessage = _ref3.formatMessage;
|
|
65
67
|
return (0, _preRelease.isPreRelease2)() ? [{
|
|
66
68
|
id: 'twocolumnslayout',
|
|
67
|
-
title: formatMessage(_messages.
|
|
69
|
+
title: formatMessage(_messages.layoutMessages.twoColumns),
|
|
68
70
|
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
69
71
|
keywords: ['layout', 'column', 'section', 'two column'],
|
|
70
72
|
priority: 1100,
|
|
@@ -72,12 +74,12 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
72
74
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconTwoColumnLayout, null);
|
|
73
75
|
},
|
|
74
76
|
action: function action(insert, state) {
|
|
75
|
-
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state));
|
|
77
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 2, formatMessage));
|
|
76
78
|
return tr;
|
|
77
79
|
}
|
|
78
80
|
}, {
|
|
79
81
|
id: 'threecolumnslayout',
|
|
80
|
-
title: formatMessage(_messages.
|
|
82
|
+
title: formatMessage(_messages.layoutMessages.threeColumns),
|
|
81
83
|
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
82
84
|
keywords: ['layout', 'column', 'section', 'three column'],
|
|
83
85
|
priority: 1100,
|
|
@@ -85,12 +87,12 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
85
87
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconThreeColumnLayout, null);
|
|
86
88
|
},
|
|
87
89
|
action: function action(insert, state) {
|
|
88
|
-
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3));
|
|
90
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3, formatMessage));
|
|
89
91
|
return tr;
|
|
90
92
|
}
|
|
91
93
|
}, {
|
|
92
94
|
id: 'fourcolumnslayout',
|
|
93
|
-
title: formatMessage(_messages.
|
|
95
|
+
title: formatMessage(_messages.layoutMessages.fourColumns),
|
|
94
96
|
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
95
97
|
keywords: ['layout', 'column', 'section', 'four column'],
|
|
96
98
|
priority: 1100,
|
|
@@ -98,12 +100,12 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
98
100
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFourColumnLayout, null);
|
|
99
101
|
},
|
|
100
102
|
action: function action(insert, state) {
|
|
101
|
-
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 4));
|
|
103
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 4, formatMessage));
|
|
102
104
|
return tr;
|
|
103
105
|
}
|
|
104
106
|
}, {
|
|
105
107
|
id: 'fivecolumnslayout',
|
|
106
|
-
title: formatMessage(_messages.
|
|
108
|
+
title: formatMessage(_messages.layoutMessages.fiveColumns),
|
|
107
109
|
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
108
110
|
keywords: ['layout', 'column', 'section', 'five column'],
|
|
109
111
|
priority: 1100,
|
|
@@ -111,7 +113,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
111
113
|
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFiveColumnLayout, null);
|
|
112
114
|
},
|
|
113
115
|
action: function action(insert, state) {
|
|
114
|
-
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 5));
|
|
116
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 5, formatMessage));
|
|
115
117
|
return tr;
|
|
116
118
|
}
|
|
117
119
|
}] : [{
|
|
@@ -139,6 +141,9 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
139
141
|
}
|
|
140
142
|
}];
|
|
141
143
|
}
|
|
144
|
+
},
|
|
145
|
+
contentComponent: function contentComponent() {
|
|
146
|
+
return (0, _preRelease.isPreRelease2)() ? /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null) : null;
|
|
142
147
|
}
|
|
143
148
|
};
|
|
144
149
|
};
|
package/dist/cjs/toolbar.js
CHANGED
|
@@ -24,6 +24,7 @@ var _layoutTwoLeftSidebar = _interopRequireDefault(require("@atlaskit/icon/glyph
|
|
|
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
26
|
var _actions = require("./actions");
|
|
27
|
+
var _preRelease = require("./utils/preRelease");
|
|
27
28
|
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); }
|
|
28
29
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
29
30
|
var LAYOUT_TYPES = [{
|
|
@@ -73,12 +74,13 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, ed
|
|
|
73
74
|
iconFallback: item.iconFallback,
|
|
74
75
|
testId: item.title.id ? "".concat(item.title.id) : undefined,
|
|
75
76
|
title: intl.formatMessage(item.title),
|
|
76
|
-
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)(item.type),
|
|
77
|
+
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)(item.type, intl.formatMessage),
|
|
77
78
|
selected: !!currentLayout && currentLayout === item.type,
|
|
78
79
|
tabIndex: null
|
|
79
80
|
};
|
|
80
81
|
};
|
|
81
82
|
var layoutToolbarTitle = exports.layoutToolbarTitle = 'Layout floating controls';
|
|
83
|
+
var iconPlaceholder = _layoutTwoColumns.default; // TODO: Replace with proper icon ED-25466
|
|
82
84
|
var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) {
|
|
83
85
|
var _api$decorations$acti, _api$decorations, _api$analytics;
|
|
84
86
|
var _ref = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
|
|
@@ -87,6 +89,7 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
87
89
|
var node = state.doc.nodeAt(pos);
|
|
88
90
|
if (node) {
|
|
89
91
|
var currentLayout = (0, _actions.getPresetLayout)(node);
|
|
92
|
+
var numberOfColumns = node.content.childCount || 2;
|
|
90
93
|
var separator = {
|
|
91
94
|
type: 'separator'
|
|
92
95
|
};
|
|
@@ -107,7 +110,46 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
107
110
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
108
111
|
tabIndex: null
|
|
109
112
|
};
|
|
110
|
-
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
113
|
+
var layoutTypes = (0, _preRelease.isPreRelease2)() ? [] : allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
114
|
+
var columnOptions = [{
|
|
115
|
+
title: intl.formatMessage(_messages.layoutMessages.columnOption, {
|
|
116
|
+
count: 2
|
|
117
|
+
}),
|
|
118
|
+
//'2-columns',
|
|
119
|
+
icon: iconPlaceholder,
|
|
120
|
+
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('two_equal', intl.formatMessage),
|
|
121
|
+
selected: numberOfColumns === 2
|
|
122
|
+
}, {
|
|
123
|
+
title: intl.formatMessage(_messages.layoutMessages.columnOption, {
|
|
124
|
+
count: 3
|
|
125
|
+
}),
|
|
126
|
+
//'3-columns'
|
|
127
|
+
icon: iconPlaceholder,
|
|
128
|
+
onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)('three_equal', intl.formatMessage),
|
|
129
|
+
selected: numberOfColumns === 3
|
|
130
|
+
}, {
|
|
131
|
+
title: intl.formatMessage(_messages.layoutMessages.columnOption, {
|
|
132
|
+
count: 4
|
|
133
|
+
}),
|
|
134
|
+
//'4-columns'
|
|
135
|
+
icon: iconPlaceholder,
|
|
136
|
+
onClick: function onClick() {
|
|
137
|
+
// TODO: Implement layout update in ED-25053
|
|
138
|
+
return true;
|
|
139
|
+
},
|
|
140
|
+
selected: numberOfColumns === 4
|
|
141
|
+
}, {
|
|
142
|
+
title: intl.formatMessage(_messages.layoutMessages.columnOption, {
|
|
143
|
+
count: 5
|
|
144
|
+
}),
|
|
145
|
+
//'5-columns'
|
|
146
|
+
icon: iconPlaceholder,
|
|
147
|
+
onClick: function onClick() {
|
|
148
|
+
// TODO: Implement layout update in ED-25053
|
|
149
|
+
return true;
|
|
150
|
+
},
|
|
151
|
+
selected: numberOfColumns === 5
|
|
152
|
+
}];
|
|
111
153
|
return {
|
|
112
154
|
title: layoutToolbarTitle,
|
|
113
155
|
getDomRef: function getDomRef(view) {
|
|
@@ -115,7 +157,16 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(state, intl, pos
|
|
|
115
157
|
},
|
|
116
158
|
nodeType: nodeType,
|
|
117
159
|
groupLabel: intl.formatMessage(_messages.layoutMessages.floatingToolbarRadioGroupAriaLabel),
|
|
118
|
-
items: [].concat((0, _toConsumableArray2.default)(
|
|
160
|
+
items: [].concat((0, _toConsumableArray2.default)((0, _preRelease.isPreRelease2)() ? [{
|
|
161
|
+
type: 'dropdown',
|
|
162
|
+
title: intl.formatMessage(_messages.layoutMessages.columnOption, {
|
|
163
|
+
count: numberOfColumns
|
|
164
|
+
}),
|
|
165
|
+
//`${numberOfColumns}-columns`,
|
|
166
|
+
options: columnOptions,
|
|
167
|
+
showSelected: true,
|
|
168
|
+
testId: 'column-options-button'
|
|
169
|
+
}] : []), (0, _toConsumableArray2.default)(layoutTypes.map(function (i) {
|
|
119
170
|
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
120
171
|
})), (0, _toConsumableArray2.default)(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
|
|
121
172
|
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.GlobalStylesWrapper = void 0;
|
|
7
|
+
var _react = require("@emotion/react");
|
|
8
|
+
/**
|
|
9
|
+
* @jsxRuntime classic
|
|
10
|
+
* @jsx jsx
|
|
11
|
+
*/
|
|
12
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
13
|
+
|
|
14
|
+
var globalStyles = (0, _react.css)({
|
|
15
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
16
|
+
'.ProseMirror [data-layout-column] span.pm-placeholder__text[data-placeholder]': {
|
|
17
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
18
|
+
'&::after': {
|
|
19
|
+
color: "var(--ds-text-disabled, #A5ADBA)",
|
|
20
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
21
|
+
fontStyle: 'italic'
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
26
|
+
return (0, _react.jsx)(_react.Global, {
|
|
27
|
+
styles: globalStyles
|
|
28
|
+
});
|
|
29
|
+
};
|
package/dist/es2019/actions.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, LAYOUT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
3
|
+
import { layoutMessages as messages } from '@atlaskit/editor-common/messages';
|
|
3
4
|
import { flatmap, getStepRange, isEmptyDocument, mapChildren } from '@atlaskit/editor-common/utils';
|
|
4
5
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
6
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
7
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
8
|
import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
|
|
8
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
|
+
import { isPreRelease2 } from './utils/preRelease';
|
|
9
11
|
export const ONE_COL_LAYOUTS = ['single'];
|
|
10
12
|
export const TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
11
13
|
export const THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
|
|
@@ -54,32 +56,47 @@ export const getSelectedLayout = (maybeLayoutSection, current) => {
|
|
|
54
56
|
}
|
|
55
57
|
return current;
|
|
56
58
|
};
|
|
57
|
-
|
|
59
|
+
const createPlaceholderNode = (schema, formatMessage) => {
|
|
60
|
+
if (!formatMessage) {
|
|
61
|
+
return undefined;
|
|
62
|
+
}
|
|
63
|
+
const {
|
|
64
|
+
paragraph,
|
|
65
|
+
placeholder
|
|
66
|
+
} = schema.nodes;
|
|
67
|
+
//create a paragraph node with content of placeholder node
|
|
68
|
+
const placeholderNode = placeholder.createChecked({
|
|
69
|
+
text: formatMessage(messages.layoutPlaceholder)
|
|
70
|
+
});
|
|
71
|
+
return paragraph.createAndFill(undefined, placeholderNode);
|
|
72
|
+
};
|
|
73
|
+
export const createMultiColumnLayoutSection = (state, numberOfColumns, formatMessage) => {
|
|
58
74
|
const {
|
|
59
75
|
layoutSection,
|
|
60
76
|
layoutColumn
|
|
61
77
|
} = state.schema.nodes;
|
|
62
|
-
|
|
63
|
-
|
|
78
|
+
const placeholder = createPlaceholderNode(state.schema, formatMessage);
|
|
79
|
+
const layoutColumnNode = layoutColumn.createAndFill({
|
|
80
|
+
width: EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
81
|
+
}, placeholder);
|
|
64
82
|
const columns = Fragment.fromArray(Array.from({
|
|
65
83
|
length: numberOfColumns
|
|
66
|
-
}, () =>
|
|
67
|
-
width: EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
68
|
-
})));
|
|
84
|
+
}, () => layoutColumnNode));
|
|
69
85
|
return layoutSection.createAndFill(undefined, columns);
|
|
70
86
|
};
|
|
71
|
-
export const createDefaultLayoutSection = state => {
|
|
87
|
+
export const createDefaultLayoutSection = (state, formatMessage) => {
|
|
72
88
|
const {
|
|
73
89
|
layoutSection,
|
|
74
90
|
layoutColumn
|
|
75
91
|
} = state.schema.nodes;
|
|
92
|
+
const placeholder = isPreRelease2() ? createPlaceholderNode(state.schema, formatMessage) : undefined;
|
|
76
93
|
|
|
77
94
|
// create a 50-50 layout by default
|
|
78
95
|
const columns = Fragment.fromArray([layoutColumn.createAndFill({
|
|
79
96
|
width: 50
|
|
80
|
-
}), layoutColumn.createAndFill({
|
|
97
|
+
}, placeholder), layoutColumn.createAndFill({
|
|
81
98
|
width: 50
|
|
82
|
-
})]);
|
|
99
|
+
}, placeholder)]);
|
|
83
100
|
return layoutSection.createAndFill(undefined, columns);
|
|
84
101
|
};
|
|
85
102
|
export const insertLayoutColumns = (state, dispatch) => {
|
|
@@ -88,7 +105,7 @@ export const insertLayoutColumns = (state, dispatch) => {
|
|
|
88
105
|
}
|
|
89
106
|
return true;
|
|
90
107
|
};
|
|
91
|
-
export const insertLayoutColumnsWithAnalytics = editorAnalyticsAPI => inputMethod => withAnalytics(editorAnalyticsAPI, {
|
|
108
|
+
export const insertLayoutColumnsWithAnalytics = editorAnalyticsAPI => (inputMethod, formatMessage) => withAnalytics(editorAnalyticsAPI, {
|
|
92
109
|
action: ACTION.INSERTED,
|
|
93
110
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
94
111
|
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
@@ -96,19 +113,36 @@ export const insertLayoutColumnsWithAnalytics = editorAnalyticsAPI => inputMetho
|
|
|
96
113
|
inputMethod
|
|
97
114
|
},
|
|
98
115
|
eventType: EVENT_TYPE.TRACK
|
|
99
|
-
})(
|
|
116
|
+
})((state, dispatch) => {
|
|
117
|
+
if (dispatch) {
|
|
118
|
+
dispatch(safeInsert(createDefaultLayoutSection(state, formatMessage))(state.tr));
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
});
|
|
100
122
|
|
|
101
123
|
/**
|
|
102
124
|
* Add a column to the right of existing layout
|
|
103
125
|
*/
|
|
104
|
-
function addColumn(schema, pos) {
|
|
126
|
+
function addColumn(schema, pos, formatMessage) {
|
|
127
|
+
if (!isPreRelease2()) {
|
|
128
|
+
return tr => {
|
|
129
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
const placeholder = createPlaceholderNode(schema, formatMessage);
|
|
105
133
|
return tr => {
|
|
106
|
-
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
134
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill(undefined, placeholder));
|
|
107
135
|
};
|
|
108
136
|
}
|
|
137
|
+
const containPlaceholderOnly = (node, schema) => {
|
|
138
|
+
var _node$firstChild, _node$firstChild2, _node$firstChild2$fir;
|
|
139
|
+
return node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.childCount) === 1 && ((_node$firstChild2 = node.firstChild) === null || _node$firstChild2 === void 0 ? void 0 : (_node$firstChild2$fir = _node$firstChild2.firstChild) === null || _node$firstChild2$fir === void 0 ? void 0 : _node$firstChild2$fir.type) === schema.nodes.placeholder;
|
|
140
|
+
};
|
|
109
141
|
function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
|
|
110
142
|
return tr => {
|
|
111
|
-
if
|
|
143
|
+
// check if the column only contains a paragraph with a placeholder text
|
|
144
|
+
// if so, remove the whole column, otherwise just remove the paragraph
|
|
145
|
+
if (isEmptyDocument(column) || containPlaceholderOnly(column, tr.doc.type.schema)) {
|
|
112
146
|
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), Slice.empty);
|
|
113
147
|
} else {
|
|
114
148
|
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), Slice.empty);
|
|
@@ -138,7 +172,7 @@ const fromThreeColstoOne = (node, tr, insideRightEdgePos) => {
|
|
|
138
172
|
* Switching from 3 -> 2 moves all the content of the third col inside the second before
|
|
139
173
|
* removing it
|
|
140
174
|
*/
|
|
141
|
-
function forceColumnStructure(state, node, pos, presetLayout) {
|
|
175
|
+
function forceColumnStructure(state, node, pos, presetLayout, formatMessage) {
|
|
142
176
|
const tr = state.tr;
|
|
143
177
|
const insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
|
|
144
178
|
const numCols = node.childCount;
|
|
@@ -151,7 +185,7 @@ function forceColumnStructure(state, node, pos, presetLayout) {
|
|
|
151
185
|
|
|
152
186
|
// 2 columns -> 3 columns
|
|
153
187
|
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
154
|
-
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
|
|
188
|
+
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection, formatMessage)(tr);
|
|
155
189
|
|
|
156
190
|
// 2 columns -> 1 column
|
|
157
191
|
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
@@ -195,8 +229,8 @@ function forceColumnWidths(state, tr, pos, presetLayout) {
|
|
|
195
229
|
}
|
|
196
230
|
return tr.replaceWith(pos + 1, pos + node.nodeSize - 1, columnWidth(node, state.schema, getWidthsForPreset(presetLayout)));
|
|
197
231
|
}
|
|
198
|
-
export function forceSectionToPresetLayout(state, node, pos, presetLayout) {
|
|
199
|
-
let tr = forceColumnStructure(state, node, pos, presetLayout);
|
|
232
|
+
export function forceSectionToPresetLayout(state, node, pos, presetLayout, formatMessage) {
|
|
233
|
+
let tr = forceColumnStructure(state, node, pos, presetLayout, formatMessage);
|
|
200
234
|
|
|
201
235
|
// save the selection here, since forcing column widths causes a change over the
|
|
202
236
|
// entire layoutSection, which remaps selection to the end. not remapping here
|
|
@@ -206,7 +240,7 @@ export function forceSectionToPresetLayout(state, node, pos, presetLayout) {
|
|
|
206
240
|
const selectionPos$ = tr.doc.resolve(selection.$from.pos);
|
|
207
241
|
return tr.setSelection(state.selection instanceof NodeSelection ? new NodeSelection(selectionPos$) : new TextSelection(selectionPos$));
|
|
208
242
|
}
|
|
209
|
-
export const setPresetLayout = editorAnalyticsAPI => layout => (state, dispatch) => {
|
|
243
|
+
export const setPresetLayout = editorAnalyticsAPI => (layout, formatMessage) => (state, dispatch) => {
|
|
210
244
|
const {
|
|
211
245
|
pos,
|
|
212
246
|
selectedLayout
|
|
@@ -218,7 +252,7 @@ export const setPresetLayout = editorAnalyticsAPI => layout => (state, dispatch)
|
|
|
218
252
|
if (!node) {
|
|
219
253
|
return false;
|
|
220
254
|
}
|
|
221
|
-
let tr = forceSectionToPresetLayout(state, node, pos, layout);
|
|
255
|
+
let tr = forceSectionToPresetLayout(state, node, pos, layout, formatMessage);
|
|
222
256
|
if (tr) {
|
|
223
257
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent({
|
|
224
258
|
action: ACTION.CHANGED_LAYOUT,
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { layoutColumn, layoutSection } from '@atlaskit/adf-schema';
|
|
3
|
+
import { layoutSectionWithSingleColumn } from '@atlaskit/adf-schema/schema';
|
|
3
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import { layoutMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
|
|
6
7
|
import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
7
8
|
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
8
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
9
10
|
import { buildToolbar } from './toolbar';
|
|
11
|
+
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
10
12
|
import { isPreRelease2 } from './utils/preRelease';
|
|
11
13
|
export { pluginKey };
|
|
12
14
|
export const layoutPlugin = ({
|
|
@@ -19,7 +21,7 @@ export const layoutPlugin = ({
|
|
|
19
21
|
nodes() {
|
|
20
22
|
return [{
|
|
21
23
|
name: 'layoutSection',
|
|
22
|
-
node: layoutSection
|
|
24
|
+
node: isPreRelease2() ? layoutSectionWithSingleColumn : layoutSection
|
|
23
25
|
}, {
|
|
24
26
|
name: 'layoutColumn',
|
|
25
27
|
node: layoutColumn
|
|
@@ -51,46 +53,46 @@ export const layoutPlugin = ({
|
|
|
51
53
|
formatMessage
|
|
52
54
|
}) => isPreRelease2() ? [{
|
|
53
55
|
id: 'twocolumnslayout',
|
|
54
|
-
title: formatMessage(
|
|
56
|
+
title: formatMessage(layoutMessages.twoColumns),
|
|
55
57
|
description: formatMessage(messages.columnsDescription),
|
|
56
58
|
keywords: ['layout', 'column', 'section', 'two column'],
|
|
57
59
|
priority: 1100,
|
|
58
60
|
icon: () => /*#__PURE__*/React.createElement(IconTwoColumnLayout, null),
|
|
59
61
|
action(insert, state) {
|
|
60
|
-
const tr = insert(createMultiColumnLayoutSection(state));
|
|
62
|
+
const tr = insert(createMultiColumnLayoutSection(state, 2, formatMessage));
|
|
61
63
|
return tr;
|
|
62
64
|
}
|
|
63
65
|
}, {
|
|
64
66
|
id: 'threecolumnslayout',
|
|
65
|
-
title: formatMessage(
|
|
67
|
+
title: formatMessage(layoutMessages.threeColumns),
|
|
66
68
|
description: formatMessage(messages.columnsDescription),
|
|
67
69
|
keywords: ['layout', 'column', 'section', 'three column'],
|
|
68
70
|
priority: 1100,
|
|
69
71
|
icon: () => /*#__PURE__*/React.createElement(IconThreeColumnLayout, null),
|
|
70
72
|
action(insert, state) {
|
|
71
|
-
const tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
73
|
+
const tr = insert(createMultiColumnLayoutSection(state, 3, formatMessage));
|
|
72
74
|
return tr;
|
|
73
75
|
}
|
|
74
76
|
}, {
|
|
75
77
|
id: 'fourcolumnslayout',
|
|
76
|
-
title: formatMessage(
|
|
78
|
+
title: formatMessage(layoutMessages.fourColumns),
|
|
77
79
|
description: formatMessage(messages.columnsDescription),
|
|
78
80
|
keywords: ['layout', 'column', 'section', 'four column'],
|
|
79
81
|
priority: 1100,
|
|
80
82
|
icon: () => /*#__PURE__*/React.createElement(IconFourColumnLayout, null),
|
|
81
83
|
action(insert, state) {
|
|
82
|
-
const tr = insert(createMultiColumnLayoutSection(state, 4));
|
|
84
|
+
const tr = insert(createMultiColumnLayoutSection(state, 4, formatMessage));
|
|
83
85
|
return tr;
|
|
84
86
|
}
|
|
85
87
|
}, {
|
|
86
88
|
id: 'fivecolumnslayout',
|
|
87
|
-
title: formatMessage(
|
|
89
|
+
title: formatMessage(layoutMessages.fiveColumns),
|
|
88
90
|
description: formatMessage(messages.columnsDescription),
|
|
89
91
|
keywords: ['layout', 'column', 'section', 'five column'],
|
|
90
92
|
priority: 1100,
|
|
91
93
|
icon: () => /*#__PURE__*/React.createElement(IconFiveColumnLayout, null),
|
|
92
94
|
action(insert, state) {
|
|
93
|
-
const tr = insert(createMultiColumnLayoutSection(state, 5));
|
|
95
|
+
const tr = insert(createMultiColumnLayoutSection(state, 5, formatMessage));
|
|
94
96
|
return tr;
|
|
95
97
|
}
|
|
96
98
|
}] : [{
|
|
@@ -115,6 +117,9 @@ export const layoutPlugin = ({
|
|
|
115
117
|
return tr;
|
|
116
118
|
}
|
|
117
119
|
}]
|
|
120
|
+
},
|
|
121
|
+
contentComponent() {
|
|
122
|
+
return isPreRelease2() ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null;
|
|
118
123
|
}
|
|
119
124
|
};
|
|
120
125
|
};
|
package/dist/es2019/toolbar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import commonMessages, { layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
1
|
+
import commonMessages, { layoutMessages, layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
2
2
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
3
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
4
4
|
import LayoutOneColumnIcon from '@atlaskit/icon/core/layout-one-column';
|
|
@@ -15,6 +15,7 @@ import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-lef
|
|
|
15
15
|
import LayoutTwoRightSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-right-sidebar';
|
|
16
16
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
17
17
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from './actions';
|
|
18
|
+
import { isPreRelease2 } from './utils/preRelease';
|
|
18
19
|
const LAYOUT_TYPES = [{
|
|
19
20
|
id: 'editor.layout.twoEquals',
|
|
20
21
|
type: 'two_equal',
|
|
@@ -61,11 +62,12 @@ const buildLayoutButton = (intl, item, currentLayout, editorAnalyticsAPI) => ({
|
|
|
61
62
|
iconFallback: item.iconFallback,
|
|
62
63
|
testId: item.title.id ? `${item.title.id}` : undefined,
|
|
63
64
|
title: intl.formatMessage(item.title),
|
|
64
|
-
onClick: setPresetLayout(editorAnalyticsAPI)(item.type),
|
|
65
|
+
onClick: setPresetLayout(editorAnalyticsAPI)(item.type, intl.formatMessage),
|
|
65
66
|
selected: !!currentLayout && currentLayout === item.type,
|
|
66
67
|
tabIndex: null
|
|
67
68
|
});
|
|
68
69
|
export const layoutToolbarTitle = 'Layout floating controls';
|
|
70
|
+
const iconPlaceholder = LayoutTwoColumnsIcon; // TODO: Replace with proper icon ED-25466
|
|
69
71
|
export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) => {
|
|
70
72
|
var _api$decorations$acti, _api$decorations, _api$analytics;
|
|
71
73
|
const {
|
|
@@ -75,6 +77,7 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
75
77
|
const node = state.doc.nodeAt(pos);
|
|
76
78
|
if (node) {
|
|
77
79
|
const currentLayout = getPresetLayout(node);
|
|
80
|
+
const numberOfColumns = node.content.childCount || 2;
|
|
78
81
|
const separator = {
|
|
79
82
|
type: 'separator'
|
|
80
83
|
};
|
|
@@ -95,13 +98,61 @@ export const buildToolbar = (state, intl, pos, _allowBreakout, addSidebarLayouts
|
|
|
95
98
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
96
99
|
tabIndex: null
|
|
97
100
|
};
|
|
98
|
-
const layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
101
|
+
const layoutTypes = isPreRelease2() ? [] : allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
102
|
+
const columnOptions = [{
|
|
103
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
104
|
+
count: 2
|
|
105
|
+
}),
|
|
106
|
+
//'2-columns',
|
|
107
|
+
icon: iconPlaceholder,
|
|
108
|
+
onClick: setPresetLayout(editorAnalyticsAPI)('two_equal', intl.formatMessage),
|
|
109
|
+
selected: numberOfColumns === 2
|
|
110
|
+
}, {
|
|
111
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
112
|
+
count: 3
|
|
113
|
+
}),
|
|
114
|
+
//'3-columns'
|
|
115
|
+
icon: iconPlaceholder,
|
|
116
|
+
onClick: setPresetLayout(editorAnalyticsAPI)('three_equal', intl.formatMessage),
|
|
117
|
+
selected: numberOfColumns === 3
|
|
118
|
+
}, {
|
|
119
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
120
|
+
count: 4
|
|
121
|
+
}),
|
|
122
|
+
//'4-columns'
|
|
123
|
+
icon: iconPlaceholder,
|
|
124
|
+
onClick: () => {
|
|
125
|
+
// TODO: Implement layout update in ED-25053
|
|
126
|
+
return true;
|
|
127
|
+
},
|
|
128
|
+
selected: numberOfColumns === 4
|
|
129
|
+
}, {
|
|
130
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
131
|
+
count: 5
|
|
132
|
+
}),
|
|
133
|
+
//'5-columns'
|
|
134
|
+
icon: iconPlaceholder,
|
|
135
|
+
onClick: () => {
|
|
136
|
+
// TODO: Implement layout update in ED-25053
|
|
137
|
+
return true;
|
|
138
|
+
},
|
|
139
|
+
selected: numberOfColumns === 5
|
|
140
|
+
}];
|
|
99
141
|
return {
|
|
100
142
|
title: layoutToolbarTitle,
|
|
101
143
|
getDomRef: view => findDomRefAtPos(pos, view.domAtPos.bind(view)),
|
|
102
144
|
nodeType,
|
|
103
145
|
groupLabel: intl.formatMessage(toolbarMessages.floatingToolbarRadioGroupAriaLabel),
|
|
104
|
-
items: [...
|
|
146
|
+
items: [...(isPreRelease2() ? [{
|
|
147
|
+
type: 'dropdown',
|
|
148
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
149
|
+
count: numberOfColumns
|
|
150
|
+
}),
|
|
151
|
+
//`${numberOfColumns}-columns`,
|
|
152
|
+
options: columnOptions,
|
|
153
|
+
showSelected: true,
|
|
154
|
+
testId: 'column-options-button'
|
|
155
|
+
}] : []), ...layoutTypes.map(i => buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI)), ...(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(i => buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI)) : []), separator, {
|
|
105
156
|
type: 'copy-button',
|
|
106
157
|
supportsViewMode: true,
|
|
107
158
|
items: [{
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { css, Global, jsx } from '@emotion/react';
|
|
7
|
+
const globalStyles = css({
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
9
|
+
'.ProseMirror [data-layout-column] span.pm-placeholder__text[data-placeholder]': {
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
11
|
+
'&::after': {
|
|
12
|
+
color: "var(--ds-text-disabled, #A5ADBA)",
|
|
13
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
14
|
+
fontStyle: 'italic'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export const GlobalStylesWrapper = () => {
|
|
19
|
+
return jsx(Global, {
|
|
20
|
+
styles: globalStyles
|
|
21
|
+
});
|
|
22
|
+
};
|
package/dist/esm/actions.js
CHANGED
|
@@ -3,12 +3,14 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
|
|
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, LAYOUT_TYPE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { withAnalytics } from '@atlaskit/editor-common/editor-analytics';
|
|
6
|
+
import { layoutMessages as messages } from '@atlaskit/editor-common/messages';
|
|
6
7
|
import { flatmap, getStepRange, isEmptyDocument, mapChildren } from '@atlaskit/editor-common/utils';
|
|
7
8
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
8
9
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
11
|
import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
|
|
11
12
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
13
|
+
import { isPreRelease2 } from './utils/preRelease';
|
|
12
14
|
export var ONE_COL_LAYOUTS = ['single'];
|
|
13
15
|
export var TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
14
16
|
export var THREE_COL_LAYOUTS = ['three_equal', 'three_with_sidebars'];
|
|
@@ -59,33 +61,46 @@ export var getSelectedLayout = function getSelectedLayout(maybeLayoutSection, cu
|
|
|
59
61
|
}
|
|
60
62
|
return current;
|
|
61
63
|
};
|
|
62
|
-
|
|
63
|
-
|
|
64
|
+
var createPlaceholderNode = function createPlaceholderNode(schema, formatMessage) {
|
|
65
|
+
if (!formatMessage) {
|
|
66
|
+
return undefined;
|
|
67
|
+
}
|
|
68
|
+
var _schema$nodes = schema.nodes,
|
|
69
|
+
paragraph = _schema$nodes.paragraph,
|
|
70
|
+
placeholder = _schema$nodes.placeholder;
|
|
71
|
+
//create a paragraph node with content of placeholder node
|
|
72
|
+
var placeholderNode = placeholder.createChecked({
|
|
73
|
+
text: formatMessage(messages.layoutPlaceholder)
|
|
74
|
+
});
|
|
75
|
+
return paragraph.createAndFill(undefined, placeholderNode);
|
|
76
|
+
};
|
|
77
|
+
export var createMultiColumnLayoutSection = function createMultiColumnLayoutSection(state, numberOfColumns, formatMessage) {
|
|
64
78
|
var _state$schema$nodes = state.schema.nodes,
|
|
65
79
|
layoutSection = _state$schema$nodes.layoutSection,
|
|
66
80
|
layoutColumn = _state$schema$nodes.layoutColumn;
|
|
67
|
-
|
|
68
|
-
|
|
81
|
+
var placeholder = createPlaceholderNode(state.schema, formatMessage);
|
|
82
|
+
var layoutColumnNode = layoutColumn.createAndFill({
|
|
83
|
+
width: EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
84
|
+
}, placeholder);
|
|
69
85
|
var columns = Fragment.fromArray(Array.from({
|
|
70
86
|
length: numberOfColumns
|
|
71
87
|
}, function () {
|
|
72
|
-
return
|
|
73
|
-
width: EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
74
|
-
});
|
|
88
|
+
return layoutColumnNode;
|
|
75
89
|
}));
|
|
76
90
|
return layoutSection.createAndFill(undefined, columns);
|
|
77
91
|
};
|
|
78
|
-
export var createDefaultLayoutSection = function createDefaultLayoutSection(state) {
|
|
92
|
+
export var createDefaultLayoutSection = function createDefaultLayoutSection(state, formatMessage) {
|
|
79
93
|
var _state$schema$nodes2 = state.schema.nodes,
|
|
80
94
|
layoutSection = _state$schema$nodes2.layoutSection,
|
|
81
95
|
layoutColumn = _state$schema$nodes2.layoutColumn;
|
|
96
|
+
var placeholder = isPreRelease2() ? createPlaceholderNode(state.schema, formatMessage) : undefined;
|
|
82
97
|
|
|
83
98
|
// create a 50-50 layout by default
|
|
84
99
|
var columns = Fragment.fromArray([layoutColumn.createAndFill({
|
|
85
100
|
width: 50
|
|
86
|
-
}), layoutColumn.createAndFill({
|
|
101
|
+
}, placeholder), layoutColumn.createAndFill({
|
|
87
102
|
width: 50
|
|
88
|
-
})]);
|
|
103
|
+
}, placeholder)]);
|
|
89
104
|
return layoutSection.createAndFill(undefined, columns);
|
|
90
105
|
};
|
|
91
106
|
export var insertLayoutColumns = function insertLayoutColumns(state, dispatch) {
|
|
@@ -95,7 +110,7 @@ export var insertLayoutColumns = function insertLayoutColumns(state, dispatch) {
|
|
|
95
110
|
return true;
|
|
96
111
|
};
|
|
97
112
|
export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAnalytics(editorAnalyticsAPI) {
|
|
98
|
-
return function (inputMethod) {
|
|
113
|
+
return function (inputMethod, formatMessage) {
|
|
99
114
|
return withAnalytics(editorAnalyticsAPI, {
|
|
100
115
|
action: ACTION.INSERTED,
|
|
101
116
|
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
@@ -104,21 +119,38 @@ export var insertLayoutColumnsWithAnalytics = function insertLayoutColumnsWithAn
|
|
|
104
119
|
inputMethod: inputMethod
|
|
105
120
|
},
|
|
106
121
|
eventType: EVENT_TYPE.TRACK
|
|
107
|
-
})(
|
|
122
|
+
})(function (state, dispatch) {
|
|
123
|
+
if (dispatch) {
|
|
124
|
+
dispatch(safeInsert(createDefaultLayoutSection(state, formatMessage))(state.tr));
|
|
125
|
+
}
|
|
126
|
+
return true;
|
|
127
|
+
});
|
|
108
128
|
};
|
|
109
129
|
};
|
|
110
130
|
|
|
111
131
|
/**
|
|
112
132
|
* Add a column to the right of existing layout
|
|
113
133
|
*/
|
|
114
|
-
function addColumn(schema, pos) {
|
|
134
|
+
function addColumn(schema, pos, formatMessage) {
|
|
135
|
+
if (!isPreRelease2()) {
|
|
136
|
+
return function (tr) {
|
|
137
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
var placeholder = createPlaceholderNode(schema, formatMessage);
|
|
115
141
|
return function (tr) {
|
|
116
|
-
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill());
|
|
142
|
+
tr.replaceWith(tr.mapping.map(pos), tr.mapping.map(pos), schema.nodes.layoutColumn.createAndFill(undefined, placeholder));
|
|
117
143
|
};
|
|
118
144
|
}
|
|
145
|
+
var containPlaceholderOnly = function containPlaceholderOnly(node, schema) {
|
|
146
|
+
var _node$firstChild, _node$firstChild2;
|
|
147
|
+
return node.childCount === 1 && ((_node$firstChild = node.firstChild) === null || _node$firstChild === void 0 ? void 0 : _node$firstChild.childCount) === 1 && ((_node$firstChild2 = node.firstChild) === null || _node$firstChild2 === void 0 || (_node$firstChild2 = _node$firstChild2.firstChild) === null || _node$firstChild2 === void 0 ? void 0 : _node$firstChild2.type) === schema.nodes.placeholder;
|
|
148
|
+
};
|
|
119
149
|
function removeLastColumnInLayout(column, columnPos, insideRightEdgePos) {
|
|
120
150
|
return function (tr) {
|
|
121
|
-
if
|
|
151
|
+
// check if the column only contains a paragraph with a placeholder text
|
|
152
|
+
// if so, remove the whole column, otherwise just remove the paragraph
|
|
153
|
+
if (isEmptyDocument(column) || containPlaceholderOnly(column, tr.doc.type.schema)) {
|
|
122
154
|
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(insideRightEdgePos), Slice.empty);
|
|
123
155
|
} else {
|
|
124
156
|
tr.replaceRange(tr.mapping.map(columnPos - 1), tr.mapping.map(columnPos + 1), Slice.empty);
|
|
@@ -148,7 +180,7 @@ var fromThreeColstoOne = function fromThreeColstoOne(node, tr, insideRightEdgePo
|
|
|
148
180
|
* Switching from 3 -> 2 moves all the content of the third col inside the second before
|
|
149
181
|
* removing it
|
|
150
182
|
*/
|
|
151
|
-
function forceColumnStructure(state, node, pos, presetLayout) {
|
|
183
|
+
function forceColumnStructure(state, node, pos, presetLayout, formatMessage) {
|
|
152
184
|
var tr = state.tr;
|
|
153
185
|
var insideRightEdgeOfLayoutSection = pos + node.nodeSize - 1;
|
|
154
186
|
var numCols = node.childCount;
|
|
@@ -161,7 +193,7 @@ function forceColumnStructure(state, node, pos, presetLayout) {
|
|
|
161
193
|
|
|
162
194
|
// 2 columns -> 3 columns
|
|
163
195
|
} else if (THREE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
164
|
-
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection)(tr);
|
|
196
|
+
fromTwoColsToThree(state.schema, insideRightEdgeOfLayoutSection, formatMessage)(tr);
|
|
165
197
|
|
|
166
198
|
// 2 columns -> 1 column
|
|
167
199
|
} else if (ONE_COL_LAYOUTS.indexOf(presetLayout) >= 0 && numCols === 2) {
|
|
@@ -204,8 +236,8 @@ function forceColumnWidths(state, tr, pos, presetLayout) {
|
|
|
204
236
|
}
|
|
205
237
|
return tr.replaceWith(pos + 1, pos + node.nodeSize - 1, columnWidth(node, state.schema, getWidthsForPreset(presetLayout)));
|
|
206
238
|
}
|
|
207
|
-
export function forceSectionToPresetLayout(state, node, pos, presetLayout) {
|
|
208
|
-
var tr = forceColumnStructure(state, node, pos, presetLayout);
|
|
239
|
+
export function forceSectionToPresetLayout(state, node, pos, presetLayout, formatMessage) {
|
|
240
|
+
var tr = forceColumnStructure(state, node, pos, presetLayout, formatMessage);
|
|
209
241
|
|
|
210
242
|
// save the selection here, since forcing column widths causes a change over the
|
|
211
243
|
// entire layoutSection, which remaps selection to the end. not remapping here
|
|
@@ -216,7 +248,7 @@ export function forceSectionToPresetLayout(state, node, pos, presetLayout) {
|
|
|
216
248
|
return tr.setSelection(state.selection instanceof NodeSelection ? new NodeSelection(selectionPos$) : new TextSelection(selectionPos$));
|
|
217
249
|
}
|
|
218
250
|
export var setPresetLayout = function setPresetLayout(editorAnalyticsAPI) {
|
|
219
|
-
return function (layout) {
|
|
251
|
+
return function (layout, formatMessage) {
|
|
220
252
|
return function (state, dispatch) {
|
|
221
253
|
var _ref = pluginKey.getState(state),
|
|
222
254
|
pos = _ref.pos,
|
|
@@ -228,7 +260,7 @@ export var setPresetLayout = function setPresetLayout(editorAnalyticsAPI) {
|
|
|
228
260
|
if (!node) {
|
|
229
261
|
return false;
|
|
230
262
|
}
|
|
231
|
-
var tr = forceSectionToPresetLayout(state, node, pos, layout);
|
|
263
|
+
var tr = forceSectionToPresetLayout(state, node, pos, layout, formatMessage);
|
|
232
264
|
if (tr) {
|
|
233
265
|
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
234
266
|
action: ACTION.CHANGED_LAYOUT,
|
package/dist/esm/plugin.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { layoutColumn, layoutSection } from '@atlaskit/adf-schema';
|
|
3
|
+
import { layoutSectionWithSingleColumn } from '@atlaskit/adf-schema/schema';
|
|
3
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
+
import { layoutMessages, toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
|
|
6
7
|
import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
7
8
|
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
8
9
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
9
10
|
import { buildToolbar } from './toolbar';
|
|
11
|
+
import { GlobalStylesWrapper } from './ui/global-styles';
|
|
10
12
|
import { isPreRelease2 } from './utils/preRelease';
|
|
11
13
|
export { pluginKey };
|
|
12
14
|
export var layoutPlugin = function layoutPlugin(_ref) {
|
|
@@ -19,7 +21,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
19
21
|
nodes: function nodes() {
|
|
20
22
|
return [{
|
|
21
23
|
name: 'layoutSection',
|
|
22
|
-
node: layoutSection
|
|
24
|
+
node: isPreRelease2() ? layoutSectionWithSingleColumn : layoutSection
|
|
23
25
|
}, {
|
|
24
26
|
name: 'layoutColumn',
|
|
25
27
|
node: layoutColumn
|
|
@@ -52,7 +54,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
52
54
|
var formatMessage = _ref3.formatMessage;
|
|
53
55
|
return isPreRelease2() ? [{
|
|
54
56
|
id: 'twocolumnslayout',
|
|
55
|
-
title: formatMessage(
|
|
57
|
+
title: formatMessage(layoutMessages.twoColumns),
|
|
56
58
|
description: formatMessage(messages.columnsDescription),
|
|
57
59
|
keywords: ['layout', 'column', 'section', 'two column'],
|
|
58
60
|
priority: 1100,
|
|
@@ -60,12 +62,12 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
60
62
|
return /*#__PURE__*/React.createElement(IconTwoColumnLayout, null);
|
|
61
63
|
},
|
|
62
64
|
action: function action(insert, state) {
|
|
63
|
-
var tr = insert(createMultiColumnLayoutSection(state));
|
|
65
|
+
var tr = insert(createMultiColumnLayoutSection(state, 2, formatMessage));
|
|
64
66
|
return tr;
|
|
65
67
|
}
|
|
66
68
|
}, {
|
|
67
69
|
id: 'threecolumnslayout',
|
|
68
|
-
title: formatMessage(
|
|
70
|
+
title: formatMessage(layoutMessages.threeColumns),
|
|
69
71
|
description: formatMessage(messages.columnsDescription),
|
|
70
72
|
keywords: ['layout', 'column', 'section', 'three column'],
|
|
71
73
|
priority: 1100,
|
|
@@ -73,12 +75,12 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
73
75
|
return /*#__PURE__*/React.createElement(IconThreeColumnLayout, null);
|
|
74
76
|
},
|
|
75
77
|
action: function action(insert, state) {
|
|
76
|
-
var tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
78
|
+
var tr = insert(createMultiColumnLayoutSection(state, 3, formatMessage));
|
|
77
79
|
return tr;
|
|
78
80
|
}
|
|
79
81
|
}, {
|
|
80
82
|
id: 'fourcolumnslayout',
|
|
81
|
-
title: formatMessage(
|
|
83
|
+
title: formatMessage(layoutMessages.fourColumns),
|
|
82
84
|
description: formatMessage(messages.columnsDescription),
|
|
83
85
|
keywords: ['layout', 'column', 'section', 'four column'],
|
|
84
86
|
priority: 1100,
|
|
@@ -86,12 +88,12 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
86
88
|
return /*#__PURE__*/React.createElement(IconFourColumnLayout, null);
|
|
87
89
|
},
|
|
88
90
|
action: function action(insert, state) {
|
|
89
|
-
var tr = insert(createMultiColumnLayoutSection(state, 4));
|
|
91
|
+
var tr = insert(createMultiColumnLayoutSection(state, 4, formatMessage));
|
|
90
92
|
return tr;
|
|
91
93
|
}
|
|
92
94
|
}, {
|
|
93
95
|
id: 'fivecolumnslayout',
|
|
94
|
-
title: formatMessage(
|
|
96
|
+
title: formatMessage(layoutMessages.fiveColumns),
|
|
95
97
|
description: formatMessage(messages.columnsDescription),
|
|
96
98
|
keywords: ['layout', 'column', 'section', 'five column'],
|
|
97
99
|
priority: 1100,
|
|
@@ -99,7 +101,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
99
101
|
return /*#__PURE__*/React.createElement(IconFiveColumnLayout, null);
|
|
100
102
|
},
|
|
101
103
|
action: function action(insert, state) {
|
|
102
|
-
var tr = insert(createMultiColumnLayoutSection(state, 5));
|
|
104
|
+
var tr = insert(createMultiColumnLayoutSection(state, 5, formatMessage));
|
|
103
105
|
return tr;
|
|
104
106
|
}
|
|
105
107
|
}] : [{
|
|
@@ -127,6 +129,9 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
127
129
|
}
|
|
128
130
|
}];
|
|
129
131
|
}
|
|
132
|
+
},
|
|
133
|
+
contentComponent: function contentComponent() {
|
|
134
|
+
return isPreRelease2() ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null;
|
|
130
135
|
}
|
|
131
136
|
};
|
|
132
137
|
};
|
package/dist/esm/toolbar.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import commonMessages, { layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
2
|
+
import commonMessages, { layoutMessages, layoutMessages as toolbarMessages } from '@atlaskit/editor-common/messages';
|
|
3
3
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
import DeleteIcon from '@atlaskit/icon/core/delete';
|
|
5
5
|
import LayoutOneColumnIcon from '@atlaskit/icon/core/layout-one-column';
|
|
@@ -16,6 +16,7 @@ import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-lef
|
|
|
16
16
|
import LayoutTwoRightSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-right-sidebar';
|
|
17
17
|
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
18
18
|
import { deleteActiveLayoutNode, getPresetLayout, setPresetLayout } from './actions';
|
|
19
|
+
import { isPreRelease2 } from './utils/preRelease';
|
|
19
20
|
var LAYOUT_TYPES = [{
|
|
20
21
|
id: 'editor.layout.twoEquals',
|
|
21
22
|
type: 'two_equal',
|
|
@@ -63,12 +64,13 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, ed
|
|
|
63
64
|
iconFallback: item.iconFallback,
|
|
64
65
|
testId: item.title.id ? "".concat(item.title.id) : undefined,
|
|
65
66
|
title: intl.formatMessage(item.title),
|
|
66
|
-
onClick: setPresetLayout(editorAnalyticsAPI)(item.type),
|
|
67
|
+
onClick: setPresetLayout(editorAnalyticsAPI)(item.type, intl.formatMessage),
|
|
67
68
|
selected: !!currentLayout && currentLayout === item.type,
|
|
68
69
|
tabIndex: null
|
|
69
70
|
};
|
|
70
71
|
};
|
|
71
72
|
export var layoutToolbarTitle = 'Layout floating controls';
|
|
73
|
+
var iconPlaceholder = LayoutTwoColumnsIcon; // TODO: Replace with proper icon ED-25466
|
|
72
74
|
export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) {
|
|
73
75
|
var _api$decorations$acti, _api$decorations, _api$analytics;
|
|
74
76
|
var _ref = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
|
|
@@ -77,6 +79,7 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
77
79
|
var node = state.doc.nodeAt(pos);
|
|
78
80
|
if (node) {
|
|
79
81
|
var currentLayout = getPresetLayout(node);
|
|
82
|
+
var numberOfColumns = node.content.childCount || 2;
|
|
80
83
|
var separator = {
|
|
81
84
|
type: 'separator'
|
|
82
85
|
};
|
|
@@ -97,7 +100,46 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
97
100
|
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
98
101
|
tabIndex: null
|
|
99
102
|
};
|
|
100
|
-
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
103
|
+
var layoutTypes = isPreRelease2() ? [] : allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
104
|
+
var columnOptions = [{
|
|
105
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
106
|
+
count: 2
|
|
107
|
+
}),
|
|
108
|
+
//'2-columns',
|
|
109
|
+
icon: iconPlaceholder,
|
|
110
|
+
onClick: setPresetLayout(editorAnalyticsAPI)('two_equal', intl.formatMessage),
|
|
111
|
+
selected: numberOfColumns === 2
|
|
112
|
+
}, {
|
|
113
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
114
|
+
count: 3
|
|
115
|
+
}),
|
|
116
|
+
//'3-columns'
|
|
117
|
+
icon: iconPlaceholder,
|
|
118
|
+
onClick: setPresetLayout(editorAnalyticsAPI)('three_equal', intl.formatMessage),
|
|
119
|
+
selected: numberOfColumns === 3
|
|
120
|
+
}, {
|
|
121
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
122
|
+
count: 4
|
|
123
|
+
}),
|
|
124
|
+
//'4-columns'
|
|
125
|
+
icon: iconPlaceholder,
|
|
126
|
+
onClick: function onClick() {
|
|
127
|
+
// TODO: Implement layout update in ED-25053
|
|
128
|
+
return true;
|
|
129
|
+
},
|
|
130
|
+
selected: numberOfColumns === 4
|
|
131
|
+
}, {
|
|
132
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
133
|
+
count: 5
|
|
134
|
+
}),
|
|
135
|
+
//'5-columns'
|
|
136
|
+
icon: iconPlaceholder,
|
|
137
|
+
onClick: function onClick() {
|
|
138
|
+
// TODO: Implement layout update in ED-25053
|
|
139
|
+
return true;
|
|
140
|
+
},
|
|
141
|
+
selected: numberOfColumns === 5
|
|
142
|
+
}];
|
|
101
143
|
return {
|
|
102
144
|
title: layoutToolbarTitle,
|
|
103
145
|
getDomRef: function getDomRef(view) {
|
|
@@ -105,7 +147,16 @@ export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout
|
|
|
105
147
|
},
|
|
106
148
|
nodeType: nodeType,
|
|
107
149
|
groupLabel: intl.formatMessage(toolbarMessages.floatingToolbarRadioGroupAriaLabel),
|
|
108
|
-
items: [].concat(_toConsumableArray(
|
|
150
|
+
items: [].concat(_toConsumableArray(isPreRelease2() ? [{
|
|
151
|
+
type: 'dropdown',
|
|
152
|
+
title: intl.formatMessage(layoutMessages.columnOption, {
|
|
153
|
+
count: numberOfColumns
|
|
154
|
+
}),
|
|
155
|
+
//`${numberOfColumns}-columns`,
|
|
156
|
+
options: columnOptions,
|
|
157
|
+
showSelected: true,
|
|
158
|
+
testId: 'column-options-button'
|
|
159
|
+
}] : []), _toConsumableArray(layoutTypes.map(function (i) {
|
|
109
160
|
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
110
161
|
})), _toConsumableArray(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
|
|
111
162
|
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @jsxRuntime classic
|
|
3
|
+
* @jsx jsx
|
|
4
|
+
*/
|
|
5
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-global-styles, @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
6
|
+
import { css, Global, jsx } from '@emotion/react';
|
|
7
|
+
var globalStyles = css({
|
|
8
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-selectors -- Ignored via go/DSP-18766
|
|
9
|
+
'.ProseMirror [data-layout-column] span.pm-placeholder__text[data-placeholder]': {
|
|
10
|
+
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-important-styles -- Ignored via go/DSP-18766
|
|
11
|
+
'&::after': {
|
|
12
|
+
color: "var(--ds-text-disabled, #A5ADBA)",
|
|
13
|
+
font: "var(--ds-font-body, normal 400 14px/20px ui-sans-serif, -apple-system, BlinkMacSystemFont, \"Segoe UI\", Ubuntu, system-ui, \"Helvetica Neue\", sans-serif)",
|
|
14
|
+
fontStyle: 'italic'
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
export var GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
19
|
+
return jsx(Global, {
|
|
20
|
+
styles: globalStyles
|
|
21
|
+
});
|
|
22
|
+
};
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Command, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -12,12 +13,12 @@ export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
|
12
13
|
*/
|
|
13
14
|
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
|
|
14
15
|
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
|
|
15
|
-
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns
|
|
16
|
-
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
|
|
16
|
+
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns: number, formatMessage: IntlShape['formatMessage']) => Node;
|
|
17
|
+
export declare const createDefaultLayoutSection: (state: EditorState, formatMessage?: IntlShape['formatMessage']) => Node;
|
|
17
18
|
export declare const insertLayoutColumns: Command;
|
|
18
|
-
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
|
|
19
|
-
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
|
|
20
|
-
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
|
|
19
|
+
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, formatMessage?: IntlShape['formatMessage']) => Command;
|
|
20
|
+
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout, formatMessage?: IntlShape['formatMessage']): Transaction;
|
|
21
|
+
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout, formatMessage?: IntlShape['formatMessage']) => Command;
|
|
21
22
|
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
|
|
22
23
|
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
|
|
23
24
|
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type IntlShape } from 'react-intl-next';
|
|
1
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
2
3
|
import type { Command, TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
3
4
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
@@ -12,12 +13,12 @@ export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
|
12
13
|
*/
|
|
13
14
|
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
|
|
14
15
|
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
|
|
15
|
-
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns
|
|
16
|
-
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
|
|
16
|
+
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns: number, formatMessage: IntlShape['formatMessage']) => Node;
|
|
17
|
+
export declare const createDefaultLayoutSection: (state: EditorState, formatMessage?: IntlShape['formatMessage']) => Node;
|
|
17
18
|
export declare const insertLayoutColumns: Command;
|
|
18
|
-
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
|
|
19
|
-
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
|
|
20
|
-
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
|
|
19
|
+
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE, formatMessage?: IntlShape['formatMessage']) => Command;
|
|
20
|
+
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout, formatMessage?: IntlShape['formatMessage']): Transaction;
|
|
21
|
+
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout, formatMessage?: IntlShape['formatMessage']) => Command;
|
|
21
22
|
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
|
|
22
23
|
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
|
|
23
24
|
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.6",
|
|
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": "^42.3.1",
|
|
35
|
-
"@atlaskit/editor-common": "^94.
|
|
35
|
+
"@atlaskit/editor-common": "^94.3.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-decorations": "^1.3.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "6.0.0",
|
|
39
|
-
"@atlaskit/icon": "^22.
|
|
39
|
+
"@atlaskit/icon": "^22.24.0",
|
|
40
40
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
41
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
42
|
-
"@
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^2.9.0",
|
|
42
|
+
"@atlaskit/tokens": "^2.0.0",
|
|
43
|
+
"@babel/runtime": "^7.0.0",
|
|
44
|
+
"@emotion/react": "^11.7.1"
|
|
43
45
|
},
|
|
44
46
|
"peerDependencies": {
|
|
45
47
|
"react": "^16.8.0 || ^17.0.0 || ~18.2.0",
|