@atlaskit/editor-plugin-layout 10.4.0 → 10.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @atlaskit/editor-plugin-layout
2
2
 
3
+ ## 10.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [`bc59bccc2fc5c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bc59bccc2fc5c) -
8
+ Reorder advanced layout quick insert suggestions
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies
13
+
3
14
  ## 10.4.0
4
15
 
5
16
  ### Minor Changes
@@ -15,6 +15,7 @@ var _quickInsert = require("@atlaskit/editor-common/quick-insert");
15
15
  var _state = require("@atlaskit/editor-prosemirror/state");
16
16
  var _utils = require("@atlaskit/editor-prosemirror/utils");
17
17
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
18
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
18
19
  var _expValEqualsNoExposure = require("@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure");
19
20
  var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
20
21
  var _actions = require("./pm-plugins/actions");
@@ -155,27 +156,94 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
155
156
  })(tr);
156
157
  return tr;
157
158
  };
158
- var advancedSingleColumnOption = allowAdvancedSingleColumnLayout ? [{
159
- id: 'onecolumnlayout',
160
- title: formatMessage(_messages.layoutMessages.singleColumnAdvancedLayout),
161
- description: formatMessage(_messages.toolbarInsertBlockMessages.singleColumnsDescriptionAdvancedLayout),
162
- keywords: ['layout', 'column', 'section', 'single column'],
163
- priority: 1100,
164
- icon: function icon() {
165
- return /*#__PURE__*/_react.default.createElement(_quickInsert.IconOneColumnLayout, null);
166
- },
167
- action: function action(insert, state) {
168
- var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 1));
169
- if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
170
- withInsertLayoutAnalytics(tr, 1);
171
- } else {
172
- withInsertLayoutAnalytics(tr);
159
+ if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
160
+ var advancedSingleColumnOption = allowAdvancedSingleColumnLayout ? [{
161
+ id: 'onecolumnlayout',
162
+ title: formatMessage(_messages.layoutMessages.singleColumnAdvancedLayout),
163
+ description: formatMessage(_messages.toolbarInsertBlockMessages.singleColumnsDescriptionAdvancedLayout),
164
+ keywords: ['layout', 'column', 'section', 'single column'],
165
+ priority: 1100,
166
+ icon: function icon() {
167
+ return /*#__PURE__*/_react.default.createElement(_quickInsert.IconOneColumnLayout, null);
168
+ },
169
+ action: function action(insert, state) {
170
+ var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 1));
171
+ if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
172
+ withInsertLayoutAnalytics(tr, 1);
173
+ } else {
174
+ withInsertLayoutAnalytics(tr);
175
+ }
176
+ selectIntoLayoutSection(tr);
177
+ return tr;
173
178
  }
174
- selectIntoLayoutSection(tr);
175
- return tr;
179
+ }] : [];
180
+ if ((0, _expValEquals.expValEquals)('platform_editor_layout_typeahead_reorder', 'isEnabled', true)) {
181
+ var createAdvancedColumnLayoutOption = function createAdvancedColumnLayoutOption(_ref4) {
182
+ var columnCount = _ref4.columnCount,
183
+ descriptionColumnCount = _ref4.descriptionColumnCount,
184
+ Icon = _ref4.icon,
185
+ id = _ref4.id,
186
+ keyword = _ref4.keyword,
187
+ title = _ref4.title;
188
+ return {
189
+ id: id,
190
+ title: title,
191
+ description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescriptionAdvancedLayout, {
192
+ numberOfColumns: descriptionColumnCount
193
+ }),
194
+ keywords: ['layout', 'column', 'section', keyword],
195
+ priority: 1100,
196
+ icon: Icon,
197
+ action: function action(insert, state) {
198
+ var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, columnCount));
199
+ if ((0, _platformFeatureFlags.fg)('platform_editor_column_count_analytics')) {
200
+ withInsertLayoutAnalytics(tr, columnCount);
201
+ } else {
202
+ withInsertLayoutAnalytics(tr);
203
+ }
204
+ selectIntoLayoutSection(tr);
205
+ return tr;
206
+ }
207
+ };
208
+ };
209
+ return [createAdvancedColumnLayoutOption({
210
+ columnCount: 2,
211
+ descriptionColumnCount: 'two',
212
+ icon: function icon() {
213
+ return /*#__PURE__*/_react.default.createElement(_quickInsert.IconTwoColumnLayout, null);
214
+ },
215
+ id: 'twocolumnslayout',
216
+ keyword: 'two column',
217
+ title: formatMessage(_messages.layoutMessages.twoColumnsAdvancedLayout)
218
+ })].concat(advancedSingleColumnOption, [createAdvancedColumnLayoutOption({
219
+ columnCount: 3,
220
+ descriptionColumnCount: 'three',
221
+ icon: function icon() {
222
+ return /*#__PURE__*/_react.default.createElement(_quickInsert.IconThreeColumnLayout, null);
223
+ },
224
+ id: 'threecolumnslayout',
225
+ keyword: 'three column',
226
+ title: formatMessage(_messages.layoutMessages.threeColumnsAdvancedLayout)
227
+ }), createAdvancedColumnLayoutOption({
228
+ columnCount: 4,
229
+ descriptionColumnCount: 'four',
230
+ icon: function icon() {
231
+ return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFourColumnLayout, null);
232
+ },
233
+ id: 'fourcolumnslayout',
234
+ keyword: 'four column',
235
+ title: formatMessage(_messages.layoutMessages.fourColumns)
236
+ }), createAdvancedColumnLayoutOption({
237
+ columnCount: 5,
238
+ descriptionColumnCount: 'five',
239
+ icon: function icon() {
240
+ return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFiveColumnLayout, null);
241
+ },
242
+ id: 'fivecolumnslayout',
243
+ keyword: 'five column',
244
+ title: formatMessage(_messages.layoutMessages.fiveColumns)
245
+ })]);
176
246
  }
177
- }] : [];
178
- if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
179
247
  return [].concat(advancedSingleColumnOption, [{
180
248
  id: 'twocolumnslayout',
181
249
  title: formatMessage(_messages.layoutMessages.twoColumnsAdvancedLayout),
@@ -289,11 +357,11 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
289
357
  }
290
358
  }
291
359
  },
292
- contentComponent: function contentComponent(_ref4) {
293
- var editorView = _ref4.editorView,
294
- popupsMountPoint = _ref4.popupsMountPoint,
295
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
296
- popupsScrollableElement = _ref4.popupsScrollableElement;
360
+ contentComponent: function contentComponent(_ref5) {
361
+ var editorView = _ref5.editorView,
362
+ popupsMountPoint = _ref5.popupsMountPoint,
363
+ popupsBoundariesElement = _ref5.popupsBoundariesElement,
364
+ popupsScrollableElement = _ref5.popupsScrollableElement;
297
365
  return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, (0, _experiments.editorExperiment)('advanced_layouts', true) ? /*#__PURE__*/_react.default.createElement(_globalStyles.GlobalStylesWrapper, null) : null, (0, _expValEqualsNoExposure.expValEqualsNoExposure)('platform_editor_layout_column_menu', 'isEnabled', true) && editorView ? /*#__PURE__*/_react.default.createElement(_LayoutColumnMenu.LayoutColumnMenu, {
298
366
  api: api,
299
367
  editorView: editorView,
@@ -8,6 +8,7 @@ import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconOneColumnLa
8
8
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
12
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
14
  import { createDefaultLayoutSection, createMultiColumnLayoutSection, deleteLayoutColumn, insertLayoutColumn, insertLayoutColumnsWithAnalytics, setLayoutColumnValign, toggleLayoutColumnMenu } from './pm-plugins/actions';
@@ -147,25 +148,83 @@ export const layoutPlugin = ({
147
148
  })(tr);
148
149
  return tr;
149
150
  };
150
- const advancedSingleColumnOption = allowAdvancedSingleColumnLayout ? [{
151
- id: 'onecolumnlayout',
152
- title: formatMessage(layoutMessages.singleColumnAdvancedLayout),
153
- description: formatMessage(messages.singleColumnsDescriptionAdvancedLayout),
154
- keywords: ['layout', 'column', 'section', 'single column'],
155
- priority: 1100,
156
- icon: () => /*#__PURE__*/React.createElement(IconOneColumnLayout, null),
157
- action(insert, state) {
158
- const tr = insert(createMultiColumnLayoutSection(state, 1));
159
- if (fg('platform_editor_column_count_analytics')) {
160
- withInsertLayoutAnalytics(tr, 1);
161
- } else {
162
- withInsertLayoutAnalytics(tr);
151
+ if (editorExperiment('advanced_layouts', true)) {
152
+ const advancedSingleColumnOption = allowAdvancedSingleColumnLayout ? [{
153
+ id: 'onecolumnlayout',
154
+ title: formatMessage(layoutMessages.singleColumnAdvancedLayout),
155
+ description: formatMessage(messages.singleColumnsDescriptionAdvancedLayout),
156
+ keywords: ['layout', 'column', 'section', 'single column'],
157
+ priority: 1100,
158
+ icon: () => /*#__PURE__*/React.createElement(IconOneColumnLayout, null),
159
+ action(insert, state) {
160
+ const tr = insert(createMultiColumnLayoutSection(state, 1));
161
+ if (fg('platform_editor_column_count_analytics')) {
162
+ withInsertLayoutAnalytics(tr, 1);
163
+ } else {
164
+ withInsertLayoutAnalytics(tr);
165
+ }
166
+ selectIntoLayoutSection(tr);
167
+ return tr;
163
168
  }
164
- selectIntoLayoutSection(tr);
165
- return tr;
169
+ }] : [];
170
+ if (expValEquals('platform_editor_layout_typeahead_reorder', 'isEnabled', true)) {
171
+ const createAdvancedColumnLayoutOption = ({
172
+ columnCount,
173
+ descriptionColumnCount,
174
+ icon: Icon,
175
+ id,
176
+ keyword,
177
+ title
178
+ }) => ({
179
+ id,
180
+ title,
181
+ description: formatMessage(messages.columnsDescriptionAdvancedLayout, {
182
+ numberOfColumns: descriptionColumnCount
183
+ }),
184
+ keywords: ['layout', 'column', 'section', keyword],
185
+ priority: 1100,
186
+ icon: Icon,
187
+ action(insert, state) {
188
+ const tr = insert(createMultiColumnLayoutSection(state, columnCount));
189
+ if (fg('platform_editor_column_count_analytics')) {
190
+ withInsertLayoutAnalytics(tr, columnCount);
191
+ } else {
192
+ withInsertLayoutAnalytics(tr);
193
+ }
194
+ selectIntoLayoutSection(tr);
195
+ return tr;
196
+ }
197
+ });
198
+ return [createAdvancedColumnLayoutOption({
199
+ columnCount: 2,
200
+ descriptionColumnCount: 'two',
201
+ icon: () => /*#__PURE__*/React.createElement(IconTwoColumnLayout, null),
202
+ id: 'twocolumnslayout',
203
+ keyword: 'two column',
204
+ title: formatMessage(layoutMessages.twoColumnsAdvancedLayout)
205
+ }), ...advancedSingleColumnOption, createAdvancedColumnLayoutOption({
206
+ columnCount: 3,
207
+ descriptionColumnCount: 'three',
208
+ icon: () => /*#__PURE__*/React.createElement(IconThreeColumnLayout, null),
209
+ id: 'threecolumnslayout',
210
+ keyword: 'three column',
211
+ title: formatMessage(layoutMessages.threeColumnsAdvancedLayout)
212
+ }), createAdvancedColumnLayoutOption({
213
+ columnCount: 4,
214
+ descriptionColumnCount: 'four',
215
+ icon: () => /*#__PURE__*/React.createElement(IconFourColumnLayout, null),
216
+ id: 'fourcolumnslayout',
217
+ keyword: 'four column',
218
+ title: formatMessage(layoutMessages.fourColumns)
219
+ }), createAdvancedColumnLayoutOption({
220
+ columnCount: 5,
221
+ descriptionColumnCount: 'five',
222
+ icon: () => /*#__PURE__*/React.createElement(IconFiveColumnLayout, null),
223
+ id: 'fivecolumnslayout',
224
+ keyword: 'five column',
225
+ title: formatMessage(layoutMessages.fiveColumns)
226
+ })];
166
227
  }
167
- }] : [];
168
- if (editorExperiment('advanced_layouts', true)) {
169
228
  return [...advancedSingleColumnOption, {
170
229
  id: 'twocolumnslayout',
171
230
  title: formatMessage(layoutMessages.twoColumnsAdvancedLayout),
@@ -8,6 +8,7 @@ import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconOneColumnLa
8
8
  import { TextSelection } from '@atlaskit/editor-prosemirror/state';
9
9
  import { findParentNode } from '@atlaskit/editor-prosemirror/utils';
10
10
  import { fg } from '@atlaskit/platform-feature-flags';
11
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
11
12
  import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
12
13
  import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
13
14
  import { createDefaultLayoutSection, createMultiColumnLayoutSection, deleteLayoutColumn as _deleteLayoutColumn, insertLayoutColumn as _insertLayoutColumn, insertLayoutColumnsWithAnalytics, setLayoutColumnValign, toggleLayoutColumnMenu } from './pm-plugins/actions';
@@ -148,27 +149,94 @@ export var layoutPlugin = function layoutPlugin(_ref) {
148
149
  })(tr);
149
150
  return tr;
150
151
  };
151
- var advancedSingleColumnOption = allowAdvancedSingleColumnLayout ? [{
152
- id: 'onecolumnlayout',
153
- title: formatMessage(layoutMessages.singleColumnAdvancedLayout),
154
- description: formatMessage(messages.singleColumnsDescriptionAdvancedLayout),
155
- keywords: ['layout', 'column', 'section', 'single column'],
156
- priority: 1100,
157
- icon: function icon() {
158
- return /*#__PURE__*/React.createElement(IconOneColumnLayout, null);
159
- },
160
- action: function action(insert, state) {
161
- var tr = insert(createMultiColumnLayoutSection(state, 1));
162
- if (fg('platform_editor_column_count_analytics')) {
163
- withInsertLayoutAnalytics(tr, 1);
164
- } else {
165
- withInsertLayoutAnalytics(tr);
152
+ if (editorExperiment('advanced_layouts', true)) {
153
+ var advancedSingleColumnOption = allowAdvancedSingleColumnLayout ? [{
154
+ id: 'onecolumnlayout',
155
+ title: formatMessage(layoutMessages.singleColumnAdvancedLayout),
156
+ description: formatMessage(messages.singleColumnsDescriptionAdvancedLayout),
157
+ keywords: ['layout', 'column', 'section', 'single column'],
158
+ priority: 1100,
159
+ icon: function icon() {
160
+ return /*#__PURE__*/React.createElement(IconOneColumnLayout, null);
161
+ },
162
+ action: function action(insert, state) {
163
+ var tr = insert(createMultiColumnLayoutSection(state, 1));
164
+ if (fg('platform_editor_column_count_analytics')) {
165
+ withInsertLayoutAnalytics(tr, 1);
166
+ } else {
167
+ withInsertLayoutAnalytics(tr);
168
+ }
169
+ selectIntoLayoutSection(tr);
170
+ return tr;
166
171
  }
167
- selectIntoLayoutSection(tr);
168
- return tr;
172
+ }] : [];
173
+ if (expValEquals('platform_editor_layout_typeahead_reorder', 'isEnabled', true)) {
174
+ var createAdvancedColumnLayoutOption = function createAdvancedColumnLayoutOption(_ref4) {
175
+ var columnCount = _ref4.columnCount,
176
+ descriptionColumnCount = _ref4.descriptionColumnCount,
177
+ Icon = _ref4.icon,
178
+ id = _ref4.id,
179
+ keyword = _ref4.keyword,
180
+ title = _ref4.title;
181
+ return {
182
+ id: id,
183
+ title: title,
184
+ description: formatMessage(messages.columnsDescriptionAdvancedLayout, {
185
+ numberOfColumns: descriptionColumnCount
186
+ }),
187
+ keywords: ['layout', 'column', 'section', keyword],
188
+ priority: 1100,
189
+ icon: Icon,
190
+ action: function action(insert, state) {
191
+ var tr = insert(createMultiColumnLayoutSection(state, columnCount));
192
+ if (fg('platform_editor_column_count_analytics')) {
193
+ withInsertLayoutAnalytics(tr, columnCount);
194
+ } else {
195
+ withInsertLayoutAnalytics(tr);
196
+ }
197
+ selectIntoLayoutSection(tr);
198
+ return tr;
199
+ }
200
+ };
201
+ };
202
+ return [createAdvancedColumnLayoutOption({
203
+ columnCount: 2,
204
+ descriptionColumnCount: 'two',
205
+ icon: function icon() {
206
+ return /*#__PURE__*/React.createElement(IconTwoColumnLayout, null);
207
+ },
208
+ id: 'twocolumnslayout',
209
+ keyword: 'two column',
210
+ title: formatMessage(layoutMessages.twoColumnsAdvancedLayout)
211
+ })].concat(advancedSingleColumnOption, [createAdvancedColumnLayoutOption({
212
+ columnCount: 3,
213
+ descriptionColumnCount: 'three',
214
+ icon: function icon() {
215
+ return /*#__PURE__*/React.createElement(IconThreeColumnLayout, null);
216
+ },
217
+ id: 'threecolumnslayout',
218
+ keyword: 'three column',
219
+ title: formatMessage(layoutMessages.threeColumnsAdvancedLayout)
220
+ }), createAdvancedColumnLayoutOption({
221
+ columnCount: 4,
222
+ descriptionColumnCount: 'four',
223
+ icon: function icon() {
224
+ return /*#__PURE__*/React.createElement(IconFourColumnLayout, null);
225
+ },
226
+ id: 'fourcolumnslayout',
227
+ keyword: 'four column',
228
+ title: formatMessage(layoutMessages.fourColumns)
229
+ }), createAdvancedColumnLayoutOption({
230
+ columnCount: 5,
231
+ descriptionColumnCount: 'five',
232
+ icon: function icon() {
233
+ return /*#__PURE__*/React.createElement(IconFiveColumnLayout, null);
234
+ },
235
+ id: 'fivecolumnslayout',
236
+ keyword: 'five column',
237
+ title: formatMessage(layoutMessages.fiveColumns)
238
+ })]);
169
239
  }
170
- }] : [];
171
- if (editorExperiment('advanced_layouts', true)) {
172
240
  return [].concat(advancedSingleColumnOption, [{
173
241
  id: 'twocolumnslayout',
174
242
  title: formatMessage(layoutMessages.twoColumnsAdvancedLayout),
@@ -282,11 +350,11 @@ export var layoutPlugin = function layoutPlugin(_ref) {
282
350
  }
283
351
  }
284
352
  },
285
- contentComponent: function contentComponent(_ref4) {
286
- var editorView = _ref4.editorView,
287
- popupsMountPoint = _ref4.popupsMountPoint,
288
- popupsBoundariesElement = _ref4.popupsBoundariesElement,
289
- popupsScrollableElement = _ref4.popupsScrollableElement;
353
+ contentComponent: function contentComponent(_ref5) {
354
+ var editorView = _ref5.editorView,
355
+ popupsMountPoint = _ref5.popupsMountPoint,
356
+ popupsBoundariesElement = _ref5.popupsBoundariesElement,
357
+ popupsScrollableElement = _ref5.popupsScrollableElement;
290
358
  return /*#__PURE__*/React.createElement(React.Fragment, null, editorExperiment('advanced_layouts', true) ? /*#__PURE__*/React.createElement(GlobalStylesWrapper, null) : null, expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true) && editorView ? /*#__PURE__*/React.createElement(LayoutColumnMenu, {
291
359
  api: api,
292
360
  editorView: editorView,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-layout",
3
- "version": "10.4.0",
3
+ "version": "10.5.0",
4
4
  "description": "Layout plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -48,14 +48,14 @@
48
48
  "@atlaskit/icon": "^35.0.0",
49
49
  "@atlaskit/icon-lab": "^6.9.0",
50
50
  "@atlaskit/platform-feature-flags": "^1.1.0",
51
- "@atlaskit/tmp-editor-statsig": "^82.1.0",
51
+ "@atlaskit/tmp-editor-statsig": "^82.5.0",
52
52
  "@atlaskit/tokens": "^13.0.0",
53
53
  "@babel/runtime": "^7.0.0",
54
54
  "@emotion/react": "^11.7.1",
55
55
  "bind-event-listener": "^3.0.0"
56
56
  },
57
57
  "peerDependencies": {
58
- "@atlaskit/editor-common": "^114.39.0",
58
+ "@atlaskit/editor-common": "^114.42.0",
59
59
  "react": "^18.2.0",
60
60
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
61
61
  },
@@ -115,6 +115,7 @@
115
115
  }
116
116
  },
117
117
  "devDependencies": {
118
+ "react": "^18.2.0",
118
119
  "react-intl": "^6.6.2"
119
120
  }
120
121
  }