@atlaskit/editor-plugin-layout 1.9.4 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 1.9.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#155345](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/155345)
8
+ [`9f00717c4915b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/9f00717c4915b) -
9
+ [ux] Add layout placeholder behind feature gate
10
+ - Updated dependencies
11
+
3
12
  ## 1.9.4
4
13
 
5
14
  ### Patch Changes
@@ -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 createMultiColumnLayoutSection = exports.createMultiColumnLayoutSection = function createMultiColumnLayoutSection(state) {
72
- var numberOfColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
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
- // create layout based on column number, each column has equal width and trucated to 2 decimal places
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 layoutColumn.createAndFill({
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
- })(insertLayoutColumns);
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 ((0, _utils.isEmptyDocument)(column)) {
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,
@@ -20,6 +20,7 @@ var _actions = require("./actions");
20
20
  var _main = _interopRequireDefault(require("./pm-plugins/main"));
21
21
  var _pluginKey = require("./pm-plugins/plugin-key");
22
22
  var _toolbar = require("./toolbar");
23
+ var _globalStyles = require("./ui/global-styles");
23
24
  var _preRelease = require("./utils/preRelease");
24
25
  var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
25
26
  var _api$analytics;
@@ -72,7 +73,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
72
73
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconTwoColumnLayout, null);
73
74
  },
74
75
  action: function action(insert, state) {
75
- var tr = insert((0, _actions.createMultiColumnLayoutSection)(state));
76
+ var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 2, formatMessage));
76
77
  return tr;
77
78
  }
78
79
  }, {
@@ -85,7 +86,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
85
86
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconThreeColumnLayout, null);
86
87
  },
87
88
  action: function action(insert, state) {
88
- var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3));
89
+ var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3, formatMessage));
89
90
  return tr;
90
91
  }
91
92
  }, {
@@ -98,7 +99,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
98
99
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFourColumnLayout, null);
99
100
  },
100
101
  action: function action(insert, state) {
101
- var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 4));
102
+ var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 4, formatMessage));
102
103
  return tr;
103
104
  }
104
105
  }, {
@@ -111,7 +112,7 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
111
112
  return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFiveColumnLayout, null);
112
113
  },
113
114
  action: function action(insert, state) {
114
- var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 5));
115
+ var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 5, formatMessage));
115
116
  return tr;
116
117
  }
117
118
  }] : [{
@@ -139,6 +140,9 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
139
140
  }
140
141
  }];
141
142
  }
143
+ },
144
+ contentComponent: function contentComponent() {
145
+ return (0, _preRelease.isPreRelease2)() ? /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null) : null;
142
146
  }
143
147
  };
144
148
  };
@@ -73,7 +73,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, ed
73
73
  iconFallback: item.iconFallback,
74
74
  testId: item.title.id ? "".concat(item.title.id) : undefined,
75
75
  title: intl.formatMessage(item.title),
76
- onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)(item.type),
76
+ onClick: (0, _actions.setPresetLayout)(editorAnalyticsAPI)(item.type, intl.formatMessage),
77
77
  selected: !!currentLayout && currentLayout === item.type,
78
78
  tabIndex: null
79
79
  };
@@ -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
+ };
@@ -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
- export const createMultiColumnLayoutSection = (state, numberOfColumns = 2) => {
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
- // create layout based on column number, each column has equal width and trucated to 2 decimal places
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
- }, () => layoutColumn.createAndFill({
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
- })(insertLayoutColumns);
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 (isEmptyDocument(column)) {
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,
@@ -7,6 +7,7 @@ import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayou
7
7
  import { default as createLayoutPlugin } from './pm-plugins/main';
8
8
  import { pluginKey } from './pm-plugins/plugin-key';
9
9
  import { buildToolbar } from './toolbar';
10
+ import { GlobalStylesWrapper } from './ui/global-styles';
10
11
  import { isPreRelease2 } from './utils/preRelease';
11
12
  export { pluginKey };
12
13
  export const layoutPlugin = ({
@@ -57,7 +58,7 @@ export const layoutPlugin = ({
57
58
  priority: 1100,
58
59
  icon: () => /*#__PURE__*/React.createElement(IconTwoColumnLayout, null),
59
60
  action(insert, state) {
60
- const tr = insert(createMultiColumnLayoutSection(state));
61
+ const tr = insert(createMultiColumnLayoutSection(state, 2, formatMessage));
61
62
  return tr;
62
63
  }
63
64
  }, {
@@ -68,7 +69,7 @@ export const layoutPlugin = ({
68
69
  priority: 1100,
69
70
  icon: () => /*#__PURE__*/React.createElement(IconThreeColumnLayout, null),
70
71
  action(insert, state) {
71
- const tr = insert(createMultiColumnLayoutSection(state, 3));
72
+ const tr = insert(createMultiColumnLayoutSection(state, 3, formatMessage));
72
73
  return tr;
73
74
  }
74
75
  }, {
@@ -79,7 +80,7 @@ export const layoutPlugin = ({
79
80
  priority: 1100,
80
81
  icon: () => /*#__PURE__*/React.createElement(IconFourColumnLayout, null),
81
82
  action(insert, state) {
82
- const tr = insert(createMultiColumnLayoutSection(state, 4));
83
+ const tr = insert(createMultiColumnLayoutSection(state, 4, formatMessage));
83
84
  return tr;
84
85
  }
85
86
  }, {
@@ -90,7 +91,7 @@ export const layoutPlugin = ({
90
91
  priority: 1100,
91
92
  icon: () => /*#__PURE__*/React.createElement(IconFiveColumnLayout, null),
92
93
  action(insert, state) {
93
- const tr = insert(createMultiColumnLayoutSection(state, 5));
94
+ const tr = insert(createMultiColumnLayoutSection(state, 5, formatMessage));
94
95
  return tr;
95
96
  }
96
97
  }] : [{
@@ -115,6 +116,9 @@ export const layoutPlugin = ({
115
116
  return tr;
116
117
  }
117
118
  }]
119
+ },
120
+ contentComponent() {
121
+ return isPreRelease2() ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null;
118
122
  }
119
123
  };
120
124
  };
@@ -61,7 +61,7 @@ const buildLayoutButton = (intl, item, currentLayout, editorAnalyticsAPI) => ({
61
61
  iconFallback: item.iconFallback,
62
62
  testId: item.title.id ? `${item.title.id}` : undefined,
63
63
  title: intl.formatMessage(item.title),
64
- onClick: setPresetLayout(editorAnalyticsAPI)(item.type),
64
+ onClick: setPresetLayout(editorAnalyticsAPI)(item.type, intl.formatMessage),
65
65
  selected: !!currentLayout && currentLayout === item.type,
66
66
  tabIndex: null
67
67
  });
@@ -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
+ };
@@ -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
- export var createMultiColumnLayoutSection = function createMultiColumnLayoutSection(state) {
63
- var numberOfColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
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
- // create layout based on column number, each column has equal width and trucated to 2 decimal places
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 layoutColumn.createAndFill({
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
- })(insertLayoutColumns);
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 (isEmptyDocument(column)) {
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,
@@ -7,6 +7,7 @@ import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayou
7
7
  import { default as createLayoutPlugin } from './pm-plugins/main';
8
8
  import { pluginKey } from './pm-plugins/plugin-key';
9
9
  import { buildToolbar } from './toolbar';
10
+ import { GlobalStylesWrapper } from './ui/global-styles';
10
11
  import { isPreRelease2 } from './utils/preRelease';
11
12
  export { pluginKey };
12
13
  export var layoutPlugin = function layoutPlugin(_ref) {
@@ -60,7 +61,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
60
61
  return /*#__PURE__*/React.createElement(IconTwoColumnLayout, null);
61
62
  },
62
63
  action: function action(insert, state) {
63
- var tr = insert(createMultiColumnLayoutSection(state));
64
+ var tr = insert(createMultiColumnLayoutSection(state, 2, formatMessage));
64
65
  return tr;
65
66
  }
66
67
  }, {
@@ -73,7 +74,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
73
74
  return /*#__PURE__*/React.createElement(IconThreeColumnLayout, null);
74
75
  },
75
76
  action: function action(insert, state) {
76
- var tr = insert(createMultiColumnLayoutSection(state, 3));
77
+ var tr = insert(createMultiColumnLayoutSection(state, 3, formatMessage));
77
78
  return tr;
78
79
  }
79
80
  }, {
@@ -86,7 +87,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
86
87
  return /*#__PURE__*/React.createElement(IconFourColumnLayout, null);
87
88
  },
88
89
  action: function action(insert, state) {
89
- var tr = insert(createMultiColumnLayoutSection(state, 4));
90
+ var tr = insert(createMultiColumnLayoutSection(state, 4, formatMessage));
90
91
  return tr;
91
92
  }
92
93
  }, {
@@ -99,7 +100,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
99
100
  return /*#__PURE__*/React.createElement(IconFiveColumnLayout, null);
100
101
  },
101
102
  action: function action(insert, state) {
102
- var tr = insert(createMultiColumnLayoutSection(state, 5));
103
+ var tr = insert(createMultiColumnLayoutSection(state, 5, formatMessage));
103
104
  return tr;
104
105
  }
105
106
  }] : [{
@@ -127,6 +128,9 @@ export var layoutPlugin = function layoutPlugin(_ref) {
127
128
  }
128
129
  }];
129
130
  }
131
+ },
132
+ contentComponent: function contentComponent() {
133
+ return isPreRelease2() ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null;
130
134
  }
131
135
  };
132
136
  };
@@ -63,7 +63,7 @@ var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, ed
63
63
  iconFallback: item.iconFallback,
64
64
  testId: item.title.id ? "".concat(item.title.id) : undefined,
65
65
  title: intl.formatMessage(item.title),
66
- onClick: setPresetLayout(editorAnalyticsAPI)(item.type),
66
+ onClick: setPresetLayout(editorAnalyticsAPI)(item.type, intl.formatMessage),
67
67
  selected: !!currentLayout && currentLayout === item.type,
68
68
  tabIndex: null
69
69
  };
@@ -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
+ };
@@ -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?: number) => Node;
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;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ export declare const GlobalStylesWrapper: () => jsx.JSX.Element;
@@ -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?: number) => Node;
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;
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @jsxRuntime classic
3
+ * @jsx jsx
4
+ */
5
+ import { jsx } from '@emotion/react';
6
+ export declare const GlobalStylesWrapper: () => jsx.JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "1.9.4",
3
+ "version": "1.9.5",
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.0.0",
35
+ "@atlaskit/editor-common": "^94.2.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.23.0",
39
+ "@atlaskit/icon": "^22.24.0",
40
40
  "@atlaskit/platform-feature-flags": "^0.3.0",
41
- "@atlaskit/tmp-editor-statsig": "^2.7.0",
42
- "@babel/runtime": "^7.0.0"
41
+ "@atlaskit/tmp-editor-statsig": "^2.8.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",