@atlaskit/editor-plugin-block-controls 33.0.0 → 34.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/dist/cjs/blockControlsPlugin.js +1 -2
- package/dist/cjs/editor-commands/move-node.js +1 -1
- package/dist/cjs/pm-plugins/handle-mouse-over.js +21 -33
- package/dist/cjs/pm-plugins/interaction-tracking/handle-mouse-move.js +8 -14
- package/dist/cjs/pm-plugins/interaction-tracking/pm-plugin.js +11 -24
- package/dist/cjs/pm-plugins/main.js +115 -170
- package/dist/cjs/pm-plugins/utils/getSelection.js +2 -3
- package/dist/cjs/pm-plugins/utils/transactions.js +2 -5
- package/dist/cjs/ui/global-styles.js +1 -19
- package/dist/es2019/blockControlsPlugin.js +1 -2
- package/dist/es2019/editor-commands/move-node.js +1 -1
- package/dist/es2019/pm-plugins/handle-mouse-over.js +21 -33
- package/dist/es2019/pm-plugins/interaction-tracking/handle-mouse-move.js +8 -14
- package/dist/es2019/pm-plugins/interaction-tracking/pm-plugin.js +11 -24
- package/dist/es2019/pm-plugins/main.js +85 -138
- package/dist/es2019/pm-plugins/utils/getSelection.js +2 -3
- package/dist/es2019/pm-plugins/utils/transactions.js +2 -5
- package/dist/es2019/ui/global-styles.js +1 -22
- package/dist/esm/blockControlsPlugin.js +1 -2
- package/dist/esm/editor-commands/move-node.js +1 -1
- package/dist/esm/pm-plugins/handle-mouse-over.js +21 -33
- package/dist/esm/pm-plugins/interaction-tracking/handle-mouse-move.js +8 -14
- package/dist/esm/pm-plugins/interaction-tracking/pm-plugin.js +11 -24
- package/dist/esm/pm-plugins/main.js +115 -170
- package/dist/esm/pm-plugins/utils/getSelection.js +2 -3
- package/dist/esm/pm-plugins/utils/transactions.js +2 -5
- package/dist/esm/ui/global-styles.js +1 -19
- package/dist/types/pm-plugins/main.d.ts +1 -4
- package/dist/types/pm-plugins/utils/getSelection.d.ts +1 -1
- package/dist/types/pm-plugins/utils/transactions.d.ts +1 -2
- package/package.json +25 -22
|
@@ -12,7 +12,6 @@ import { getBrowserInfo } from '@atlaskit/editor-common/browser';
|
|
|
12
12
|
import { getNodeIdProvider } from '@atlaskit/editor-common/node-anchor-provider';
|
|
13
13
|
import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
14
14
|
import { DRAG_HANDLE_SELECTOR } from '@atlaskit/editor-common/styles/drag-handle';
|
|
15
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
16
15
|
import { EDIT_AREA_ID } from '@atlaskit/editor-common/ui-toolbar';
|
|
17
16
|
import { isEmptyDocument } from '@atlaskit/editor-common/utils';
|
|
18
17
|
import { PluginKey, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
@@ -173,14 +172,14 @@ var getDecorationAtPos = function getDecorationAtPos(state, decorations, pos, to
|
|
|
173
172
|
var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
|
|
174
173
|
return nodeDecAtActivePos;
|
|
175
174
|
};
|
|
176
|
-
var _apply = function apply(api, formatMessage, tr, currentState, newState,
|
|
177
|
-
var _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _meta$toggleMenu, _meta$isDragging3, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$lastDragCancell;
|
|
178
|
-
var rightSideControlsEnabled = arguments.length >
|
|
179
|
-
var quickInsertButtonEnabled = arguments.length >
|
|
180
|
-
var anchorRectCache = arguments.length >
|
|
181
|
-
var resizeObserverWidth = arguments.length >
|
|
182
|
-
var pragmaticCleanup = arguments.length >
|
|
183
|
-
var limitedModeTeardown = arguments.length >
|
|
175
|
+
var _apply = function apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry) {
|
|
176
|
+
var _meta$multiSelectDnD, _api$editorViewMode, _activeNode, _activeNode2, _meta$activeNode$hand, _activeNode3, _activeNode4, _meta$isDragging2, _latestActiveNode11, _latestActiveNode12, _meta$toggleMenu, _meta$isDragging3, _meta$toggleMenu2, _meta$toggleMenu3, _meta$toggleMenu4, _meta$toggleMenu5, _meta$toggleMenu6, _meta$toggleMenu7, _meta$toggleMenu8, _meta$editorHeight, _meta$editorWidthLeft, _meta$editorWidthRigh, _meta$isPMDragging, _meta$lastDragCancell;
|
|
177
|
+
var rightSideControlsEnabled = arguments.length > 7 && arguments[7] !== undefined ? arguments[7] : false;
|
|
178
|
+
var quickInsertButtonEnabled = arguments.length > 8 && arguments[8] !== undefined ? arguments[8] : true;
|
|
179
|
+
var anchorRectCache = arguments.length > 9 ? arguments[9] : undefined;
|
|
180
|
+
var resizeObserverWidth = arguments.length > 10 ? arguments[10] : undefined;
|
|
181
|
+
var pragmaticCleanup = arguments.length > 11 ? arguments[11] : undefined;
|
|
182
|
+
var limitedModeTeardown = arguments.length > 12 ? arguments[12] : undefined;
|
|
184
183
|
var activeNode = currentState.activeNode,
|
|
185
184
|
decorations = currentState.decorations,
|
|
186
185
|
isResizerResizing = currentState.isResizerResizing,
|
|
@@ -198,7 +197,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
198
197
|
isPMDragging = currentState.isPMDragging,
|
|
199
198
|
lastDragCancelled = currentState.lastDragCancelled;
|
|
200
199
|
var isActiveNodeDeleted = false;
|
|
201
|
-
var _getTrMetadata = getTrMetadata(tr
|
|
200
|
+
var _getTrMetadata = getTrMetadata(tr),
|
|
202
201
|
from = _getTrMetadata.from,
|
|
203
202
|
to = _getTrMetadata.to,
|
|
204
203
|
numReplaceSteps = _getTrMetadata.numReplaceSteps,
|
|
@@ -297,62 +296,50 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
297
296
|
|
|
298
297
|
// enables quick insert
|
|
299
298
|
// don't remap activeNode if it's being dragged
|
|
300
|
-
if (
|
|
301
|
-
|
|
302
|
-
|
|
299
|
+
if (activeNode && (meta === null || meta === void 0 ? void 0 : meta.isDragging) !== true) {
|
|
300
|
+
var _mappedRootPos$pos, _mappedRootPos;
|
|
301
|
+
var mappedPos;
|
|
302
|
+
var browser = getBrowserInfo();
|
|
303
|
+
// In safari,
|
|
304
|
+
// sometimes the drag handle for the layout disppears after you click on the handle for a few times
|
|
305
|
+
// Which caused the drag handle onClick event not firing, then block menu wouldn't be opened
|
|
306
|
+
// This is caused by the mappedPos.deletedAfter sometimes returning true in webkit browsers even though the active node still exists
|
|
307
|
+
// This is likely a prosemirror and safari integration bug, but to unblock the issue, we are going to use mappedPos.deleted in safari for now
|
|
308
|
+
if (browser.webkit) {
|
|
309
|
+
mappedPos = tr.mapping.mapResult(activeNode.pos);
|
|
303
310
|
isActiveNodeDeleted = mappedPos.deleted;
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
nodeType: activeNode.nodeType
|
|
308
|
-
};
|
|
311
|
+
} else {
|
|
312
|
+
mappedPos = tr.mapping.mapResult(activeNode.pos, -1);
|
|
313
|
+
isActiveNodeDeleted = mappedPos.deletedAfter;
|
|
309
314
|
}
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
_mappedPos = tr.mapping.mapResult(activeNode.pos, -1);
|
|
325
|
-
isActiveNodeDeleted = _mappedPos.deletedAfter;
|
|
326
|
-
}
|
|
327
|
-
// for editor controls, remap the rootPos as well
|
|
328
|
-
var mappedRootPos;
|
|
329
|
-
if (activeNode.rootPos !== undefined) {
|
|
330
|
-
mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
|
|
315
|
+
// for editor controls, remap the rootPos as well
|
|
316
|
+
var mappedRootPos;
|
|
317
|
+
if (activeNode.rootPos !== undefined) {
|
|
318
|
+
mappedRootPos = tr.mapping.mapResult(activeNode.rootPos, -1);
|
|
319
|
+
}
|
|
320
|
+
var mappedNodeType = activeNode.nodeType;
|
|
321
|
+
var mappedRootNodeType = activeNode.rootNodeType;
|
|
322
|
+
// Sparse mode does not redraw the old decorations. A block-type transaction may report
|
|
323
|
+
// a text range that excludes the active block position, so always refresh the already
|
|
324
|
+
// active node and root from the new document (for example, paragraph → heading-1).
|
|
325
|
+
if (isExperimentEnabled('platform_editor_block_control_migration')) {
|
|
326
|
+
var mappedNode = newState.doc.nodeAt(mappedPos.pos);
|
|
327
|
+
if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
|
|
328
|
+
mappedNodeType = getNodeTypeWithLevel(mappedNode);
|
|
331
329
|
}
|
|
332
|
-
var
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
// a text range that excludes the active block position, so always refresh the already
|
|
336
|
-
// active node and root from the new document (for example, paragraph → heading-1).
|
|
337
|
-
if (isExperimentEnabled('platform_editor_block_control_migration')) {
|
|
338
|
-
var mappedNode = newState.doc.nodeAt(_mappedPos.pos);
|
|
339
|
-
if (mappedNode !== null && mappedNode !== void 0 && mappedNode.isBlock) {
|
|
340
|
-
mappedNodeType = getNodeTypeWithLevel(mappedNode);
|
|
341
|
-
}
|
|
342
|
-
var mappedRootNode = mappedRootPos ? mappedRootPos.pos === _mappedPos.pos && mappedNode ? mappedNode : newState.doc.nodeAt(mappedRootPos.pos) : undefined;
|
|
343
|
-
if (mappedRootNode !== null && mappedRootNode !== void 0 && mappedRootNode.isBlock) {
|
|
344
|
-
mappedRootNodeType = getNodeTypeWithLevel(mappedRootNode);
|
|
345
|
-
}
|
|
330
|
+
var mappedRootNode = mappedRootPos ? mappedRootPos.pos === mappedPos.pos && mappedNode ? mappedNode : newState.doc.nodeAt(mappedRootPos.pos) : undefined;
|
|
331
|
+
if (mappedRootNode !== null && mappedRootNode !== void 0 && mappedRootNode.isBlock) {
|
|
332
|
+
mappedRootNodeType = getNodeTypeWithLevel(mappedRootNode);
|
|
346
333
|
}
|
|
347
|
-
activeNode = {
|
|
348
|
-
pos: _mappedPos.pos,
|
|
349
|
-
anchorName: activeNode.anchorName,
|
|
350
|
-
nodeType: mappedNodeType,
|
|
351
|
-
rootPos: (_mappedRootPos$pos = (_mappedRootPos = mappedRootPos) === null || _mappedRootPos === void 0 ? void 0 : _mappedRootPos.pos) !== null && _mappedRootPos$pos !== void 0 ? _mappedRootPos$pos : activeNode.rootPos,
|
|
352
|
-
rootAnchorName: activeNode.rootAnchorName,
|
|
353
|
-
rootNodeType: mappedRootNodeType
|
|
354
|
-
};
|
|
355
334
|
}
|
|
335
|
+
activeNode = {
|
|
336
|
+
pos: mappedPos.pos,
|
|
337
|
+
anchorName: activeNode.anchorName,
|
|
338
|
+
nodeType: mappedNodeType,
|
|
339
|
+
rootPos: (_mappedRootPos$pos = (_mappedRootPos = mappedRootPos) === null || _mappedRootPos === void 0 ? void 0 : _mappedRootPos.pos) !== null && _mappedRootPos$pos !== void 0 ? _mappedRootPos$pos : activeNode.rootPos,
|
|
340
|
+
rootAnchorName: activeNode.rootAnchorName,
|
|
341
|
+
rootNodeType: mappedRootNodeType
|
|
342
|
+
};
|
|
356
343
|
}
|
|
357
344
|
if (multiSelectDnD) {
|
|
358
345
|
multiSelectDnD.anchor = tr.mapping.map(multiSelectDnD.anchor);
|
|
@@ -395,43 +382,21 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
395
382
|
decorations = decorations.add(newState.doc, newNodeDecs);
|
|
396
383
|
|
|
397
384
|
// enables quick insert
|
|
398
|
-
if (!
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
// Find the specific dec that the active node corresponds to
|
|
404
|
-
var nodeDecsAtActivePos = findNewNodeDecs.filter(function (dec) {
|
|
405
|
-
return (dec === null || dec === void 0 ? void 0 : dec.from) === latestActiveNode.pos;
|
|
406
|
-
});
|
|
407
|
-
|
|
408
|
-
// If multiple decorations at the active node pos, we want the last one
|
|
409
|
-
var nodeDecAtActivePos = nodeDecsAtActivePos.pop();
|
|
410
|
-
|
|
411
|
-
// Update the active node anchor-name and type for accurate positioning
|
|
412
|
-
if (nodeDecAtActivePos) {
|
|
413
|
-
isActiveNodeModified = true;
|
|
414
|
-
latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
|
|
415
|
-
latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
|
|
416
|
-
}
|
|
385
|
+
if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
|
|
386
|
+
var nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
|
|
387
|
+
var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
|
|
388
|
+
if (nodeDecAtActivePos || rootNodeDecAtActivePos) {
|
|
389
|
+
isActiveNodeModified = true;
|
|
417
390
|
}
|
|
418
|
-
} else {
|
|
419
|
-
if (latestActiveNode && (!isActiveNodeDeleted || isReplacedWithSameSize)) {
|
|
420
|
-
var _nodeDecAtActivePos = getDecorationAtPos(newState, decorations, latestActiveNode.pos, to);
|
|
421
|
-
var rootNodeDecAtActivePos = latestActiveNode.rootPos !== undefined ? getDecorationAtPos(newState, decorations, latestActiveNode.rootPos, to) : undefined;
|
|
422
|
-
if (_nodeDecAtActivePos || rootNodeDecAtActivePos) {
|
|
423
|
-
isActiveNodeModified = true;
|
|
424
|
-
}
|
|
425
391
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
}
|
|
392
|
+
// Update the active node anchor-name and type for accurate positioning
|
|
393
|
+
if (nodeDecAtActivePos) {
|
|
394
|
+
latestActiveNode.anchorName = nodeDecAtActivePos.spec.anchorName;
|
|
395
|
+
latestActiveNode.nodeType = nodeDecAtActivePos.spec.nodeType;
|
|
396
|
+
}
|
|
397
|
+
if (rootNodeDecAtActivePos) {
|
|
398
|
+
latestActiveNode.rootAnchorName = rootNodeDecAtActivePos.spec.anchorName;
|
|
399
|
+
latestActiveNode.rootNodeType = rootNodeDecAtActivePos.spec.nodeType;
|
|
435
400
|
}
|
|
436
401
|
}
|
|
437
402
|
}
|
|
@@ -454,10 +419,8 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
454
419
|
var shouldRemoveHandle = latestActiveNode ? isResizerResizing || isActiveNodeDeleted && !isReplacedWithSameSize || (meta === null || meta === void 0 ? void 0 : meta.nodeMoved) : true;
|
|
455
420
|
|
|
456
421
|
// enables quick insert
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
|
|
460
|
-
}
|
|
422
|
+
// Remove handle dec when editor is blurred
|
|
423
|
+
shouldRemoveHandle = shouldRemoveHandle || (meta === null || meta === void 0 ? void 0 : meta.editorBlurred);
|
|
461
424
|
|
|
462
425
|
// In view mode with right-side controls, remove any lingering drag handle decorations
|
|
463
426
|
// (they may carry over from edit mode). Only remove drag handles specifically, not
|
|
@@ -490,54 +453,52 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
490
453
|
// nodeDecorationRegistry cleanup (e.g. the legacy Remix button) is independent of the legacy
|
|
491
454
|
// quick-insert button, so this must not be gated by quickInsertButtonEnabled — otherwise a
|
|
492
455
|
// stale decoration is left behind whenever platform_editor_block_control_migration is on.
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
456
|
+
// enables quick insert
|
|
457
|
+
if (quickInsertButtonEnabled) {
|
|
458
|
+
var _activeNode7, _activeNode8;
|
|
459
|
+
var oldQuickInsertButton = findQuickInsertInsertButtonDecoration(decorations, (_activeNode7 = activeNode) === null || _activeNode7 === void 0 ? void 0 : _activeNode7.rootPos, (_activeNode8 = activeNode) === null || _activeNode8 === void 0 ? void 0 : _activeNode8.rootPos);
|
|
460
|
+
decorations = decorations.remove(oldQuickInsertButton);
|
|
461
|
+
}
|
|
462
|
+
var _iterator = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
463
|
+
_step;
|
|
464
|
+
try {
|
|
465
|
+
var _loop2 = function _loop2() {
|
|
466
|
+
var _activeNode1, _activeNode10;
|
|
467
|
+
var factory = _step.value;
|
|
468
|
+
var old = decorations.find((_activeNode1 = activeNode) === null || _activeNode1 === void 0 ? void 0 : _activeNode1.rootPos, (_activeNode10 = activeNode) === null || _activeNode10 === void 0 ? void 0 : _activeNode10.rootPos, function (spec) {
|
|
469
|
+
return spec.type === factory.type;
|
|
470
|
+
});
|
|
471
|
+
decorations = decorations.remove(old);
|
|
472
|
+
};
|
|
473
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
474
|
+
_loop2();
|
|
499
475
|
}
|
|
500
|
-
|
|
501
|
-
|
|
476
|
+
} catch (err) {
|
|
477
|
+
_iterator.e(err);
|
|
478
|
+
} finally {
|
|
479
|
+
_iterator.f();
|
|
480
|
+
}
|
|
481
|
+
if (rightSideControlsEnabled && isViewMode) {
|
|
482
|
+
var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
483
|
+
_step2;
|
|
502
484
|
try {
|
|
503
|
-
var
|
|
504
|
-
var
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
485
|
+
var _loop = function _loop() {
|
|
486
|
+
var factory = _step2.value;
|
|
487
|
+
if (factory.showInViewMode) {
|
|
488
|
+
var _activeNode9, _activeNode0;
|
|
489
|
+
var old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, function (spec) {
|
|
490
|
+
return spec.type === factory.type;
|
|
491
|
+
});
|
|
492
|
+
decorations = decorations.remove(old);
|
|
493
|
+
}
|
|
510
494
|
};
|
|
511
|
-
for (
|
|
512
|
-
|
|
495
|
+
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
496
|
+
_loop();
|
|
513
497
|
}
|
|
514
498
|
} catch (err) {
|
|
515
|
-
|
|
499
|
+
_iterator2.e(err);
|
|
516
500
|
} finally {
|
|
517
|
-
|
|
518
|
-
}
|
|
519
|
-
if (rightSideControlsEnabled && isViewMode) {
|
|
520
|
-
var _iterator2 = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
521
|
-
_step2;
|
|
522
|
-
try {
|
|
523
|
-
var _loop = function _loop() {
|
|
524
|
-
var factory = _step2.value;
|
|
525
|
-
if (factory.showInViewMode) {
|
|
526
|
-
var _activeNode9, _activeNode0;
|
|
527
|
-
var old = decorations.find((_activeNode9 = activeNode) === null || _activeNode9 === void 0 ? void 0 : _activeNode9.rootPos, (_activeNode0 = activeNode) === null || _activeNode0 === void 0 ? void 0 : _activeNode0.rootPos, function (spec) {
|
|
528
|
-
return spec.type === factory.type;
|
|
529
|
-
});
|
|
530
|
-
decorations = decorations.remove(old);
|
|
531
|
-
}
|
|
532
|
-
};
|
|
533
|
-
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
534
|
-
_loop();
|
|
535
|
-
}
|
|
536
|
-
} catch (err) {
|
|
537
|
-
_iterator2.e(err);
|
|
538
|
-
} finally {
|
|
539
|
-
_iterator2.f();
|
|
540
|
-
}
|
|
501
|
+
_iterator2.f();
|
|
541
502
|
}
|
|
542
503
|
}
|
|
543
504
|
} else if (api) {
|
|
@@ -615,9 +576,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
615
576
|
}
|
|
616
577
|
}
|
|
617
578
|
}
|
|
618
|
-
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) &&
|
|
619
|
-
// enables quick insert
|
|
620
|
-
flags.toolbarFlagsEnabled && (!rightSideControlsEnabled || !isViewMode)) {
|
|
579
|
+
if (shouldRecreateQuickInsertButton && ((_latestActiveNode5 = latestActiveNode) === null || _latestActiveNode5 === void 0 ? void 0 : _latestActiveNode5.rootPos) !== undefined && (quickInsertButtonEnabled || nodeDecorationRegistry.length > 0) && (!rightSideControlsEnabled || !isViewMode)) {
|
|
621
580
|
var _latestActiveNode1;
|
|
622
581
|
if (quickInsertButtonEnabled) {
|
|
623
582
|
var _activeNode13, _activeNode14, _latestActiveNode6, _latestActiveNode7, _latestActiveNode8, _latestActiveNode9, _latestActiveNode0;
|
|
@@ -723,7 +682,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
723
682
|
var rootPos = (_latestActiveNode10 = latestActiveNode) === null || _latestActiveNode10 === void 0 ? void 0 : _latestActiveNode10.rootPos;
|
|
724
683
|
// rootPos is computed using the same logic as the floating insert menu, so it always points to a top-level (doc child) block when defined.
|
|
725
684
|
var isDocLevel = rootPos !== undefined && !isNaN(rootPos);
|
|
726
|
-
if (isViewMode && isDocLevel &&
|
|
685
|
+
if (isViewMode && isDocLevel && rightSideControlsEnabled) {
|
|
727
686
|
var _iterator5 = _createForOfIteratorHelper(nodeDecorationRegistry),
|
|
728
687
|
_step5;
|
|
729
688
|
try {
|
|
@@ -835,21 +794,15 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
835
794
|
decorations = decorations.add(newState.doc, [emptyParagraphNodeDecorations()]);
|
|
836
795
|
}
|
|
837
796
|
}
|
|
838
|
-
|
|
797
|
+
|
|
839
798
|
// enables quick insert
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
var keepActiveNodeForOpenBlockMenu = isExperimentEnabled('platform_editor_block_control_migration') && isMenuOpen;
|
|
848
|
-
newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
|
|
849
|
-
} else {
|
|
850
|
-
var _latestActiveNode13, _latestActiveNode14;
|
|
851
|
-
newActiveNode = isEmptyDoc || !(meta !== null && meta !== void 0 && meta.activeNode) && !isExperimentEnabled('platform_editor_block_control_migration') && findHandleDec(decorations, (_latestActiveNode13 = latestActiveNode) === null || _latestActiveNode13 === void 0 ? void 0 : _latestActiveNode13.pos, (_latestActiveNode14 = latestActiveNode) === null || _latestActiveNode14 === void 0 ? void 0 : _latestActiveNode14.pos).length === 0 ? null : latestActiveNode;
|
|
852
|
-
}
|
|
799
|
+
// remove isEmptyDoc check and let decorations render and determine their own visibility
|
|
800
|
+
// In view mode with right-side controls we render node decorations (right-edge button), not the
|
|
801
|
+
// handle - so findHandleDec is always empty. Don't clear activeNode in that case.
|
|
802
|
+
var hasHandleOrViewModeControls = isExperimentEnabled('platform_editor_block_control_migration') || isViewMode && rightSideControlsEnabled || findHandleDec(decorations, (_latestActiveNode11 = latestActiveNode) === null || _latestActiveNode11 === void 0 ? void 0 : _latestActiveNode11.pos, (_latestActiveNode12 = latestActiveNode) === null || _latestActiveNode12 === void 0 ? void 0 : _latestActiveNode12.pos).length > 0;
|
|
803
|
+
// Keep the registry surface mounted while its Block Menu owns focus.
|
|
804
|
+
var keepActiveNodeForOpenBlockMenu = isExperimentEnabled('platform_editor_block_control_migration') && isMenuOpen;
|
|
805
|
+
var newActiveNode = meta !== null && meta !== void 0 && meta.editorBlurred && !keepActiveNodeForOpenBlockMenu || !(meta !== null && meta !== void 0 && meta.activeNode) && !hasHandleOrViewModeControls ? null : latestActiveNode;
|
|
853
806
|
var nextMenuTriggerByNode = (meta === null || meta === void 0 || (_meta$toggleMenu = meta.toggleMenu) === null || _meta$toggleMenu === void 0 ? void 0 : _meta$toggleMenu.triggerByNode) || menuTriggerByNode;
|
|
854
807
|
if (isExperimentEnabled('platform_editor_block_control_migration') && tr.docChanged && menuTriggerByNode && !(meta !== null && meta !== void 0 && meta.toggleMenu)) {
|
|
855
808
|
var _menuTriggerByNode$ro, _newState$doc$nodeAt4;
|
|
@@ -871,11 +824,7 @@ var _apply = function apply(api, formatMessage, tr, currentState, newState, flag
|
|
|
871
824
|
var isSameAnchor = (meta === null || meta === void 0 ? void 0 : meta.toggleMenu.anchorName) === menuTriggerBy;
|
|
872
825
|
isMenuOpen = menuTriggerBy === undefined || isSameAnchor || !isMenuOpen && !isSameAnchor ? !isMenuOpen : isMenuOpen;
|
|
873
826
|
}
|
|
874
|
-
|
|
875
|
-
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
876
|
-
} else {
|
|
877
|
-
isSelectedViaDragHandle = false;
|
|
878
|
-
}
|
|
827
|
+
isSelectedViaDragHandle = (meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle) !== undefined ? meta === null || meta === void 0 ? void 0 : meta.isSelectedViaDragHandle : isSelectedViaDragHandle;
|
|
879
828
|
return {
|
|
880
829
|
decorations: decorations,
|
|
881
830
|
surfaceNodePositions: surfaceNodePositions,
|
|
@@ -910,10 +859,6 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
910
859
|
var isAdvancedLayoutEnabled = editorExperiment('advanced_layouts', true, {
|
|
911
860
|
exposure: true
|
|
912
861
|
});
|
|
913
|
-
var toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
914
|
-
var flags = {
|
|
915
|
-
toolbarFlagsEnabled: toolbarFlagsEnabled
|
|
916
|
-
};
|
|
917
862
|
var anchorRectCache;
|
|
918
863
|
if (!isAnchorSupported()) {
|
|
919
864
|
anchorRectCache = new AnchorRectCache();
|
|
@@ -962,7 +907,7 @@ export var createPlugin = function createPlugin(api, getIntl, nodeViewPortalProv
|
|
|
962
907
|
return _objectSpread({}, initialState);
|
|
963
908
|
},
|
|
964
909
|
apply: function apply(tr, currentState, _, newState) {
|
|
965
|
-
return _apply(api, formatMessage, tr, currentState, newState,
|
|
910
|
+
return _apply(api, formatMessage, tr, currentState, newState, nodeViewPortalProviderAPI, nodeDecorationRegistry, rightSideControlsEnabled, quickInsertButtonEnabled, anchorRectCache, resizeObserverWidth, pragmaticCleanup, limitedModeTeardown);
|
|
966
911
|
}
|
|
967
912
|
},
|
|
968
913
|
props: {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { getNodeSelectionForPos, selectNodeAtPos } from '@atlaskit/editor-common/node-selection';
|
|
2
2
|
import { Side } from '@atlaskit/editor-common/selection';
|
|
3
3
|
import { GapCursorSelection } from '@atlaskit/editor-common/selection/gap-cursor/selection';
|
|
4
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
5
4
|
import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
6
5
|
import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
|
|
7
6
|
import { selectTableClosestToPos } from '@atlaskit/editor-tables/select-table-closest-to-pos';
|
|
@@ -68,7 +67,7 @@ export var selectNode = function selectNode(tr, start, nodeType, api) {
|
|
|
68
67
|
}
|
|
69
68
|
return tr;
|
|
70
69
|
};
|
|
71
|
-
export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(tr, start
|
|
70
|
+
export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(tr, start) {
|
|
72
71
|
var node = tr.doc.nodeAt(start);
|
|
73
72
|
var isNodeSelection = node && NodeSelection.isSelectable(node);
|
|
74
73
|
var nodeSize = node ? node.nodeSize : 1;
|
|
@@ -82,7 +81,7 @@ export var setCursorPositionAtMovedNode = function setCursorPositionAtMovedNode(
|
|
|
82
81
|
}
|
|
83
82
|
|
|
84
83
|
// this is a fix for empty paragraph selection - can safely use start position as the paragraph is empty
|
|
85
|
-
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'paragraph' && (node === null || node === void 0 ? void 0 : node.childCount) === 0
|
|
84
|
+
if ((node === null || node === void 0 ? void 0 : node.type.name) === 'paragraph' && (node === null || node === void 0 ? void 0 : node.childCount) === 0) {
|
|
86
85
|
var _selection = new TextSelection(tr.doc.resolve(start));
|
|
87
86
|
tr.setSelection(_selection);
|
|
88
87
|
return tr;
|
|
@@ -45,7 +45,7 @@ var isStepContentReplacedWithAnotherOfSameSize = function isStepContentReplacedW
|
|
|
45
45
|
* Number of ReplaceStep and ReplaceAroundStep steps 'numReplaceSteps'.
|
|
46
46
|
* 'isAllText' if all steps are represent adding inline text or a backspace/delete or no-op
|
|
47
47
|
*/
|
|
48
|
-
export var getTrMetadata = function getTrMetadata(tr
|
|
48
|
+
export var getTrMetadata = function getTrMetadata(tr) {
|
|
49
49
|
var from;
|
|
50
50
|
var to;
|
|
51
51
|
var numReplaceSteps = 0;
|
|
@@ -57,10 +57,7 @@ export var getTrMetadata = function getTrMetadata(tr, flags) {
|
|
|
57
57
|
isAllText = false;
|
|
58
58
|
}
|
|
59
59
|
// Fixes drag handle and quick insert button overlap issues
|
|
60
|
-
|
|
61
|
-
// fixes drag handle and quick insert button overlap issues
|
|
62
|
-
isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
|
|
63
|
-
}
|
|
60
|
+
isReplacedWithSameSize = isStepContentReplacedWithAnotherOfSameSize(s);
|
|
64
61
|
var mappedTo = tr.mapping.map(s.to);
|
|
65
62
|
var $to = s.from + s.slice.size;
|
|
66
63
|
$to = $to > mappedTo ? $to : mappedTo;
|
|
@@ -7,7 +7,6 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
|
7
7
|
import { css, Global, jsx } from '@emotion/react';
|
|
8
8
|
import { DRAG_HANDLE_WIDTH } from '@atlaskit/editor-common/styles/drag-handle';
|
|
9
9
|
import { ANCHOR_VARIABLE_NAME, isCSSAnchorSupported } from '@atlaskit/editor-common/styles/native-anchor';
|
|
10
|
-
import { areToolbarFlagsEnabled } from '@atlaskit/editor-common/toolbar-flag-check';
|
|
11
10
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/useSharedPluginStateWithSelector';
|
|
12
11
|
import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace/whitespace';
|
|
13
12
|
import { akEditorBreakoutPadding, akEditorCalculatedWideLayoutWidth, akEditorCalculatedWideLayoutWidthSmallViewport, akEditorFullPageNarrowBreakout, akEditorGutterPaddingDynamic, akEditorGutterPaddingReduced } from '@atlaskit/editor-shared-styles/constants';
|
|
@@ -190,24 +189,10 @@ var extendedDragZoneNext = css({
|
|
|
190
189
|
left: "calc((100% - var(--ak-editor-max-container-width))/2)"
|
|
191
190
|
})
|
|
192
191
|
});
|
|
193
|
-
var paragraphWithTrailingBreakAsOnlyChild = '+ :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
|
|
194
|
-
var indentatedParagraphWithTrailingBreakAsOnlyChild = '+ div.fabric-editor-indentation-mark > :is(p, h1, h2, h3, h4, h5, h6) > .ProseMirror-trailingBreak:only-child';
|
|
195
|
-
var paragraphWithPlaceholder = '+ p > .placeholder-decoration';
|
|
196
192
|
var dragHandleContainer = '.ProseMirror-widget[data-blocks-drag-handle-container="true"]';
|
|
197
|
-
var dragHandleSelector = 'button[data-testid="block-ctrl-drag-handle"]';
|
|
198
193
|
var dropTargetContainer = '.ProseMirror-widget[data-blocks-drop-target-container="true"]';
|
|
199
194
|
var dividerBodiedInCustomPanelWithNoIconSelector = '[data-panel-type].ak-editor-panel__no-icon .ProseMirror-widget:first-child + .ProseMirror-widget:nth-child(2) + hr, [data-panel-type] hr:first-child';
|
|
200
|
-
var withInlineNodeStyleSelectors = ["".concat(dragHandleContainer, ":has(").concat(paragraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(indentatedParagraphWithTrailingBreakAsOnlyChild, ") ").concat(dragHandleSelector), "".concat(dragHandleContainer, ":has(").concat(paragraphWithPlaceholder, ") ").concat(dragHandleSelector)].join(', ');
|
|
201
195
|
var withFormatInLayoutStyleFixSelectors = ["".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-font-size > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-indentation-mark > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-alignment > p:first-child"), "".concat(dragHandleContainer, ":first-child + ").concat(dropTargetContainer, " + .fabric-editor-font-size > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-alignment > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-indentation-mark > p:first-child"), "".concat(dropTargetContainer, ":first-child + .fabric-editor-font-size > p:first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-indentation-mark > :is(h1, h2, h3, h4, h5, h6):first-child"), "".concat(dragHandleContainer, ":first-child + .fabric-editor-font-size > :is(h1, h2, h3, h4, h5, h6):first-child")].join(', ');
|
|
202
|
-
|
|
203
|
-
/**
|
|
204
|
-
* Please do not change change transform to display:none, or visibility:hidden
|
|
205
|
-
* Otherwise it might break composition input for Chrome
|
|
206
|
-
* https://product-fabric.atlassian.net/browse/ED-24136
|
|
207
|
-
*/
|
|
208
|
-
var withInlineNodeStyle = css(_defineProperty({}, withInlineNodeStyleSelectors, {
|
|
209
|
-
transform: 'scale(0)'
|
|
210
|
-
}));
|
|
211
196
|
var legacyBreakoutWideLayoutStyle = css({
|
|
212
197
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/no-nested-selectors, @atlaskit/ui-styling-standard/no-unsafe-values
|
|
213
198
|
'.ProseMirror-widget[data-blocks-drop-target-container="true"]': {
|
|
@@ -492,15 +477,12 @@ export var GlobalStylesWrapper = function GlobalStylesWrapper(_ref) {
|
|
|
492
477
|
var isDragging = isDraggingFromState;
|
|
493
478
|
var shouldRenderAnchors = isCSSAnchorSupported() && expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true);
|
|
494
479
|
var sparseSurfaceAnchorsEnabled = Boolean(isCSSAnchorSupported()) && sparseSurfacesEnabled;
|
|
495
|
-
var toolbarFlagsEnabled = areToolbarFlagsEnabled(Boolean(api === null || api === void 0 ? void 0 : api.toolbar));
|
|
496
480
|
return jsx(Global
|
|
497
481
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
498
482
|
, {
|
|
499
483
|
styles: [globalStyles(), globalDnDStyle, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedHoverZoneNext() : extendedHoverZone()), isDragging && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendedDragZoneNext : extendedDragZone), (!sparseSurfacesEnabled || isDragging) && editorExperiment('platform_editor_preview_panel_responsiveness', true, {
|
|
500
484
|
exposure: true
|
|
501
|
-
}) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined,
|
|
502
|
-
// this allows drag handles to render on empty lines
|
|
503
|
-
toolbarFlagsEnabled ? undefined : withInlineNodeStyle, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, isExperimentEnabled('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && ((expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration')) && expValEquals('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
|
|
485
|
+
}) ? expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? extendHoverZoneReducedNext : extendHoverZoneReduced : undefined, withDeleteLinesStyleFix, withMediaSingleStyleFix, legacyBreakoutWideLayoutStyle, headingWithIndentationInLayoutStyleFix, editorExperiment('advanced_layouts', true) ? blockCardWithoutLayout : undefined, withDividerInPanelStyleFix, isExperimentEnabled('platform_editor_lovability_dividers') && withRuleOverflowStyleFix, withFormatInLayoutStyleFix, (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withRelativePosStyleNext : withRelativePosStyle), (!sparseSurfacesEnabled || isDragging) && (expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration') ? withAnchorNameZindexStyleNext : withAnchorNameZindexStyle), (!sparseSurfacesEnabled || isDragging) && ((expValEquals('platform_editor_native_anchor_with_dnd', 'isEnabled', true) || isExperimentEnabled('platform_editor_block_control_migration')) && expValEquals('advanced_layouts', 'isEnabled', true) ? layoutColumnExtendedHoverZone : layoutColumnWithoutHoverZone), sparseSurfaceAnchorsEnabled ? isDragging ? dragAnchorStyles : false : expValEquals('platform_editor_controls_reliable_anchor', 'isEnabled', true) ?
|
|
504
486
|
// dragAnchorStyles sets anchor-name on ALL nodes during drag (needed for drop target positioning).
|
|
505
487
|
// staticControlsAnchorStyles handles anchor-name via node decorations for non-drag state.
|
|
506
488
|
// shouldRenderAnchors guards both: only apply anchor styles on browsers that support CSS anchor positioning.
|
|
@@ -8,11 +8,8 @@ import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
|
8
8
|
import type { BlockControlsMeta, BlockControlsPlugin, NodeDecorationFactory, PluginState } from '../blockControlsPluginType';
|
|
9
9
|
import { AnchorRectCache } from './utils/anchor-utils';
|
|
10
10
|
export declare const key: PluginKey<PluginState>;
|
|
11
|
-
export interface FlagType {
|
|
12
|
-
toolbarFlagsEnabled: boolean;
|
|
13
|
-
}
|
|
14
11
|
export declare const getDecorations: (state: EditorState) => DecorationSet | undefined;
|
|
15
|
-
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState,
|
|
12
|
+
export declare const apply: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, formatMessage: IntlShape['formatMessage'], tr: ReadonlyTransaction, currentState: PluginState, newState: EditorState, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean, anchorRectCache?: AnchorRectCache, resizeObserverWidth?: ResizeObserver, pragmaticCleanup?: (() => void) | null, limitedModeTeardown?: {
|
|
16
13
|
done: boolean;
|
|
17
14
|
}) => PluginState;
|
|
18
15
|
export declare const createPlugin: (api: ExtractInjectionAPI<BlockControlsPlugin> | undefined, getIntl: () => IntlShape, nodeViewPortalProviderAPI: PortalProviderAPI, nodeDecorationRegistry: NodeDecorationFactory[], rightSideControlsEnabled?: boolean, quickInsertButtonEnabled?: boolean) => SafePlugin<PluginState>;
|
|
@@ -18,7 +18,7 @@ export declare const getInlineNodePos: (doc: PMNode, start: number, nodeSize: nu
|
|
|
18
18
|
export declare const newGetSelection: (doc: PMNode, selectionEmpty: boolean, start: number) => false | TextSelection | NodeSelection;
|
|
19
19
|
export declare const getSelection: (tr: Transaction, start: number) => false | TextSelection | NodeSelection;
|
|
20
20
|
export declare const selectNode: (tr: Transaction, start: number, nodeType: string, api?: ExtractInjectionAPI<BlockControlsPlugin>) => Transaction;
|
|
21
|
-
export declare const setCursorPositionAtMovedNode: (tr: Transaction, start: number
|
|
21
|
+
export declare const setCursorPositionAtMovedNode: (tr: Transaction, start: number) => Transaction;
|
|
22
22
|
/**
|
|
23
23
|
* Checks if handle position is with the selection or corresponds to a (partially) selected node
|
|
24
24
|
* @param state
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
2
2
|
import { ReplaceStep } from '@atlaskit/editor-prosemirror/transform';
|
|
3
|
-
import type { FlagType } from '../main';
|
|
4
3
|
interface TransactionMetadata {
|
|
5
4
|
from: number;
|
|
6
5
|
isAllText: boolean;
|
|
@@ -27,5 +26,5 @@ export declare const isStepDelete: (s: ReplaceStep) => boolean;
|
|
|
27
26
|
* Number of ReplaceStep and ReplaceAroundStep steps 'numReplaceSteps'.
|
|
28
27
|
* 'isAllText' if all steps are represent adding inline text or a backspace/delete or no-op
|
|
29
28
|
*/
|
|
30
|
-
export declare const getTrMetadata: (tr: Transaction | ReadonlyTransaction
|
|
29
|
+
export declare const getTrMetadata: (tr: Transaction | ReadonlyTransaction) => TransactionMetadata;
|
|
31
30
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-block-controls",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "34.0.1",
|
|
4
4
|
"description": "Block controls plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -29,23 +29,23 @@
|
|
|
29
29
|
"@atlaskit/button": "^25.8.0",
|
|
30
30
|
"@atlaskit/css": "^1.1.0",
|
|
31
31
|
"@atlaskit/docs": "^12.3.0",
|
|
32
|
-
"@atlaskit/editor-plugin-accessibility-utils": "^
|
|
33
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
34
|
-
"@atlaskit/editor-plugin-block-collapse": "^
|
|
35
|
-
"@atlaskit/editor-plugin-editor-disabled": "^
|
|
36
|
-
"@atlaskit/editor-plugin-editor-viewmode": "^
|
|
37
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
38
|
-
"@atlaskit/editor-plugin-interaction": "^
|
|
39
|
-
"@atlaskit/editor-plugin-limited-mode": "^
|
|
40
|
-
"@atlaskit/editor-plugin-metrics": "^
|
|
41
|
-
"@atlaskit/editor-plugin-quick-insert": "^
|
|
42
|
-
"@atlaskit/editor-plugin-selection": "^
|
|
43
|
-
"@atlaskit/editor-plugin-show-diff": "^
|
|
44
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
45
|
-
"@atlaskit/editor-plugin-type-ahead": "^
|
|
46
|
-
"@atlaskit/editor-plugin-ui-control-registry": "^
|
|
47
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
48
|
-
"@atlaskit/editor-plugin-width": "^
|
|
32
|
+
"@atlaskit/editor-plugin-accessibility-utils": "^33.0.0",
|
|
33
|
+
"@atlaskit/editor-plugin-analytics": "^33.0.0",
|
|
34
|
+
"@atlaskit/editor-plugin-block-collapse": "^19.0.0",
|
|
35
|
+
"@atlaskit/editor-plugin-editor-disabled": "^33.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-editor-viewmode": "^35.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-feature-flags": "^32.0.0",
|
|
38
|
+
"@atlaskit/editor-plugin-interaction": "^47.0.0",
|
|
39
|
+
"@atlaskit/editor-plugin-limited-mode": "^30.0.0",
|
|
40
|
+
"@atlaskit/editor-plugin-metrics": "^34.0.0",
|
|
41
|
+
"@atlaskit/editor-plugin-quick-insert": "^33.0.0",
|
|
42
|
+
"@atlaskit/editor-plugin-selection": "^33.0.0",
|
|
43
|
+
"@atlaskit/editor-plugin-show-diff": "^33.0.0",
|
|
44
|
+
"@atlaskit/editor-plugin-toolbar": "^30.0.0",
|
|
45
|
+
"@atlaskit/editor-plugin-type-ahead": "^34.0.0",
|
|
46
|
+
"@atlaskit/editor-plugin-ui-control-registry": "^27.0.0",
|
|
47
|
+
"@atlaskit/editor-plugin-user-intent": "^31.0.0",
|
|
48
|
+
"@atlaskit/editor-plugin-width": "^34.0.0",
|
|
49
49
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^5.2.0",
|
|
51
51
|
"@atlaskit/editor-tables": "^3.2.0",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@atlaskit/primitives": "^22.7.0",
|
|
61
61
|
"@atlaskit/section-message": "^10.3.0",
|
|
62
62
|
"@atlaskit/theme": "^28.2.0",
|
|
63
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
64
|
-
"@atlaskit/tokens": "^20.
|
|
63
|
+
"@atlaskit/tmp-editor-statsig": "^265.0.0",
|
|
64
|
+
"@atlaskit/tokens": "^20.13.0",
|
|
65
65
|
"@atlaskit/tooltip": "^24.4.0",
|
|
66
66
|
"@babel/runtime": "^7.0.0",
|
|
67
67
|
"@compiled/react": "^1.0.2",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"uuid": "^11.1.1"
|
|
73
73
|
},
|
|
74
74
|
"peerDependencies": {
|
|
75
|
-
"@atlaskit/editor-common": "^
|
|
75
|
+
"@atlaskit/editor-common": "^137.1.0",
|
|
76
76
|
"react": "^18.2.0 || ^19.2.0",
|
|
77
77
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
78
78
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|
|
@@ -96,7 +96,10 @@
|
|
|
96
96
|
}
|
|
97
97
|
},
|
|
98
98
|
"devDependencies": {
|
|
99
|
-
"@
|
|
99
|
+
"@af/editor-examples-helpers": "workspace:^",
|
|
100
|
+
"@atlaskit/editor-common": "^137.1.0",
|
|
101
|
+
"@atlaskit/editor-plugins": "^17.0.0",
|
|
102
|
+
"@atlaskit/synchrony-test-helpers": "workspace:^",
|
|
100
103
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
101
104
|
"@atlassian/workbench": "workspace:*",
|
|
102
105
|
"react": "^19.2.0",
|