@atlaskit/editor-plugin-block-controls 3.3.12 → 3.3.14
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/editor-commands/move-node.js +19 -2
- package/dist/cjs/editor-commands/move-to-layout.js +16 -60
- package/dist/cjs/pm-plugins/handle-mouse-over.js +1 -1
- package/dist/cjs/pm-plugins/main.js +1 -1
- package/dist/cjs/pm-plugins/utils/drag-handle-positions.js +2 -7
- package/dist/cjs/pm-plugins/utils/validation.js +43 -11
- package/dist/cjs/ui/drag-handle.js +2 -4
- package/dist/cjs/ui/drag-preview.js +8 -19
- package/dist/cjs/ui/drop-target-layout.js +9 -15
- package/dist/cjs/ui/global-styles.js +1 -2
- package/dist/cjs/ui/inline-drop-target.js +9 -15
- package/dist/es2019/editor-commands/move-node.js +21 -4
- package/dist/es2019/editor-commands/move-to-layout.js +5 -51
- package/dist/es2019/pm-plugins/handle-mouse-over.js +1 -1
- package/dist/es2019/pm-plugins/main.js +1 -1
- package/dist/es2019/pm-plugins/utils/drag-handle-positions.js +2 -7
- package/dist/es2019/pm-plugins/utils/validation.js +39 -9
- package/dist/es2019/ui/drag-handle.js +2 -4
- package/dist/es2019/ui/drag-preview.js +9 -20
- package/dist/es2019/ui/drop-target-layout.js +10 -16
- package/dist/es2019/ui/global-styles.js +1 -2
- package/dist/es2019/ui/inline-drop-target.js +10 -16
- package/dist/esm/editor-commands/move-node.js +21 -4
- package/dist/esm/editor-commands/move-to-layout.js +18 -62
- package/dist/esm/pm-plugins/handle-mouse-over.js +1 -1
- package/dist/esm/pm-plugins/main.js +1 -1
- package/dist/esm/pm-plugins/utils/drag-handle-positions.js +2 -7
- package/dist/esm/pm-plugins/utils/validation.js +42 -10
- package/dist/esm/ui/drag-handle.js +2 -4
- package/dist/esm/ui/drag-preview.js +9 -20
- package/dist/esm/ui/drop-target-layout.js +9 -15
- package/dist/esm/ui/global-styles.js +1 -2
- package/dist/esm/ui/inline-drop-target.js +9 -15
- package/dist/types/pm-plugins/utils/validation.d.ts +2 -1
- package/dist/types-ts4.5/pm-plugins/utils/validation.d.ts +2 -1
- package/package.json +7 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-block-controls
|
|
2
2
|
|
|
3
|
+
## 3.3.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 3.3.13
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#126772](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/126772)
|
|
14
|
+
[`c64847bdf13d4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c64847bdf13d4) -
|
|
15
|
+
[ED-27001] This change is cleaning up the feature gate for a drag and drop bugfix to update the
|
|
16
|
+
drag preview for extensions with iFrames.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 3.3.12
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -88,6 +88,10 @@ var isDragLayoutColumnToTopLevel = function isDragLayoutColumnToTopLevel($from,
|
|
|
88
88
|
var _$from$nodeAfter;
|
|
89
89
|
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;
|
|
90
90
|
};
|
|
91
|
+
var isDragLayoutColumnIntoTable = function isDragLayoutColumnIntoTable($from, $to) {
|
|
92
|
+
var _$from$nodeAfter2;
|
|
93
|
+
return ((_$from$nodeAfter2 = $from.nodeAfter) === null || _$from$nodeAfter2 === void 0 ? void 0 : _$from$nodeAfter2.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && ($to.parent.type.name === 'tableCell' || $to.parent.type.name === 'tableHeader');
|
|
94
|
+
};
|
|
91
95
|
|
|
92
96
|
/**
|
|
93
97
|
*
|
|
@@ -376,12 +380,25 @@ var moveNode = exports.moveNode = function moveNode(api) {
|
|
|
376
380
|
var destType = $to.node().type;
|
|
377
381
|
var destParent = $to.node($to.depth);
|
|
378
382
|
var sourceNode = $handlePos.nodeAfter;
|
|
383
|
+
var dragLayoutColumnToTopLevel = isDragLayoutColumnToTopLevel($handlePos, $to);
|
|
384
|
+
var dragLayoutColumnIntoTable = isDragLayoutColumnIntoTable($handlePos, $to);
|
|
379
385
|
|
|
380
386
|
//TODO: ED-26959 - Does this need to be updated with new selection logic above? ^
|
|
381
387
|
// Move a layout column to top level
|
|
382
|
-
|
|
388
|
+
// Move a layout column into a table cell, only moves the content into the cell
|
|
389
|
+
if (sourceNode && (dragLayoutColumnToTopLevel || dragLayoutColumnIntoTable)) {
|
|
383
390
|
// need update after we support single column layout.
|
|
384
|
-
var
|
|
391
|
+
var layoutColumnContent = sourceNode.content;
|
|
392
|
+
var fragment;
|
|
393
|
+
if (dragLayoutColumnIntoTable) {
|
|
394
|
+
var contentContainsExpand = (0, _utils2.findChildrenByType)(sourceNode, expand).length > 0;
|
|
395
|
+
fragment = contentContainsExpand ? (0, _validation.transformFragmentExpandToNestedExpand)(_model.Fragment.from(layoutColumnContent)) : _model.Fragment.from(layoutColumnContent);
|
|
396
|
+
if (!fragment) {
|
|
397
|
+
return tr;
|
|
398
|
+
}
|
|
399
|
+
} else {
|
|
400
|
+
fragment = _model.Fragment.from(layoutColumnContent);
|
|
401
|
+
}
|
|
385
402
|
(0, _removeFromSource.removeFromSource)(tr, $handlePos, $handlePos.pos + sourceNode.nodeSize);
|
|
386
403
|
var _mappedTo = tr.mapping.map(to);
|
|
387
404
|
tr.insert(_mappedTo, fragment).setSelection(_state.Selection.near(tr.doc.resolve(_mappedTo))).scrollIntoView();
|
|
@@ -15,7 +15,6 @@ var _checkFragment = require("../pm-plugins/utils/check-fragment");
|
|
|
15
15
|
var _consts = require("../pm-plugins/utils/consts");
|
|
16
16
|
var _removeFromSource = require("../pm-plugins/utils/remove-from-source");
|
|
17
17
|
var _selection = require("../pm-plugins/utils/selection");
|
|
18
|
-
var _updateColumnWidths = require("../pm-plugins/utils/update-column-widths");
|
|
19
18
|
var _validation = require("../pm-plugins/utils/validation");
|
|
20
19
|
var _consts2 = require("../ui/consts");
|
|
21
20
|
var createNewLayout = function createNewLayout(schema, layoutContents) {
|
|
@@ -70,20 +69,14 @@ var moveToExistingLayout = function moveToExistingLayout(toLayout, toLayoutPos,
|
|
|
70
69
|
tr.delete(from, sourceContentEndPos);
|
|
71
70
|
var mappedTo = tr.mapping.map(to);
|
|
72
71
|
tr.insert(mappedTo, sourceContent);
|
|
73
|
-
if (
|
|
72
|
+
if (selectMovedNode) {
|
|
74
73
|
tr.setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
75
74
|
}
|
|
76
75
|
(0, _analytics2.attachMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf === void 0 ? void 0 : _$originalFrom$nodeAf.type.name) || '', 1, 'layoutSection', true, api, sourceNodeTypes, hasSelectedMultipleNodes);
|
|
77
76
|
} else if (toLayout.childCount < (0, _consts.maxLayoutColumnSupported)()) {
|
|
78
77
|
var _$originalFrom$nodeAf2;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
insertToDestinationNoWidthUpdate(tr, tr.mapping.map(to), sourceContent);
|
|
82
|
-
} else {
|
|
83
|
-
insertToDestination(tr, to, sourceContent, toLayout, toLayoutPos);
|
|
84
|
-
var mappedFrom = tr.mapping.map(from);
|
|
85
|
-
(0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(mappedFrom), tr.mapping.map(sourceContentEndPos));
|
|
86
|
-
}
|
|
78
|
+
(0, _removeFromSource.removeFromSource)(tr, tr.doc.resolve(from), sourceContentEndPos);
|
|
79
|
+
insertToDestinationNoWidthUpdate(tr, tr.mapping.map(to), sourceContent);
|
|
87
80
|
(0, _analytics2.attachMoveNodeAnalytics)(tr, _analytics.INPUT_METHOD.DRAG_AND_DROP, $originalFrom.depth, ((_$originalFrom$nodeAf2 = $originalFrom.nodeAfter) === null || _$originalFrom$nodeAf2 === void 0 ? void 0 : _$originalFrom$nodeAf2.type.name) || '', 1, 'layoutSection', false, api, sourceNodeTypes, hasSelectedMultipleNodes);
|
|
88
81
|
}
|
|
89
82
|
return tr;
|
|
@@ -128,40 +121,6 @@ var insertToDestinationNoWidthUpdate = function insertToDestinationNoWidthUpdate
|
|
|
128
121
|
}
|
|
129
122
|
return tr;
|
|
130
123
|
};
|
|
131
|
-
var insertToDestination = function insertToDestination(tr, to, sourceContent, toLayout, toLayoutPos) {
|
|
132
|
-
var _ref3 = (0, _updateColumnWidths.updateColumnWidths)(tr, toLayout, toLayoutPos, toLayout.childCount + 1) || {},
|
|
133
|
-
newColumnWidth = _ref3.newColumnWidth;
|
|
134
|
-
var _ref4 = tr.doc.type.schema.nodes || {},
|
|
135
|
-
layoutColumn = _ref4.layoutColumn;
|
|
136
|
-
var content = null;
|
|
137
|
-
try {
|
|
138
|
-
if ((0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true)) {
|
|
139
|
-
if (sourceContent instanceof _model.Fragment) {
|
|
140
|
-
var _sourceContent$firstC;
|
|
141
|
-
content = layoutColumn.createChecked({
|
|
142
|
-
width: newColumnWidth
|
|
143
|
-
}, (0, _checkFragment.isFragmentOfType)(sourceContent, 'layoutColumn') ? (_sourceContent$firstC = sourceContent.firstChild) === null || _sourceContent$firstC === void 0 ? void 0 : _sourceContent$firstC.content : sourceContent);
|
|
144
|
-
}
|
|
145
|
-
} else {
|
|
146
|
-
if (sourceContent instanceof _model.Node) {
|
|
147
|
-
content = layoutColumn.createChecked({
|
|
148
|
-
width: newColumnWidth
|
|
149
|
-
}, sourceContent.type.name === 'layoutColumn' ? sourceContent.content : sourceContent);
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
} catch (error) {
|
|
153
|
-
(0, _monitoring.logException)(error, {
|
|
154
|
-
location: 'editor-plugin-block-controls/move-to-layout'
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
if (content) {
|
|
158
|
-
tr.insert(to, content);
|
|
159
|
-
}
|
|
160
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
161
|
-
tr.setSelection(new _state.NodeSelection(tr.doc.resolve(to))).scrollIntoView();
|
|
162
|
-
}
|
|
163
|
-
return tr;
|
|
164
|
-
};
|
|
165
124
|
|
|
166
125
|
/**
|
|
167
126
|
* Check if the node at `from` can be moved to node at `to` to create/expand a layout.
|
|
@@ -171,10 +130,10 @@ var canMoveToLayout = function canMoveToLayout(api, from, to, tr, moveNodeAtCurs
|
|
|
171
130
|
if (from === to) {
|
|
172
131
|
return;
|
|
173
132
|
}
|
|
174
|
-
var
|
|
175
|
-
layoutSection =
|
|
176
|
-
layoutColumn =
|
|
177
|
-
doc =
|
|
133
|
+
var _ref3 = tr.doc.type.schema.nodes || {},
|
|
134
|
+
layoutSection = _ref3.layoutSection,
|
|
135
|
+
layoutColumn = _ref3.layoutColumn,
|
|
136
|
+
doc = _ref3.doc;
|
|
178
137
|
|
|
179
138
|
// layout plugin does not exist
|
|
180
139
|
if (!layoutSection || !layoutColumn) {
|
|
@@ -224,8 +183,8 @@ var canMoveToLayout = function canMoveToLayout(api, from, to, tr, moveNodeAtCurs
|
|
|
224
183
|
};
|
|
225
184
|
var removeBreakoutMarks = function removeBreakoutMarks(tr, $from, to) {
|
|
226
185
|
var fromContentWithoutBreakout = $from.nodeAfter;
|
|
227
|
-
var
|
|
228
|
-
breakout =
|
|
186
|
+
var _ref4 = tr.doc.type.schema.marks || {},
|
|
187
|
+
breakout = _ref4.breakout;
|
|
229
188
|
if ((0, _experiments.editorExperiment)('platform_editor_element_drag_and_drop_multiselect', true)) {
|
|
230
189
|
tr.doc.nodesBetween($from.pos, to, function (node, pos, parent) {
|
|
231
190
|
// breakout doesn't exist on nested nodes
|
|
@@ -288,8 +247,8 @@ var getBreakoutMode = function getBreakoutMode(content, breakout) {
|
|
|
288
247
|
// source content variable that has type of `PMNode | Fragment` should be updated to `Fragment` only
|
|
289
248
|
var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
290
249
|
return function (from, to, options) {
|
|
291
|
-
return function (
|
|
292
|
-
var tr =
|
|
250
|
+
return function (_ref5) {
|
|
251
|
+
var tr = _ref5.tr;
|
|
293
252
|
if (!api) {
|
|
294
253
|
return tr;
|
|
295
254
|
}
|
|
@@ -302,11 +261,11 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
302
261
|
sourceContent = canMove.sourceContent,
|
|
303
262
|
$sourceFrom = canMove.$sourceFrom,
|
|
304
263
|
sourceTo = canMove.sourceTo;
|
|
305
|
-
var
|
|
306
|
-
layoutSection =
|
|
307
|
-
layoutColumn =
|
|
308
|
-
var
|
|
309
|
-
breakout =
|
|
264
|
+
var _ref6 = tr.doc.type.schema.nodes || {},
|
|
265
|
+
layoutSection = _ref6.layoutSection,
|
|
266
|
+
layoutColumn = _ref6.layoutColumn;
|
|
267
|
+
var _ref7 = tr.doc.type.schema.marks || {},
|
|
268
|
+
breakout = _ref7.breakout;
|
|
310
269
|
|
|
311
270
|
// get breakout mode from destination node,
|
|
312
271
|
// if not found, get from source node,
|
|
@@ -364,9 +323,6 @@ var moveToLayout = exports.moveToLayout = function moveToLayout(api) {
|
|
|
364
323
|
tr = (0, _removeFromSource.removeFromSource)(tr, $sourceFrom, sourceTo);
|
|
365
324
|
var mappedTo = tr.mapping.map(to);
|
|
366
325
|
tr.delete(mappedTo, mappedTo + toNodeWithoutBreakout.nodeSize).insert(mappedTo, newLayout);
|
|
367
|
-
if (!(0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
368
|
-
tr.setSelection(new _state.NodeSelection(tr.doc.resolve(mappedTo))).scrollIntoView();
|
|
369
|
-
}
|
|
370
326
|
breakoutMode && tr.setNodeMarkup(mappedTo, newLayout.type, newLayout.attrs, [breakout.create({
|
|
371
327
|
mode: breakoutMode
|
|
372
328
|
})]);
|
|
@@ -46,7 +46,7 @@ var handleMouseOver = exports.handleMouseOver = function handleMouseOver(view, e
|
|
|
46
46
|
}
|
|
47
47
|
var parentElement = (_rootElement$parentEl = rootElement.parentElement) === null || _rootElement$parentEl === void 0 ? void 0 : _rootElement$parentEl.closest('[data-drag-handler-anchor-name]');
|
|
48
48
|
var parentElementType = parentElement === null || parentElement === void 0 ? void 0 : parentElement.getAttribute('data-drag-handler-node-type');
|
|
49
|
-
if ((0, _experiments.editorExperiment)('advanced_layouts', true)
|
|
49
|
+
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
50
50
|
// We want to exclude handles from showing for direct descendant of table nodes (i.e. nodes in cells)
|
|
51
51
|
if (parentElement && (parentElementType === 'table' || parentElementType === 'tableRow') && (0, _experiments.editorExperiment)('nested-dnd', true)) {
|
|
52
52
|
rootElement = parentElement;
|
|
@@ -642,7 +642,7 @@ var createPlugin = exports.createPlugin = function createPlugin(api, getIntl, no
|
|
|
642
642
|
// Currently we can only drag one node at a time
|
|
643
643
|
// so we only need to check first child
|
|
644
644
|
var draggable = dragging === null || dragging === void 0 ? void 0 : dragging.slice.content.firstChild;
|
|
645
|
-
if (dndDragCancelled && isMultiSelectEnabled || (draggable === null || draggable === void 0 ? void 0 : draggable.type.name) === 'layoutColumn'
|
|
645
|
+
if (dndDragCancelled && isMultiSelectEnabled || (draggable === null || draggable === void 0 ? void 0 : draggable.type.name) === 'layoutColumn') {
|
|
646
646
|
// we prevent native DnD for layoutColumn to prevent single column layout.
|
|
647
647
|
event.preventDefault();
|
|
648
648
|
return false;
|
|
@@ -4,24 +4,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getTopPosition = exports.getLeftPosition = void 0;
|
|
7
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
7
|
var _consts = require("../../ui/consts");
|
|
9
8
|
var getTopPosition = exports.getTopPosition = function getTopPosition(dom, type) {
|
|
10
9
|
if (!dom) {
|
|
11
10
|
return 'auto';
|
|
12
11
|
}
|
|
13
12
|
var table = dom.querySelector('table');
|
|
14
|
-
var isTable =
|
|
13
|
+
var isTable = table && (!type || type === 'table');
|
|
15
14
|
if (isTable) {
|
|
16
15
|
return "".concat(dom.offsetTop + ((table === null || table === void 0 ? void 0 : table.offsetTop) || 0), "px");
|
|
17
16
|
} else if (type === 'rule') {
|
|
18
17
|
return "".concat(dom.offsetTop - _consts.DRAG_HANDLE_DIVIDER_TOP_ADJUSTMENT, "px");
|
|
19
18
|
} else if (type === 'layoutColumn') {
|
|
20
|
-
|
|
21
|
-
return "".concat(-dom.offsetTop / 2, "px");
|
|
22
|
-
} else {
|
|
23
|
-
return "".concat(-_consts.DRAG_HANDLE_WIDTH, "px");
|
|
24
|
-
}
|
|
19
|
+
return "".concat(-dom.offsetTop / 2, "px");
|
|
25
20
|
} else if (type === 'heading-1') {
|
|
26
21
|
return "".concat(dom.offsetTop + _consts.DRAG_HANDLE_H1_TOP_ADJUSTMENT, "px");
|
|
27
22
|
} else if (type === 'heading-2') {
|
|
@@ -6,10 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.canMoveNodeToIndex = canMoveNodeToIndex;
|
|
8
8
|
exports.canMoveSliceToIndex = canMoveSliceToIndex;
|
|
9
|
-
exports.transformSliceExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isLayoutColumn = exports.isInsideTable = exports.isInSameLayout = exports.isExpand = exports.isDoc = void 0;
|
|
9
|
+
exports.transformSliceExpandToNestedExpand = exports.transformFragmentExpandToNestedExpand = exports.transformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = exports.isNestedExpand = exports.isLayoutColumn = exports.isInsideTable = exports.isInSameLayout = exports.isExpand = exports.isDoc = void 0;
|
|
10
10
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
11
11
|
var _nesting = require("@atlaskit/editor-common/nesting");
|
|
12
12
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
13
|
+
var _utils = require("@atlaskit/editor-prosemirror/utils");
|
|
13
14
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
15
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
15
16
|
var isInsideTable = exports.isInsideTable = function isInsideTable(nodeType) {
|
|
@@ -54,10 +55,10 @@ var transformExpandToNestedExpand = exports.transformExpandToNestedExpand = func
|
|
|
54
55
|
}
|
|
55
56
|
return null;
|
|
56
57
|
};
|
|
57
|
-
var
|
|
58
|
+
var transformFragmentExpandToNestedExpand = exports.transformFragmentExpandToNestedExpand = function transformFragmentExpandToNestedExpand(fragment) {
|
|
58
59
|
var children = [];
|
|
59
60
|
try {
|
|
60
|
-
|
|
61
|
+
fragment.forEach(function (node) {
|
|
61
62
|
if (isExpand(node.type)) {
|
|
62
63
|
var nestedExpandNode = transformExpandToNestedExpand(node);
|
|
63
64
|
if (nestedExpandNode) {
|
|
@@ -70,7 +71,14 @@ var transformSliceExpandToNestedExpand = exports.transformSliceExpandToNestedExp
|
|
|
70
71
|
} catch (e) {
|
|
71
72
|
return null;
|
|
72
73
|
}
|
|
73
|
-
return
|
|
74
|
+
return _model.Fragment.fromArray(children);
|
|
75
|
+
};
|
|
76
|
+
var transformSliceExpandToNestedExpand = exports.transformSliceExpandToNestedExpand = function transformSliceExpandToNestedExpand(slice) {
|
|
77
|
+
var fragment = transformFragmentExpandToNestedExpand(slice.content);
|
|
78
|
+
if (!fragment) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return new _model.Slice(fragment, slice.openStart, slice.openEnd);
|
|
74
82
|
};
|
|
75
83
|
var memoizedTransformExpandToNestedExpand = exports.memoizedTransformExpandToNestedExpand = (0, _memoizeOne.default)(function (node) {
|
|
76
84
|
try {
|
|
@@ -83,11 +91,40 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos,
|
|
|
83
91
|
var srcNodeType = srcNode.type;
|
|
84
92
|
var parentNodeType = destParent === null || destParent === void 0 ? void 0 : destParent.type.name;
|
|
85
93
|
var activeNodeType = srcNode === null || srcNode === void 0 ? void 0 : srcNode.type.name;
|
|
94
|
+
var isNestingTablesSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
|
|
95
|
+
exposure: true
|
|
96
|
+
});
|
|
97
|
+
var tableNodeType = srcNode.type.schema.nodes.table;
|
|
98
|
+
var expandNodeType = srcNode.type.schema.nodes.expand;
|
|
86
99
|
if (activeNodeType === 'layoutColumn' && (0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
87
100
|
// Allow drag layout column and drop into layout section
|
|
88
101
|
if ((destNode === null || destNode === void 0 ? void 0 : destNode.type.name) === 'layoutSection' || parentNodeType === 'doc') {
|
|
89
102
|
return true;
|
|
90
103
|
}
|
|
104
|
+
if ((parentNodeType === 'tableCell' || parentNodeType === 'tableHeader') && (0, _platformFeatureFlags.fg)('platform_editor_drag_layout_column_into_nodes')) {
|
|
105
|
+
var maybeExpandNodesArray = (0, _utils.findChildrenByType)(srcNode, expandNodeType);
|
|
106
|
+
var layoutColumnContainExpand = maybeExpandNodesArray.length > 0;
|
|
107
|
+
var layoutColumnContainTable = (0, _utils.findChildrenByType)(srcNode, tableNodeType).length > 0;
|
|
108
|
+
|
|
109
|
+
// when layout column content does not contain table, allow to drop into table cell
|
|
110
|
+
if (!layoutColumnContainTable) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
// when layout column content contains table, but does not contain expand, allow drop into table cell if nesting tables is supported, and the nesting depth does not exceed 1
|
|
115
|
+
if (layoutColumnContainTable && !layoutColumnContainExpand) {
|
|
116
|
+
var nestingDepth = (0, _nesting.getParentOfTypeCount)(tableNodeType)($destNodePos);
|
|
117
|
+
return isNestingTablesSupported && nestingDepth <= 1;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// when layout column content contains an expand, and there is a table inside the expand, should not allow to drop into table cell
|
|
121
|
+
if (layoutColumnContainTable && layoutColumnContainExpand) {
|
|
122
|
+
var isAnyTableNestedInExpand = maybeExpandNodesArray.some(function (result) {
|
|
123
|
+
return (0, _utils.findChildrenByType)(result.node, tableNodeType).length > 0;
|
|
124
|
+
});
|
|
125
|
+
return !isAnyTableNestedInExpand;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
91
128
|
}
|
|
92
129
|
|
|
93
130
|
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
@@ -97,16 +134,11 @@ function canMoveNodeToIndex(destParent, indexIntoParent, srcNode, $destNodePos,
|
|
|
97
134
|
}
|
|
98
135
|
}
|
|
99
136
|
|
|
100
|
-
// Place experiments here instead of just inside move-node.ts as it stops the drag marker from appearing.
|
|
101
|
-
var isNestingTablesSupported = (0, _platformFeatureFlags.fg)('platform_editor_use_nested_table_pm_nodes') && (0, _experiments.editorExperiment)('nested-tables-in-tables', true, {
|
|
102
|
-
exposure: true
|
|
103
|
-
});
|
|
104
|
-
|
|
105
137
|
// NOTE: this will block drop targets from showing for dragging a table into another table
|
|
106
138
|
// unless nested tables are supported and the nesting depth does not exceed 1
|
|
107
139
|
if ((parentNodeType === 'tableCell' || parentNodeType === 'tableHeader') && activeNodeType === 'table') {
|
|
108
|
-
var
|
|
109
|
-
if (!isNestingTablesSupported || isNestingTablesSupported &&
|
|
140
|
+
var _nestingDepth = (0, _nesting.getParentOfTypeCount)(tableNodeType)($destNodePos);
|
|
141
|
+
if (!isNestingTablesSupported || isNestingTablesSupported && _nestingDepth > 1) {
|
|
110
142
|
return false;
|
|
111
143
|
}
|
|
112
144
|
}
|
|
@@ -239,11 +239,9 @@ var DragHandle = exports.DragHandle = function DragHandle(_ref) {
|
|
|
239
239
|
// but ensures the preview is generated correctly.
|
|
240
240
|
var handleMouseDown = (0, _react.useCallback)(function () {
|
|
241
241
|
if ((0, _experiments.editorExperiment)('advanced_layouts', true)) {
|
|
242
|
+
var _buttonRef$current;
|
|
242
243
|
// prevent native drag and drop.
|
|
243
|
-
|
|
244
|
-
var _buttonRef$current;
|
|
245
|
-
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
246
|
-
}
|
|
244
|
+
(_buttonRef$current = buttonRef.current) === null || _buttonRef$current === void 0 || _buttonRef$current.focus();
|
|
247
245
|
if (!isLayoutColumn) {
|
|
248
246
|
return undefined;
|
|
249
247
|
}
|
|
@@ -7,31 +7,21 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.dragPreview = void 0;
|
|
8
8
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
9
|
var _browser = require("@atlaskit/editor-common/browser");
|
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
11
10
|
var _colors = require("@atlaskit/theme/colors");
|
|
12
|
-
var
|
|
11
|
+
var previewStyle = {
|
|
13
12
|
borderColor: "var(--ds-border, ".concat(_colors.N30, ")"),
|
|
14
13
|
borderStyle: 'solid',
|
|
15
14
|
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
16
15
|
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
17
16
|
backgroundColor: "var(--ds-skeleton-subtle, ".concat(_colors.N20, ")")
|
|
18
17
|
};
|
|
19
|
-
var previewStyleOld = {
|
|
20
|
-
borderColor: "var(--ds-border-focused, ".concat(_colors.B200, ")"),
|
|
21
|
-
borderStyle: 'solid',
|
|
22
|
-
borderRadius: "var(--ds-border-radius-100, 3px)",
|
|
23
|
-
borderWidth: "var(--ds-border-width-outline, 2px)",
|
|
24
|
-
backgroundColor: "var(--ds-blanket-selected, #388BFF14)"
|
|
25
|
-
};
|
|
26
18
|
var getPreviewContainerDimensionsForSingle = function getPreviewContainerDimensionsForSingle(dom, nodeType) {
|
|
27
19
|
var nodeContainer = dom;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
nodeContainer = iframeContainer;
|
|
34
|
-
}
|
|
20
|
+
var iframeContainer = dom.querySelector('iframe');
|
|
21
|
+
if (nodeType === 'embedCard') {
|
|
22
|
+
nodeContainer = dom.querySelector('.rich-media-item') || dom;
|
|
23
|
+
} else if (nodeType === 'extension' && iframeContainer) {
|
|
24
|
+
nodeContainer = iframeContainer;
|
|
35
25
|
}
|
|
36
26
|
var nodeContainerRect = nodeContainer.getBoundingClientRect();
|
|
37
27
|
return {
|
|
@@ -61,7 +51,6 @@ var createGenericPreview = function createGenericPreview() {
|
|
|
61
51
|
var generalPreview = document.createElement('div');
|
|
62
52
|
// ProseMirror class is required to make sure the cloned dom is styled correctly
|
|
63
53
|
generalPreview.classList.add('ProseMirror', 'block-ctrl-drag-preview');
|
|
64
|
-
var previewStyle = (0, _platformFeatureFlags.fg)('platform_editor_elements_drag_and_drop_ed_23189') ? previewStyleNew : previewStyleOld;
|
|
65
54
|
generalPreview.style.border = "".concat(previewStyle.borderWidth, " ").concat(previewStyle.borderStyle, " ").concat(previewStyle.borderColor);
|
|
66
55
|
generalPreview.style.borderRadius = previewStyle.borderRadius;
|
|
67
56
|
generalPreview.style.backgroundColor = previewStyle.backgroundColor;
|
|
@@ -85,13 +74,13 @@ var createContentPreviewElement = function createContentPreviewElement(dom, node
|
|
|
85
74
|
clonedDom.style.marginRight = '0';
|
|
86
75
|
clonedDom.style.marginBottom = nodeSpacing ? "".concat(nodeSpacing.bottom) : '0';
|
|
87
76
|
clonedDom.style.boxShadow = 'none';
|
|
88
|
-
clonedDom.style.opacity = _browser.browser.windows ? '1' :
|
|
77
|
+
clonedDom.style.opacity = _browser.browser.windows ? '1' : '0.31';
|
|
89
78
|
contentPreviewOneElement.appendChild(clonedDom);
|
|
90
79
|
return contentPreviewOneElement;
|
|
91
80
|
};
|
|
92
81
|
var isGenericPreview = function isGenericPreview(dom, nodeType) {
|
|
93
82
|
var embedCard = dom.querySelector('.embedCardView-content-wrap');
|
|
94
|
-
return
|
|
83
|
+
return nodeType === 'embedCard' || !!embedCard || nodeType === 'extension' && !!dom.querySelector('iframe');
|
|
95
84
|
};
|
|
96
85
|
var createPreviewForElement = function createPreviewForElement(dom, nodeType, nodeSpacing) {
|
|
97
86
|
var shouldBeGenericPreview = isGenericPreview(dom, nodeType);
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
15
14
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
16
15
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -81,7 +80,7 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
81
80
|
var to = getPos();
|
|
82
81
|
var mappedTo;
|
|
83
82
|
if (to !== undefined) {
|
|
84
|
-
var _api$core;
|
|
83
|
+
var _api$core, _api$core2;
|
|
85
84
|
var from = activeNode.pos;
|
|
86
85
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref2) {
|
|
87
86
|
var _api$blockControls2;
|
|
@@ -89,22 +88,17 @@ var DropTargetLayout = exports.DropTargetLayout = function DropTargetLayout(prop
|
|
|
89
88
|
api === null || api === void 0 || (_api$blockControls2 = api.blockControls) === null || _api$blockControls2 === void 0 || (_api$blockControls2 = _api$blockControls2.commands) === null || _api$blockControls2 === void 0 || _api$blockControls2.moveToLayout(from, to)({
|
|
90
89
|
tr: tr
|
|
91
90
|
});
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
91
|
+
var insertColumnStep = (0, _updateSelection.getInsertLayoutStep)(tr);
|
|
92
|
+
mappedTo = insertColumnStep === null || insertColumnStep === void 0 ? void 0 : insertColumnStep.from;
|
|
93
|
+
return tr;
|
|
94
|
+
});
|
|
95
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
|
|
96
|
+
var tr = _ref3.tr;
|
|
97
|
+
if (mappedTo !== undefined) {
|
|
98
|
+
(0, _updateSelection.updateSelection)(tr, mappedTo);
|
|
95
99
|
}
|
|
96
100
|
return tr;
|
|
97
101
|
});
|
|
98
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
99
|
-
var _api$core2;
|
|
100
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref3) {
|
|
101
|
-
var tr = _ref3.tr;
|
|
102
|
-
if (mappedTo !== undefined) {
|
|
103
|
-
(0, _updateSelection.updateSelection)(tr, mappedTo);
|
|
104
|
-
}
|
|
105
|
-
return tr;
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
102
|
}
|
|
109
103
|
}, [api, getPos, activeNode]);
|
|
110
104
|
(0, _react.useEffect)(function () {
|
|
@@ -8,7 +8,6 @@ exports.GlobalStylesWrapper = void 0;
|
|
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
9
|
var _react = require("@emotion/react");
|
|
10
10
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
11
|
var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
|
|
13
12
|
var _consts = require("./consts");
|
|
14
13
|
/**
|
|
@@ -216,6 +215,6 @@ var blockCardWithoutLayout = (0, _react.css)({
|
|
|
216
215
|
});
|
|
217
216
|
var GlobalStylesWrapper = exports.GlobalStylesWrapper = function GlobalStylesWrapper() {
|
|
218
217
|
return (0, _react.jsx)(_react.Global, {
|
|
219
|
-
styles: [globalStyles(),
|
|
218
|
+
styles: [globalStyles(), globalDnDStyle, (0, _experiments.editorExperiment)('nested-dnd', true) ? extendedHoverZoneNested() : extendedHoverZone(), withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, (0, _experiments.editorExperiment)('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, withFormatInLayoutStyleFix, withRelativePosStyle, topLevelNodeMarginStyles, (0, _experiments.editorExperiment)('nested-dnd', true) ? withAnchorNameZindexNestedStyle : withAnchorNameZindexStyle,,]
|
|
220
219
|
});
|
|
221
220
|
};
|
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
|
10
10
|
var _react = require("react");
|
|
11
11
|
var _react2 = require("@emotion/react");
|
|
12
12
|
var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
|
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
14
13
|
var _box = require("@atlaskit/pragmatic-drag-and-drop-react-drop-indicator/box");
|
|
15
14
|
var _adapter = require("@atlaskit/pragmatic-drag-and-drop/element/adapter");
|
|
16
15
|
var _colors = require("@atlaskit/theme/colors");
|
|
@@ -191,7 +190,7 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
191
190
|
var toPos = getPos();
|
|
192
191
|
var mappedTo;
|
|
193
192
|
if (activeNode && toPos !== undefined) {
|
|
194
|
-
var _api$core;
|
|
193
|
+
var _api$core, _api$core2;
|
|
195
194
|
var start = activeNode.pos;
|
|
196
195
|
var moveToEnd = position === 'right';
|
|
197
196
|
api === null || api === void 0 || (_api$core = api.core) === null || _api$core === void 0 || _api$core.actions.execute(function (_ref3) {
|
|
@@ -202,22 +201,17 @@ var InlineDropTarget = exports.InlineDropTarget = function InlineDropTarget(_ref
|
|
|
202
201
|
})({
|
|
203
202
|
tr: tr
|
|
204
203
|
});
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
204
|
+
var insertLayoutStep = (0, _updateSelection.getInsertLayoutStep)(tr);
|
|
205
|
+
mappedTo = insertLayoutStep === null || insertLayoutStep === void 0 ? void 0 : insertLayoutStep.from;
|
|
206
|
+
return tr;
|
|
207
|
+
});
|
|
208
|
+
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
|
|
209
|
+
var tr = _ref4.tr;
|
|
210
|
+
if (mappedTo !== undefined) {
|
|
211
|
+
(0, _updateSelection.updateSelection)(tr, mappedTo, moveToEnd);
|
|
208
212
|
}
|
|
209
213
|
return tr;
|
|
210
214
|
});
|
|
211
|
-
if ((0, _platformFeatureFlags.fg)('platform_editor_advanced_layouts_post_fix_patch_1')) {
|
|
212
|
-
var _api$core2;
|
|
213
|
-
api === null || api === void 0 || (_api$core2 = api.core) === null || _api$core2 === void 0 || _api$core2.actions.execute(function (_ref4) {
|
|
214
|
-
var tr = _ref4.tr;
|
|
215
|
-
if (mappedTo !== undefined) {
|
|
216
|
-
(0, _updateSelection.updateSelection)(tr, mappedTo, moveToEnd);
|
|
217
|
-
}
|
|
218
|
-
return tr;
|
|
219
|
-
});
|
|
220
|
-
}
|
|
221
215
|
}
|
|
222
216
|
}, [api, getPos, position]);
|
|
223
217
|
var hoverZoneRectStyle = (0, _react.useMemo)(function () {
|
|
@@ -6,7 +6,7 @@ import { transformSliceNestedExpandToExpand } from '@atlaskit/editor-common/tran
|
|
|
6
6
|
import { isEmptyParagraph } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
|
8
8
|
import { Selection, NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
|
-
import { findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
9
|
+
import { findChildrenByType, findParentNodeOfType, findParentNodeOfTypeClosestToPos } from '@atlaskit/editor-prosemirror/utils';
|
|
10
10
|
import { findTable, isInTable, isTableSelected } from '@atlaskit/editor-tables/utils';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
|
|
@@ -18,7 +18,7 @@ import { selectNode, setCursorPositionAtMovedNode } from '../pm-plugins/utils/ge
|
|
|
18
18
|
import { removeFromSource } from '../pm-plugins/utils/remove-from-source';
|
|
19
19
|
import { getSelectedSlicePosition } from '../pm-plugins/utils/selection';
|
|
20
20
|
import { getInsertLayoutStep, updateSelection } from '../pm-plugins/utils/update-selection';
|
|
21
|
-
import { canMoveNodeToIndex, isInsideTable, transformSliceExpandToNestedExpand } from '../pm-plugins/utils/validation';
|
|
21
|
+
import { canMoveNodeToIndex, isInsideTable, transformSliceExpandToNestedExpand, transformFragmentExpandToNestedExpand } from '../pm-plugins/utils/validation';
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* This function transforms the slice to move
|
|
@@ -81,6 +81,10 @@ const isDragLayoutColumnToTopLevel = ($from, $to) => {
|
|
|
81
81
|
var _$from$nodeAfter;
|
|
82
82
|
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;
|
|
83
83
|
};
|
|
84
|
+
const isDragLayoutColumnIntoTable = ($from, $to) => {
|
|
85
|
+
var _$from$nodeAfter2;
|
|
86
|
+
return ((_$from$nodeAfter2 = $from.nodeAfter) === null || _$from$nodeAfter2 === void 0 ? void 0 : _$from$nodeAfter2.type.name) === 'layoutColumn' && $from.parent.type.name === 'layoutSection' && ($to.parent.type.name === 'tableCell' || $to.parent.type.name === 'tableHeader');
|
|
87
|
+
};
|
|
84
88
|
|
|
85
89
|
/**
|
|
86
90
|
*
|
|
@@ -378,12 +382,25 @@ export const moveNode = api => (start, to, inputMethod = INPUT_METHOD.DRAG_AND_D
|
|
|
378
382
|
const destType = $to.node().type;
|
|
379
383
|
const destParent = $to.node($to.depth);
|
|
380
384
|
const sourceNode = $handlePos.nodeAfter;
|
|
385
|
+
const dragLayoutColumnToTopLevel = isDragLayoutColumnToTopLevel($handlePos, $to);
|
|
386
|
+
const dragLayoutColumnIntoTable = isDragLayoutColumnIntoTable($handlePos, $to);
|
|
381
387
|
|
|
382
388
|
//TODO: ED-26959 - Does this need to be updated with new selection logic above? ^
|
|
383
389
|
// Move a layout column to top level
|
|
384
|
-
|
|
390
|
+
// Move a layout column into a table cell, only moves the content into the cell
|
|
391
|
+
if (sourceNode && (dragLayoutColumnToTopLevel || dragLayoutColumnIntoTable)) {
|
|
385
392
|
// need update after we support single column layout.
|
|
386
|
-
const
|
|
393
|
+
const layoutColumnContent = sourceNode.content;
|
|
394
|
+
let fragment;
|
|
395
|
+
if (dragLayoutColumnIntoTable) {
|
|
396
|
+
const contentContainsExpand = findChildrenByType(sourceNode, expand).length > 0;
|
|
397
|
+
fragment = contentContainsExpand ? transformFragmentExpandToNestedExpand(Fragment.from(layoutColumnContent)) : Fragment.from(layoutColumnContent);
|
|
398
|
+
if (!fragment) {
|
|
399
|
+
return tr;
|
|
400
|
+
}
|
|
401
|
+
} else {
|
|
402
|
+
fragment = Fragment.from(layoutColumnContent);
|
|
403
|
+
}
|
|
387
404
|
removeFromSource(tr, $handlePos, $handlePos.pos + sourceNode.nodeSize);
|
|
388
405
|
const mappedTo = tr.mapping.map(to);
|
|
389
406
|
tr.insert(mappedTo, fragment).setSelection(Selection.near(tr.doc.resolve(mappedTo))).scrollIntoView();
|