@atlaskit/editor-plugin-layout 10.9.0 → 10.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/cjs/layoutPlugin.js +1 -1
- package/dist/cjs/pm-plugins/actions.js +78 -85
- package/dist/cjs/pm-plugins/utils/layout-column-selection.js +10 -1
- package/dist/cjs/ui/LayoutColumnMenu/DeleteColumnDropdownItem.js +6 -1
- package/dist/cjs/ui/LayoutColumnMenu/DistributeColumnsDropdownItem.js +6 -1
- package/dist/cjs/ui/LayoutColumnMenu/InsertColumnDropdownItem.js +2 -2
- package/dist/cjs/ui/LayoutColumnMenu/VerticalAlignNestedMenu.js +1 -1
- package/dist/cjs/ui/LayoutColumnMenu/components.js +20 -9
- package/dist/cjs/ui/LayoutColumnMenu/index.js +5 -1
- package/dist/cjs/ui/LayoutColumnMenu/keys.js +8 -3
- package/dist/cjs/ui/LayoutColumnMenu/verticalAlignIcons.js +6 -6
- package/dist/cjs/ui/toolbar.js +1 -2
- package/dist/es2019/layoutPlugin.js +2 -2
- package/dist/es2019/pm-plugins/actions.js +1 -6
- package/dist/es2019/pm-plugins/utils/layout-column-selection.js +12 -1
- package/dist/es2019/ui/LayoutColumnMenu/DeleteColumnDropdownItem.js +7 -2
- package/dist/es2019/ui/LayoutColumnMenu/DistributeColumnsDropdownItem.js +7 -2
- package/dist/es2019/ui/LayoutColumnMenu/InsertColumnDropdownItem.js +2 -2
- package/dist/es2019/ui/LayoutColumnMenu/VerticalAlignNestedMenu.js +1 -1
- package/dist/es2019/ui/LayoutColumnMenu/components.js +23 -10
- package/dist/es2019/ui/LayoutColumnMenu/index.js +5 -1
- package/dist/es2019/ui/LayoutColumnMenu/keys.js +10 -3
- package/dist/es2019/ui/LayoutColumnMenu/verticalAlignIcons.js +6 -6
- package/dist/es2019/ui/toolbar.js +1 -2
- package/dist/esm/layoutPlugin.js +2 -2
- package/dist/esm/pm-plugins/actions.js +77 -84
- package/dist/esm/pm-plugins/utils/layout-column-selection.js +10 -1
- package/dist/esm/ui/LayoutColumnMenu/DeleteColumnDropdownItem.js +7 -2
- package/dist/esm/ui/LayoutColumnMenu/DistributeColumnsDropdownItem.js +7 -2
- package/dist/esm/ui/LayoutColumnMenu/InsertColumnDropdownItem.js +2 -2
- package/dist/esm/ui/LayoutColumnMenu/VerticalAlignNestedMenu.js +1 -1
- package/dist/esm/ui/LayoutColumnMenu/components.js +21 -10
- package/dist/esm/ui/LayoutColumnMenu/index.js +5 -1
- package/dist/esm/ui/LayoutColumnMenu/keys.js +7 -2
- package/dist/esm/ui/LayoutColumnMenu/verticalAlignIcons.js +6 -6
- package/dist/esm/ui/toolbar.js +1 -2
- package/dist/types/layoutPluginType.d.ts +5 -3
- package/dist/types/pm-plugins/actions.d.ts +5 -9
- package/dist/types/pm-plugins/utils/layout-column-selection.d.ts +1 -1
- package/dist/types/ui/LayoutColumnMenu/keys.d.ts +2 -0
- package/dist/types/ui/LayoutColumnMenu/verticalAlignIcons.d.ts +2 -2
- package/dist/types-ts4.5/layoutPluginType.d.ts +5 -3
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +5 -9
- package/dist/types-ts4.5/pm-plugins/utils/layout-column-selection.d.ts +1 -1
- package/dist/types-ts4.5/ui/LayoutColumnMenu/keys.d.ts +2 -0
- package/dist/types-ts4.5/ui/LayoutColumnMenu/verticalAlignIcons.d.ts +2 -2
- package/package.json +3 -2
|
@@ -15,8 +15,13 @@ export const LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION = {
|
|
|
15
15
|
type: 'menu-section',
|
|
16
16
|
key: 'layout-column-vertical-align-menu-section'
|
|
17
17
|
};
|
|
18
|
+
export const LAYOUT_COLUMN_DANGER_SECTION = {
|
|
19
|
+
type: 'menu-section',
|
|
20
|
+
key: 'layout-column-danger-section'
|
|
21
|
+
};
|
|
18
22
|
export const LAYOUT_COLUMN_MENU_RANK = {
|
|
19
|
-
[LAYOUT_COLUMN_MENU_SECTION.key]: 100
|
|
23
|
+
[LAYOUT_COLUMN_MENU_SECTION.key]: 100,
|
|
24
|
+
[LAYOUT_COLUMN_DANGER_SECTION.key]: 200
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
// --- Menus ---
|
|
@@ -63,8 +68,10 @@ export const LAYOUT_COLUMN_MENU_SECTION_RANK = {
|
|
|
63
68
|
[VERTICAL_ALIGN_MENU.key]: 100,
|
|
64
69
|
[INSERT_COLUMN_LEFT_MENU_ITEM.key]: 200,
|
|
65
70
|
[INSERT_COLUMN_RIGHT_MENU_ITEM.key]: 300,
|
|
66
|
-
[DISTRIBUTE_COLUMNS_MENU_ITEM.key]: 400
|
|
67
|
-
|
|
71
|
+
[DISTRIBUTE_COLUMNS_MENU_ITEM.key]: 400
|
|
72
|
+
};
|
|
73
|
+
export const LAYOUT_COLUMN_DANGER_SECTION_RANK = {
|
|
74
|
+
[DELETE_COLUMN_MENU_ITEM.key]: 100
|
|
68
75
|
};
|
|
69
76
|
export const VERTICAL_ALIGN_MENU_RANK = {
|
|
70
77
|
[LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION.key]: 100
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Disable no-re-export here, this is a useful mapping file for icon lookup used in multiple places
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
|
|
5
|
+
import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
|
|
6
|
+
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
7
7
|
export const VERTICAL_ALIGN_ICONS = {
|
|
8
|
-
top:
|
|
9
|
-
middle:
|
|
10
|
-
bottom:
|
|
8
|
+
top: AlignPositionTopIcon,
|
|
9
|
+
middle: AlignPositionCenterVerticalIcon,
|
|
10
|
+
bottom: AlignPositionBottomIcon
|
|
11
11
|
};
|
|
@@ -227,8 +227,7 @@ const getAdvancedLayoutItems = ({
|
|
|
227
227
|
disabled: isDistributedUniformly(getLayoutColumnWidths(node)),
|
|
228
228
|
icon: TableColumnsDistributeIcon,
|
|
229
229
|
onClick: (editorState, dispatch) => {
|
|
230
|
-
const tr = distributeLayoutColumns({
|
|
231
|
-
editorAnalyticsAPI,
|
|
230
|
+
const tr = distributeLayoutColumns(editorAnalyticsAPI)({
|
|
232
231
|
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
233
232
|
target: 'allColumns'
|
|
234
233
|
})({
|
package/dist/esm/layoutPlugin.js
CHANGED
|
@@ -11,7 +11,7 @@ import { fg } from '@atlaskit/platform-feature-flags';
|
|
|
11
11
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
12
12
|
import { expValEqualsNoExposure } from '@atlaskit/tmp-editor-statsig/exp-val-equals-no-exposure';
|
|
13
13
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
14
|
-
import { createDefaultLayoutSection,
|
|
14
|
+
import { createDefaultLayoutSection, createMultiColumnLayoutSection, deleteLayoutColumn as _deleteLayoutColumn, distributeLayoutColumns, insertLayoutColumn as _insertLayoutColumn, insertLayoutColumnsWithAnalytics, setLayoutColumnValign as _setLayoutColumnValign, toggleLayoutColumnMenu } from './pm-plugins/actions';
|
|
15
15
|
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
16
16
|
import { pluginKey } from './pm-plugins/plugin-key';
|
|
17
17
|
import { default as createLayoutResizingPlugin } from './pm-plugins/resizing';
|
|
@@ -374,7 +374,7 @@ export var layoutPlugin = function layoutPlugin(_ref) {
|
|
|
374
374
|
var _api$analytics4;
|
|
375
375
|
return _deleteLayoutColumn(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)(props);
|
|
376
376
|
},
|
|
377
|
-
distributeLayoutColumns:
|
|
377
|
+
distributeLayoutColumns: distributeLayoutColumns(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions),
|
|
378
378
|
insertLayoutColumn: function insertLayoutColumn(side) {
|
|
379
379
|
var _api$analytics6;
|
|
380
380
|
return _insertLayoutColumn(side, api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions);
|
|
@@ -662,93 +662,86 @@ export var setLayoutColumnValign = function setLayoutColumnValign(valign, editor
|
|
|
662
662
|
return tr;
|
|
663
663
|
};
|
|
664
664
|
};
|
|
665
|
-
export var distributeLayoutColumns = function distributeLayoutColumns() {
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
677
|
-
var selectedLayoutColumnsResult = target === 'allColumns' ? getAllLayoutColumnsFromSelection(tr.selection) : getSelectedLayoutColumnsFromSelection(tr.selection);
|
|
678
|
-
if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length < 2) {
|
|
679
|
-
return null;
|
|
680
|
-
}
|
|
681
|
-
var layoutSectionNode = selectedLayoutColumnsResult.layoutSectionNode,
|
|
682
|
-
startIndex = selectedLayoutColumnsResult.startIndex,
|
|
683
|
-
endIndex = selectedLayoutColumnsResult.endIndex,
|
|
684
|
-
selectedLayoutColumns = selectedLayoutColumnsResult.selectedLayoutColumns;
|
|
685
|
-
var existingWidths = mapChildren(layoutSectionNode, function (column) {
|
|
686
|
-
return column.attrs.width;
|
|
687
|
-
});
|
|
688
|
-
var selectedWidths = selectedLayoutColumns.map(function (_ref0) {
|
|
689
|
-
var node = _ref0.node;
|
|
690
|
-
return node.attrs.width;
|
|
691
|
-
});
|
|
692
|
-
var distribution = calculateDistribution(selectedWidths);
|
|
693
|
-
if (!distribution) {
|
|
694
|
-
return null;
|
|
695
|
-
}
|
|
696
|
-
var selectedTotal = distribution.selectedTotal,
|
|
697
|
-
equalWidth = distribution.equalWidth;
|
|
698
|
-
if (isDistributedUniformly(selectedWidths, distribution)) {
|
|
699
|
-
return null;
|
|
700
|
-
}
|
|
701
|
-
|
|
702
|
-
// Build new widths array: selected columns get equal share, unselected unchanged.
|
|
703
|
-
// Assign rounded (2dp) equal widths to all selected cols except the last, which absorbs
|
|
704
|
-
// the rounding remainder so the sum of selected widths equals selectedTotal exactly.
|
|
705
|
-
var assignedToSelected = 0;
|
|
706
|
-
var selectedAssignedCount = 0;
|
|
707
|
-
var newWidths = existingWidths.map(function (w, idx) {
|
|
708
|
-
if (idx < startIndex || idx > endIndex) {
|
|
709
|
-
return w;
|
|
665
|
+
export var distributeLayoutColumns = function distributeLayoutColumns(editorAnalyticsAPI) {
|
|
666
|
+
return function () {
|
|
667
|
+
var _ref8 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
668
|
+
_ref8$inputMethod = _ref8.inputMethod,
|
|
669
|
+
inputMethod = _ref8$inputMethod === void 0 ? INPUT_METHOD.LAYOUT_COLUMN_MENU : _ref8$inputMethod,
|
|
670
|
+
_ref8$target = _ref8.target,
|
|
671
|
+
target = _ref8$target === void 0 ? 'selectedColumns' : _ref8$target;
|
|
672
|
+
return function (_ref9) {
|
|
673
|
+
var tr = _ref9.tr;
|
|
674
|
+
if (!expValEqualsNoExposure('platform_editor_layout_column_menu', 'isEnabled', true)) {
|
|
675
|
+
return null;
|
|
710
676
|
}
|
|
711
|
-
|
|
712
|
-
if (
|
|
713
|
-
|
|
714
|
-
|
|
677
|
+
var selectedLayoutColumnsResult = target === 'allColumns' ? getAllLayoutColumnsFromSelection(tr.selection) : getSelectedLayoutColumnsFromSelection(tr.selection);
|
|
678
|
+
if (!selectedLayoutColumnsResult || selectedLayoutColumnsResult.selectedLayoutColumns.length < 2) {
|
|
679
|
+
return null;
|
|
680
|
+
}
|
|
681
|
+
var layoutSectionNode = selectedLayoutColumnsResult.layoutSectionNode,
|
|
682
|
+
startIndex = selectedLayoutColumnsResult.startIndex,
|
|
683
|
+
endIndex = selectedLayoutColumnsResult.endIndex,
|
|
684
|
+
selectedLayoutColumns = selectedLayoutColumnsResult.selectedLayoutColumns;
|
|
685
|
+
var existingWidths = mapChildren(layoutSectionNode, function (column) {
|
|
686
|
+
return column.attrs.width;
|
|
687
|
+
});
|
|
688
|
+
var selectedWidths = selectedLayoutColumns.map(function (_ref0) {
|
|
689
|
+
var node = _ref0.node;
|
|
690
|
+
return node.attrs.width;
|
|
691
|
+
});
|
|
692
|
+
var distribution = calculateDistribution(selectedWidths);
|
|
693
|
+
if (!distribution) {
|
|
694
|
+
return null;
|
|
695
|
+
}
|
|
696
|
+
var selectedTotal = distribution.selectedTotal,
|
|
697
|
+
equalWidth = distribution.equalWidth;
|
|
698
|
+
if (isDistributedUniformly(selectedWidths, distribution)) {
|
|
699
|
+
return null;
|
|
715
700
|
}
|
|
716
|
-
// Last selected column: absorb the remainder to avoid drift
|
|
717
|
-
return Number((selectedTotal - assignedToSelected).toFixed(2));
|
|
718
|
-
});
|
|
719
701
|
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
var
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
};
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
702
|
+
// Build new widths array: selected columns get equal share, unselected unchanged.
|
|
703
|
+
// Assign rounded (2dp) equal widths to all selected cols except the last, which absorbs
|
|
704
|
+
// the rounding remainder so the sum of selected widths equals selectedTotal exactly.
|
|
705
|
+
var assignedToSelected = 0;
|
|
706
|
+
var selectedAssignedCount = 0;
|
|
707
|
+
var newWidths = existingWidths.map(function (w, idx) {
|
|
708
|
+
if (idx < startIndex || idx > endIndex) {
|
|
709
|
+
return w;
|
|
710
|
+
}
|
|
711
|
+
selectedAssignedCount += 1;
|
|
712
|
+
if (selectedAssignedCount < selectedLayoutColumns.length) {
|
|
713
|
+
assignedToSelected += equalWidth;
|
|
714
|
+
return equalWidth;
|
|
715
|
+
}
|
|
716
|
+
// Last selected column: absorb the remainder to avoid drift
|
|
717
|
+
return Number((selectedTotal - assignedToSelected).toFixed(2));
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
// Apply widths via setNodeMarkup per selected column — keeps nodes in place (preserves identity, marks, decorations)
|
|
721
|
+
selectedLayoutColumns.forEach(function (_ref1, i) {
|
|
722
|
+
var node = _ref1.node,
|
|
723
|
+
pos = _ref1.pos;
|
|
724
|
+
var colIdx = startIndex + i;
|
|
725
|
+
tr.setNodeMarkup(pos, node.type, _objectSpread(_objectSpread({}, node.attrs), {}, {
|
|
726
|
+
width: newWidths[colIdx]
|
|
727
|
+
}));
|
|
728
|
+
});
|
|
729
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.attachAnalyticsEvent({
|
|
730
|
+
action: ACTION.UPDATED,
|
|
731
|
+
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
732
|
+
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT_COLUMN,
|
|
733
|
+
attributes: {
|
|
734
|
+
columnCount: layoutSectionNode.childCount,
|
|
735
|
+
endIndex: endIndex,
|
|
736
|
+
inputMethod: inputMethod,
|
|
737
|
+
selectedCount: selectedLayoutColumns.length,
|
|
738
|
+
startIndex: startIndex
|
|
739
|
+
},
|
|
740
|
+
eventType: EVENT_TYPE.TRACK
|
|
741
|
+
})(tr);
|
|
742
|
+
tr.setMeta('scrollIntoView', false);
|
|
743
|
+
return tr;
|
|
744
|
+
};
|
|
752
745
|
};
|
|
753
746
|
};
|
|
754
747
|
export var toggleLayoutColumnMenu = function toggleLayoutColumnMenu(_ref10) {
|
|
@@ -1,6 +1,15 @@
|
|
|
1
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
1
2
|
import { findChildrenByType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
2
3
|
var findLayoutSectionFromSelection = function findLayoutSectionFromSelection(selection) {
|
|
3
|
-
|
|
4
|
+
var layoutSection = selection.$from.doc.type.schema.nodes.layoutSection;
|
|
5
|
+
// NodeSelection on the layoutSection node itself
|
|
6
|
+
if (selection instanceof NodeSelection && selection.node.type === layoutSection) {
|
|
7
|
+
return {
|
|
8
|
+
node: selection.node,
|
|
9
|
+
pos: selection.from
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
return findParentNodeOfType(layoutSection)(selection);
|
|
4
13
|
};
|
|
5
14
|
var findLayoutColumnsFromLayoutSection = function findLayoutColumnsFromLayoutSection(layoutSectionNode) {
|
|
6
15
|
var layoutSectionPos = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
4
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
4
|
+
import { DeleteIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
5
|
import { useSelectedLayoutColumns } from './useSelectedLayoutColumns';
|
|
6
6
|
var DeleteColumnDropdownItem = function DeleteColumnDropdownItem(_ref) {
|
|
7
7
|
var api = _ref.api;
|
|
@@ -30,7 +30,12 @@ var DeleteColumnDropdownItem = function DeleteColumnDropdownItem(_ref) {
|
|
|
30
30
|
}
|
|
31
31
|
var selectedColumnCount = selectedLayoutColumns.selectedLayoutColumns.length;
|
|
32
32
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
33
|
-
onClick: onClick
|
|
33
|
+
onClick: onClick,
|
|
34
|
+
elemBefore: /*#__PURE__*/React.createElement(DeleteIcon, {
|
|
35
|
+
color: "currentColor",
|
|
36
|
+
label: "",
|
|
37
|
+
size: "small"
|
|
38
|
+
})
|
|
34
39
|
}, formatMessage(layoutMessages.deleteColumn, {
|
|
35
40
|
count: selectedColumnCount
|
|
36
41
|
}));
|
|
@@ -2,7 +2,7 @@ import React, { useCallback, useMemo } from 'react';
|
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
3
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
5
|
-
import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
5
|
+
import { TableColumnsDistributeIcon, ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
|
|
6
6
|
import { isDistributedUniformly } from '../../pm-plugins/utils/layout-column-distribution';
|
|
7
7
|
import { useSelectedLayoutColumns } from './useSelectedLayoutColumns';
|
|
8
8
|
export var DistributeColumnsDropdownItem = function DistributeColumnsDropdownItem(_ref) {
|
|
@@ -44,6 +44,11 @@ export var DistributeColumnsDropdownItem = function DistributeColumnsDropdownIte
|
|
|
44
44
|
}
|
|
45
45
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
46
46
|
onClick: handleClick,
|
|
47
|
-
isDisabled: isAlreadyUniform
|
|
47
|
+
isDisabled: isAlreadyUniform,
|
|
48
|
+
elemBefore: /*#__PURE__*/React.createElement(TableColumnsDistributeIcon, {
|
|
49
|
+
color: "currentColor",
|
|
50
|
+
label: "",
|
|
51
|
+
size: "small"
|
|
52
|
+
})
|
|
48
53
|
}, formatMessage(layoutMessages.distributeColumns));
|
|
49
54
|
};
|
|
@@ -7,12 +7,12 @@ import { useSelectedLayoutColumns } from './useSelectedLayoutColumns';
|
|
|
7
7
|
var INSERT_COLUMN_OPTIONS = {
|
|
8
8
|
left: {
|
|
9
9
|
Icon: TableColumnAddLeftIcon,
|
|
10
|
-
label: layoutMessages.
|
|
10
|
+
label: layoutMessages.addColumnLeft,
|
|
11
11
|
side: 'left'
|
|
12
12
|
},
|
|
13
13
|
right: {
|
|
14
14
|
Icon: TableColumnAddRightIcon,
|
|
15
|
-
label: layoutMessages.
|
|
15
|
+
label: layoutMessages.addColumnRight,
|
|
16
16
|
side: 'right'
|
|
17
17
|
}
|
|
18
18
|
};
|
|
@@ -23,7 +23,7 @@ export var VerticalAlignNestedMenu = function VerticalAlignNestedMenu(_ref) {
|
|
|
23
23
|
}
|
|
24
24
|
return firstValign;
|
|
25
25
|
}, [selectedLayoutColumns]);
|
|
26
|
-
var TriggerIcon = currentValign ? VERTICAL_ALIGN_ICONS[currentValign] : VERTICAL_ALIGN_ICONS.
|
|
26
|
+
var TriggerIcon = currentValign ? VERTICAL_ALIGN_ICONS[currentValign] : VERTICAL_ALIGN_ICONS.middle;
|
|
27
27
|
return /*#__PURE__*/React.createElement(ToolbarNestedDropdownMenu, {
|
|
28
28
|
elemBefore: /*#__PURE__*/React.createElement(TriggerIcon, {
|
|
29
29
|
label: "",
|
|
@@ -9,7 +9,7 @@ import { ToolbarMenuContainer } from '@atlaskit/editor-toolbar/toolbar-menu-cont
|
|
|
9
9
|
import { DeleteColumnDropdownItem } from './DeleteColumnDropdownItem';
|
|
10
10
|
import { DistributeColumnsDropdownItem } from './DistributeColumnsDropdownItem';
|
|
11
11
|
import { InsertColumnDropdownItem } from './InsertColumnDropdownItem';
|
|
12
|
-
import { DELETE_COLUMN_MENU_ITEM, DISTRIBUTE_COLUMNS_MENU_ITEM, INSERT_COLUMN_LEFT_MENU_ITEM, INSERT_COLUMN_RIGHT_MENU_ITEM, LAYOUT_COLUMN_MENU, LAYOUT_COLUMN_MENU_RANK, LAYOUT_COLUMN_MENU_SECTION, LAYOUT_COLUMN_MENU_SECTION_RANK, LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_BOTTOM_MENU_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_MENU_ITEM, VERTICAL_ALIGN_TOP_MENU_ITEM } from './keys';
|
|
12
|
+
import { DELETE_COLUMN_MENU_ITEM, DISTRIBUTE_COLUMNS_MENU_ITEM, INSERT_COLUMN_LEFT_MENU_ITEM, INSERT_COLUMN_RIGHT_MENU_ITEM, LAYOUT_COLUMN_DANGER_SECTION, LAYOUT_COLUMN_DANGER_SECTION_RANK, LAYOUT_COLUMN_MENU, LAYOUT_COLUMN_MENU_RANK, LAYOUT_COLUMN_MENU_SECTION, LAYOUT_COLUMN_MENU_SECTION_RANK, LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION, VERTICAL_ALIGN_BOTTOM_MENU_ITEM, VERTICAL_ALIGN_MENU, VERTICAL_ALIGN_MENU_RANK, VERTICAL_ALIGN_MENU_SECTION_RANK, VERTICAL_ALIGN_MIDDLE_MENU_ITEM, VERTICAL_ALIGN_TOP_MENU_ITEM } from './keys';
|
|
13
13
|
import { VerticalAlignDropdownItem } from './VerticalAlignDropdownItem';
|
|
14
14
|
import { VerticalAlignNestedMenu } from './VerticalAlignNestedMenu';
|
|
15
15
|
var LayoutColumnMenuContainer = function LayoutColumnMenuContainer(_ref) {
|
|
@@ -62,15 +62,6 @@ export var getLayoutColumnMenuComponents = function getLayoutColumnMenuComponent
|
|
|
62
62
|
parents: [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_MENU_SECTION), {}, {
|
|
63
63
|
rank: LAYOUT_COLUMN_MENU_SECTION_RANK[DISTRIBUTE_COLUMNS_MENU_ITEM.key]
|
|
64
64
|
})]
|
|
65
|
-
}), _objectSpread(_objectSpread({}, DELETE_COLUMN_MENU_ITEM), {}, {
|
|
66
|
-
component: function component() {
|
|
67
|
-
return /*#__PURE__*/React.createElement(DeleteColumnDropdownItem, {
|
|
68
|
-
api: api
|
|
69
|
-
});
|
|
70
|
-
},
|
|
71
|
-
parents: [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_MENU_SECTION), {}, {
|
|
72
|
-
rank: LAYOUT_COLUMN_MENU_SECTION_RANK[DELETE_COLUMN_MENU_ITEM.key]
|
|
73
|
-
})]
|
|
74
65
|
}), _objectSpread(_objectSpread({}, VERTICAL_ALIGN_MENU), {}, {
|
|
75
66
|
component: function component(_ref4) {
|
|
76
67
|
var children = _ref4.children;
|
|
@@ -118,5 +109,25 @@ export var getLayoutColumnMenuComponents = function getLayoutColumnMenuComponent
|
|
|
118
109
|
parents: [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION), {}, {
|
|
119
110
|
rank: VERTICAL_ALIGN_MENU_SECTION_RANK[VERTICAL_ALIGN_BOTTOM_MENU_ITEM.key]
|
|
120
111
|
})]
|
|
112
|
+
}), // --- Danger section (Delete column) ---
|
|
113
|
+
_objectSpread(_objectSpread({}, LAYOUT_COLUMN_DANGER_SECTION), {}, {
|
|
114
|
+
component: function component(_ref5) {
|
|
115
|
+
var children = _ref5.children;
|
|
116
|
+
return /*#__PURE__*/React.createElement(ToolbarDropdownItemSection, {
|
|
117
|
+
hasSeparator: true
|
|
118
|
+
}, children);
|
|
119
|
+
},
|
|
120
|
+
parents: [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_MENU), {}, {
|
|
121
|
+
rank: LAYOUT_COLUMN_MENU_RANK[LAYOUT_COLUMN_DANGER_SECTION.key]
|
|
122
|
+
})]
|
|
123
|
+
}), _objectSpread(_objectSpread({}, DELETE_COLUMN_MENU_ITEM), {}, {
|
|
124
|
+
component: function component() {
|
|
125
|
+
return /*#__PURE__*/React.createElement(DeleteColumnDropdownItem, {
|
|
126
|
+
api: api
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
parents: [_objectSpread(_objectSpread({}, LAYOUT_COLUMN_DANGER_SECTION), {}, {
|
|
130
|
+
rank: LAYOUT_COLUMN_DANGER_SECTION_RANK[DELETE_COLUMN_MENU_ITEM.key]
|
|
131
|
+
})]
|
|
121
132
|
})];
|
|
122
133
|
};
|
|
@@ -3,6 +3,7 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
3
3
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles';
|
|
4
4
|
import { Popup } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import { withReactEditorViewOuterListeners } from '@atlaskit/editor-common/ui-react';
|
|
6
|
+
import { UserIntentPopupWrapper } from '@atlaskit/editor-common/user-intent';
|
|
6
7
|
import { akEditorFloatingOverlapPanelZIndex } from '@atlaskit/editor-shared-styles';
|
|
7
8
|
import { ToolbarDropdownMenuProvider } from '@atlaskit/editor-toolbar';
|
|
8
9
|
import { SurfaceRenderer } from '@atlaskit/editor-ui-control-model';
|
|
@@ -96,6 +97,9 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
96
97
|
offset: LAYOUT_COLUMN_MENU_POPUP_OFFSET,
|
|
97
98
|
handleClickOutside: handleClickOutside,
|
|
98
99
|
handleEscapeKeydown: closeLayoutColumnMenu
|
|
100
|
+
}, /*#__PURE__*/React.createElement(UserIntentPopupWrapper, {
|
|
101
|
+
api: api,
|
|
102
|
+
userIntent: "layoutColumnMenuPopupOpen"
|
|
99
103
|
}, /*#__PURE__*/React.createElement(ToolbarDropdownMenuProvider, {
|
|
100
104
|
isOpen: isLayoutColumnMenuOpen,
|
|
101
105
|
setIsOpen: handleSetIsOpen
|
|
@@ -103,5 +107,5 @@ export var LayoutColumnMenu = /*#__PURE__*/React.memo(function LayoutColumnMenu(
|
|
|
103
107
|
components: components,
|
|
104
108
|
fallbacks: LAYOUT_COLUMN_MENU_FALLBACKS,
|
|
105
109
|
surface: LAYOUT_COLUMN_MENU
|
|
106
|
-
})));
|
|
110
|
+
}))));
|
|
107
111
|
});
|
|
@@ -16,7 +16,11 @@ export var LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION = {
|
|
|
16
16
|
type: 'menu-section',
|
|
17
17
|
key: 'layout-column-vertical-align-menu-section'
|
|
18
18
|
};
|
|
19
|
-
export var
|
|
19
|
+
export var LAYOUT_COLUMN_DANGER_SECTION = {
|
|
20
|
+
type: 'menu-section',
|
|
21
|
+
key: 'layout-column-danger-section'
|
|
22
|
+
};
|
|
23
|
+
export var LAYOUT_COLUMN_MENU_RANK = _defineProperty(_defineProperty({}, LAYOUT_COLUMN_MENU_SECTION.key, 100), LAYOUT_COLUMN_DANGER_SECTION.key, 200);
|
|
20
24
|
|
|
21
25
|
// --- Menus ---
|
|
22
26
|
|
|
@@ -58,6 +62,7 @@ export var DELETE_COLUMN_MENU_ITEM = {
|
|
|
58
62
|
|
|
59
63
|
// --- Item ranks within sections ---
|
|
60
64
|
|
|
61
|
-
export var LAYOUT_COLUMN_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty(
|
|
65
|
+
export var LAYOUT_COLUMN_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, VERTICAL_ALIGN_MENU.key, 100), INSERT_COLUMN_LEFT_MENU_ITEM.key, 200), INSERT_COLUMN_RIGHT_MENU_ITEM.key, 300), DISTRIBUTE_COLUMNS_MENU_ITEM.key, 400);
|
|
66
|
+
export var LAYOUT_COLUMN_DANGER_SECTION_RANK = _defineProperty({}, DELETE_COLUMN_MENU_ITEM.key, 100);
|
|
62
67
|
export var VERTICAL_ALIGN_MENU_RANK = _defineProperty({}, LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION.key, 100);
|
|
63
68
|
export var VERTICAL_ALIGN_MENU_SECTION_RANK = _defineProperty(_defineProperty(_defineProperty({}, VERTICAL_ALIGN_TOP_MENU_ITEM.key, 100), VERTICAL_ALIGN_MIDDLE_MENU_ITEM.key, 200), VERTICAL_ALIGN_BOTTOM_MENU_ITEM.key, 300);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// Disable no-re-export here, this is a useful mapping file for icon lookup used in multiple places
|
|
2
2
|
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
3
|
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
4
|
+
import AlignPositionBottomIcon from '@atlaskit/icon-lab/core/align-position-bottom';
|
|
5
|
+
import AlignPositionCenterVerticalIcon from '@atlaskit/icon-lab/core/align-position-center-vertical';
|
|
6
|
+
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
7
7
|
export var VERTICAL_ALIGN_ICONS = {
|
|
8
|
-
top:
|
|
9
|
-
middle:
|
|
10
|
-
bottom:
|
|
8
|
+
top: AlignPositionTopIcon,
|
|
9
|
+
middle: AlignPositionCenterVerticalIcon,
|
|
10
|
+
bottom: AlignPositionBottomIcon
|
|
11
11
|
};
|
package/dist/esm/ui/toolbar.js
CHANGED
|
@@ -234,8 +234,7 @@ var getAdvancedLayoutItems = function getAdvancedLayoutItems(_ref) {
|
|
|
234
234
|
disabled: isDistributedUniformly(getLayoutColumnWidths(node)),
|
|
235
235
|
icon: TableColumnsDistributeIcon,
|
|
236
236
|
onClick: function onClick(editorState, dispatch) {
|
|
237
|
-
var tr = distributeLayoutColumns({
|
|
238
|
-
editorAnalyticsAPI: editorAnalyticsAPI,
|
|
237
|
+
var tr = distributeLayoutColumns(editorAnalyticsAPI)({
|
|
239
238
|
inputMethod: INPUT_METHOD.FLOATING_TB,
|
|
240
239
|
target: 'allColumns'
|
|
241
240
|
})({
|
|
@@ -8,8 +8,9 @@ import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
|
8
8
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
9
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
10
10
|
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
11
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
11
12
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
12
|
-
import type { deleteLayoutColumn,
|
|
13
|
+
import type { deleteLayoutColumn, distributeLayoutColumns, InsertLayoutColumnSide, insertLayoutColumnsWithAnalytics, setLayoutColumnValign, toggleLayoutColumnMenu } from './pm-plugins/actions';
|
|
13
14
|
import type { LayoutState } from './pm-plugins/types';
|
|
14
15
|
import type { LayoutPluginOptions } from './types';
|
|
15
16
|
export type LayoutPluginDependencies = [
|
|
@@ -22,7 +23,8 @@ export type LayoutPluginDependencies = [
|
|
|
22
23
|
OptionalPlugin<InteractionPlugin>,
|
|
23
24
|
OptionalPlugin<BlockMenuPlugin>,
|
|
24
25
|
OptionalPlugin<ToolbarPlugin>,
|
|
25
|
-
OptionalPlugin<UiControlRegistryPlugin
|
|
26
|
+
OptionalPlugin<UiControlRegistryPlugin>,
|
|
27
|
+
OptionalPlugin<UserIntentPlugin>
|
|
26
28
|
];
|
|
27
29
|
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
28
30
|
actions: {
|
|
@@ -30,7 +32,7 @@ export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
|
30
32
|
};
|
|
31
33
|
commands: {
|
|
32
34
|
deleteLayoutColumn: ReturnType<typeof deleteLayoutColumn>;
|
|
33
|
-
distributeLayoutColumns: ReturnType<typeof
|
|
35
|
+
distributeLayoutColumns: ReturnType<typeof distributeLayoutColumns>;
|
|
34
36
|
insertLayoutColumn: (side: InsertLayoutColumnSide) => EditorCommand;
|
|
35
37
|
setLayoutColumnValign: (valign: Parameters<typeof setLayoutColumnValign>[0]) => EditorCommand;
|
|
36
38
|
toggleLayoutColumnMenu: typeof toggleLayoutColumnMenu;
|
|
@@ -5,13 +5,6 @@ import type { Command, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor
|
|
|
5
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { Change, PresetLayout } from '../types';
|
|
8
|
-
export type DistributeLayoutColumnsOptions = {
|
|
9
|
-
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.FLOATING_TB;
|
|
10
|
-
target?: 'selectedColumns' | 'allColumns';
|
|
11
|
-
};
|
|
12
|
-
type DistributeLayoutColumnsActionOptions = DistributeLayoutColumnsOptions & {
|
|
13
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
14
|
-
};
|
|
15
8
|
export declare const ONE_COL_LAYOUTS: PresetLayout[];
|
|
16
9
|
export declare const TWO_COL_LAYOUTS: PresetLayout[];
|
|
17
10
|
export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
@@ -42,8 +35,11 @@ export type InsertLayoutColumnSide = 'left' | 'right';
|
|
|
42
35
|
export declare function getEffectiveMaxLayoutColumns(): number;
|
|
43
36
|
export declare const insertLayoutColumn: (side: InsertLayoutColumnSide, editorAnalyticsAPI?: EditorAnalyticsAPI) => EditorCommand;
|
|
44
37
|
export declare const setLayoutColumnValign: (valign: Valign, editorAnalyticsAPI?: EditorAnalyticsAPI) => EditorCommand;
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
type DistributeLayoutColumnsOptions = {
|
|
39
|
+
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.FLOATING_TB;
|
|
40
|
+
target?: 'selectedColumns' | 'allColumns';
|
|
41
|
+
};
|
|
42
|
+
export declare const distributeLayoutColumns: (editorAnalyticsAPI?: EditorAnalyticsAPI) => ({ inputMethod, target, }?: DistributeLayoutColumnsOptions) => EditorCommand;
|
|
47
43
|
export declare const toggleLayoutColumnMenu: ({ anchorPos, isOpen }: {
|
|
48
44
|
anchorPos?: number;
|
|
49
45
|
isOpen?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
2
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
3
|
-
import type
|
|
3
|
+
import { type Selection } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
type FoundNode = {
|
|
5
5
|
node: PMNode;
|
|
6
6
|
pos: number;
|
|
@@ -2,6 +2,7 @@ import type { MenuItemType, MenuSectionType, MenuType, NestedMenuType } from '@a
|
|
|
2
2
|
export declare const LAYOUT_COLUMN_MENU: MenuType;
|
|
3
3
|
export declare const LAYOUT_COLUMN_MENU_SECTION: MenuSectionType;
|
|
4
4
|
export declare const LAYOUT_COLUMN_VERTICAL_ALIGN_MENU_SECTION: MenuSectionType;
|
|
5
|
+
export declare const LAYOUT_COLUMN_DANGER_SECTION: MenuSectionType;
|
|
5
6
|
export declare const LAYOUT_COLUMN_MENU_RANK: Record<string, number>;
|
|
6
7
|
export declare const VERTICAL_ALIGN_MENU: NestedMenuType;
|
|
7
8
|
export declare const INSERT_COLUMN_LEFT_MENU_ITEM: MenuItemType;
|
|
@@ -12,5 +13,6 @@ export declare const VERTICAL_ALIGN_MIDDLE_MENU_ITEM: MenuItemType;
|
|
|
12
13
|
export declare const VERTICAL_ALIGN_BOTTOM_MENU_ITEM: MenuItemType;
|
|
13
14
|
export declare const DELETE_COLUMN_MENU_ITEM: MenuItemType;
|
|
14
15
|
export declare const LAYOUT_COLUMN_MENU_SECTION_RANK: Record<string, number>;
|
|
16
|
+
export declare const LAYOUT_COLUMN_DANGER_SECTION_RANK: Record<string, number>;
|
|
15
17
|
export declare const VERTICAL_ALIGN_MENU_RANK: Record<string, number>;
|
|
16
18
|
export declare const VERTICAL_ALIGN_MENU_SECTION_RANK: Record<string, number>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
|
-
import
|
|
3
|
-
type VerticalAlignIcon = typeof
|
|
2
|
+
import AlignPositionTopIcon from '@atlaskit/icon-lab/core/align-position-top';
|
|
3
|
+
type VerticalAlignIcon = typeof AlignPositionTopIcon;
|
|
4
4
|
export declare const VERTICAL_ALIGN_ICONS: Record<Valign, VerticalAlignIcon>;
|
|
5
5
|
export {};
|
|
@@ -8,8 +8,9 @@ import type { InteractionPlugin } from '@atlaskit/editor-plugin-interaction';
|
|
|
8
8
|
import type { SelectionPlugin } from '@atlaskit/editor-plugin-selection';
|
|
9
9
|
import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
10
10
|
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
11
|
+
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
11
12
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
12
|
-
import type { deleteLayoutColumn,
|
|
13
|
+
import type { deleteLayoutColumn, distributeLayoutColumns, InsertLayoutColumnSide, insertLayoutColumnsWithAnalytics, setLayoutColumnValign, toggleLayoutColumnMenu } from './pm-plugins/actions';
|
|
13
14
|
import type { LayoutState } from './pm-plugins/types';
|
|
14
15
|
import type { LayoutPluginOptions } from './types';
|
|
15
16
|
export type LayoutPluginDependencies = [
|
|
@@ -22,7 +23,8 @@ export type LayoutPluginDependencies = [
|
|
|
22
23
|
OptionalPlugin<InteractionPlugin>,
|
|
23
24
|
OptionalPlugin<BlockMenuPlugin>,
|
|
24
25
|
OptionalPlugin<ToolbarPlugin>,
|
|
25
|
-
OptionalPlugin<UiControlRegistryPlugin
|
|
26
|
+
OptionalPlugin<UiControlRegistryPlugin>,
|
|
27
|
+
OptionalPlugin<UserIntentPlugin>
|
|
26
28
|
];
|
|
27
29
|
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
28
30
|
actions: {
|
|
@@ -30,7 +32,7 @@ export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
|
30
32
|
};
|
|
31
33
|
commands: {
|
|
32
34
|
deleteLayoutColumn: ReturnType<typeof deleteLayoutColumn>;
|
|
33
|
-
distributeLayoutColumns: ReturnType<typeof
|
|
35
|
+
distributeLayoutColumns: ReturnType<typeof distributeLayoutColumns>;
|
|
34
36
|
insertLayoutColumn: (side: InsertLayoutColumnSide) => EditorCommand;
|
|
35
37
|
setLayoutColumnValign: (valign: Parameters<typeof setLayoutColumnValign>[0]) => EditorCommand;
|
|
36
38
|
toggleLayoutColumnMenu: typeof toggleLayoutColumnMenu;
|
|
@@ -5,13 +5,6 @@ import type { Command, EditorCommand, TOOLBAR_MENU_TYPE } from '@atlaskit/editor
|
|
|
5
5
|
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { Change, PresetLayout } from '../types';
|
|
8
|
-
export type DistributeLayoutColumnsOptions = {
|
|
9
|
-
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.FLOATING_TB;
|
|
10
|
-
target?: 'selectedColumns' | 'allColumns';
|
|
11
|
-
};
|
|
12
|
-
type DistributeLayoutColumnsActionOptions = DistributeLayoutColumnsOptions & {
|
|
13
|
-
editorAnalyticsAPI?: EditorAnalyticsAPI;
|
|
14
|
-
};
|
|
15
8
|
export declare const ONE_COL_LAYOUTS: PresetLayout[];
|
|
16
9
|
export declare const TWO_COL_LAYOUTS: PresetLayout[];
|
|
17
10
|
export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
@@ -42,8 +35,11 @@ export type InsertLayoutColumnSide = 'left' | 'right';
|
|
|
42
35
|
export declare function getEffectiveMaxLayoutColumns(): number;
|
|
43
36
|
export declare const insertLayoutColumn: (side: InsertLayoutColumnSide, editorAnalyticsAPI?: EditorAnalyticsAPI) => EditorCommand;
|
|
44
37
|
export declare const setLayoutColumnValign: (valign: Valign, editorAnalyticsAPI?: EditorAnalyticsAPI) => EditorCommand;
|
|
45
|
-
|
|
46
|
-
|
|
38
|
+
type DistributeLayoutColumnsOptions = {
|
|
39
|
+
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.FLOATING_TB;
|
|
40
|
+
target?: 'selectedColumns' | 'allColumns';
|
|
41
|
+
};
|
|
42
|
+
export declare const distributeLayoutColumns: (editorAnalyticsAPI?: EditorAnalyticsAPI) => ({ inputMethod, target, }?: DistributeLayoutColumnsOptions) => EditorCommand;
|
|
47
43
|
export declare const toggleLayoutColumnMenu: ({ anchorPos, isOpen }: {
|
|
48
44
|
anchorPos?: number;
|
|
49
45
|
isOpen?: boolean;
|