@atlaskit/editor-plugin-layout 11.1.10 → 12.0.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 +16 -0
- package/dist/cjs/layoutPlugin.js +7 -10
- package/dist/cjs/pm-plugins/actions.js +82 -49
- package/dist/cjs/pm-plugins/consts.js +2 -1
- package/dist/cjs/pm-plugins/keymap.js +19 -5
- package/dist/cjs/pm-plugins/main.js +28 -0
- package/dist/cjs/pm-plugins/utils/layout-column-selection.js +2 -1
- package/dist/cjs/ui/LayoutColumnMenu/DeleteColumnDropdownItem.js +4 -1
- package/dist/cjs/ui/LayoutColumnMenu/InsertColumnDropdownItem.js +5 -1
- package/dist/cjs/ui/LayoutColumnMenu/VerticalAlignDropdownItem.js +3 -1
- package/dist/es2019/layoutPlugin.js +8 -11
- package/dist/es2019/pm-plugins/actions.js +42 -14
- package/dist/es2019/pm-plugins/consts.js +1 -0
- package/dist/es2019/pm-plugins/keymap.js +19 -5
- package/dist/es2019/pm-plugins/main.js +30 -0
- package/dist/es2019/pm-plugins/utils/layout-column-selection.js +2 -1
- package/dist/es2019/ui/LayoutColumnMenu/DeleteColumnDropdownItem.js +4 -1
- package/dist/es2019/ui/LayoutColumnMenu/InsertColumnDropdownItem.js +5 -1
- package/dist/es2019/ui/LayoutColumnMenu/VerticalAlignDropdownItem.js +3 -1
- package/dist/esm/layoutPlugin.js +8 -11
- package/dist/esm/pm-plugins/actions.js +84 -51
- package/dist/esm/pm-plugins/consts.js +1 -0
- package/dist/esm/pm-plugins/keymap.js +19 -5
- package/dist/esm/pm-plugins/main.js +28 -0
- package/dist/esm/pm-plugins/utils/layout-column-selection.js +2 -1
- package/dist/esm/ui/LayoutColumnMenu/DeleteColumnDropdownItem.js +4 -1
- package/dist/esm/ui/LayoutColumnMenu/InsertColumnDropdownItem.js +5 -1
- package/dist/esm/ui/LayoutColumnMenu/VerticalAlignDropdownItem.js +3 -1
- package/dist/types/layoutPluginType.d.ts +4 -5
- package/dist/types/pm-plugins/actions.d.ts +15 -4
- package/dist/types/pm-plugins/consts.d.ts +2 -0
- package/dist/types-ts4.5/layoutPluginType.d.ts +4 -5
- package/dist/types-ts4.5/pm-plugins/actions.d.ts +15 -4
- package/dist/types-ts4.5/pm-plugins/consts.d.ts +2 -0
- package/package.json +4 -4
|
@@ -15,11 +15,25 @@ function keymapPlugin(_ref) {
|
|
|
15
15
|
var _api$analytics, _api$analytics2, _api$analytics3, _api$analytics4, _api$analytics5;
|
|
16
16
|
var api = _ref.api;
|
|
17
17
|
var list = {};
|
|
18
|
-
bindLayoutColumnShortcut(addColumnBefore.common, insertLayoutColumn(
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
bindLayoutColumnShortcut(
|
|
18
|
+
bindLayoutColumnShortcut(addColumnBefore.common, insertLayoutColumn({
|
|
19
|
+
side: 'left',
|
|
20
|
+
inputMethod: INPUT_METHOD.SHORTCUT
|
|
21
|
+
}, api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api), list);
|
|
22
|
+
bindLayoutColumnShortcut(addColumnBeforeVO.common, insertLayoutColumn({
|
|
23
|
+
side: 'left',
|
|
24
|
+
inputMethod: INPUT_METHOD.SHORTCUT
|
|
25
|
+
}, api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions, api), list);
|
|
26
|
+
bindLayoutColumnShortcut(addColumnAfter.common, insertLayoutColumn({
|
|
27
|
+
side: 'right',
|
|
28
|
+
inputMethod: INPUT_METHOD.SHORTCUT
|
|
29
|
+
}, api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, api), list);
|
|
30
|
+
bindLayoutColumnShortcut(addColumnAfterVO.common, insertLayoutColumn({
|
|
31
|
+
side: 'right',
|
|
32
|
+
inputMethod: INPUT_METHOD.SHORTCUT
|
|
33
|
+
}, api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, api), list);
|
|
34
|
+
bindLayoutColumnShortcut(deleteColumn.common, deleteLayoutColumn({
|
|
35
|
+
inputMethod: INPUT_METHOD.SHORTCUT
|
|
36
|
+
}, api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions, api), list);
|
|
23
37
|
return keymap(list);
|
|
24
38
|
}
|
|
25
39
|
export default keymapPlugin;
|
|
@@ -2,6 +2,7 @@ import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
3
3
|
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; }
|
|
4
4
|
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; }
|
|
5
|
+
import { ACTION, ACTION_SUBJECT, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
6
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
6
7
|
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
7
8
|
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
@@ -17,6 +18,7 @@ import { EVEN_DISTRIBUTED_COL_WIDTHS } from './consts';
|
|
|
17
18
|
import { pluginKey } from './plugin-key';
|
|
18
19
|
import { pluginKey as layoutResizingPluginKey } from './resizing';
|
|
19
20
|
import { getMaybeLayoutSection } from './utils';
|
|
21
|
+
import { getSelectedLayoutColumnsFromSelection } from './utils/layout-column-selection';
|
|
20
22
|
export var DEFAULT_LAYOUT = 'two_equal';
|
|
21
23
|
var isWholeSelectionInsideLayoutColumn = function isWholeSelectionInsideLayoutColumn(state) {
|
|
22
24
|
// Since findParentNodeOfType doesn't check if selection.to shares the parent, we do this check ourselves
|
|
@@ -84,6 +86,28 @@ var getInitialPluginState = function getInitialPluginState(options, state) {
|
|
|
84
86
|
dangerPreviewLayoutColumnPositions: undefined
|
|
85
87
|
};
|
|
86
88
|
};
|
|
89
|
+
var fireLayoutColumnMenuOpenedAnalytics = function fireLayoutColumnMenuOpenedAnalytics(editorAnalyticsAPI, state, openedViaKeyboard) {
|
|
90
|
+
var selectedLayoutColumnsResult = getSelectedLayoutColumnsFromSelection(state.selection);
|
|
91
|
+
if (!selectedLayoutColumnsResult) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
var layoutSectionNode = selectedLayoutColumnsResult.layoutSectionNode,
|
|
95
|
+
selectedLayoutColumns = selectedLayoutColumnsResult.selectedLayoutColumns,
|
|
96
|
+
startIndex = selectedLayoutColumnsResult.startIndex,
|
|
97
|
+
endIndex = selectedLayoutColumnsResult.endIndex;
|
|
98
|
+
editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 || editorAnalyticsAPI.fireAnalyticsEvent({
|
|
99
|
+
action: ACTION.OPENED,
|
|
100
|
+
actionSubject: ACTION_SUBJECT.LAYOUT_COLUMN_MENU,
|
|
101
|
+
attributes: {
|
|
102
|
+
columnCount: layoutSectionNode.childCount,
|
|
103
|
+
endIndex: endIndex,
|
|
104
|
+
inputMethod: openedViaKeyboard ? INPUT_METHOD.KEYBOARD : INPUT_METHOD.MOUSE,
|
|
105
|
+
selectedCount: selectedLayoutColumns.length,
|
|
106
|
+
startIndex: startIndex
|
|
107
|
+
},
|
|
108
|
+
eventType: EVENT_TYPE.UI
|
|
109
|
+
});
|
|
110
|
+
};
|
|
87
111
|
var reduceLayoutColumnMenuState = function reduceLayoutColumnMenuState(pluginState, action) {
|
|
88
112
|
switch (action.type) {
|
|
89
113
|
case 'toggleLayoutColumnMenu':
|
|
@@ -176,10 +200,14 @@ export default (function (options, editorAnalyticsAPI) {
|
|
|
176
200
|
var columnMenuMeta = tr.getMeta('toggleLayoutColumnMenu');
|
|
177
201
|
var dangerPreviewMeta = tr.getMeta('layoutColumnDangerPreview');
|
|
178
202
|
if (columnMenuMeta) {
|
|
203
|
+
var wasLayoutColumnMenuOpen = nextPluginState.isLayoutColumnMenuOpen;
|
|
179
204
|
nextPluginState = reduceLayoutColumnMenuState(nextPluginState, {
|
|
180
205
|
meta: columnMenuMeta,
|
|
181
206
|
type: 'toggleLayoutColumnMenu'
|
|
182
207
|
});
|
|
208
|
+
if (!wasLayoutColumnMenuOpen && nextPluginState.isLayoutColumnMenuOpen) {
|
|
209
|
+
fireLayoutColumnMenuOpenedAnalytics(editorAnalyticsAPI, newState, columnMenuMeta.openedViaKeyboard);
|
|
210
|
+
}
|
|
183
211
|
}
|
|
184
212
|
if (tr.getMeta('layoutColumnDangerPreview') !== undefined) {
|
|
185
213
|
nextPluginState = reduceLayoutColumnMenuState(nextPluginState, {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { findChildrenByType, findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
+
import { DEFAULT_LAYOUT_COLUMN_VALIGN } from '../consts';
|
|
3
4
|
var findLayoutSectionFromSelection = function findLayoutSectionFromSelection(selection) {
|
|
4
5
|
var layoutSection = selection.$from.doc.type.schema.nodes.layoutSection;
|
|
5
6
|
// NodeSelection on the layoutSection node itself
|
|
@@ -98,7 +99,7 @@ export var getAllLayoutColumnsFromSelection = function getAllLayoutColumnsFromSe
|
|
|
98
99
|
};
|
|
99
100
|
export var getLayoutColumnValign = function getLayoutColumnValign(layoutColumn) {
|
|
100
101
|
var _ref4;
|
|
101
|
-
return layoutColumn ? (_ref4 = layoutColumn.attrs.valign) !== null && _ref4 !== void 0 ? _ref4 :
|
|
102
|
+
return layoutColumn ? (_ref4 = layoutColumn.attrs.valign) !== null && _ref4 !== void 0 ? _ref4 : DEFAULT_LAYOUT_COLUMN_VALIGN : undefined;
|
|
102
103
|
};
|
|
103
104
|
export var getLayoutColumnMenuAnchorPos = function getLayoutColumnMenuAnchorPos(selection, anchorPosFromHandle) {
|
|
104
105
|
var _clickedSelectedColum, _selectedLayoutColumn;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { deleteColumn, getAriaKeyshortcuts, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
5
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { DeleteIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
@@ -22,7 +23,9 @@ var DeleteColumnDropdownItem = function DeleteColumnDropdownItem(_ref) {
|
|
|
22
23
|
}, [setDangerPreview]);
|
|
23
24
|
var onClick = useCallback(function () {
|
|
24
25
|
var _api$layout2, _api$core2;
|
|
25
|
-
var deleteCommand = api === null || api === void 0 || (_api$layout2 = api.layout) === null || _api$layout2 === void 0 ? void 0 : _api$layout2.commands.deleteLayoutColumn(
|
|
26
|
+
var deleteCommand = api === null || api === void 0 || (_api$layout2 = api.layout) === null || _api$layout2 === void 0 ? void 0 : _api$layout2.commands.deleteLayoutColumn({
|
|
27
|
+
inputMethod: INPUT_METHOD.LAYOUT_COLUMN_MENU
|
|
28
|
+
});
|
|
26
29
|
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (props) {
|
|
27
30
|
var _api$layout3;
|
|
28
31
|
var tr = deleteCommand === null || deleteCommand === void 0 ? void 0 : deleteCommand(props);
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { useCallback } from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl';
|
|
3
|
+
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
4
|
import { addColumnAfter, addColumnBefore, getAriaKeyshortcuts, tooltip } from '@atlaskit/editor-common/keymaps';
|
|
4
5
|
import { layoutMessages } from '@atlaskit/editor-common/messages';
|
|
5
6
|
import { TableColumnAddLeftIcon, TableColumnAddRightIcon, ToolbarDropdownItem, ToolbarKeyboardShortcutHint } from '@atlaskit/editor-toolbar';
|
|
@@ -33,7 +34,10 @@ export var InsertColumnDropdownItem = function InsertColumnDropdownItem(_ref) {
|
|
|
33
34
|
var canInsertColumn = selectedLayoutColumns !== undefined && columnCount < maxColumnCount;
|
|
34
35
|
var onClick = useCallback(function () {
|
|
35
36
|
var _api$layout, _api$core;
|
|
36
|
-
var insertCommand = api === null || api === void 0 || (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.insertLayoutColumn(
|
|
37
|
+
var insertCommand = api === null || api === void 0 || (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.insertLayoutColumn({
|
|
38
|
+
side: side,
|
|
39
|
+
inputMethod: INPUT_METHOD.LAYOUT_COLUMN_MENU
|
|
40
|
+
});
|
|
37
41
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (props) {
|
|
38
42
|
var _api$layout2;
|
|
39
43
|
var tr = insertCommand === null || insertCommand === void 0 ? void 0 : insertCommand(props);
|
|
@@ -19,7 +19,9 @@ export var VerticalAlignDropdownItem = function VerticalAlignDropdownItem(_ref)
|
|
|
19
19
|
var Icon = VERTICAL_ALIGN_ICONS[value];
|
|
20
20
|
var onClick = useCallback(function () {
|
|
21
21
|
var _api$core, _api$layout;
|
|
22
|
-
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.setLayoutColumnValign(
|
|
22
|
+
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(api === null || api === void 0 || (_api$layout = api.layout) === null || _api$layout === void 0 ? void 0 : _api$layout.commands.setLayoutColumnValign({
|
|
23
|
+
valign: value
|
|
24
|
+
}));
|
|
23
25
|
}, [api, value]);
|
|
24
26
|
return /*#__PURE__*/React.createElement(ToolbarDropdownItem, {
|
|
25
27
|
elemBefore: /*#__PURE__*/React.createElement(Icon, {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
3
|
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
@@ -12,7 +11,7 @@ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
|
12
11
|
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
13
12
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
14
13
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
15
|
-
import type { DistributeLayoutColumnsOptions,
|
|
14
|
+
import type { DeleteLayoutColumnOptions, DistributeLayoutColumnsOptions, InsertLayoutColumnOptions, InsertLayoutColumnsInputMethod, SetLayoutColumnValignOptions, ToggleLayoutColumnMenuOptions } from './pm-plugins/actions';
|
|
16
15
|
import type { LayoutState } from './pm-plugins/types';
|
|
17
16
|
import type { LayoutPluginOptions } from './types';
|
|
18
17
|
export type LayoutPluginDependencies = [
|
|
@@ -34,11 +33,11 @@ export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
|
34
33
|
insertLayoutColumns: (inputMethod: InsertLayoutColumnsInputMethod) => Command;
|
|
35
34
|
};
|
|
36
35
|
commands: {
|
|
37
|
-
deleteLayoutColumn: (
|
|
36
|
+
deleteLayoutColumn: (options?: DeleteLayoutColumnOptions) => EditorCommand;
|
|
38
37
|
distributeLayoutColumns: (options?: DistributeLayoutColumnsOptions) => EditorCommand;
|
|
39
|
-
insertLayoutColumn: (
|
|
38
|
+
insertLayoutColumn: (options: InsertLayoutColumnOptions) => EditorCommand;
|
|
40
39
|
setLayoutColumnDangerPreview: (show: boolean) => EditorCommand;
|
|
41
|
-
setLayoutColumnValign: (
|
|
40
|
+
setLayoutColumnValign: (options: SetLayoutColumnValignOptions) => EditorCommand;
|
|
42
41
|
toggleLayoutColumnMenu: (options: ToggleLayoutColumnMenuOptions) => EditorCommand;
|
|
43
42
|
};
|
|
44
43
|
dependencies: LayoutPluginDependencies;
|
|
@@ -37,13 +37,21 @@ export type LayoutColumnInsertMeta = {
|
|
|
37
37
|
side: InsertLayoutColumnSide;
|
|
38
38
|
};
|
|
39
39
|
type LayoutPluginAPI = ExtractInjectionAPI<LayoutPlugin> | undefined;
|
|
40
|
-
export type LayoutColumnActionInputMethod = INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.
|
|
40
|
+
export type LayoutColumnActionInputMethod = INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.SHORTCUT;
|
|
41
41
|
/**
|
|
42
42
|
* Returns the active maximum layout column count for the current advanced layouts experiment state.
|
|
43
43
|
*/
|
|
44
44
|
export declare function getEffectiveMaxLayoutColumns(): number;
|
|
45
|
-
export
|
|
46
|
-
|
|
45
|
+
export type InsertLayoutColumnOptions = {
|
|
46
|
+
inputMethod?: LayoutColumnActionInputMethod;
|
|
47
|
+
side: InsertLayoutColumnSide;
|
|
48
|
+
};
|
|
49
|
+
export declare const insertLayoutColumn: ({ side, inputMethod }: InsertLayoutColumnOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, api?: LayoutPluginAPI) => EditorCommand;
|
|
50
|
+
export type SetLayoutColumnValignOptions = {
|
|
51
|
+
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU;
|
|
52
|
+
valign: Valign;
|
|
53
|
+
};
|
|
54
|
+
export declare const setLayoutColumnValign: ({ valign, inputMethod }: SetLayoutColumnValignOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, api?: LayoutPluginAPI) => EditorCommand;
|
|
47
55
|
export type DistributeLayoutColumnsOptions = {
|
|
48
56
|
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.FLOATING_TB;
|
|
49
57
|
target?: 'selectedColumns' | 'allColumns';
|
|
@@ -56,5 +64,8 @@ export type ToggleLayoutColumnMenuOptions = {
|
|
|
56
64
|
};
|
|
57
65
|
export declare const toggleLayoutColumnMenu: ({ anchorPos, isOpen, openedViaKeyboard }: ToggleLayoutColumnMenuOptions) => EditorCommand;
|
|
58
66
|
export declare const setLayoutColumnDangerPreview: (show: boolean) => EditorCommand;
|
|
59
|
-
export
|
|
67
|
+
export type DeleteLayoutColumnOptions = {
|
|
68
|
+
inputMethod?: LayoutColumnActionInputMethod;
|
|
69
|
+
};
|
|
70
|
+
export declare const deleteLayoutColumn: ({ inputMethod }?: DeleteLayoutColumnOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, api?: LayoutPluginAPI) => EditorCommand;
|
|
60
71
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
1
2
|
export declare const MAX_STANDARD_LAYOUT_COLUMNS = 3;
|
|
2
3
|
export declare const MAX_LAYOUT_COLUMNS = 5;
|
|
3
4
|
export declare const MIN_LAYOUT_COLUMN_WIDTH_PERCENT = 5;
|
|
5
|
+
export declare const DEFAULT_LAYOUT_COLUMN_VALIGN: Valign;
|
|
4
6
|
export declare const EVEN_DISTRIBUTED_COL_WIDTHS: {
|
|
5
7
|
[key: number]: number;
|
|
6
8
|
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
2
1
|
import type { Command, EditorCommand, NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
3
2
|
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
4
3
|
import type { BlockControlsPlugin } from '@atlaskit/editor-plugin-block-controls';
|
|
@@ -12,7 +11,7 @@ import type { ToolbarPlugin } from '@atlaskit/editor-plugin-toolbar';
|
|
|
12
11
|
import type { UiControlRegistryPlugin } from '@atlaskit/editor-plugin-ui-control-registry';
|
|
13
12
|
import type { UserIntentPlugin } from '@atlaskit/editor-plugin-user-intent';
|
|
14
13
|
import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
|
|
15
|
-
import type { DistributeLayoutColumnsOptions,
|
|
14
|
+
import type { DeleteLayoutColumnOptions, DistributeLayoutColumnsOptions, InsertLayoutColumnOptions, InsertLayoutColumnsInputMethod, SetLayoutColumnValignOptions, ToggleLayoutColumnMenuOptions } from './pm-plugins/actions';
|
|
16
15
|
import type { LayoutState } from './pm-plugins/types';
|
|
17
16
|
import type { LayoutPluginOptions } from './types';
|
|
18
17
|
export type LayoutPluginDependencies = [
|
|
@@ -34,11 +33,11 @@ export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
|
34
33
|
insertLayoutColumns: (inputMethod: InsertLayoutColumnsInputMethod) => Command;
|
|
35
34
|
};
|
|
36
35
|
commands: {
|
|
37
|
-
deleteLayoutColumn: (
|
|
36
|
+
deleteLayoutColumn: (options?: DeleteLayoutColumnOptions) => EditorCommand;
|
|
38
37
|
distributeLayoutColumns: (options?: DistributeLayoutColumnsOptions) => EditorCommand;
|
|
39
|
-
insertLayoutColumn: (
|
|
38
|
+
insertLayoutColumn: (options: InsertLayoutColumnOptions) => EditorCommand;
|
|
40
39
|
setLayoutColumnDangerPreview: (show: boolean) => EditorCommand;
|
|
41
|
-
setLayoutColumnValign: (
|
|
40
|
+
setLayoutColumnValign: (options: SetLayoutColumnValignOptions) => EditorCommand;
|
|
42
41
|
toggleLayoutColumnMenu: (options: ToggleLayoutColumnMenuOptions) => EditorCommand;
|
|
43
42
|
};
|
|
44
43
|
dependencies: LayoutPluginDependencies;
|
|
@@ -37,13 +37,21 @@ export type LayoutColumnInsertMeta = {
|
|
|
37
37
|
side: InsertLayoutColumnSide;
|
|
38
38
|
};
|
|
39
39
|
type LayoutPluginAPI = ExtractInjectionAPI<LayoutPlugin> | undefined;
|
|
40
|
-
export type LayoutColumnActionInputMethod = INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.
|
|
40
|
+
export type LayoutColumnActionInputMethod = INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.SHORTCUT;
|
|
41
41
|
/**
|
|
42
42
|
* Returns the active maximum layout column count for the current advanced layouts experiment state.
|
|
43
43
|
*/
|
|
44
44
|
export declare function getEffectiveMaxLayoutColumns(): number;
|
|
45
|
-
export
|
|
46
|
-
|
|
45
|
+
export type InsertLayoutColumnOptions = {
|
|
46
|
+
inputMethod?: LayoutColumnActionInputMethod;
|
|
47
|
+
side: InsertLayoutColumnSide;
|
|
48
|
+
};
|
|
49
|
+
export declare const insertLayoutColumn: ({ side, inputMethod }: InsertLayoutColumnOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, api?: LayoutPluginAPI) => EditorCommand;
|
|
50
|
+
export type SetLayoutColumnValignOptions = {
|
|
51
|
+
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU;
|
|
52
|
+
valign: Valign;
|
|
53
|
+
};
|
|
54
|
+
export declare const setLayoutColumnValign: ({ valign, inputMethod }: SetLayoutColumnValignOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, api?: LayoutPluginAPI) => EditorCommand;
|
|
47
55
|
export type DistributeLayoutColumnsOptions = {
|
|
48
56
|
inputMethod?: INPUT_METHOD.LAYOUT_COLUMN_MENU | INPUT_METHOD.FLOATING_TB;
|
|
49
57
|
target?: 'selectedColumns' | 'allColumns';
|
|
@@ -56,5 +64,8 @@ export type ToggleLayoutColumnMenuOptions = {
|
|
|
56
64
|
};
|
|
57
65
|
export declare const toggleLayoutColumnMenu: ({ anchorPos, isOpen, openedViaKeyboard }: ToggleLayoutColumnMenuOptions) => EditorCommand;
|
|
58
66
|
export declare const setLayoutColumnDangerPreview: (show: boolean) => EditorCommand;
|
|
59
|
-
export
|
|
67
|
+
export type DeleteLayoutColumnOptions = {
|
|
68
|
+
inputMethod?: LayoutColumnActionInputMethod;
|
|
69
|
+
};
|
|
70
|
+
export declare const deleteLayoutColumn: ({ inputMethod }?: DeleteLayoutColumnOptions, editorAnalyticsAPI?: EditorAnalyticsAPI, api?: LayoutPluginAPI) => EditorCommand;
|
|
60
71
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import type { Valign } from '@atlaskit/adf-schema/layout-column';
|
|
1
2
|
export declare const MAX_STANDARD_LAYOUT_COLUMNS = 3;
|
|
2
3
|
export declare const MAX_LAYOUT_COLUMNS = 5;
|
|
3
4
|
export declare const MIN_LAYOUT_COLUMN_WIDTH_PERCENT = 5;
|
|
5
|
+
export declare const DEFAULT_LAYOUT_COLUMN_VALIGN: Valign;
|
|
4
6
|
export declare const EVEN_DISTRIBUTED_COL_WIDTHS: {
|
|
5
7
|
[key: number]: number;
|
|
6
8
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-layout",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.0",
|
|
4
4
|
"description": "Layout plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"atlaskit:src": "src/index.ts",
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@atlaskit/adf-schema": "^
|
|
32
|
+
"@atlaskit/adf-schema": "^54.0.0",
|
|
33
33
|
"@atlaskit/css": "^0.19.0",
|
|
34
34
|
"@atlaskit/editor-plugin-analytics": "^11.0.0",
|
|
35
35
|
"@atlaskit/editor-plugin-block-controls": "^12.3.0",
|
|
@@ -50,14 +50,14 @@
|
|
|
50
50
|
"@atlaskit/icon": "^35.4.0",
|
|
51
51
|
"@atlaskit/icon-lab": "^6.13.0",
|
|
52
52
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
53
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
53
|
+
"@atlaskit/tmp-editor-statsig": "^99.0.0",
|
|
54
54
|
"@atlaskit/tokens": "^13.3.0",
|
|
55
55
|
"@babel/runtime": "^7.0.0",
|
|
56
56
|
"@emotion/react": "^11.7.1",
|
|
57
57
|
"bind-event-listener": "^3.0.0"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
60
|
-
"@atlaskit/editor-common": "^115.
|
|
60
|
+
"@atlaskit/editor-common": "^115.13.0",
|
|
61
61
|
"react": "^18.2.0",
|
|
62
62
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
63
63
|
},
|