@atlaskit/editor-plugin-selection 1.5.5 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (136) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/cjs/index.js +2 -2
  3. package/dist/cjs/pm-plugins/auto-expand-selection-range-on-inline-node-key.js +8 -0
  4. package/dist/cjs/pm-plugins/auto-expand-selection-range-on-inline-node-main.js +67 -0
  5. package/dist/cjs/{commands.js → pm-plugins/commands.js} +1 -1
  6. package/dist/cjs/pm-plugins/events/create-selection-between.js +18 -4
  7. package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/actions.js +1 -1
  8. package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils.js +7 -0
  9. package/dist/cjs/pm-plugins/gap-cursor-keymap.js +3 -3
  10. package/dist/cjs/pm-plugins/gap-cursor-main.js +4 -4
  11. package/dist/cjs/pm-plugins/keymap.js +1 -1
  12. package/dist/cjs/pm-plugins/mark-boundary-cursor-main.js +2 -2
  13. package/dist/cjs/{plugin-factory.js → pm-plugins/plugin-factory.js} +1 -1
  14. package/dist/cjs/pm-plugins/selection-main.js +3 -3
  15. package/dist/cjs/{utils.js → pm-plugins/utils.js} +1 -1
  16. package/dist/cjs/{plugin.js → selectionPlugin.js} +7 -1
  17. package/dist/cjs/selectionPluginType.js +5 -0
  18. package/dist/es2019/index.js +1 -1
  19. package/dist/es2019/pm-plugins/auto-expand-selection-range-on-inline-node-key.js +2 -0
  20. package/dist/es2019/pm-plugins/auto-expand-selection-range-on-inline-node-main.js +63 -0
  21. package/dist/es2019/{commands.js → pm-plugins/commands.js} +1 -1
  22. package/dist/es2019/pm-plugins/events/create-selection-between.js +18 -4
  23. package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/actions.js +1 -1
  24. package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils.js +7 -0
  25. package/dist/es2019/pm-plugins/gap-cursor-keymap.js +3 -3
  26. package/dist/es2019/pm-plugins/gap-cursor-main.js +4 -4
  27. package/dist/es2019/pm-plugins/keymap.js +1 -1
  28. package/dist/es2019/pm-plugins/mark-boundary-cursor-main.js +2 -2
  29. package/dist/es2019/{plugin-factory.js → pm-plugins/plugin-factory.js} +1 -1
  30. package/dist/es2019/pm-plugins/selection-main.js +3 -3
  31. package/dist/es2019/{utils.js → pm-plugins/utils.js} +1 -1
  32. package/dist/es2019/{plugin.js → selectionPlugin.js} +5 -1
  33. package/dist/es2019/selectionPluginType.js +1 -0
  34. package/dist/esm/index.js +1 -1
  35. package/dist/esm/pm-plugins/auto-expand-selection-range-on-inline-node-key.js +2 -0
  36. package/dist/esm/pm-plugins/auto-expand-selection-range-on-inline-node-main.js +61 -0
  37. package/dist/esm/{commands.js → pm-plugins/commands.js} +1 -1
  38. package/dist/esm/pm-plugins/events/create-selection-between.js +18 -4
  39. package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/actions.js +1 -1
  40. package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils.js +7 -0
  41. package/dist/esm/pm-plugins/gap-cursor-keymap.js +3 -3
  42. package/dist/esm/pm-plugins/gap-cursor-main.js +4 -4
  43. package/dist/esm/pm-plugins/keymap.js +1 -1
  44. package/dist/esm/pm-plugins/mark-boundary-cursor-main.js +2 -2
  45. package/dist/esm/{plugin-factory.js → pm-plugins/plugin-factory.js} +1 -1
  46. package/dist/esm/pm-plugins/selection-main.js +3 -3
  47. package/dist/esm/{utils.js → pm-plugins/utils.js} +1 -1
  48. package/dist/esm/{plugin.js → selectionPlugin.js} +7 -1
  49. package/dist/esm/selectionPluginType.js +1 -0
  50. package/dist/types/index.d.ts +2 -2
  51. package/dist/{types-ts4.5 → types/pm-plugins}/actions.d.ts +1 -1
  52. package/dist/types/pm-plugins/auto-expand-selection-range-on-inline-node-key.d.ts +2 -0
  53. package/dist/types/pm-plugins/auto-expand-selection-range-on-inline-node-main.d.ts +2 -0
  54. package/dist/types/{commands.d.ts → pm-plugins/commands.d.ts} +1 -1
  55. package/dist/types/{plugin-factory.d.ts → pm-plugins/plugin-factory.d.ts} +1 -1
  56. package/dist/types/{reducer.d.ts → pm-plugins/reducer.d.ts} +1 -1
  57. package/dist/types/selectionPlugin.d.ts +3 -0
  58. package/dist/types/{plugin.d.ts → selectionPluginType.d.ts} +0 -2
  59. package/dist/types-ts4.5/index.d.ts +2 -2
  60. package/dist/{types → types-ts4.5/pm-plugins}/actions.d.ts +1 -1
  61. package/dist/types-ts4.5/pm-plugins/auto-expand-selection-range-on-inline-node-key.d.ts +2 -0
  62. package/dist/types-ts4.5/pm-plugins/auto-expand-selection-range-on-inline-node-main.d.ts +2 -0
  63. package/dist/types-ts4.5/{commands.d.ts → pm-plugins/commands.d.ts} +1 -1
  64. package/dist/types-ts4.5/{plugin-factory.d.ts → pm-plugins/plugin-factory.d.ts} +1 -1
  65. package/dist/types-ts4.5/{reducer.d.ts → pm-plugins/reducer.d.ts} +1 -1
  66. package/dist/types-ts4.5/selectionPlugin.d.ts +3 -0
  67. package/dist/types-ts4.5/{plugin.d.ts → selectionPluginType.d.ts} +0 -2
  68. package/package.json +13 -3
  69. package/types/package.json +5 -5
  70. /package/dist/cjs/{actions.js → pm-plugins/actions.js} +0 -0
  71. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/direction.js +0 -0
  72. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/selection.js +0 -0
  73. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.js +0 -0
  74. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.js +0 -0
  75. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.js +0 -0
  76. /package/dist/cjs/{gap-cursor-selection.js → pm-plugins/gap-cursor-selection.js} +0 -0
  77. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.js +0 -0
  78. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.js +0 -0
  79. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.js +0 -0
  80. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.js +0 -0
  81. /package/dist/cjs/{reducer.js → pm-plugins/reducer.js} +0 -0
  82. /package/dist/cjs/{types.js → types/index.js} +0 -0
  83. /package/dist/es2019/{actions.js → pm-plugins/actions.js} +0 -0
  84. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/direction.js +0 -0
  85. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/selection.js +0 -0
  86. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.js +0 -0
  87. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.js +0 -0
  88. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.js +0 -0
  89. /package/dist/es2019/{gap-cursor-selection.js → pm-plugins/gap-cursor-selection.js} +0 -0
  90. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.js +0 -0
  91. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.js +0 -0
  92. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.js +0 -0
  93. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.js +0 -0
  94. /package/dist/es2019/{reducer.js → pm-plugins/reducer.js} +0 -0
  95. /package/dist/es2019/{types.js → types/index.js} +0 -0
  96. /package/dist/esm/{actions.js → pm-plugins/actions.js} +0 -0
  97. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/direction.js +0 -0
  98. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/selection.js +0 -0
  99. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.js +0 -0
  100. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.js +0 -0
  101. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.js +0 -0
  102. /package/dist/esm/{gap-cursor-selection.js → pm-plugins/gap-cursor-selection.js} +0 -0
  103. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.js +0 -0
  104. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.js +0 -0
  105. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.js +0 -0
  106. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.js +0 -0
  107. /package/dist/esm/{reducer.js → pm-plugins/reducer.js} +0 -0
  108. /package/dist/esm/{types.js → types/index.js} +0 -0
  109. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/actions.d.ts +0 -0
  110. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/direction.d.ts +0 -0
  111. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/selection.d.ts +0 -0
  112. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.d.ts +0 -0
  113. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.d.ts +0 -0
  114. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.d.ts +0 -0
  115. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils.d.ts +0 -0
  116. /package/dist/types/{gap-cursor-selection.d.ts → pm-plugins/gap-cursor-selection.d.ts} +0 -0
  117. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.d.ts +0 -0
  118. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.d.ts +0 -0
  119. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.d.ts +0 -0
  120. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.d.ts +0 -0
  121. /package/dist/types/{utils.d.ts → pm-plugins/utils.d.ts} +0 -0
  122. /package/dist/types/{types.d.ts → types/index.d.ts} +0 -0
  123. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/actions.d.ts +0 -0
  124. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/direction.d.ts +0 -0
  125. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/selection.d.ts +0 -0
  126. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.d.ts +0 -0
  127. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.d.ts +0 -0
  128. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.d.ts +0 -0
  129. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils.d.ts +0 -0
  130. /package/dist/types-ts4.5/{gap-cursor-selection.d.ts → pm-plugins/gap-cursor-selection.d.ts} +0 -0
  131. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.d.ts +0 -0
  132. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.d.ts +0 -0
  133. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.d.ts +0 -0
  134. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.d.ts +0 -0
  135. /package/dist/types-ts4.5/{utils.d.ts → pm-plugins/utils.d.ts} +0 -0
  136. /package/dist/types-ts4.5/{types.d.ts → types/index.d.ts} +0 -0
@@ -0,0 +1,61 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
4
+ import { autoExpandSelectionRangeOnInlineNodePluginKey } from './auto-expand-selection-range-on-inline-node-key';
5
+ export var createAutoExpandSelectionRangeOnInlineNodePlugin = function createAutoExpandSelectionRangeOnInlineNodePlugin() {
6
+ var mouseDownElement = null;
7
+ return new SafePlugin({
8
+ key: autoExpandSelectionRangeOnInlineNodePluginKey,
9
+ props: {
10
+ handleDOMEvents: {
11
+ mousedown: function mousedown(_view, event) {
12
+ mouseDownElement = event.target;
13
+ },
14
+ mouseup: function mouseup(view, event) {
15
+ var mouseUpElement = event.target;
16
+
17
+ // terminate early if mouse down and mouse up elements are the same -> e.g a click event
18
+ if (mouseDownElement === mouseUpElement) {
19
+ return;
20
+ }
21
+
22
+ // terminate early if mouse up event is not fired on inline node
23
+ if (!isMouseUpOnSupportedNode(mouseUpElement)) {
24
+ return;
25
+ }
26
+ var dispatch = view.dispatch,
27
+ state = view.state;
28
+ var selection = state.selection;
29
+
30
+ // terminate early if current selection is on a node
31
+ if (selection instanceof NodeSelection) {
32
+ return;
33
+ }
34
+
35
+ // only expand range when experiment is enabled, also fire exposure events here
36
+ if (editorExperiment('expand_selection_range_to_include_inline_node', true, {
37
+ exposure: true
38
+ })) {
39
+ // find the document position of the mouse up element
40
+ var elementStartPosition = view.posAtDOM(mouseUpElement, 0);
41
+
42
+ // find out the direction of selection
43
+ var isAnchorBeforeElement = selection.$anchor.pos <= elementStartPosition;
44
+ var expandedSelectionHeadPosition = isAnchorBeforeElement ? elementStartPosition + 1 : elementStartPosition;
45
+
46
+ // expand the selection to include the mouse up element
47
+ var tr = state.tr.setSelection(TextSelection.create(state.doc, selection.$anchor.pos, expandedSelectionHeadPosition));
48
+ dispatch(tr);
49
+ }
50
+ }
51
+ }
52
+ }
53
+ });
54
+ };
55
+ var isMouseUpOnSupportedNode = function isMouseUpOnSupportedNode(mouseUpElement) {
56
+ var supportedNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
57
+ var supportedNodeViewContentClassNamesList = supportedNodes.map(function (nodeType) {
58
+ return ".".concat(nodeType, "View-content-wrap");
59
+ }).join(', ');
60
+ return !!mouseUpElement.closest(supportedNodeViewContentClassNamesList);
61
+ };
@@ -2,10 +2,10 @@
2
2
  import { isIgnored as isIgnoredByGapCursor } from '@atlaskit/editor-common/selection';
3
3
  import { isEmptyParagraph, isNodeEmpty } from '@atlaskit/editor-common/utils';
4
4
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
+ import { RelativeSelectionPos, SelectionDirection, selectionPluginKey } from '../types';
5
6
  import { SelectionActionTypes } from './actions';
6
7
  import { GapCursorSelection, Side } from './gap-cursor-selection';
7
8
  import { createCommand, getPluginState } from './plugin-factory';
8
- import { RelativeSelectionPos, SelectionDirection, selectionPluginKey } from './types';
9
9
  import { findFirstChildNodeToSelect, findLastChildNodeToSelect, findSelectableContainerAfter, findSelectableContainerBefore, findSelectableContainerParent, isSelectableContainerNode, isSelectionAtEndOfParentNode, isSelectionAtStartOfParentNode } from './utils';
10
10
  export var selectNearNode = function selectNearNode(selectionRelativeToNode, selection) {
11
11
  return function (_ref) {
@@ -1,4 +1,5 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  var DOC_START_POS = 0;
3
4
  function isNodeContentEmpty(maybeNode) {
4
5
  return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
@@ -45,10 +46,23 @@ function findNextSelectionPosition(_ref) {
45
46
 
46
47
  //ED-20209: If the targetHead position is just before some node, Then return $targetHead and not select any node.
47
48
  var maybeNode = null;
48
- if ($targetHead.pos !== DOC_START_POS) {
49
- var justBeforeHeadPos = $targetHead.pos - 1;
50
- var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
51
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
49
+ if (fg('platform_editor_fix_drag_and_drop_lists')) {
50
+ // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
51
+ // and $head which are based on a transformed document, but only provides the original
52
+ // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
53
+ if ($targetHead.pos >= doc.nodeSize) {
54
+ maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
55
+ } else if ($targetHead.pos !== DOC_START_POS) {
56
+ var justBeforeHeadPos = $targetHead.pos - 1;
57
+ var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
58
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
59
+ }
60
+ } else {
61
+ if ($targetHead.pos !== DOC_START_POS) {
62
+ var _justBeforeHeadPos = $targetHead.pos - 1;
63
+ var _$resolvedJustBeforeHeadPos = doc.resolve(_justBeforeHeadPos);
64
+ maybeNode = _$resolvedJustBeforeHeadPos.nodeAfter;
65
+ }
52
66
  }
53
67
  if (maybeNode === null) {
54
68
  maybeNode = $targetHead.nodeAfter;
@@ -3,7 +3,7 @@ import { isMediaNode, isNodeBeforeMediaNode, isPositionNearTableRow } from '@atl
3
3
  import { ZERO_WIDTH_SPACE } from '@atlaskit/editor-common/whitespace';
4
4
  import { NodeSelection, Selection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { findDomRefAtPos, findPositionOfNodeBefore, removeNodeBefore } from '@atlaskit/editor-prosemirror/utils';
6
- import { gapCursorPluginKey } from '../pm-plugins/gap-cursor-plugin-key';
6
+ import { gapCursorPluginKey } from '../gap-cursor-plugin-key';
7
7
  import { Direction, isBackward, isForward } from './direction';
8
8
  import { GapCursorSelection, Side } from './selection';
9
9
  import { isTextBlockNearPos } from './utils';
@@ -1,5 +1,6 @@
1
1
  import { CAPTION_PLACEHOLDER_ID } from '@atlaskit/editor-common/media-single';
2
2
  import { TableSharedCssClassName, UnsupportedSharedCssClassName } from '@atlaskit/editor-common/styles';
3
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
3
4
  import { Side } from './selection';
4
5
  export var isLeftCursor = function isLeftCursor(side) {
5
6
  return side === Side.LEFT;
@@ -124,5 +125,11 @@ export var getComputedStyleForLayoutMode = function getComputedStyleForLayoutMod
124
125
  return window.getComputedStyle(tableContainer);
125
126
  }
126
127
  }
128
+ if (editorExperiment('advanced_layouts', true) && node && node.type.name === 'layoutSection') {
129
+ var layoutSectionContainer = dom.querySelector('.layout-section-container');
130
+ if (layoutSectionContainer) {
131
+ return window.getComputedStyle(layoutSectionContainer);
132
+ }
133
+ }
127
134
  return style;
128
135
  };
@@ -1,9 +1,9 @@
1
1
  import { backspace, bindKeymapWithCommand, deleteKey, insertNewLine, moveDown, moveLeft, moveRight, moveUp } from '@atlaskit/editor-common/keymaps';
2
2
  import { createParagraphNear } from '@atlaskit/editor-prosemirror/commands';
3
3
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
4
- import { arrow, deleteNode } from '../gap-cursor/actions';
5
- import { Direction } from '../gap-cursor/direction';
6
- import { GapCursorSelection } from '../gap-cursor/selection';
4
+ import { arrow, deleteNode } from './gap-cursor/actions';
5
+ import { Direction } from './gap-cursor/direction';
6
+ import { GapCursorSelection } from './gap-cursor/selection';
7
7
  export default function keymapPlugin() {
8
8
  var map = {};
9
9
  bindKeymapWithCommand(insertNewLine.common, function (state, dispatch, view) {
@@ -4,11 +4,11 @@ import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
4
4
  import { findPositionOfNodeBefore } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
7
- import { deleteNode } from '../gap-cursor/actions';
8
- import { Direction } from '../gap-cursor/direction';
9
- import { getLayoutModeFromTargetNode, isIgnoredClick } from '../gap-cursor/utils';
10
- import { toDOM } from '../gap-cursor/utils/place-gap-cursor';
11
7
  import { gapCursorPluginKey } from './gap-cursor-plugin-key';
8
+ import { deleteNode } from './gap-cursor/actions';
9
+ import { Direction } from './gap-cursor/direction';
10
+ import { getLayoutModeFromTargetNode, isIgnoredClick } from './gap-cursor/utils';
11
+ import { toDOM } from './gap-cursor/utils/place-gap-cursor';
12
12
  var plugin = new SafePlugin({
13
13
  key: gapCursorPluginKey,
14
14
  state: {
@@ -1,6 +1,6 @@
1
1
  import { bindKeymapWithCommand, moveLeft, moveRight } from '@atlaskit/editor-common/keymaps';
2
2
  import { keymap } from '@atlaskit/editor-prosemirror/keymap';
3
- import { arrowLeft, arrowRight } from '../commands';
3
+ import { arrowLeft, arrowRight } from './commands';
4
4
  function keymapPlugin() {
5
5
  var list = {};
6
6
  bindKeymapWithCommand(moveRight.common, arrowRight, list);
@@ -1,8 +1,8 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import { createMarkBoundaryCursorDecoration } from '../mark-boundary-cursor/ui/mark-boundary-cursor-decoration';
4
- import { getActiveMarksSide } from '../mark-boundary-cursor/utils/active-marks-side';
5
3
  import { markBoundaryCursorPluginKey } from './mark-boundary-cursor-plugin-key';
4
+ import { createMarkBoundaryCursorDecoration } from './mark-boundary-cursor/ui/mark-boundary-cursor-decoration';
5
+ import { getActiveMarksSide } from './mark-boundary-cursor/utils/active-marks-side';
6
6
  export var createMarkBoundaryCursorPlugin = function createMarkBoundaryCursorPlugin() {
7
7
  return new SafePlugin({
8
8
  key: markBoundaryCursorPluginKey,
@@ -5,8 +5,8 @@ import { pluginFactory } from '@atlaskit/editor-common/utils';
5
5
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
6
6
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
7
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
8
+ import { selectionPluginKey } from '../types';
8
9
  import { reducer } from './reducer';
9
- import { selectionPluginKey } from './types';
10
10
  import { getDecorations, isSelectableContainerNode } from './utils';
11
11
  var handleDocChanged = function handleDocChanged(tr, pluginState) {
12
12
  // in some collab edge cases mapping decorations could throw an error
@@ -1,11 +1,11 @@
1
1
  import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
3
- import { SelectionActionTypes } from '../actions';
4
- import { createPluginState, getPluginState } from '../plugin-factory';
5
3
  import { selectionPluginKey } from '../types';
6
- import { getDecorations, shouldRecalcDecorations } from '../utils';
4
+ import { SelectionActionTypes } from './actions';
7
5
  import { onCreateSelectionBetween } from './events/create-selection-between';
8
6
  import { createOnKeydown } from './events/keydown';
7
+ import { createPluginState, getPluginState } from './plugin-factory';
8
+ import { getDecorations, shouldRecalcDecorations } from './utils';
9
9
  export var getInitialState = function getInitialState(state) {
10
10
  return {
11
11
  decorationSet: getDecorations(state.tr),
@@ -4,7 +4,7 @@ import { AllSelection, NodeSelection, Selection, TextSelection } from '@atlaskit
4
4
  import { findParentNode, flatten } from '@atlaskit/editor-prosemirror/utils';
5
5
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
6
6
  import { akEditorSelectedNodeClassName } from '@atlaskit/editor-shared-styles';
7
- import { selectionPluginKey } from './types';
7
+ import { selectionPluginKey } from '../types';
8
8
  export var getDecorations = function getDecorations(tr) {
9
9
  if (tr.selection instanceof NodeSelection) {
10
10
  return DecorationSet.create(tr.doc, [Decoration.node(tr.selection.from, tr.selection.to, {
@@ -1,6 +1,7 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import { fg } from '@atlaskit/platform-feature-flags';
3
- import { selectNearNode as _selectNearNode } from './commands';
3
+ import { createAutoExpandSelectionRangeOnInlineNodePlugin } from './pm-plugins/auto-expand-selection-range-on-inline-node-main';
4
+ import { selectNearNode as _selectNearNode } from './pm-plugins/commands';
4
5
  import gapCursorKeymapPlugin from './pm-plugins/gap-cursor-keymap';
5
6
  import gapCursorPlugin from './pm-plugins/gap-cursor-main';
6
7
  import { gapCursorPluginKey } from './pm-plugins/gap-cursor-plugin-key';
@@ -70,6 +71,11 @@ export var selectionPlugin = function selectionPlugin(_ref2) {
70
71
  plugin: function plugin() {
71
72
  return createMarkBoundaryCursorPlugin();
72
73
  }
74
+ }] : []), _toConsumableArray(fg('editor_auto_expand_selection_on_inline_node') ? [{
75
+ name: 'autoExpandSelectionRangeOnInlineNode',
76
+ plugin: function plugin() {
77
+ return createAutoExpandSelectionRangeOnInlineNodePlugin();
78
+ }
73
79
  }] : []));
74
80
  }
75
81
  };
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,3 @@
1
- export { selectionPlugin } from './plugin';
2
- export type { SelectionPlugin } from './plugin';
1
+ export { selectionPlugin } from './selectionPlugin';
2
+ export type { SelectionPlugin } from './selectionPluginType';
3
3
  export type { EditorSelectionAPI, SetSelectionRelativeToNode, SelectionPluginOptions, } from './types';
@@ -1,6 +1,6 @@
1
1
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import type { RelativeSelectionPos } from './types';
3
+ import type { RelativeSelectionPos } from '../types';
4
4
  export declare enum SelectionActionTypes {
5
5
  SET_DECORATIONS = "SET_DECORATIONS",
6
6
  SET_RELATIVE_SELECTION = "SET_RELATIVE_SELECTION"
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const autoExpandSelectionRangeOnInlineNodePluginKey: PluginKey<any>;
@@ -0,0 +1,2 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ export declare const createAutoExpandSelectionRangeOnInlineNodePlugin: () => SafePlugin<any>;
@@ -1,7 +1,7 @@
1
1
  import type { Command, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
2
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
- import { RelativeSelectionPos } from './types';
4
+ import { RelativeSelectionPos } from '../types';
5
5
  export declare const selectNearNode: EditorCommandWithMetadata;
6
6
  export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
7
7
  export declare const arrowRight: Command;
@@ -1,2 +1,2 @@
1
- import type { SelectionPluginState } from './types';
1
+ import type { SelectionPluginState } from '../types';
2
2
  export declare const createCommand: <A = import("./actions").SelectionAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => SelectionPluginState, createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: SelectionPluginState | ((state: import("prosemirror-state").EditorState) => SelectionPluginState)) => import("prosemirror-state").SafeStateField<SelectionPluginState>;
@@ -1,3 +1,3 @@
1
+ import type { SelectionPluginState } from '../types';
1
2
  import type { SelectionAction } from './actions';
2
- import type { SelectionPluginState } from './types';
3
3
  export declare function reducer(pluginState: SelectionPluginState, action: SelectionAction): SelectionPluginState;
@@ -0,0 +1,3 @@
1
+ import type { SelectionPlugin } from './selectionPluginType';
2
+ export declare const selectionPlugin: SelectionPlugin;
3
+ export default selectionPlugin;
@@ -9,5 +9,3 @@ export type SelectionPlugin = NextEditorPlugin<'selection', {
9
9
  };
10
10
  sharedState: SelectionSharedState;
11
11
  }>;
12
- export declare const selectionPlugin: SelectionPlugin;
13
- export default selectionPlugin;
@@ -1,3 +1,3 @@
1
- export { selectionPlugin } from './plugin';
2
- export type { SelectionPlugin } from './plugin';
1
+ export { selectionPlugin } from './selectionPlugin';
2
+ export type { SelectionPlugin } from './selectionPluginType';
3
3
  export type { EditorSelectionAPI, SetSelectionRelativeToNode, SelectionPluginOptions, } from './types';
@@ -1,6 +1,6 @@
1
1
  import type { Selection } from '@atlaskit/editor-prosemirror/state';
2
2
  import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
3
- import type { RelativeSelectionPos } from './types';
3
+ import type { RelativeSelectionPos } from '../types';
4
4
  export declare enum SelectionActionTypes {
5
5
  SET_DECORATIONS = "SET_DECORATIONS",
6
6
  SET_RELATIVE_SELECTION = "SET_RELATIVE_SELECTION"
@@ -0,0 +1,2 @@
1
+ import { PluginKey } from '@atlaskit/editor-prosemirror/state';
2
+ export declare const autoExpandSelectionRangeOnInlineNodePluginKey: PluginKey<any>;
@@ -0,0 +1,2 @@
1
+ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
+ export declare const createAutoExpandSelectionRangeOnInlineNodePlugin: () => SafePlugin<any>;
@@ -1,7 +1,7 @@
1
1
  import type { Command, EditorCommandWithMetadata } from '@atlaskit/editor-common/types';
2
2
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import { Selection } from '@atlaskit/editor-prosemirror/state';
4
- import { RelativeSelectionPos } from './types';
4
+ import { RelativeSelectionPos } from '../types';
5
5
  export declare const selectNearNode: EditorCommandWithMetadata;
6
6
  export declare const setSelectionRelativeToNode: (selectionRelativeToNode?: RelativeSelectionPos, selection?: Selection | null) => Command;
7
7
  export declare const arrowRight: Command;
@@ -1,2 +1,2 @@
1
- import type { SelectionPluginState } from './types';
1
+ import type { SelectionPluginState } from '../types';
2
2
  export declare const createCommand: <A = import("./actions").SelectionAction>(action: A | ((state: Readonly<import("prosemirror-state").EditorState>) => false | A), transform?: ((tr: import("prosemirror-state").Transaction, state: import("prosemirror-state").EditorState) => import("prosemirror-state").Transaction) | undefined) => import("@atlaskit/editor-common/types").Command, getPluginState: (state: import("prosemirror-state").EditorState) => SelectionPluginState, createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: SelectionPluginState | ((state: import("prosemirror-state").EditorState) => SelectionPluginState)) => import("prosemirror-state").SafeStateField<SelectionPluginState>;
@@ -1,3 +1,3 @@
1
+ import type { SelectionPluginState } from '../types';
1
2
  import type { SelectionAction } from './actions';
2
- import type { SelectionPluginState } from './types';
3
3
  export declare function reducer(pluginState: SelectionPluginState, action: SelectionAction): SelectionPluginState;
@@ -0,0 +1,3 @@
1
+ import type { SelectionPlugin } from './selectionPluginType';
2
+ export declare const selectionPlugin: SelectionPlugin;
3
+ export default selectionPlugin;
@@ -9,5 +9,3 @@ export type SelectionPlugin = NextEditorPlugin<'selection', {
9
9
  };
10
10
  sharedState: SelectionSharedState;
11
11
  }>;
12
- export declare const selectionPlugin: SelectionPlugin;
13
- export default selectionPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection",
3
- "version": "1.5.5",
3
+ "version": "1.6.0",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -20,11 +20,12 @@
20
20
  "runReact18": true
21
21
  },
22
22
  "dependencies": {
23
- "@atlaskit/editor-common": "^96.0.0",
23
+ "@atlaskit/editor-common": "^96.3.0",
24
24
  "@atlaskit/editor-prosemirror": "6.2.1",
25
25
  "@atlaskit/editor-shared-styles": "^3.2.0",
26
26
  "@atlaskit/editor-tables": "^2.8.0",
27
27
  "@atlaskit/platform-feature-flags": "^0.3.0",
28
+ "@atlaskit/tmp-editor-statsig": "2.25.0",
28
29
  "@atlaskit/tokens": "^2.4.0",
29
30
  "@babel/runtime": "^7.0.0"
30
31
  },
@@ -36,6 +37,9 @@
36
37
  },
37
38
  "techstack": {
38
39
  "@atlassian/frontend": {
40
+ "code-structure": [
41
+ "editor-plugin"
42
+ ],
39
43
  "import-structure": [
40
44
  "atlassian-conventions"
41
45
  ],
@@ -69,7 +73,7 @@
69
73
  },
70
74
  "af:exports": {
71
75
  ".": "./src/index.ts",
72
- "./types": "./src/types.ts"
76
+ "./types": "./src/types/index.ts"
73
77
  },
74
78
  "stricter": {
75
79
  "no-unused-dependencies": {
@@ -82,6 +86,12 @@
82
86
  },
83
87
  "platform_editor_mark_boundary_cursor": {
84
88
  "type": "boolean"
89
+ },
90
+ "platform_editor_fix_drag_and_drop_lists": {
91
+ "type": "boolean"
92
+ },
93
+ "editor_auto_expand_selection_on_inline_node": {
94
+ "type": "boolean"
85
95
  }
86
96
  }
87
97
  }
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection/types",
3
- "main": "../dist/cjs/types.js",
4
- "module": "../dist/esm/types.js",
5
- "module:es2019": "../dist/es2019/types.js",
3
+ "main": "../dist/cjs/types/index.js",
4
+ "module": "../dist/esm/types/index.js",
5
+ "module:es2019": "../dist/es2019/types/index.js",
6
6
  "sideEffects": false,
7
- "types": "../dist/types/types.d.ts",
7
+ "types": "../dist/types/types/index.d.ts",
8
8
  "typesVersions": {
9
9
  ">=4.5 <5.4": {
10
10
  "*": [
11
- "../dist/types-ts4.5/types.d.ts"
11
+ "../dist/types-ts4.5/types/index.d.ts"
12
12
  ]
13
13
  }
14
14
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes