@atlaskit/editor-plugin-layout 1.9.2 → 1.9.3
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 +9 -0
- package/dist/cjs/actions.js +19 -2
- package/dist/cjs/consts.js +13 -0
- package/dist/cjs/plugin.js +54 -1
- package/dist/cjs/utils/preRelease.js +11 -0
- package/dist/es2019/actions.js +15 -0
- package/dist/es2019/consts.js +7 -0
- package/dist/es2019/plugin.js +48 -3
- package/dist/es2019/utils/preRelease.js +3 -0
- package/dist/esm/actions.js +18 -1
- package/dist/esm/consts.js +7 -0
- package/dist/esm/plugin.js +56 -3
- package/dist/esm/utils/preRelease.js +5 -0
- package/dist/types/actions.d.ts +1 -0
- package/dist/types/consts.d.ts +3 -0
- package/dist/types/utils/preRelease.d.ts +1 -0
- package/dist/types-ts4.5/actions.d.ts +1 -0
- package/dist/types-ts4.5/consts.d.ts +3 -0
- package/dist/types-ts4.5/utils/preRelease.d.ts +1 -0
- package/package.json +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-layout
|
|
2
2
|
|
|
3
|
+
## 1.9.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#153024](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/153024)
|
|
8
|
+
[`0200c770ddcb2`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0200c770ddcb2) -
|
|
9
|
+
[ux] Add multiple column layout via quick insert
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
3
12
|
## 1.9.2
|
|
4
13
|
|
|
5
14
|
### Patch Changes
|
package/dist/cjs/actions.js
CHANGED
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.fixColumnStructure = exports.fixColumnSizes = exports.deleteActiveLayoutNode = exports.createDefaultLayoutSection = exports.TWO_COL_LAYOUTS = exports.THREE_COL_LAYOUTS = exports.ONE_COL_LAYOUTS = void 0;
|
|
7
|
+
exports.fixColumnStructure = exports.fixColumnSizes = exports.deleteActiveLayoutNode = exports.createMultiColumnLayoutSection = exports.createDefaultLayoutSection = exports.TWO_COL_LAYOUTS = exports.THREE_COL_LAYOUTS = exports.ONE_COL_LAYOUTS = void 0;
|
|
8
8
|
exports.forceSectionToPresetLayout = forceSectionToPresetLayout;
|
|
9
9
|
exports.setPresetLayout = exports.insertLayoutColumnsWithAnalytics = exports.insertLayoutColumns = exports.getSelectedLayout = exports.getPresetLayout = void 0;
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
@@ -14,6 +14,7 @@ var _utils = require("@atlaskit/editor-common/utils");
|
|
|
14
14
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
15
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
17
|
+
var _consts = require("./consts");
|
|
17
18
|
var _pluginKey = require("./pm-plugins/plugin-key");
|
|
18
19
|
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; }
|
|
19
20
|
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; }
|
|
@@ -67,11 +68,27 @@ var getSelectedLayout = exports.getSelectedLayout = function getSelectedLayout(m
|
|
|
67
68
|
}
|
|
68
69
|
return current;
|
|
69
70
|
};
|
|
70
|
-
var
|
|
71
|
+
var createMultiColumnLayoutSection = exports.createMultiColumnLayoutSection = function createMultiColumnLayoutSection(state) {
|
|
72
|
+
var numberOfColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
71
73
|
var _state$schema$nodes = state.schema.nodes,
|
|
72
74
|
layoutSection = _state$schema$nodes.layoutSection,
|
|
73
75
|
layoutColumn = _state$schema$nodes.layoutColumn;
|
|
74
76
|
|
|
77
|
+
// create layout based on column number, each column has equal width and trucated to 2 decimal places
|
|
78
|
+
var columns = _model.Fragment.fromArray(Array.from({
|
|
79
|
+
length: numberOfColumns
|
|
80
|
+
}, function () {
|
|
81
|
+
return layoutColumn.createAndFill({
|
|
82
|
+
width: _consts.EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
83
|
+
});
|
|
84
|
+
}));
|
|
85
|
+
return layoutSection.createAndFill(undefined, columns);
|
|
86
|
+
};
|
|
87
|
+
var createDefaultLayoutSection = exports.createDefaultLayoutSection = function createDefaultLayoutSection(state) {
|
|
88
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
89
|
+
layoutSection = _state$schema$nodes2.layoutSection,
|
|
90
|
+
layoutColumn = _state$schema$nodes2.layoutColumn;
|
|
91
|
+
|
|
75
92
|
// create a 50-50 layout by default
|
|
76
93
|
var columns = _model.Fragment.fromArray([layoutColumn.createAndFill({
|
|
77
94
|
width: 50
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.EVEN_DISTRIBUTED_COL_WIDTHS = void 0;
|
|
7
|
+
var EVEN_DISTRIBUTED_COL_WIDTHS = exports.EVEN_DISTRIBUTED_COL_WIDTHS = {
|
|
8
|
+
1: 100,
|
|
9
|
+
2: 50,
|
|
10
|
+
3: 33.33,
|
|
11
|
+
4: 25,
|
|
12
|
+
5: 20
|
|
13
|
+
};
|
package/dist/cjs/plugin.js
CHANGED
|
@@ -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 _preRelease = require("./utils/preRelease");
|
|
23
24
|
var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
24
25
|
var _api$analytics;
|
|
25
26
|
var _ref$config = _ref.config,
|
|
@@ -61,7 +62,59 @@ var layoutPlugin = exports.layoutPlugin = function layoutPlugin(_ref) {
|
|
|
61
62
|
},
|
|
62
63
|
quickInsert: function quickInsert(_ref3) {
|
|
63
64
|
var formatMessage = _ref3.formatMessage;
|
|
64
|
-
return [{
|
|
65
|
+
return (0, _preRelease.isPreRelease2)() ? [{
|
|
66
|
+
id: 'twocolumnslayout',
|
|
67
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.twoColumns),
|
|
68
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
69
|
+
keywords: ['layout', 'column', 'section', 'two column'],
|
|
70
|
+
priority: 1100,
|
|
71
|
+
icon: function icon() {
|
|
72
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconTwoColumnLayout, null);
|
|
73
|
+
},
|
|
74
|
+
action: function action(insert, state) {
|
|
75
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state));
|
|
76
|
+
return tr;
|
|
77
|
+
}
|
|
78
|
+
}, {
|
|
79
|
+
id: 'threecolumnslayout',
|
|
80
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.threeColumns),
|
|
81
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
82
|
+
keywords: ['layout', 'column', 'section', 'three column'],
|
|
83
|
+
priority: 1100,
|
|
84
|
+
icon: function icon() {
|
|
85
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconThreeColumnLayout, null);
|
|
86
|
+
},
|
|
87
|
+
action: function action(insert, state) {
|
|
88
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 3));
|
|
89
|
+
return tr;
|
|
90
|
+
}
|
|
91
|
+
}, {
|
|
92
|
+
id: 'fourcolumnslayout',
|
|
93
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.fourColumns),
|
|
94
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
95
|
+
keywords: ['layout', 'column', 'section', 'four column'],
|
|
96
|
+
priority: 1100,
|
|
97
|
+
icon: function icon() {
|
|
98
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFourColumnLayout, null);
|
|
99
|
+
},
|
|
100
|
+
action: function action(insert, state) {
|
|
101
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 4));
|
|
102
|
+
return tr;
|
|
103
|
+
}
|
|
104
|
+
}, {
|
|
105
|
+
id: 'fivecolumnslayout',
|
|
106
|
+
title: formatMessage(_messages.toolbarInsertBlockMessages.fiveColumns),
|
|
107
|
+
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
108
|
+
keywords: ['layout', 'column', 'section', 'five column'],
|
|
109
|
+
priority: 1100,
|
|
110
|
+
icon: function icon() {
|
|
111
|
+
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconFiveColumnLayout, null);
|
|
112
|
+
},
|
|
113
|
+
action: function action(insert, state) {
|
|
114
|
+
var tr = insert((0, _actions.createMultiColumnLayoutSection)(state, 5));
|
|
115
|
+
return tr;
|
|
116
|
+
}
|
|
117
|
+
}] : [{
|
|
65
118
|
id: 'layout',
|
|
66
119
|
title: formatMessage(_messages.toolbarInsertBlockMessages.columns),
|
|
67
120
|
description: formatMessage(_messages.toolbarInsertBlockMessages.columnsDescription),
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isPreRelease2 = void 0;
|
|
7
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
9
|
+
var isPreRelease2 = exports.isPreRelease2 = function isPreRelease2() {
|
|
10
|
+
return (0, _experiments.editorExperiment)('advanced_layouts', true) || (0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_pre_release_2');
|
|
11
|
+
};
|
package/dist/es2019/actions.js
CHANGED
|
@@ -4,6 +4,7 @@ import { flatmap, getStepRange, isEmptyDocument, mapChildren } from '@atlaskit/e
|
|
|
4
4
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
5
5
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
6
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
7
|
+
import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
|
|
7
8
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
8
9
|
export const ONE_COL_LAYOUTS = ['single'];
|
|
9
10
|
export const TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
@@ -53,6 +54,20 @@ export const getSelectedLayout = (maybeLayoutSection, current) => {
|
|
|
53
54
|
}
|
|
54
55
|
return current;
|
|
55
56
|
};
|
|
57
|
+
export const createMultiColumnLayoutSection = (state, numberOfColumns = 2) => {
|
|
58
|
+
const {
|
|
59
|
+
layoutSection,
|
|
60
|
+
layoutColumn
|
|
61
|
+
} = state.schema.nodes;
|
|
62
|
+
|
|
63
|
+
// create layout based on column number, each column has equal width and trucated to 2 decimal places
|
|
64
|
+
const columns = Fragment.fromArray(Array.from({
|
|
65
|
+
length: numberOfColumns
|
|
66
|
+
}, () => layoutColumn.createAndFill({
|
|
67
|
+
width: EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
68
|
+
})));
|
|
69
|
+
return layoutSection.createAndFill(undefined, columns);
|
|
70
|
+
};
|
|
56
71
|
export const createDefaultLayoutSection = state => {
|
|
57
72
|
const {
|
|
58
73
|
layoutSection,
|
package/dist/es2019/plugin.js
CHANGED
|
@@ -2,11 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { layoutColumn, layoutSection } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { IconLayout } from '@atlaskit/editor-common/quick-insert';
|
|
6
|
-
import { createDefaultLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
5
|
+
import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
|
|
6
|
+
import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
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 { isPreRelease2 } from './utils/preRelease';
|
|
10
11
|
export { pluginKey };
|
|
11
12
|
export const layoutPlugin = ({
|
|
12
13
|
config: options = {},
|
|
@@ -48,7 +49,51 @@ export const layoutPlugin = ({
|
|
|
48
49
|
},
|
|
49
50
|
quickInsert: ({
|
|
50
51
|
formatMessage
|
|
51
|
-
}) => [{
|
|
52
|
+
}) => isPreRelease2() ? [{
|
|
53
|
+
id: 'twocolumnslayout',
|
|
54
|
+
title: formatMessage(messages.twoColumns),
|
|
55
|
+
description: formatMessage(messages.columnsDescription),
|
|
56
|
+
keywords: ['layout', 'column', 'section', 'two column'],
|
|
57
|
+
priority: 1100,
|
|
58
|
+
icon: () => /*#__PURE__*/React.createElement(IconTwoColumnLayout, null),
|
|
59
|
+
action(insert, state) {
|
|
60
|
+
const tr = insert(createMultiColumnLayoutSection(state));
|
|
61
|
+
return tr;
|
|
62
|
+
}
|
|
63
|
+
}, {
|
|
64
|
+
id: 'threecolumnslayout',
|
|
65
|
+
title: formatMessage(messages.threeColumns),
|
|
66
|
+
description: formatMessage(messages.columnsDescription),
|
|
67
|
+
keywords: ['layout', 'column', 'section', 'three column'],
|
|
68
|
+
priority: 1100,
|
|
69
|
+
icon: () => /*#__PURE__*/React.createElement(IconThreeColumnLayout, null),
|
|
70
|
+
action(insert, state) {
|
|
71
|
+
const tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
72
|
+
return tr;
|
|
73
|
+
}
|
|
74
|
+
}, {
|
|
75
|
+
id: 'fourcolumnslayout',
|
|
76
|
+
title: formatMessage(messages.fourColumns),
|
|
77
|
+
description: formatMessage(messages.columnsDescription),
|
|
78
|
+
keywords: ['layout', 'column', 'section', 'four column'],
|
|
79
|
+
priority: 1100,
|
|
80
|
+
icon: () => /*#__PURE__*/React.createElement(IconFourColumnLayout, null),
|
|
81
|
+
action(insert, state) {
|
|
82
|
+
const tr = insert(createMultiColumnLayoutSection(state, 4));
|
|
83
|
+
return tr;
|
|
84
|
+
}
|
|
85
|
+
}, {
|
|
86
|
+
id: 'fivecolumnslayout',
|
|
87
|
+
title: formatMessage(messages.fiveColumns),
|
|
88
|
+
description: formatMessage(messages.columnsDescription),
|
|
89
|
+
keywords: ['layout', 'column', 'section', 'five column'],
|
|
90
|
+
priority: 1100,
|
|
91
|
+
icon: () => /*#__PURE__*/React.createElement(IconFiveColumnLayout, null),
|
|
92
|
+
action(insert, state) {
|
|
93
|
+
const tr = insert(createMultiColumnLayoutSection(state, 5));
|
|
94
|
+
return tr;
|
|
95
|
+
}
|
|
96
|
+
}] : [{
|
|
52
97
|
id: 'layout',
|
|
53
98
|
title: formatMessage(messages.columns),
|
|
54
99
|
description: formatMessage(messages.columnsDescription),
|
package/dist/esm/actions.js
CHANGED
|
@@ -7,6 +7,7 @@ import { flatmap, getStepRange, isEmptyDocument, mapChildren } from '@atlaskit/e
|
|
|
7
7
|
import { Fragment, Slice } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
9
|
import { safeInsert } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
+
import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
|
|
10
11
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
11
12
|
export var ONE_COL_LAYOUTS = ['single'];
|
|
12
13
|
export var TWO_COL_LAYOUTS = ['two_equal', 'two_left_sidebar', 'two_right_sidebar'];
|
|
@@ -58,11 +59,27 @@ export var getSelectedLayout = function getSelectedLayout(maybeLayoutSection, cu
|
|
|
58
59
|
}
|
|
59
60
|
return current;
|
|
60
61
|
};
|
|
61
|
-
export var
|
|
62
|
+
export var createMultiColumnLayoutSection = function createMultiColumnLayoutSection(state) {
|
|
63
|
+
var numberOfColumns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
62
64
|
var _state$schema$nodes = state.schema.nodes,
|
|
63
65
|
layoutSection = _state$schema$nodes.layoutSection,
|
|
64
66
|
layoutColumn = _state$schema$nodes.layoutColumn;
|
|
65
67
|
|
|
68
|
+
// create layout based on column number, each column has equal width and trucated to 2 decimal places
|
|
69
|
+
var columns = Fragment.fromArray(Array.from({
|
|
70
|
+
length: numberOfColumns
|
|
71
|
+
}, function () {
|
|
72
|
+
return layoutColumn.createAndFill({
|
|
73
|
+
width: EVEN_DISTRIBUTED_COL_WIDTHS[numberOfColumns]
|
|
74
|
+
});
|
|
75
|
+
}));
|
|
76
|
+
return layoutSection.createAndFill(undefined, columns);
|
|
77
|
+
};
|
|
78
|
+
export var createDefaultLayoutSection = function createDefaultLayoutSection(state) {
|
|
79
|
+
var _state$schema$nodes2 = state.schema.nodes,
|
|
80
|
+
layoutSection = _state$schema$nodes2.layoutSection,
|
|
81
|
+
layoutColumn = _state$schema$nodes2.layoutColumn;
|
|
82
|
+
|
|
66
83
|
// create a 50-50 layout by default
|
|
67
84
|
var columns = Fragment.fromArray([layoutColumn.createAndFill({
|
|
68
85
|
width: 50
|
package/dist/esm/plugin.js
CHANGED
|
@@ -2,11 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import { layoutColumn, layoutSection } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { toolbarInsertBlockMessages as messages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { IconLayout } from '@atlaskit/editor-common/quick-insert';
|
|
6
|
-
import { createDefaultLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
5
|
+
import { IconFiveColumnLayout, IconFourColumnLayout, IconLayout, IconThreeColumnLayout, IconTwoColumnLayout } from '@atlaskit/editor-common/quick-insert';
|
|
6
|
+
import { createDefaultLayoutSection, createMultiColumnLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
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 { isPreRelease2 } from './utils/preRelease';
|
|
10
11
|
export { pluginKey };
|
|
11
12
|
export var layoutPlugin = function layoutPlugin(_ref) {
|
|
12
13
|
var _api$analytics;
|
|
@@ -49,7 +50,59 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
49
50
|
},
|
|
50
51
|
quickInsert: function quickInsert(_ref3) {
|
|
51
52
|
var formatMessage = _ref3.formatMessage;
|
|
52
|
-
return [{
|
|
53
|
+
return isPreRelease2() ? [{
|
|
54
|
+
id: 'twocolumnslayout',
|
|
55
|
+
title: formatMessage(messages.twoColumns),
|
|
56
|
+
description: formatMessage(messages.columnsDescription),
|
|
57
|
+
keywords: ['layout', 'column', 'section', 'two column'],
|
|
58
|
+
priority: 1100,
|
|
59
|
+
icon: function icon() {
|
|
60
|
+
return /*#__PURE__*/React.createElement(IconTwoColumnLayout, null);
|
|
61
|
+
},
|
|
62
|
+
action: function action(insert, state) {
|
|
63
|
+
var tr = insert(createMultiColumnLayoutSection(state));
|
|
64
|
+
return tr;
|
|
65
|
+
}
|
|
66
|
+
}, {
|
|
67
|
+
id: 'threecolumnslayout',
|
|
68
|
+
title: formatMessage(messages.threeColumns),
|
|
69
|
+
description: formatMessage(messages.columnsDescription),
|
|
70
|
+
keywords: ['layout', 'column', 'section', 'three column'],
|
|
71
|
+
priority: 1100,
|
|
72
|
+
icon: function icon() {
|
|
73
|
+
return /*#__PURE__*/React.createElement(IconThreeColumnLayout, null);
|
|
74
|
+
},
|
|
75
|
+
action: function action(insert, state) {
|
|
76
|
+
var tr = insert(createMultiColumnLayoutSection(state, 3));
|
|
77
|
+
return tr;
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
id: 'fourcolumnslayout',
|
|
81
|
+
title: formatMessage(messages.fourColumns),
|
|
82
|
+
description: formatMessage(messages.columnsDescription),
|
|
83
|
+
keywords: ['layout', 'column', 'section', 'four column'],
|
|
84
|
+
priority: 1100,
|
|
85
|
+
icon: function icon() {
|
|
86
|
+
return /*#__PURE__*/React.createElement(IconFourColumnLayout, null);
|
|
87
|
+
},
|
|
88
|
+
action: function action(insert, state) {
|
|
89
|
+
var tr = insert(createMultiColumnLayoutSection(state, 4));
|
|
90
|
+
return tr;
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
id: 'fivecolumnslayout',
|
|
94
|
+
title: formatMessage(messages.fiveColumns),
|
|
95
|
+
description: formatMessage(messages.columnsDescription),
|
|
96
|
+
keywords: ['layout', 'column', 'section', 'five column'],
|
|
97
|
+
priority: 1100,
|
|
98
|
+
icon: function icon() {
|
|
99
|
+
return /*#__PURE__*/React.createElement(IconFiveColumnLayout, null);
|
|
100
|
+
},
|
|
101
|
+
action: function action(insert, state) {
|
|
102
|
+
var tr = insert(createMultiColumnLayoutSection(state, 5));
|
|
103
|
+
return tr;
|
|
104
|
+
}
|
|
105
|
+
}] : [{
|
|
53
106
|
id: 'layout',
|
|
54
107
|
title: formatMessage(messages.columns),
|
|
55
108
|
description: formatMessage(messages.columnsDescription),
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
|
+
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
3
|
+
export var isPreRelease2 = function isPreRelease2() {
|
|
4
|
+
return editorExperiment('advanced_layouts', true) || fg('platform_editor_advanced_layouts_pre_release_2');
|
|
5
|
+
};
|
package/dist/types/actions.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
|
|
14
14
|
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
|
|
15
|
+
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns?: number) => Node;
|
|
15
16
|
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
|
|
16
17
|
export declare const insertLayoutColumns: Command;
|
|
17
18
|
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPreRelease2: () => boolean;
|
|
@@ -12,6 +12,7 @@ export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
|
|
14
14
|
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
|
|
15
|
+
export declare const createMultiColumnLayoutSection: (state: EditorState, numberOfColumns?: number) => Node;
|
|
15
16
|
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
|
|
16
17
|
export declare const insertLayoutColumns: Command;
|
|
17
18
|
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isPreRelease2: () => boolean;
|
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.3",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,11 +32,13 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^42.0.2",
|
|
35
|
-
"@atlaskit/editor-common": "^93.
|
|
35
|
+
"@atlaskit/editor-common": "^93.6.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
39
|
"@atlaskit/icon": "^22.22.0",
|
|
40
|
+
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
41
|
+
"@atlaskit/tmp-editor-statsig": "^2.6.0",
|
|
40
42
|
"@babel/runtime": "^7.0.0"
|
|
41
43
|
},
|
|
42
44
|
"peerDependencies": {
|
|
@@ -83,5 +85,10 @@
|
|
|
83
85
|
"no-unused-dependencies": {
|
|
84
86
|
"checkDevDependencies": true
|
|
85
87
|
}
|
|
88
|
+
},
|
|
89
|
+
"platform-feature-flags": {
|
|
90
|
+
"platform_editor_advanced_layouts_pre_release_2": {
|
|
91
|
+
"type": "boolean"
|
|
92
|
+
}
|
|
86
93
|
}
|
|
87
94
|
}
|