@atlaskit/editor-core 189.1.10 → 189.1.12
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 +13 -0
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/plugins/insert-block/index.js +3 -8
- package/dist/cjs/presets/universal.js +2 -1
- package/dist/cjs/ui/ContentStyles/index.js +8 -8
- package/dist/cjs/{plugins/layout/styles.js → ui/ContentStyles/layout.js} +1 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/plugins/insert-block/index.js +3 -8
- package/dist/es2019/presets/universal.js +2 -1
- package/dist/es2019/ui/ContentStyles/index.js +1 -1
- package/dist/es2019/{plugins/layout/styles.js → ui/ContentStyles/layout.js} +1 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/plugins/insert-block/index.js +3 -8
- package/dist/esm/presets/universal.js +2 -1
- package/dist/esm/ui/ContentStyles/index.js +1 -1
- package/dist/esm/{plugins/layout/styles.js → ui/ContentStyles/layout.js} +1 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +1 -1
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/{plugins/layout/styles.d.ts → ui/ContentStyles/layout.d.ts} +1 -1
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +1 -1
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/{plugins/layout/styles.d.ts → ui/ContentStyles/layout.d.ts} +1 -1
- package/package.json +2 -1
- package/report.api.md +1 -10
- package/tmp/api-report-tmp.d.ts +1 -10
- package/dist/cjs/plugins/layout/actions.js +0 -346
- package/dist/cjs/plugins/layout/index.js +0 -92
- package/dist/cjs/plugins/layout/pm-plugins/main.js +0 -148
- package/dist/cjs/plugins/layout/pm-plugins/plugin-key.js +0 -8
- package/dist/cjs/plugins/layout/pm-plugins/types.js +0 -5
- package/dist/cjs/plugins/layout/toolbar-messages.js +0 -39
- package/dist/cjs/plugins/layout/toolbar.js +0 -116
- package/dist/cjs/plugins/layout/types.js +0 -5
- package/dist/cjs/plugins/layout/utils.js +0 -30
- package/dist/es2019/plugins/layout/actions.js +0 -329
- package/dist/es2019/plugins/layout/index.js +0 -76
- package/dist/es2019/plugins/layout/pm-plugins/main.js +0 -142
- package/dist/es2019/plugins/layout/pm-plugins/plugin-key.js +0 -2
- package/dist/es2019/plugins/layout/pm-plugins/types.js +0 -1
- package/dist/es2019/plugins/layout/toolbar-messages.js +0 -33
- package/dist/es2019/plugins/layout/toolbar.js +0 -101
- package/dist/es2019/plugins/layout/types.js +0 -1
- package/dist/es2019/plugins/layout/utils.js +0 -1
- package/dist/esm/plugins/layout/actions.js +0 -337
- package/dist/esm/plugins/layout/index.js +0 -80
- package/dist/esm/plugins/layout/pm-plugins/main.js +0 -141
- package/dist/esm/plugins/layout/pm-plugins/plugin-key.js +0 -2
- package/dist/esm/plugins/layout/pm-plugins/types.js +0 -1
- package/dist/esm/plugins/layout/toolbar-messages.js +0 -33
- package/dist/esm/plugins/layout/toolbar.js +0 -109
- package/dist/esm/plugins/layout/types.js +0 -1
- package/dist/esm/plugins/layout/utils.js +0 -1
- package/dist/types/plugins/layout/actions.d.ts +0 -23
- package/dist/types/plugins/layout/index.d.ts +0 -16
- package/dist/types/plugins/layout/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/layout/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types/plugins/layout/pm-plugins/types.d.ts +0 -14
- package/dist/types/plugins/layout/toolbar-messages.d.ts +0 -32
- package/dist/types/plugins/layout/toolbar.d.ts +0 -6
- package/dist/types/plugins/layout/types.d.ts +0 -13
- package/dist/types/plugins/layout/utils.d.ts +0 -1
- package/dist/types-ts4.5/plugins/layout/actions.d.ts +0 -23
- package/dist/types-ts4.5/plugins/layout/index.d.ts +0 -19
- package/dist/types-ts4.5/plugins/layout/pm-plugins/main.d.ts +0 -6
- package/dist/types-ts4.5/plugins/layout/pm-plugins/plugin-key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/layout/pm-plugins/types.d.ts +0 -14
- package/dist/types-ts4.5/plugins/layout/toolbar-messages.d.ts +0 -32
- package/dist/types-ts4.5/plugins/layout/toolbar.d.ts +0 -6
- package/dist/types-ts4.5/plugins/layout/types.d.ts +0 -13
- package/dist/types-ts4.5/plugins/layout/utils.d.ts +0 -1
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { layoutColumn, layoutSection } from '@atlaskit/adf-schema';
|
|
3
|
-
import { default as createLayoutPlugin } from './pm-plugins/main';
|
|
4
|
-
import { buildToolbar } from './toolbar';
|
|
5
|
-
import { createDefaultLayoutSection, insertLayoutColumnsWithAnalytics } from './actions';
|
|
6
|
-
import { IconLayout } from '@atlaskit/editor-common/quick-insert';
|
|
7
|
-
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
8
|
-
import { messages } from '../insert-block/ui/ToolbarInsertBlock/messages';
|
|
9
|
-
import { pluginKey } from './pm-plugins/plugin-key';
|
|
10
|
-
export { pluginKey };
|
|
11
|
-
var layoutPlugin = function layoutPlugin(_ref) {
|
|
12
|
-
var _api$analytics;
|
|
13
|
-
var _ref$config = _ref.config,
|
|
14
|
-
options = _ref$config === void 0 ? {} : _ref$config,
|
|
15
|
-
api = _ref.api;
|
|
16
|
-
return {
|
|
17
|
-
name: 'layout',
|
|
18
|
-
nodes: function nodes() {
|
|
19
|
-
return [{
|
|
20
|
-
name: 'layoutSection',
|
|
21
|
-
node: layoutSection
|
|
22
|
-
}, {
|
|
23
|
-
name: 'layoutColumn',
|
|
24
|
-
node: layoutColumn
|
|
25
|
-
}];
|
|
26
|
-
},
|
|
27
|
-
pmPlugins: function pmPlugins() {
|
|
28
|
-
return [{
|
|
29
|
-
name: 'layout',
|
|
30
|
-
plugin: function plugin() {
|
|
31
|
-
return createLayoutPlugin(options);
|
|
32
|
-
}
|
|
33
|
-
}];
|
|
34
|
-
},
|
|
35
|
-
actions: {
|
|
36
|
-
insertLayoutColumns: insertLayoutColumnsWithAnalytics(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions)
|
|
37
|
-
},
|
|
38
|
-
pluginsOptions: {
|
|
39
|
-
floatingToolbar: function floatingToolbar(state, intl) {
|
|
40
|
-
var _ref2 = pluginKey.getState(state),
|
|
41
|
-
pos = _ref2.pos,
|
|
42
|
-
allowBreakout = _ref2.allowBreakout,
|
|
43
|
-
addSidebarLayouts = _ref2.addSidebarLayouts,
|
|
44
|
-
allowSingleColumnLayout = _ref2.allowSingleColumnLayout;
|
|
45
|
-
if (pos !== null) {
|
|
46
|
-
return buildToolbar(state, intl, pos, allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api);
|
|
47
|
-
}
|
|
48
|
-
return undefined;
|
|
49
|
-
},
|
|
50
|
-
quickInsert: function quickInsert(_ref3) {
|
|
51
|
-
var formatMessage = _ref3.formatMessage;
|
|
52
|
-
return [{
|
|
53
|
-
id: 'layout',
|
|
54
|
-
title: formatMessage(messages.columns),
|
|
55
|
-
description: formatMessage(messages.columnsDescription),
|
|
56
|
-
keywords: ['column', 'section'],
|
|
57
|
-
priority: 1100,
|
|
58
|
-
icon: function icon() {
|
|
59
|
-
return /*#__PURE__*/React.createElement(IconLayout, null);
|
|
60
|
-
},
|
|
61
|
-
action: function action(insert, state) {
|
|
62
|
-
var _api$analytics2;
|
|
63
|
-
var tr = insert(createDefaultLayoutSection(state));
|
|
64
|
-
api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 || (_api$analytics2 = _api$analytics2.actions) === null || _api$analytics2 === void 0 || _api$analytics2.attachAnalyticsEvent({
|
|
65
|
-
action: ACTION.INSERTED,
|
|
66
|
-
actionSubject: ACTION_SUBJECT.DOCUMENT,
|
|
67
|
-
actionSubjectId: ACTION_SUBJECT_ID.LAYOUT,
|
|
68
|
-
attributes: {
|
|
69
|
-
inputMethod: INPUT_METHOD.QUICK_INSERT
|
|
70
|
-
},
|
|
71
|
-
eventType: EVENT_TYPE.TRACK
|
|
72
|
-
})(tr);
|
|
73
|
-
return tr;
|
|
74
|
-
}
|
|
75
|
-
}];
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
};
|
|
79
|
-
};
|
|
80
|
-
export default layoutPlugin;
|
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
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; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
5
|
-
import { TextSelection, Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
-
import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
7
|
-
import { keydownHandler } from '@atlaskit/editor-prosemirror/keymap';
|
|
8
|
-
import { findParentNodeOfType, findSelectedNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
-
import { filterCommand as filter } from '@atlaskit/editor-common/utils';
|
|
10
|
-
import { createSelectionClickHandler } from '@atlaskit/editor-common/selection';
|
|
11
|
-
import { fixColumnSizes, fixColumnStructure, getSelectedLayout } from '../actions';
|
|
12
|
-
import { pluginKey } from './plugin-key';
|
|
13
|
-
export var DEFAULT_LAYOUT = 'two_equal';
|
|
14
|
-
var isWholeSelectionInsideLayoutColumn = function isWholeSelectionInsideLayoutColumn(state) {
|
|
15
|
-
// Since findParentNodeOfType doesn't check if selection.to shares the parent, we do this check ourselves
|
|
16
|
-
var fromParent = findParentNodeOfType(state.schema.nodes.layoutColumn)(state.selection);
|
|
17
|
-
if (fromParent) {
|
|
18
|
-
var isToPosInsideSameLayoutColumn = state.selection.from < fromParent.pos + fromParent.node.nodeSize;
|
|
19
|
-
return isToPosInsideSameLayoutColumn;
|
|
20
|
-
}
|
|
21
|
-
return false;
|
|
22
|
-
};
|
|
23
|
-
var moveCursorToNextColumn = function moveCursorToNextColumn(state, dispatch) {
|
|
24
|
-
var selection = state.selection;
|
|
25
|
-
var _state$schema$nodes = state.schema.nodes,
|
|
26
|
-
layoutColumn = _state$schema$nodes.layoutColumn,
|
|
27
|
-
layoutSection = _state$schema$nodes.layoutSection;
|
|
28
|
-
var section = findParentNodeOfType(layoutSection)(selection);
|
|
29
|
-
var column = findParentNodeOfType(layoutColumn)(selection);
|
|
30
|
-
if (column.node !== section.node.lastChild) {
|
|
31
|
-
var $nextColumn = state.doc.resolve(column.pos + column.node.nodeSize);
|
|
32
|
-
var shiftedSelection = TextSelection.findFrom($nextColumn, 1);
|
|
33
|
-
if (dispatch) {
|
|
34
|
-
dispatch(state.tr.setSelection(shiftedSelection));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return true;
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
// TODO: Look at memoize-one-ing this fn
|
|
41
|
-
var getNodeDecoration = function getNodeDecoration(pos, node) {
|
|
42
|
-
return [Decoration.node(pos, pos + node.nodeSize, {
|
|
43
|
-
class: 'selected'
|
|
44
|
-
})];
|
|
45
|
-
};
|
|
46
|
-
var getInitialPluginState = function getInitialPluginState(options, state) {
|
|
47
|
-
var maybeLayoutSection = findParentNodeOfType(state.schema.nodes.layoutSection)(state.selection);
|
|
48
|
-
var allowBreakout = options.allowBreakout || false;
|
|
49
|
-
var addSidebarLayouts = options.UNSAFE_addSidebarLayouts || false;
|
|
50
|
-
var allowSingleColumnLayout = options.UNSAFE_allowSingleColumnLayout || false;
|
|
51
|
-
var pos = maybeLayoutSection ? maybeLayoutSection.pos : null;
|
|
52
|
-
var selectedLayout = getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, DEFAULT_LAYOUT);
|
|
53
|
-
return {
|
|
54
|
-
pos: pos,
|
|
55
|
-
allowBreakout: allowBreakout,
|
|
56
|
-
addSidebarLayouts: addSidebarLayouts,
|
|
57
|
-
selectedLayout: selectedLayout,
|
|
58
|
-
allowSingleColumnLayout: allowSingleColumnLayout
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
export default (function (options) {
|
|
62
|
-
return new SafePlugin({
|
|
63
|
-
key: pluginKey,
|
|
64
|
-
state: {
|
|
65
|
-
init: function init(_, state) {
|
|
66
|
-
return getInitialPluginState(options, state);
|
|
67
|
-
},
|
|
68
|
-
apply: function apply(tr, pluginState, _oldState, newState) {
|
|
69
|
-
if (tr.docChanged || tr.selectionSet) {
|
|
70
|
-
var layoutSection = newState.schema.nodes.layoutSection,
|
|
71
|
-
selection = newState.selection;
|
|
72
|
-
var maybeLayoutSection = findParentNodeOfType(layoutSection)(selection) || findSelectedNodeOfType([layoutSection])(selection);
|
|
73
|
-
var newPluginState = _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
74
|
-
pos: maybeLayoutSection ? maybeLayoutSection.pos : null,
|
|
75
|
-
selectedLayout: getSelectedLayout(maybeLayoutSection && maybeLayoutSection.node, pluginState.selectedLayout)
|
|
76
|
-
});
|
|
77
|
-
return newPluginState;
|
|
78
|
-
}
|
|
79
|
-
return pluginState;
|
|
80
|
-
}
|
|
81
|
-
},
|
|
82
|
-
props: {
|
|
83
|
-
decorations: function decorations(state) {
|
|
84
|
-
var layoutState = pluginKey.getState(state);
|
|
85
|
-
if (layoutState.pos !== null) {
|
|
86
|
-
return DecorationSet.create(state.doc, getNodeDecoration(layoutState.pos, state.doc.nodeAt(layoutState.pos)));
|
|
87
|
-
}
|
|
88
|
-
return undefined;
|
|
89
|
-
},
|
|
90
|
-
handleKeyDown: keydownHandler({
|
|
91
|
-
Tab: filter(isWholeSelectionInsideLayoutColumn, moveCursorToNextColumn)
|
|
92
|
-
}),
|
|
93
|
-
handleClickOn: createSelectionClickHandler(['layoutColumn'], function (target) {
|
|
94
|
-
return target.hasAttribute('data-layout-section') || target.hasAttribute('data-layout-column');
|
|
95
|
-
}, {
|
|
96
|
-
useLongPressSelection: options.useLongPressSelection || false,
|
|
97
|
-
getNodeSelectionPos: function getNodeSelectionPos(state, nodePos) {
|
|
98
|
-
return state.doc.resolve(nodePos).before();
|
|
99
|
-
}
|
|
100
|
-
})
|
|
101
|
-
},
|
|
102
|
-
appendTransaction: function appendTransaction(transactions, _oldState, newState) {
|
|
103
|
-
var changes = [];
|
|
104
|
-
transactions.forEach(function (prevTr) {
|
|
105
|
-
// remap change segments across the transaction set
|
|
106
|
-
changes.forEach(function (change) {
|
|
107
|
-
return {
|
|
108
|
-
from: prevTr.mapping.map(change.from),
|
|
109
|
-
to: prevTr.mapping.map(change.to),
|
|
110
|
-
slice: change.slice
|
|
111
|
-
};
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
// don't consider transactions that don't mutate
|
|
115
|
-
if (!prevTr.docChanged) {
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
var change = fixColumnSizes(prevTr, newState);
|
|
119
|
-
if (change) {
|
|
120
|
-
changes.push(change);
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
if (changes.length) {
|
|
124
|
-
var tr = newState.tr;
|
|
125
|
-
var selection = newState.selection.toJSON();
|
|
126
|
-
changes.forEach(function (change) {
|
|
127
|
-
tr.replaceRange(change.from, change.to, change.slice);
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
// selecting and deleting across columns in 3 col layouts can remove
|
|
131
|
-
// a layoutColumn so we fix the structure here
|
|
132
|
-
tr = fixColumnStructure(newState) || tr;
|
|
133
|
-
if (tr.docChanged) {
|
|
134
|
-
tr.setSelection(Selection.fromJSON(tr.doc, selection));
|
|
135
|
-
return tr;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
});
|
|
141
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from 'react-intl-next';
|
|
2
|
-
export var toolbarMessages = defineMessages({
|
|
3
|
-
singleColumn: {
|
|
4
|
-
id: 'fabric.editor.single',
|
|
5
|
-
defaultMessage: 'Single column',
|
|
6
|
-
description: 'Layout with one single column'
|
|
7
|
-
},
|
|
8
|
-
twoColumns: {
|
|
9
|
-
id: 'fabric.editor.twoColumns',
|
|
10
|
-
defaultMessage: 'Two columns',
|
|
11
|
-
description: 'Layout with two columns of equal width'
|
|
12
|
-
},
|
|
13
|
-
threeColumns: {
|
|
14
|
-
id: 'fabric.editor.threeColumns',
|
|
15
|
-
defaultMessage: 'Three columns',
|
|
16
|
-
description: 'Layout with three columns of equal width'
|
|
17
|
-
},
|
|
18
|
-
rightSidebar: {
|
|
19
|
-
id: 'fabric.editor.rightSidebar',
|
|
20
|
-
defaultMessage: 'Right sidebar',
|
|
21
|
-
description: 'Layout with two columns, left column is 2/3 and right is 1/3 of page'
|
|
22
|
-
},
|
|
23
|
-
leftSidebar: {
|
|
24
|
-
id: 'fabric.editor.leftSidebar',
|
|
25
|
-
defaultMessage: 'Left sidebar',
|
|
26
|
-
description: 'Layout with two columns, left column is 1/3 and right is 2/3 of page'
|
|
27
|
-
},
|
|
28
|
-
threeColumnsWithSidebars: {
|
|
29
|
-
id: 'fabric.editor.threeColumnsWithSidebars',
|
|
30
|
-
defaultMessage: 'Three columns with sidebars',
|
|
31
|
-
description: 'Layout with 3 columns laid out as 25% - 50% - 25%'
|
|
32
|
-
}
|
|
33
|
-
});
|
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
|
|
2
|
-
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
3
|
-
import EditorLayoutSingleIcon from '@atlaskit/icon/glyph/editor/layout-single';
|
|
4
|
-
import LayoutTwoEqualIcon from '@atlaskit/icon/glyph/editor/layout-two-equal';
|
|
5
|
-
import LayoutThreeEqualIcon from '@atlaskit/icon/glyph/editor/layout-three-equal';
|
|
6
|
-
import LayoutTwoLeftSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-left-sidebar';
|
|
7
|
-
import LayoutTwoRightSidebarIcon from '@atlaskit/icon/glyph/editor/layout-two-right-sidebar';
|
|
8
|
-
import LayoutThreeWithSidebarsIcon from '@atlaskit/icon/glyph/editor/layout-three-with-sidebars';
|
|
9
|
-
import RemoveIcon from '@atlaskit/icon/glyph/editor/remove';
|
|
10
|
-
import { toolbarMessages } from './toolbar-messages';
|
|
11
|
-
import commonMessages from '../../messages';
|
|
12
|
-
import { setPresetLayout, deleteActiveLayoutNode, getPresetLayout } from './actions';
|
|
13
|
-
var LAYOUT_TYPES = [{
|
|
14
|
-
id: 'editor.layout.twoEquals',
|
|
15
|
-
type: 'two_equal',
|
|
16
|
-
title: toolbarMessages.twoColumns,
|
|
17
|
-
icon: LayoutTwoEqualIcon
|
|
18
|
-
}, {
|
|
19
|
-
id: 'editor.layout.threeEquals',
|
|
20
|
-
type: 'three_equal',
|
|
21
|
-
title: toolbarMessages.threeColumns,
|
|
22
|
-
icon: LayoutThreeEqualIcon
|
|
23
|
-
}];
|
|
24
|
-
var LAYOUT_TYPES_WITH_SINGLE_COL = [{
|
|
25
|
-
id: 'editor.layout.singeLayout',
|
|
26
|
-
type: 'single',
|
|
27
|
-
title: toolbarMessages.singleColumn,
|
|
28
|
-
icon: EditorLayoutSingleIcon
|
|
29
|
-
}].concat(LAYOUT_TYPES);
|
|
30
|
-
var SIDEBAR_LAYOUT_TYPES = [{
|
|
31
|
-
id: 'editor.layout.twoRightSidebar',
|
|
32
|
-
type: 'two_right_sidebar',
|
|
33
|
-
title: toolbarMessages.rightSidebar,
|
|
34
|
-
icon: LayoutTwoRightSidebarIcon
|
|
35
|
-
}, {
|
|
36
|
-
id: 'editor.layout.twoLeftSidebar',
|
|
37
|
-
type: 'two_left_sidebar',
|
|
38
|
-
title: toolbarMessages.leftSidebar,
|
|
39
|
-
icon: LayoutTwoLeftSidebarIcon
|
|
40
|
-
}, {
|
|
41
|
-
id: 'editor.layout.threeWithSidebars',
|
|
42
|
-
type: 'three_with_sidebars',
|
|
43
|
-
title: toolbarMessages.threeColumnsWithSidebars,
|
|
44
|
-
icon: LayoutThreeWithSidebarsIcon
|
|
45
|
-
}];
|
|
46
|
-
var buildLayoutButton = function buildLayoutButton(intl, item, currentLayout, editorAnalyticsAPI) {
|
|
47
|
-
return {
|
|
48
|
-
id: item.id,
|
|
49
|
-
type: 'button',
|
|
50
|
-
icon: item.icon,
|
|
51
|
-
testId: item.title.id,
|
|
52
|
-
title: intl.formatMessage(item.title),
|
|
53
|
-
onClick: setPresetLayout(editorAnalyticsAPI)(item.type),
|
|
54
|
-
selected: !!currentLayout && currentLayout === item.type,
|
|
55
|
-
tabIndex: null
|
|
56
|
-
};
|
|
57
|
-
};
|
|
58
|
-
export var layoutToolbarTitle = 'Layout floating controls';
|
|
59
|
-
export var buildToolbar = function buildToolbar(state, intl, pos, _allowBreakout, addSidebarLayouts, allowSingleColumnLayout, api) {
|
|
60
|
-
var _api$decorations$acti, _api$decorations, _api$analytics;
|
|
61
|
-
var _ref = (_api$decorations$acti = api === null || api === void 0 || (_api$decorations = api.decorations) === null || _api$decorations === void 0 ? void 0 : _api$decorations.actions) !== null && _api$decorations$acti !== void 0 ? _api$decorations$acti : {},
|
|
62
|
-
hoverDecoration = _ref.hoverDecoration;
|
|
63
|
-
var editorAnalyticsAPI = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions;
|
|
64
|
-
var node = state.doc.nodeAt(pos);
|
|
65
|
-
if (node) {
|
|
66
|
-
var currentLayout = getPresetLayout(node);
|
|
67
|
-
var separator = {
|
|
68
|
-
type: 'separator'
|
|
69
|
-
};
|
|
70
|
-
var nodeType = state.schema.nodes.layoutSection;
|
|
71
|
-
var deleteButton = {
|
|
72
|
-
id: 'editor.layout.delete',
|
|
73
|
-
type: 'button',
|
|
74
|
-
appearance: 'danger',
|
|
75
|
-
focusEditoronEnter: true,
|
|
76
|
-
icon: RemoveIcon,
|
|
77
|
-
testId: commonMessages.remove.id,
|
|
78
|
-
title: intl.formatMessage(commonMessages.remove),
|
|
79
|
-
onClick: deleteActiveLayoutNode(editorAnalyticsAPI),
|
|
80
|
-
onMouseEnter: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
81
|
-
onMouseLeave: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
82
|
-
onFocus: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, true),
|
|
83
|
-
onBlur: hoverDecoration === null || hoverDecoration === void 0 ? void 0 : hoverDecoration(nodeType, false),
|
|
84
|
-
tabIndex: null
|
|
85
|
-
};
|
|
86
|
-
var layoutTypes = allowSingleColumnLayout ? LAYOUT_TYPES_WITH_SINGLE_COL : LAYOUT_TYPES;
|
|
87
|
-
return {
|
|
88
|
-
title: layoutToolbarTitle,
|
|
89
|
-
getDomRef: function getDomRef(view) {
|
|
90
|
-
return findDomRefAtPos(pos, view.domAtPos.bind(view));
|
|
91
|
-
},
|
|
92
|
-
nodeType: nodeType,
|
|
93
|
-
items: [].concat(_toConsumableArray(layoutTypes.map(function (i) {
|
|
94
|
-
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
95
|
-
})), _toConsumableArray(addSidebarLayouts ? SIDEBAR_LAYOUT_TYPES.map(function (i) {
|
|
96
|
-
return buildLayoutButton(intl, i, currentLayout, editorAnalyticsAPI);
|
|
97
|
-
}) : []), [{
|
|
98
|
-
type: 'copy-button',
|
|
99
|
-
items: [separator, {
|
|
100
|
-
state: state,
|
|
101
|
-
formatMessage: intl.formatMessage,
|
|
102
|
-
nodeType: nodeType
|
|
103
|
-
}]
|
|
104
|
-
}, separator, deleteButton]),
|
|
105
|
-
scrollable: true
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return;
|
|
109
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes } from '@atlaskit/editor-common/transforms';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Command } from '../../types/command';
|
|
3
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { Change, PresetLayout } from './types';
|
|
6
|
-
import type { TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
7
|
-
export declare const ONE_COL_LAYOUTS: PresetLayout[];
|
|
8
|
-
export declare const TWO_COL_LAYOUTS: PresetLayout[];
|
|
9
|
-
export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
10
|
-
/**
|
|
11
|
-
* Finds layout preset based on the width attrs of all the layoutColumn nodes
|
|
12
|
-
* inside the layoutSection node
|
|
13
|
-
*/
|
|
14
|
-
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
|
|
15
|
-
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
|
|
16
|
-
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
|
|
17
|
-
export declare const insertLayoutColumns: Command;
|
|
18
|
-
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
|
|
19
|
-
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
|
|
20
|
-
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
|
|
21
|
-
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
|
|
22
|
-
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
|
|
23
|
-
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { insertLayoutColumnsWithAnalytics } from './actions';
|
|
3
|
-
import { pluginKey } from './pm-plugins/plugin-key';
|
|
4
|
-
import type { LayoutPluginOptions } from './types';
|
|
5
|
-
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
-
export { pluginKey };
|
|
8
|
-
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
9
|
-
pluginConfiguration: LayoutPluginOptions | undefined;
|
|
10
|
-
dependencies: [DecorationsPlugin, OptionalPlugin<AnalyticsPlugin>];
|
|
11
|
-
actions: {
|
|
12
|
-
insertLayoutColumns: ReturnType<typeof insertLayoutColumnsWithAnalytics>;
|
|
13
|
-
};
|
|
14
|
-
}>;
|
|
15
|
-
declare const layoutPlugin: LayoutPlugin;
|
|
16
|
-
export default layoutPlugin;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { LayoutState } from './types';
|
|
3
|
-
import type { LayoutPluginOptions } from '../types';
|
|
4
|
-
export declare const DEFAULT_LAYOUT = "two_equal";
|
|
5
|
-
declare const _default: (options: LayoutPluginOptions) => SafePlugin<LayoutState>;
|
|
6
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { PresetLayout } from '../types';
|
|
3
|
-
export type LayoutState = {
|
|
4
|
-
pos: number | null;
|
|
5
|
-
allowBreakout: boolean;
|
|
6
|
-
addSidebarLayouts: boolean;
|
|
7
|
-
selectedLayout: PresetLayout | undefined;
|
|
8
|
-
allowSingleColumnLayout: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type Change = {
|
|
11
|
-
from: number;
|
|
12
|
-
to: number;
|
|
13
|
-
slice: Slice;
|
|
14
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export declare const toolbarMessages: {
|
|
2
|
-
singleColumn: {
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
twoColumns: {
|
|
8
|
-
id: string;
|
|
9
|
-
defaultMessage: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
threeColumns: {
|
|
13
|
-
id: string;
|
|
14
|
-
defaultMessage: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
rightSidebar: {
|
|
18
|
-
id: string;
|
|
19
|
-
defaultMessage: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
leftSidebar: {
|
|
23
|
-
id: string;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
threeColumnsWithSidebars: {
|
|
28
|
-
id: string;
|
|
29
|
-
defaultMessage: string;
|
|
30
|
-
description: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { FloatingToolbarConfig, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { LayoutPlugin } from './';
|
|
5
|
-
export declare const layoutToolbarTitle = "Layout floating controls";
|
|
6
|
-
export declare const buildToolbar: (state: EditorState, intl: IntlShape, pos: number, _allowBreakout: boolean, addSidebarLayouts: boolean, allowSingleColumnLayout: boolean, api: ExtractInjectionAPI<LayoutPlugin> | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
3
|
-
export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
|
|
4
|
-
allowBreakout?: boolean;
|
|
5
|
-
UNSAFE_addSidebarLayouts?: boolean;
|
|
6
|
-
UNSAFE_allowSingleColumnLayout?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars';
|
|
9
|
-
export interface Change {
|
|
10
|
-
from: number;
|
|
11
|
-
to: number;
|
|
12
|
-
slice: Slice;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes, } from '@atlaskit/editor-common/transforms';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { Command } from '../../types/command';
|
|
3
|
-
import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
4
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
5
|
-
import type { Change, PresetLayout } from './types';
|
|
6
|
-
import type { TOOLBAR_MENU_TYPE } from '@atlaskit/editor-common/types';
|
|
7
|
-
export declare const ONE_COL_LAYOUTS: PresetLayout[];
|
|
8
|
-
export declare const TWO_COL_LAYOUTS: PresetLayout[];
|
|
9
|
-
export declare const THREE_COL_LAYOUTS: PresetLayout[];
|
|
10
|
-
/**
|
|
11
|
-
* Finds layout preset based on the width attrs of all the layoutColumn nodes
|
|
12
|
-
* inside the layoutSection node
|
|
13
|
-
*/
|
|
14
|
-
export declare const getPresetLayout: (section: Node) => PresetLayout | undefined;
|
|
15
|
-
export declare const getSelectedLayout: (maybeLayoutSection: Node | undefined, current: PresetLayout) => PresetLayout;
|
|
16
|
-
export declare const createDefaultLayoutSection: (state: EditorState) => Node;
|
|
17
|
-
export declare const insertLayoutColumns: Command;
|
|
18
|
-
export declare const insertLayoutColumnsWithAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (inputMethod: TOOLBAR_MENU_TYPE) => Command;
|
|
19
|
-
export declare function forceSectionToPresetLayout(state: EditorState, node: Node, pos: number, presetLayout: PresetLayout): Transaction;
|
|
20
|
-
export declare const setPresetLayout: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (layout: PresetLayout) => Command;
|
|
21
|
-
export declare const fixColumnSizes: (changedTr: Transaction, state: EditorState) => Change | undefined;
|
|
22
|
-
export declare const fixColumnStructure: (state: EditorState) => Transaction | undefined;
|
|
23
|
-
export declare const deleteActiveLayoutNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { NextEditorPlugin, OptionalPlugin } from '@atlaskit/editor-common/types';
|
|
2
|
-
import { insertLayoutColumnsWithAnalytics } from './actions';
|
|
3
|
-
import { pluginKey } from './pm-plugins/plugin-key';
|
|
4
|
-
import type { LayoutPluginOptions } from './types';
|
|
5
|
-
import type { DecorationsPlugin } from '@atlaskit/editor-plugin-decorations';
|
|
6
|
-
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
7
|
-
export { pluginKey };
|
|
8
|
-
export type LayoutPlugin = NextEditorPlugin<'layout', {
|
|
9
|
-
pluginConfiguration: LayoutPluginOptions | undefined;
|
|
10
|
-
dependencies: [
|
|
11
|
-
DecorationsPlugin,
|
|
12
|
-
OptionalPlugin<AnalyticsPlugin>
|
|
13
|
-
];
|
|
14
|
-
actions: {
|
|
15
|
-
insertLayoutColumns: ReturnType<typeof insertLayoutColumnsWithAnalytics>;
|
|
16
|
-
};
|
|
17
|
-
}>;
|
|
18
|
-
declare const layoutPlugin: LayoutPlugin;
|
|
19
|
-
export default layoutPlugin;
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
2
|
-
import type { LayoutState } from './types';
|
|
3
|
-
import type { LayoutPluginOptions } from '../types';
|
|
4
|
-
export declare const DEFAULT_LAYOUT = "two_equal";
|
|
5
|
-
declare const _default: (options: LayoutPluginOptions) => SafePlugin<LayoutState>;
|
|
6
|
-
export default _default;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { PresetLayout } from '../types';
|
|
3
|
-
export type LayoutState = {
|
|
4
|
-
pos: number | null;
|
|
5
|
-
allowBreakout: boolean;
|
|
6
|
-
addSidebarLayouts: boolean;
|
|
7
|
-
selectedLayout: PresetLayout | undefined;
|
|
8
|
-
allowSingleColumnLayout: boolean;
|
|
9
|
-
};
|
|
10
|
-
export type Change = {
|
|
11
|
-
from: number;
|
|
12
|
-
to: number;
|
|
13
|
-
slice: Slice;
|
|
14
|
-
};
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
export declare const toolbarMessages: {
|
|
2
|
-
singleColumn: {
|
|
3
|
-
id: string;
|
|
4
|
-
defaultMessage: string;
|
|
5
|
-
description: string;
|
|
6
|
-
};
|
|
7
|
-
twoColumns: {
|
|
8
|
-
id: string;
|
|
9
|
-
defaultMessage: string;
|
|
10
|
-
description: string;
|
|
11
|
-
};
|
|
12
|
-
threeColumns: {
|
|
13
|
-
id: string;
|
|
14
|
-
defaultMessage: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
rightSidebar: {
|
|
18
|
-
id: string;
|
|
19
|
-
defaultMessage: string;
|
|
20
|
-
description: string;
|
|
21
|
-
};
|
|
22
|
-
leftSidebar: {
|
|
23
|
-
id: string;
|
|
24
|
-
defaultMessage: string;
|
|
25
|
-
description: string;
|
|
26
|
-
};
|
|
27
|
-
threeColumnsWithSidebars: {
|
|
28
|
-
id: string;
|
|
29
|
-
defaultMessage: string;
|
|
30
|
-
description: string;
|
|
31
|
-
};
|
|
32
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IntlShape } from 'react-intl-next';
|
|
2
|
-
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import type { FloatingToolbarConfig, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
4
|
-
import type { LayoutPlugin } from './';
|
|
5
|
-
export declare const layoutToolbarTitle = "Layout floating controls";
|
|
6
|
-
export declare const buildToolbar: (state: EditorState, intl: IntlShape, pos: number, _allowBreakout: boolean, addSidebarLayouts: boolean, allowSingleColumnLayout: boolean, api: ExtractInjectionAPI<LayoutPlugin> | undefined) => FloatingToolbarConfig | undefined;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Slice } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/types';
|
|
3
|
-
export interface LayoutPluginOptions extends LongPressSelectionPluginOptions {
|
|
4
|
-
allowBreakout?: boolean;
|
|
5
|
-
UNSAFE_addSidebarLayouts?: boolean;
|
|
6
|
-
UNSAFE_allowSingleColumnLayout?: boolean;
|
|
7
|
-
}
|
|
8
|
-
export type PresetLayout = 'single' | 'two_equal' | 'three_equal' | 'two_right_sidebar' | 'two_left_sidebar' | 'three_with_sidebars';
|
|
9
|
-
export interface Change {
|
|
10
|
-
from: number;
|
|
11
|
-
to: number;
|
|
12
|
-
slice: Slice;
|
|
13
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { unwrapContentFromLayout, removeLayoutFromFirstChild, removeLayoutFromLastChild, transformSliceToRemoveOpenLayoutNodes, } from '@atlaskit/editor-common/transforms';
|