@atlaskit/editor-plugin-block-controls 2.13.14 → 2.13.16
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 +21 -0
- package/dist/cjs/commands/move-node.js +18 -0
- package/dist/cjs/commands/move-to-layout.js +8 -35
- package/dist/cjs/ui/inline-drop-target.js +8 -2
- package/dist/cjs/utils/remove-from-source.js +26 -0
- package/dist/cjs/utils/update-column-widths.js +21 -0
- package/dist/cjs/utils/validation.js +6 -5
- package/dist/es2019/commands/move-node.js +18 -0
- package/dist/es2019/commands/move-to-layout.js +7 -34
- package/dist/es2019/ui/inline-drop-target.js +8 -2
- package/dist/es2019/utils/remove-from-source.js +20 -0
- package/dist/es2019/utils/update-column-widths.js +15 -0
- package/dist/es2019/utils/validation.js +6 -5
- package/dist/esm/commands/move-node.js +18 -0
- package/dist/esm/commands/move-to-layout.js +7 -34
- package/dist/esm/ui/inline-drop-target.js +8 -2
- package/dist/esm/utils/remove-from-source.js +20 -0
- package/dist/esm/utils/update-column-widths.js +15 -0
- package/dist/esm/utils/validation.js +6 -5
- package/dist/types/utils/remove-from-source.d.ts +3 -0
- package/dist/types/utils/update-column-widths.d.ts +6 -0
- package/dist/types-ts4.5/utils/remove-from-source.d.ts +3 -0
- package/dist/types-ts4.5/utils/update-column-widths.d.ts +6 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 2.13.16
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#165732](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165732)
|
|
8
|
+
[`55bfa121bfd1b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/55bfa121bfd1b) -
|
|
9
|
+
ED-25682 unify remove from source code and cleanup
|
|
10
|
+
- Updated dependencies
|
|
11
|
+
|
|
12
|
+
## 2.13.15
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- [#165354](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165354)
|
|
17
|
+
[`387f345afdec1`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/387f345afdec1) -
|
|
18
|
+
ED-25703 fix inline drop targert position
|
|
19
|
+
- [#162957](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/162957)
|
|
20
|
+
[`bd48c403d1fdd`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bd48c403d1fdd) -
|
|
21
|
+
ED-25059 drag layout column to top level
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 2.13.14
|
|
4
25
|
|
|
5
26
|
### Patch Changes
|
|
@@ -11,6 +11,8 @@ var _messages = require("@atlaskit/editor-common/messages");
|
|
|
11
11
|
var _selection = require("@atlaskit/editor-common/selection");
|
|
12
12
|
var _transforms = require("@atlaskit/editor-common/transforms");
|
|
13
13
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
14
|
+
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
15
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
14
16
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
15
17
|
var _utils3 = require("@atlaskit/editor-tables/utils");
|
|
16
18
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
@@ -19,6 +21,7 @@ var _consts = require("../consts");
|
|
|
19
21
|
var _main = require("../pm-plugins/main");
|
|
20
22
|
var _utils4 = require("../utils");
|
|
21
23
|
var _getSelection = require("../utils/getSelection");
|
|
24
|
+
var _removeFromSource = require("../utils/remove-from-source");
|
|
22
25
|
var _validation = require("../utils/validation");
|
|
23
26
|
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; }
|
|
24
27
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
@@ -43,6 +46,10 @@ function transformSourceSlice(nodeCopy, destType) {
|
|
|
43
46
|
}
|
|
44
47
|
return nodeCopy;
|
|
45
48
|
}
|
|
49
|
+
var isDragLayoutColumnToTopLevel = function isDragLayoutColumnToTopLevel($from, $to) {
|
|
50
|
+
var _$from$nodeAfter;
|
|
51
|
+
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && $to.depth === 0;
|
|
52
|
+
};
|
|
46
53
|
|
|
47
54
|
/**
|
|
48
55
|
*
|
|
@@ -169,6 +176,17 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
169
176
|
var $from = tr.doc.resolve(start);
|
|
170
177
|
var destType = $to.node().type;
|
|
171
178
|
var destParent = $to.node($to.depth);
|
|
179
|
+
var sourceNode = $from.nodeAfter;
|
|
180
|
+
|
|
181
|
+
// Move a layout column to top level
|
|
182
|
+
if (sourceNode && isDragLayoutColumnToTopLevel($from, $to)) {
|
|
183
|
+
// need update after we support single column layout.
|
|
184
|
+
var fragment = _model.Fragment.from(sourceNode.content);
|
|
185
|
+
(0, _removeFromSource.removeFromSource)(tr, $from);
|
|
186
|
+
var _mappedTo = tr.mapping.map(to);
|
|
187
|
+
tr.insert(_mappedTo, fragment).setSelection(_state.Selection.near(tr.doc.resolve(_mappedTo))).scrollIntoView();
|
|
188
|
+
return tr;
|
|
189
|
+
}
|
|
172
190
|
if (!(0, _validation.canMoveNodeToIndex)(destParent, $to.index(), $from.node().child($from.index()))) {
|
|
173
191
|
return tr;
|
|
174
192
|
}
|
|
@@ -8,6 +8,8 @@ var _model = require("@atlaskit/editor-prosemirror/model");
|
|
|
8
8
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
9
9
|
var _consts = require("../consts");
|
|
10
10
|
var _consts2 = require("../ui/consts");
|
|
11
|
+
var _removeFromSource = require("../utils/remove-from-source");
|
|
12
|
+
var _updateColumnWidths = require("../utils/update-column-widths");
|
|
11
13
|
var _validation = require("../utils/validation");
|
|
12
14
|
var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
13
15
|
if (layoutContents.length === 0 || layoutContents.length > (0, _consts.maxLayoutColumnSupported)()) {
|
|
@@ -33,20 +35,6 @@ var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
|
33
35
|
}
|
|
34
36
|
return null;
|
|
35
37
|
};
|
|
36
|
-
var updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount) {
|
|
37
|
-
var newColumnWidth = _consts2.DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
38
|
-
if (newColumnWidth) {
|
|
39
|
-
layoutNode.content.forEach(function (node, offset) {
|
|
40
|
-
if (node.type.name === 'layoutColumn') {
|
|
41
|
-
tr.setNodeAttribute(layoutNodePos + offset + 1, 'width', newColumnWidth);
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
return {
|
|
46
|
-
newColumnWidth: newColumnWidth,
|
|
47
|
-
tr: tr
|
|
48
|
-
};
|
|
49
|
-
};
|
|
50
38
|
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, isSameLayout) {
|
|
51
39
|
if (isSameLayout) {
|
|
52
40
|
// reorder columns
|
|
@@ -56,30 +44,12 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
56
44
|
} else if (toLayout.childCount < (0, _consts.maxLayoutColumnSupported)()) {
|
|
57
45
|
insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos);
|
|
58
46
|
var mappedFrom = tr.mapping.map(from);
|
|
59
|
-
removeFromSource(tr, tr.doc.resolve(mappedFrom));
|
|
47
|
+
(0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(mappedFrom));
|
|
60
48
|
}
|
|
61
49
|
return tr;
|
|
62
50
|
};
|
|
63
|
-
var removeFromSource = function removeFromSource(tr, $from) {
|
|
64
|
-
var sourceNode = $from.nodeAfter;
|
|
65
|
-
var sourceParent = $from.parent;
|
|
66
|
-
if (!sourceNode) {
|
|
67
|
-
return tr;
|
|
68
|
-
}
|
|
69
|
-
var sourceNodeEndPos = $from.pos + sourceNode.nodeSize;
|
|
70
|
-
if (sourceNode.type.name === 'layoutColumn') {
|
|
71
|
-
if (sourceParent.childCount === _consts.MIN_LAYOUT_COLUMN) {
|
|
72
|
-
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
73
|
-
return tr;
|
|
74
|
-
} else {
|
|
75
|
-
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
tr.delete($from.pos, sourceNodeEndPos);
|
|
79
|
-
return tr;
|
|
80
|
-
};
|
|
81
51
|
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos) {
|
|
82
|
-
var _ref2 = updateColumnWidths(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
52
|
+
var _ref2 = (0, _updateColumnWidths.updateColumnWidths)(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
83
53
|
newColumnWidth = _ref2.newColumnWidth;
|
|
84
54
|
var _ref3 = tr.doc.type.schema.nodes || {},
|
|
85
55
|
layoutColumn = _ref3.layoutColumn;
|
|
@@ -177,10 +147,13 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
177
147
|
// resolve again the source node after node updated (remove breakout marks)
|
|
178
148
|
toNodeWithoutBreakout = tr.doc.resolve(to).nodeAfter || toNode;
|
|
179
149
|
}
|
|
150
|
+
if (fromNodeWithoutBreakout.type.name === 'layoutColumn') {
|
|
151
|
+
fromNodeWithoutBreakout = fromNodeWithoutBreakout.content;
|
|
152
|
+
}
|
|
180
153
|
var layoutContents = options !== null && options !== void 0 && options.moveToEnd ? [toNodeWithoutBreakout, fromNodeWithoutBreakout] : [fromNodeWithoutBreakout, toNodeWithoutBreakout];
|
|
181
154
|
var newLayout = createNewLayout(tr.doc.type.schema, layoutContents);
|
|
182
155
|
if (newLayout) {
|
|
183
|
-
tr.
|
|
156
|
+
tr = (0, _removeFromSource.removeFromSource)(tr, $from);
|
|
184
157
|
var mappedTo = tr.mapping.map(to);
|
|
185
158
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
186
159
|
}
|
|
@@ -61,6 +61,7 @@ var getWidthOffset = function getWidthOffset(node, width, position) {
|
|
|
61
61
|
return '-12px';
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
|
+
var TABLE_NUMBERED_COLUMN_WIDTH = 42;
|
|
64
65
|
var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref) {
|
|
65
66
|
var api = _ref.api,
|
|
66
67
|
nextNode = _ref.nextNode,
|
|
@@ -92,9 +93,14 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
92
93
|
innerContainerWidth = 'max(calc(var(--ak-editor-max-container-width) - var(--ak-editor--default-gutter-padding) * 2), var(--ak-editor--line-length))';
|
|
93
94
|
}
|
|
94
95
|
} else if (nextNode.type.name === 'table' && nextNode.firstChild) {
|
|
95
|
-
var _anchorRectCache$getR;
|
|
96
96
|
var tableWidthAnchor = (0, _decorationsCommon.getNodeAnchor)(nextNode.firstChild);
|
|
97
|
-
|
|
97
|
+
var isNumberColumnEnabled = Boolean(nextNode.attrs.isNumberColumnEnabled);
|
|
98
|
+
if ((0, _anchorUtils.isAnchorSupported)()) {
|
|
99
|
+
innerContainerWidth = isNumberColumnEnabled ? "calc(anchor-size(".concat(tableWidthAnchor, " width) + ").concat(TABLE_NUMBERED_COLUMN_WIDTH, "px)") : "anchor-size(".concat(tableWidthAnchor, " width)");
|
|
100
|
+
} else {
|
|
101
|
+
var _anchorRectCache$getR;
|
|
102
|
+
innerContainerWidth = "".concat(((anchorRectCache === null || anchorRectCache === void 0 || (_anchorRectCache$getR = anchorRectCache.getRect(tableWidthAnchor)) === null || _anchorRectCache$getR === void 0 ? void 0 : _anchorRectCache$getR.width) || 0) + TABLE_NUMBERED_COLUMN_WIDTH, "px");
|
|
103
|
+
}
|
|
98
104
|
if (nextNode.attrs.width) {
|
|
99
105
|
// when the table has horizontal scroll
|
|
100
106
|
innerContainerWidth = "min(".concat(nextNode.attrs.width, "px, ").concat(innerContainerWidth, ")");
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.removeFromSource = void 0;
|
|
7
|
+
var _consts = require("../consts");
|
|
8
|
+
var _updateColumnWidths = require("./update-column-widths");
|
|
9
|
+
var removeFromSource = exports.removeFromSource = function removeFromSource(tr, $from) {
|
|
10
|
+
var sourceNode = $from.nodeAfter;
|
|
11
|
+
var sourceParent = $from.parent;
|
|
12
|
+
if (!sourceNode) {
|
|
13
|
+
return tr;
|
|
14
|
+
}
|
|
15
|
+
var sourceNodeEndPos = $from.pos + sourceNode.nodeSize;
|
|
16
|
+
if (sourceNode.type.name === 'layoutColumn') {
|
|
17
|
+
if (sourceParent.childCount === _consts.MIN_LAYOUT_COLUMN) {
|
|
18
|
+
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
19
|
+
return tr;
|
|
20
|
+
} else {
|
|
21
|
+
(0, _updateColumnWidths.updateColumnWidths)(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
tr.delete($from.pos, sourceNodeEndPos);
|
|
25
|
+
return tr;
|
|
26
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.updateColumnWidths = void 0;
|
|
7
|
+
var _consts = require("../ui/consts");
|
|
8
|
+
var updateColumnWidths = exports.updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount) {
|
|
9
|
+
var newColumnWidth = _consts.DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
10
|
+
if (newColumnWidth) {
|
|
11
|
+
layoutNode.content.forEach(function (node, offset) {
|
|
12
|
+
if (node.type.name === 'layoutColumn') {
|
|
13
|
+
tr.setNodeAttribute(layoutNodePos + offset + 1, 'width', newColumnWidth);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
newColumnWidth: newColumnWidth,
|
|
19
|
+
tr: tr
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -78,14 +78,15 @@ var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNes
|
|
|
78
78
|
}
|
|
79
79
|
});
|
|
80
80
|
function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
81
|
-
if ((0, _advancedLayoutsFlags.isPreRelease2)() &&
|
|
82
|
-
// Allow drag layout column and drop into layout section
|
|
83
|
-
srcNode.type.name === 'layoutColumn' && (destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection') {
|
|
84
|
-
return true;
|
|
85
|
-
}
|
|
86
81
|
var srcNodeType = srcNode.type;
|
|
87
82
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
88
83
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
84
|
+
if ((0, _advancedLayoutsFlags.isPreRelease2)() && activeNodeType === 'layoutColumn') {
|
|
85
|
+
// Allow drag layout column and drop into layout section
|
|
86
|
+
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' || parentNodeType === 'doc') {
|
|
87
|
+
return true;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
89
90
|
|
|
90
91
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
91
92
|
if ((0, _experiments.editorExperiment)('nest-media-and-codeblock-in-quote', false)) {
|
|
@@ -3,6 +3,8 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
|
3
3
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
4
4
|
import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
5
5
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
6
|
+
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
7
|
+
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
6
8
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
9
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
8
10
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -11,6 +13,7 @@ import { DIRECTION } from '../consts';
|
|
|
11
13
|
import { key } from '../pm-plugins/main';
|
|
12
14
|
import { getNestedNodePosition, selectNode } from '../utils';
|
|
13
15
|
import { setCursorPositionAtMovedNode } from '../utils/getSelection';
|
|
16
|
+
import { removeFromSource } from '../utils/remove-from-source';
|
|
14
17
|
import { canMoveNodeToIndex, isInsideTable, transformSliceExpandToNestedExpand } from '../utils/validation';
|
|
15
18
|
|
|
16
19
|
/**
|
|
@@ -35,6 +38,10 @@ function transformSourceSlice(nodeCopy, destType) {
|
|
|
35
38
|
}
|
|
36
39
|
return nodeCopy;
|
|
37
40
|
}
|
|
41
|
+
const isDragLayoutColumnToTopLevel = ($from, $to) => {
|
|
42
|
+
var _$from$nodeAfter;
|
|
43
|
+
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && $to.depth === 0;
|
|
44
|
+
};
|
|
38
45
|
|
|
39
46
|
/**
|
|
40
47
|
*
|
|
@@ -163,6 +170,17 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
163
170
|
const $from = tr.doc.resolve(start);
|
|
164
171
|
const destType = $to.node().type;
|
|
165
172
|
const destParent = $to.node($to.depth);
|
|
173
|
+
const sourceNode = $from.nodeAfter;
|
|
174
|
+
|
|
175
|
+
// Move a layout column to top level
|
|
176
|
+
if (sourceNode && isDragLayoutColumnToTopLevel($from, $to)) {
|
|
177
|
+
// need update after we support single column layout.
|
|
178
|
+
const fragment = Fragment.from(sourceNode.content);
|
|
179
|
+
removeFromSource(tr, $from);
|
|
180
|
+
const mappedTo = tr.mapping.map(to);
|
|
181
|
+
tr.insert(mappedTo, fragment).setSelection(Selection.near(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
182
|
+
return tr;
|
|
183
|
+
}
|
|
166
184
|
if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()))) {
|
|
167
185
|
return tr;
|
|
168
186
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { maxLayoutColumnSupported
|
|
3
|
+
import { maxLayoutColumnSupported } from '../consts';
|
|
4
4
|
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../ui/consts';
|
|
5
|
+
import { removeFromSource } from '../utils/remove-from-source';
|
|
6
|
+
import { updateColumnWidths } from '../utils/update-column-widths';
|
|
5
7
|
import { isInSameLayout } from '../utils/validation';
|
|
6
8
|
const createNewLayout = (schema, layoutContents) => {
|
|
7
9
|
if (layoutContents.length === 0 || layoutContents.length > maxLayoutColumnSupported()) {
|
|
@@ -28,20 +30,6 @@ const createNewLayout = (schema, layoutContents) => {
|
|
|
28
30
|
}
|
|
29
31
|
return null;
|
|
30
32
|
};
|
|
31
|
-
const updateColumnWidths = (tr, layoutNode, layoutNodePos, childCount) => {
|
|
32
|
-
const newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
33
|
-
if (newColumnWidth) {
|
|
34
|
-
layoutNode.content.forEach((node, offset) => {
|
|
35
|
-
if (node.type.name === 'layoutColumn') {
|
|
36
|
-
tr.setNodeAttribute(layoutNodePos + offset + 1, 'width', newColumnWidth);
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
return {
|
|
41
|
-
newColumnWidth,
|
|
42
|
-
tr
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
33
|
const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, isSameLayout) => {
|
|
46
34
|
if (isSameLayout) {
|
|
47
35
|
// reorder columns
|
|
@@ -55,24 +43,6 @@ const moveToExistingLayout = (toLayout, toLayoutPos, sourceNode, from, to, tr, i
|
|
|
55
43
|
}
|
|
56
44
|
return tr;
|
|
57
45
|
};
|
|
58
|
-
const removeFromSource = (tr, $from) => {
|
|
59
|
-
const sourceNode = $from.nodeAfter;
|
|
60
|
-
const sourceParent = $from.parent;
|
|
61
|
-
if (!sourceNode) {
|
|
62
|
-
return tr;
|
|
63
|
-
}
|
|
64
|
-
const sourceNodeEndPos = $from.pos + sourceNode.nodeSize;
|
|
65
|
-
if (sourceNode.type.name === 'layoutColumn') {
|
|
66
|
-
if (sourceParent.childCount === MIN_LAYOUT_COLUMN) {
|
|
67
|
-
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
68
|
-
return tr;
|
|
69
|
-
} else {
|
|
70
|
-
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
tr.delete($from.pos, sourceNodeEndPos);
|
|
74
|
-
return tr;
|
|
75
|
-
};
|
|
76
46
|
const insertToDestination = (tr, to, sourceNode, toLayout, toLayoutPos) => {
|
|
77
47
|
const {
|
|
78
48
|
newColumnWidth
|
|
@@ -174,10 +144,13 @@ export const moveToLayout = api => (from, to, options) => ({
|
|
|
174
144
|
// resolve again the source node after node updated (remove breakout marks)
|
|
175
145
|
toNodeWithoutBreakout = tr.doc.resolve(to).nodeAfter || toNode;
|
|
176
146
|
}
|
|
147
|
+
if (fromNodeWithoutBreakout.type.name === 'layoutColumn') {
|
|
148
|
+
fromNodeWithoutBreakout = fromNodeWithoutBreakout.content;
|
|
149
|
+
}
|
|
177
150
|
const layoutContents = options !== null && options !== void 0 && options.moveToEnd ? [toNodeWithoutBreakout, fromNodeWithoutBreakout] : [fromNodeWithoutBreakout, toNodeWithoutBreakout];
|
|
178
151
|
const newLayout = createNewLayout(tr.doc.type.schema, layoutContents);
|
|
179
152
|
if (newLayout) {
|
|
180
|
-
tr
|
|
153
|
+
tr = removeFromSource(tr, $from);
|
|
181
154
|
const mappedTo = tr.mapping.map(to);
|
|
182
155
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
183
156
|
}
|
|
@@ -52,6 +52,7 @@ const getWidthOffset = (node, width, position) => {
|
|
|
52
52
|
return '-12px';
|
|
53
53
|
}
|
|
54
54
|
};
|
|
55
|
+
const TABLE_NUMBERED_COLUMN_WIDTH = 42;
|
|
55
56
|
export const InlineDropTarget = ({
|
|
56
57
|
api,
|
|
57
58
|
nextNode,
|
|
@@ -79,9 +80,14 @@ export const InlineDropTarget = ({
|
|
|
79
80
|
innerContainerWidth = 'max(calc(var(--ak-editor-max-container-width) - var(--ak-editor--default-gutter-padding) * 2), var(--ak-editor--line-length))';
|
|
80
81
|
}
|
|
81
82
|
} else if (nextNode.type.name === 'table' && nextNode.firstChild) {
|
|
82
|
-
var _anchorRectCache$getR;
|
|
83
83
|
const tableWidthAnchor = getNodeAnchor(nextNode.firstChild);
|
|
84
|
-
|
|
84
|
+
const isNumberColumnEnabled = Boolean(nextNode.attrs.isNumberColumnEnabled);
|
|
85
|
+
if (isAnchorSupported()) {
|
|
86
|
+
innerContainerWidth = isNumberColumnEnabled ? `calc(anchor-size(${tableWidthAnchor} width) + ${TABLE_NUMBERED_COLUMN_WIDTH}px)` : `anchor-size(${tableWidthAnchor} width)`;
|
|
87
|
+
} else {
|
|
88
|
+
var _anchorRectCache$getR;
|
|
89
|
+
innerContainerWidth = `${((anchorRectCache === null || anchorRectCache === void 0 ? void 0 : (_anchorRectCache$getR = anchorRectCache.getRect(tableWidthAnchor)) === null || _anchorRectCache$getR === void 0 ? void 0 : _anchorRectCache$getR.width) || 0) + TABLE_NUMBERED_COLUMN_WIDTH}px`;
|
|
90
|
+
}
|
|
85
91
|
if (nextNode.attrs.width) {
|
|
86
92
|
// when the table has horizontal scroll
|
|
87
93
|
innerContainerWidth = `min(${nextNode.attrs.width}px, ${innerContainerWidth})`;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MIN_LAYOUT_COLUMN } from '../consts';
|
|
2
|
+
import { updateColumnWidths } from './update-column-widths';
|
|
3
|
+
export const removeFromSource = (tr, $from) => {
|
|
4
|
+
const sourceNode = $from.nodeAfter;
|
|
5
|
+
const sourceParent = $from.parent;
|
|
6
|
+
if (!sourceNode) {
|
|
7
|
+
return tr;
|
|
8
|
+
}
|
|
9
|
+
const sourceNodeEndPos = $from.pos + sourceNode.nodeSize;
|
|
10
|
+
if (sourceNode.type.name === 'layoutColumn') {
|
|
11
|
+
if (sourceParent.childCount === MIN_LAYOUT_COLUMN) {
|
|
12
|
+
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
13
|
+
return tr;
|
|
14
|
+
} else {
|
|
15
|
+
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
tr.delete($from.pos, sourceNodeEndPos);
|
|
19
|
+
return tr;
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../ui/consts';
|
|
2
|
+
export const updateColumnWidths = (tr, layoutNode, layoutNodePos, childCount) => {
|
|
3
|
+
const newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
4
|
+
if (newColumnWidth) {
|
|
5
|
+
layoutNode.content.forEach((node, offset) => {
|
|
6
|
+
if (node.type.name === 'layoutColumn') {
|
|
7
|
+
tr.setNodeAttribute(layoutNodePos + offset + 1, 'width', newColumnWidth);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
newColumnWidth,
|
|
13
|
+
tr
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -72,14 +72,15 @@ export const memoizedTransformExpandToNestedExpand = memoizeOne(node => {
|
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
75
|
-
if (isPreRelease2() &&
|
|
76
|
-
// Allow drag layout column and drop into layout section
|
|
77
|
-
srcNode.type.name === 'layoutColumn' && (destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection') {
|
|
78
|
-
return true;
|
|
79
|
-
}
|
|
80
75
|
let srcNodeType = srcNode.type;
|
|
81
76
|
const parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
82
77
|
const activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
78
|
+
if (isPreRelease2() && activeNodeType === 'layoutColumn') {
|
|
79
|
+
// Allow drag layout column and drop into layout section
|
|
80
|
+
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' || parentNodeType === 'doc') {
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
83
84
|
|
|
84
85
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
85
86
|
if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
|
|
@@ -6,6 +6,8 @@ import { blockControlsMessages } from '@atlaskit/editor-common/messages';
|
|
|
6
6
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection';
|
|
7
7
|
import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/transforms';
|
|
8
8
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
9
|
+
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
10
|
+
import { Selection } from '@atlaskit/editor-prosemirror/state';
|
|
9
11
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
10
12
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
11
13
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
@@ -14,6 +16,7 @@ import { DIRECTION } from '../consts';
|
|
|
14
16
|
import { key } from '../pm-plugins/main';
|
|
15
17
|
import { getNestedNodePosition, selectNode } from '../utils';
|
|
16
18
|
import { setCursorPositionAtMovedNode } from '../utils/getSelection';
|
|
19
|
+
import { removeFromSource } from '../utils/remove-from-source';
|
|
17
20
|
import { canMoveNodeToIndex, isInsideTable, transformSliceExpandToNestedExpand } from '../utils/validation';
|
|
18
21
|
|
|
19
22
|
/**
|
|
@@ -37,6 +40,10 @@ function transformSourceSlice(nodeCopy, destType) {
|
|
|
37
40
|
}
|
|
38
41
|
return nodeCopy;
|
|
39
42
|
}
|
|
43
|
+
var isDragLayoutColumnToTopLevel = function isDragLayoutColumnToTopLevel($from, $to) {
|
|
44
|
+
var _$from$nodeAfter;
|
|
45
|
+
return ((_$from$nodeAfter = $from.nodeAfter) === null || _$from$nodeAfter === void 0 ? void 0 : _$from$nodeAfter.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && $to.depth === 0;
|
|
46
|
+
};
|
|
40
47
|
|
|
41
48
|
/**
|
|
42
49
|
*
|
|
@@ -163,6 +170,17 @@ export var moveNode = function moveNode(api) {
|
|
|
163
170
|
var $from = tr.doc.resolve(start);
|
|
164
171
|
var destType = $to.node().type;
|
|
165
172
|
var destParent = $to.node($to.depth);
|
|
173
|
+
var sourceNode = $from.nodeAfter;
|
|
174
|
+
|
|
175
|
+
// Move a layout column to top level
|
|
176
|
+
if (sourceNode && isDragLayoutColumnToTopLevel($from, $to)) {
|
|
177
|
+
// need update after we support single column layout.
|
|
178
|
+
var fragment = Fragment.from(sourceNode.content);
|
|
179
|
+
removeFromSource(tr, $from);
|
|
180
|
+
var _mappedTo = tr.mapping.map(to);
|
|
181
|
+
tr.insert(_mappedTo, fragment).setSelection(Selection.near(tr.doc.resolve(_mappedTo))).scrollIntoView();
|
|
182
|
+
return tr;
|
|
183
|
+
}
|
|
166
184
|
if (!canMoveNodeToIndex(destParent, $to.index(), $from.node().child($from.index()))) {
|
|
167
185
|
return tr;
|
|
168
186
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
2
2
|
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
-
import { maxLayoutColumnSupported
|
|
3
|
+
import { maxLayoutColumnSupported } from '../consts';
|
|
4
4
|
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../ui/consts';
|
|
5
|
+
import { removeFromSource } from '../utils/remove-from-source';
|
|
6
|
+
import { updateColumnWidths } from '../utils/update-column-widths';
|
|
5
7
|
import { isInSameLayout } from '../utils/validation';
|
|
6
8
|
var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
7
9
|
if (layoutContents.length === 0 || layoutContents.length > maxLayoutColumnSupported()) {
|
|
@@ -27,20 +29,6 @@ var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
|
27
29
|
}
|
|
28
30
|
return null;
|
|
29
31
|
};
|
|
30
|
-
var updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount) {
|
|
31
|
-
var newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
32
|
-
if (newColumnWidth) {
|
|
33
|
-
layoutNode.content.forEach(function (node, offset) {
|
|
34
|
-
if (node.type.name === 'layoutColumn') {
|
|
35
|
-
tr.setNodeAttribute(layoutNodePos + offset + 1, 'width', newColumnWidth);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
return {
|
|
40
|
-
newColumnWidth: newColumnWidth,
|
|
41
|
-
tr: tr
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
32
|
var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos, sourceNode, from, to, tr, isSameLayout) {
|
|
45
33
|
if (isSameLayout) {
|
|
46
34
|
// reorder columns
|
|
@@ -54,24 +42,6 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
54
42
|
}
|
|
55
43
|
return tr;
|
|
56
44
|
};
|
|
57
|
-
var removeFromSource = function removeFromSource(tr, $from) {
|
|
58
|
-
var sourceNode = $from.nodeAfter;
|
|
59
|
-
var sourceParent = $from.parent;
|
|
60
|
-
if (!sourceNode) {
|
|
61
|
-
return tr;
|
|
62
|
-
}
|
|
63
|
-
var sourceNodeEndPos = $from.pos + sourceNode.nodeSize;
|
|
64
|
-
if (sourceNode.type.name === 'layoutColumn') {
|
|
65
|
-
if (sourceParent.childCount === MIN_LAYOUT_COLUMN) {
|
|
66
|
-
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
67
|
-
return tr;
|
|
68
|
-
} else {
|
|
69
|
-
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
tr.delete($from.pos, sourceNodeEndPos);
|
|
73
|
-
return tr;
|
|
74
|
-
};
|
|
75
45
|
var insertToDestination = function insertToDestination(tr, to, sourceNode, toLayout, toLayoutPos) {
|
|
76
46
|
var _ref2 = updateColumnWidths(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
77
47
|
newColumnWidth = _ref2.newColumnWidth;
|
|
@@ -171,10 +141,13 @@ export var moveToLayout = function moveToLayout(api) {
|
|
|
171
141
|
// resolve again the source node after node updated (remove breakout marks)
|
|
172
142
|
toNodeWithoutBreakout = tr.doc.resolve(to).nodeAfter || toNode;
|
|
173
143
|
}
|
|
144
|
+
if (fromNodeWithoutBreakout.type.name === 'layoutColumn') {
|
|
145
|
+
fromNodeWithoutBreakout = fromNodeWithoutBreakout.content;
|
|
146
|
+
}
|
|
174
147
|
var layoutContents = options !== null && options !== void 0 && options.moveToEnd ? [toNodeWithoutBreakout, fromNodeWithoutBreakout] : [fromNodeWithoutBreakout, toNodeWithoutBreakout];
|
|
175
148
|
var newLayout = createNewLayout(tr.doc.type.schema, layoutContents);
|
|
176
149
|
if (newLayout) {
|
|
177
|
-
tr
|
|
150
|
+
tr = removeFromSource(tr, $from);
|
|
178
151
|
var mappedTo = tr.mapping.map(to);
|
|
179
152
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout).setSelection(new NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
180
153
|
}
|
|
@@ -53,6 +53,7 @@ var getWidthOffset = function getWidthOffset(node, width, position) {
|
|
|
53
53
|
return '-12px';
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
+
var TABLE_NUMBERED_COLUMN_WIDTH = 42;
|
|
56
57
|
export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
57
58
|
var api = _ref.api,
|
|
58
59
|
nextNode = _ref.nextNode,
|
|
@@ -84,9 +85,14 @@ export var InlineDropTarget = function InlineDropTarget(_ref) {
|
|
|
84
85
|
innerContainerWidth = 'max(calc(var(--ak-editor-max-container-width) - var(--ak-editor--default-gutter-padding) * 2), var(--ak-editor--line-length))';
|
|
85
86
|
}
|
|
86
87
|
} else if (nextNode.type.name === 'table' && nextNode.firstChild) {
|
|
87
|
-
var _anchorRectCache$getR;
|
|
88
88
|
var tableWidthAnchor = getNodeAnchor(nextNode.firstChild);
|
|
89
|
-
|
|
89
|
+
var isNumberColumnEnabled = Boolean(nextNode.attrs.isNumberColumnEnabled);
|
|
90
|
+
if (isAnchorSupported()) {
|
|
91
|
+
innerContainerWidth = isNumberColumnEnabled ? "calc(anchor-size(".concat(tableWidthAnchor, " width) + ").concat(TABLE_NUMBERED_COLUMN_WIDTH, "px)") : "anchor-size(".concat(tableWidthAnchor, " width)");
|
|
92
|
+
} else {
|
|
93
|
+
var _anchorRectCache$getR;
|
|
94
|
+
innerContainerWidth = "".concat(((anchorRectCache === null || anchorRectCache === void 0 || (_anchorRectCache$getR = anchorRectCache.getRect(tableWidthAnchor)) === null || _anchorRectCache$getR === void 0 ? void 0 : _anchorRectCache$getR.width) || 0) + TABLE_NUMBERED_COLUMN_WIDTH, "px");
|
|
95
|
+
}
|
|
90
96
|
if (nextNode.attrs.width) {
|
|
91
97
|
// when the table has horizontal scroll
|
|
92
98
|
innerContainerWidth = "min(".concat(nextNode.attrs.width, "px, ").concat(innerContainerWidth, ")");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { MIN_LAYOUT_COLUMN } from '../consts';
|
|
2
|
+
import { updateColumnWidths } from './update-column-widths';
|
|
3
|
+
export var removeFromSource = function removeFromSource(tr, $from) {
|
|
4
|
+
var sourceNode = $from.nodeAfter;
|
|
5
|
+
var sourceParent = $from.parent;
|
|
6
|
+
if (!sourceNode) {
|
|
7
|
+
return tr;
|
|
8
|
+
}
|
|
9
|
+
var sourceNodeEndPos = $from.pos + sourceNode.nodeSize;
|
|
10
|
+
if (sourceNode.type.name === 'layoutColumn') {
|
|
11
|
+
if (sourceParent.childCount === MIN_LAYOUT_COLUMN) {
|
|
12
|
+
tr.delete($from.pos + 1, sourceNodeEndPos - 1);
|
|
13
|
+
return tr;
|
|
14
|
+
} else {
|
|
15
|
+
updateColumnWidths(tr, $from.parent, $from.before($from.depth), sourceParent.childCount - 1);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
tr.delete($from.pos, sourceNodeEndPos);
|
|
19
|
+
return tr;
|
|
20
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DEFAULT_COLUMN_DISTRIBUTIONS } from '../ui/consts';
|
|
2
|
+
export var updateColumnWidths = function updateColumnWidths(tr, layoutNode, layoutNodePos, childCount) {
|
|
3
|
+
var newColumnWidth = DEFAULT_COLUMN_DISTRIBUTIONS[childCount];
|
|
4
|
+
if (newColumnWidth) {
|
|
5
|
+
layoutNode.content.forEach(function (node, offset) {
|
|
6
|
+
if (node.type.name === 'layoutColumn') {
|
|
7
|
+
tr.setNodeAttribute(layoutNodePos + offset + 1, 'width', newColumnWidth);
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
return {
|
|
12
|
+
newColumnWidth: newColumnWidth,
|
|
13
|
+
tr: tr
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -70,14 +70,15 @@ export var memoizedTransformExpandToNestedExpand = memoizeOne(function (node) {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
export function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, destNode) {
|
|
73
|
-
if (isPreRelease2() &&
|
|
74
|
-
// Allow drag layout column and drop into layout section
|
|
75
|
-
srcNode.type.name === 'layoutColumn' && (destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection') {
|
|
76
|
-
return true;
|
|
77
|
-
}
|
|
78
73
|
var srcNodeType = srcNode.type;
|
|
79
74
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
80
75
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
76
|
+
if (isPreRelease2() && activeNodeType === 'layoutColumn') {
|
|
77
|
+
// Allow drag layout column and drop into layout section
|
|
78
|
+
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' || parentNodeType === 'doc') {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
81
82
|
|
|
82
83
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
83
84
|
if (editorExperiment('nest-media-and-codeblock-in-quote', false)) {
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const updateColumnWidths: (tr: Transaction, layoutNode: PMNode, layoutNodePos: number, childCount: number) => {
|
|
4
|
+
newColumnWidth: number;
|
|
5
|
+
tr: Transaction;
|
|
6
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
export declare const updateColumnWidths: (tr: Transaction, layoutNode: PMNode, layoutNodePos: number, childCount: number) => {
|
|
4
|
+
newColumnWidth: number;
|
|
5
|
+
tr: Transaction;
|
|
6
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.16",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@atlaskit/adf-schema": "^44.2.0",
|
|
34
|
-
"@atlaskit/editor-common": "^94.
|
|
34
|
+
"@atlaskit/editor-common": "^94.23.0",
|
|
35
35
|
"@atlaskit/editor-plugin-accessibility-utils": "^1.2.0",
|
|
36
36
|
"@atlaskit/editor-plugin-analytics": "^1.10.0",
|
|
37
37
|
"@atlaskit/editor-plugin-editor-disabled": "^1.3.0",
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
"@atlaskit/pragmatic-drag-and-drop-react-drop-indicator": "^1.1.0",
|
|
49
49
|
"@atlaskit/primitives": "^13.2.0",
|
|
50
50
|
"@atlaskit/theme": "^14.0.0",
|
|
51
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
51
|
+
"@atlaskit/tmp-editor-statsig": "^2.18.0",
|
|
52
52
|
"@atlaskit/tokens": "^2.2.0",
|
|
53
53
|
"@atlaskit/tooltip": "^18.9.0",
|
|
54
54
|
"@babel/runtime": "^7.0.0",
|