@atlaskit/editor-plugin-selection 1.5.4 → 1.5.6

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 (126) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/index.js +2 -2
  3. package/dist/cjs/{commands.js → pm-plugins/commands.js} +1 -1
  4. package/dist/cjs/pm-plugins/events/create-selection-between.js +18 -4
  5. package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/actions.js +1 -1
  6. package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils.js +7 -0
  7. package/dist/cjs/pm-plugins/gap-cursor-keymap.js +3 -3
  8. package/dist/cjs/pm-plugins/gap-cursor-main.js +4 -4
  9. package/dist/cjs/pm-plugins/keymap.js +1 -1
  10. package/dist/cjs/pm-plugins/mark-boundary-cursor-main.js +2 -2
  11. package/dist/cjs/{plugin-factory.js → pm-plugins/plugin-factory.js} +1 -1
  12. package/dist/cjs/pm-plugins/selection-main.js +3 -3
  13. package/dist/cjs/{utils.js → pm-plugins/utils.js} +1 -1
  14. package/dist/cjs/{plugin.js → selectionPlugin.js} +1 -1
  15. package/dist/cjs/selectionPluginType.js +5 -0
  16. package/dist/es2019/index.js +1 -1
  17. package/dist/es2019/{commands.js → pm-plugins/commands.js} +1 -1
  18. package/dist/es2019/pm-plugins/events/create-selection-between.js +18 -4
  19. package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/actions.js +1 -1
  20. package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils.js +7 -0
  21. package/dist/es2019/pm-plugins/gap-cursor-keymap.js +3 -3
  22. package/dist/es2019/pm-plugins/gap-cursor-main.js +4 -4
  23. package/dist/es2019/pm-plugins/keymap.js +1 -1
  24. package/dist/es2019/pm-plugins/mark-boundary-cursor-main.js +2 -2
  25. package/dist/es2019/{plugin-factory.js → pm-plugins/plugin-factory.js} +1 -1
  26. package/dist/es2019/pm-plugins/selection-main.js +3 -3
  27. package/dist/es2019/{utils.js → pm-plugins/utils.js} +1 -1
  28. package/dist/es2019/{plugin.js → selectionPlugin.js} +1 -1
  29. package/dist/es2019/selectionPluginType.js +1 -0
  30. package/dist/esm/index.js +1 -1
  31. package/dist/esm/{commands.js → pm-plugins/commands.js} +1 -1
  32. package/dist/esm/pm-plugins/events/create-selection-between.js +18 -4
  33. package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/actions.js +1 -1
  34. package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils.js +7 -0
  35. package/dist/esm/pm-plugins/gap-cursor-keymap.js +3 -3
  36. package/dist/esm/pm-plugins/gap-cursor-main.js +4 -4
  37. package/dist/esm/pm-plugins/keymap.js +1 -1
  38. package/dist/esm/pm-plugins/mark-boundary-cursor-main.js +2 -2
  39. package/dist/esm/{plugin-factory.js → pm-plugins/plugin-factory.js} +1 -1
  40. package/dist/esm/pm-plugins/selection-main.js +3 -3
  41. package/dist/esm/{utils.js → pm-plugins/utils.js} +1 -1
  42. package/dist/esm/{plugin.js → selectionPlugin.js} +1 -1
  43. package/dist/esm/selectionPluginType.js +1 -0
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/{types-ts4.5 → types/pm-plugins}/actions.d.ts +1 -1
  46. package/dist/types/{commands.d.ts → pm-plugins/commands.d.ts} +1 -1
  47. package/dist/types/{plugin-factory.d.ts → pm-plugins/plugin-factory.d.ts} +1 -1
  48. package/dist/types/{reducer.d.ts → pm-plugins/reducer.d.ts} +1 -1
  49. package/dist/types/selectionPlugin.d.ts +3 -0
  50. package/dist/types/{plugin.d.ts → selectionPluginType.d.ts} +0 -2
  51. package/dist/types-ts4.5/index.d.ts +2 -2
  52. package/dist/{types → types-ts4.5/pm-plugins}/actions.d.ts +1 -1
  53. package/dist/types-ts4.5/{commands.d.ts → pm-plugins/commands.d.ts} +1 -1
  54. package/dist/types-ts4.5/{plugin-factory.d.ts → pm-plugins/plugin-factory.d.ts} +1 -1
  55. package/dist/types-ts4.5/{reducer.d.ts → pm-plugins/reducer.d.ts} +1 -1
  56. package/dist/types-ts4.5/selectionPlugin.d.ts +3 -0
  57. package/dist/types-ts4.5/{plugin.d.ts → selectionPluginType.d.ts} +0 -2
  58. package/package.json +12 -5
  59. package/types/package.json +5 -5
  60. /package/dist/cjs/{actions.js → pm-plugins/actions.js} +0 -0
  61. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/direction.js +0 -0
  62. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/selection.js +0 -0
  63. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.js +0 -0
  64. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.js +0 -0
  65. /package/dist/cjs/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.js +0 -0
  66. /package/dist/cjs/{gap-cursor-selection.js → pm-plugins/gap-cursor-selection.js} +0 -0
  67. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.js +0 -0
  68. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.js +0 -0
  69. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.js +0 -0
  70. /package/dist/cjs/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.js +0 -0
  71. /package/dist/cjs/{reducer.js → pm-plugins/reducer.js} +0 -0
  72. /package/dist/cjs/{types.js → types/index.js} +0 -0
  73. /package/dist/es2019/{actions.js → pm-plugins/actions.js} +0 -0
  74. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/direction.js +0 -0
  75. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/selection.js +0 -0
  76. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.js +0 -0
  77. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.js +0 -0
  78. /package/dist/es2019/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.js +0 -0
  79. /package/dist/es2019/{gap-cursor-selection.js → pm-plugins/gap-cursor-selection.js} +0 -0
  80. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.js +0 -0
  81. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.js +0 -0
  82. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.js +0 -0
  83. /package/dist/es2019/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.js +0 -0
  84. /package/dist/es2019/{reducer.js → pm-plugins/reducer.js} +0 -0
  85. /package/dist/es2019/{types.js → types/index.js} +0 -0
  86. /package/dist/esm/{actions.js → pm-plugins/actions.js} +0 -0
  87. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/direction.js +0 -0
  88. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/selection.js +0 -0
  89. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.js +0 -0
  90. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.js +0 -0
  91. /package/dist/esm/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.js +0 -0
  92. /package/dist/esm/{gap-cursor-selection.js → pm-plugins/gap-cursor-selection.js} +0 -0
  93. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.js +0 -0
  94. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.js +0 -0
  95. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.js +0 -0
  96. /package/dist/esm/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.js +0 -0
  97. /package/dist/esm/{reducer.js → pm-plugins/reducer.js} +0 -0
  98. /package/dist/esm/{types.js → types/index.js} +0 -0
  99. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/actions.d.ts +0 -0
  100. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/direction.d.ts +0 -0
  101. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/selection.d.ts +0 -0
  102. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.d.ts +0 -0
  103. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.d.ts +0 -0
  104. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.d.ts +0 -0
  105. /package/dist/types/{gap-cursor → pm-plugins/gap-cursor}/utils.d.ts +0 -0
  106. /package/dist/types/{gap-cursor-selection.d.ts → pm-plugins/gap-cursor-selection.d.ts} +0 -0
  107. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.d.ts +0 -0
  108. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.d.ts +0 -0
  109. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.d.ts +0 -0
  110. /package/dist/types/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.d.ts +0 -0
  111. /package/dist/types/{utils.d.ts → pm-plugins/utils.d.ts} +0 -0
  112. /package/dist/types/{types.d.ts → types/index.d.ts} +0 -0
  113. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/actions.d.ts +0 -0
  114. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/direction.d.ts +0 -0
  115. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/selection.d.ts +0 -0
  116. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils/is-ignored.d.ts +0 -0
  117. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils/is-valid-target-node.d.ts +0 -0
  118. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils/place-gap-cursor.d.ts +0 -0
  119. /package/dist/types-ts4.5/{gap-cursor → pm-plugins/gap-cursor}/utils.d.ts +0 -0
  120. /package/dist/types-ts4.5/{gap-cursor-selection.d.ts → pm-plugins/gap-cursor-selection.d.ts} +0 -0
  121. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/marks-side.d.ts +0 -0
  122. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/ui/mark-boundary-cursor-decoration.d.ts +0 -0
  123. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/active-marks-side.d.ts +0 -0
  124. /package/dist/types-ts4.5/{mark-boundary-cursor → pm-plugins/mark-boundary-cursor}/utils/inline-code-side.d.ts +0 -0
  125. /package/dist/types-ts4.5/{utils.d.ts → pm-plugins/utils.d.ts} +0 -0
  126. /package/dist/types-ts4.5/{types.d.ts → types/index.d.ts} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-selection
2
2
 
3
+ ## 1.5.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#171440](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/171440)
8
+ [`835f7bbff3122`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/835f7bbff3122) -
9
+ ED-25816: refactors plugins to meet folder standards
10
+ - Updated dependencies
11
+
12
+ ## 1.5.5
13
+
14
+ ### Patch Changes
15
+
16
+ - Updated dependencies
17
+
3
18
  ## 1.5.4
4
19
 
5
20
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "selectionPlugin", {
7
7
  enumerable: true,
8
8
  get: function get() {
9
- return _plugin.selectionPlugin;
9
+ return _selectionPlugin.selectionPlugin;
10
10
  }
11
11
  });
12
- var _plugin = require("./plugin");
12
+ var _selectionPlugin = require("./selectionPlugin");
@@ -7,10 +7,10 @@ exports.setSelectionRelativeToNode = exports.setSelectionInsideAtNodeEnd = expor
7
7
  var _selection = require("@atlaskit/editor-common/selection");
8
8
  var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _state = require("@atlaskit/editor-prosemirror/state");
10
+ var _types = require("../types");
10
11
  var _actions = require("./actions");
11
12
  var _gapCursorSelection = require("./gap-cursor-selection");
12
13
  var _pluginFactory = require("./plugin-factory");
13
- var _types = require("./types");
14
14
  var _utils2 = require("./utils");
15
15
  /* eslint-disable import/no-extraneous-dependencies */
16
16
 
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.onCreateSelectionBetween = void 0;
7
7
  var _state = require("@atlaskit/editor-prosemirror/state");
8
+ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
8
9
  var DOC_START_POS = 0;
9
10
  function isNodeContentEmpty(maybeNode) {
10
11
  return (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.content.size) === 0 || (maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.textContent) === '';
@@ -51,10 +52,23 @@ function findNextSelectionPosition(_ref) {
51
52
 
52
53
  //ED-20209: If the targetHead position is just before some node, Then return $targetHead and not select any node.
53
54
  var maybeNode = null;
54
- if ($targetHead.pos !== DOC_START_POS) {
55
- var justBeforeHeadPos = $targetHead.pos - 1;
56
- var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
57
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
55
+ if ((0, _platformFeatureFlags.fg)('platform_editor_fix_drag_and_drop_lists')) {
56
+ // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
57
+ // and $head which are based on a transformed document, but only provides the original
58
+ // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
59
+ if ($targetHead.pos >= doc.nodeSize) {
60
+ maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
61
+ } else if ($targetHead.pos !== DOC_START_POS) {
62
+ var justBeforeHeadPos = $targetHead.pos - 1;
63
+ var $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
64
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
65
+ }
66
+ } else {
67
+ if ($targetHead.pos !== DOC_START_POS) {
68
+ var _justBeforeHeadPos = $targetHead.pos - 1;
69
+ var _$resolvedJustBeforeHeadPos = doc.resolve(_justBeforeHeadPos);
70
+ maybeNode = _$resolvedJustBeforeHeadPos.nodeAfter;
71
+ }
58
72
  }
59
73
  if (maybeNode === null) {
60
74
  maybeNode = $targetHead.nodeAfter;
@@ -9,7 +9,7 @@ var _utils = require("@atlaskit/editor-common/utils");
9
9
  var _whitespace = require("@atlaskit/editor-common/whitespace");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
12
- var _gapCursorPluginKey = require("../pm-plugins/gap-cursor-plugin-key");
12
+ var _gapCursorPluginKey = require("../gap-cursor-plugin-key");
13
13
  var _direction = require("./direction");
14
14
  var _selection2 = require("./selection");
15
15
  var _utils3 = require("./utils");
@@ -9,6 +9,7 @@ exports.getMediaNearPos = getMediaNearPos;
9
9
  exports.isTextBlockNearPos = exports.isLeftCursor = exports.isIgnoredClick = void 0;
10
10
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
11
11
  var _styles = require("@atlaskit/editor-common/styles");
12
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
12
13
  var _selection = require("./selection");
13
14
  var isLeftCursor = exports.isLeftCursor = function isLeftCursor(side) {
14
15
  return side === _selection.Side.LEFT;
@@ -133,5 +134,11 @@ var getComputedStyleForLayoutMode = exports.getComputedStyleForLayoutMode = func
133
134
  return window.getComputedStyle(tableContainer);
134
135
  }
135
136
  }
137
+ if ((0, _experiments.editorExperiment)('advanced_layouts', true) && node && node.type.name === 'layoutSection') {
138
+ var layoutSectionContainer = dom.querySelector('.layout-section-container');
139
+ if (layoutSectionContainer) {
140
+ return window.getComputedStyle(layoutSectionContainer);
141
+ }
142
+ }
136
143
  return style;
137
144
  };
@@ -7,9 +7,9 @@ exports.default = keymapPlugin;
7
7
  var _keymaps = require("@atlaskit/editor-common/keymaps");
8
8
  var _commands = require("@atlaskit/editor-prosemirror/commands");
9
9
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
10
- var _actions = require("../gap-cursor/actions");
11
- var _direction = require("../gap-cursor/direction");
12
- var _selection = require("../gap-cursor/selection");
10
+ var _actions = require("./gap-cursor/actions");
11
+ var _direction = require("./gap-cursor/direction");
12
+ var _selection = require("./gap-cursor/selection");
13
13
  function keymapPlugin() {
14
14
  var map = {};
15
15
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.insertNewLine.common, function (state, dispatch, view) {
@@ -10,11 +10,11 @@ var _state = require("@atlaskit/editor-prosemirror/state");
10
10
  var _utils = require("@atlaskit/editor-prosemirror/utils");
11
11
  var _view2 = require("@atlaskit/editor-prosemirror/view");
12
12
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
- var _actions = require("../gap-cursor/actions");
14
- var _direction = require("../gap-cursor/direction");
15
- var _utils2 = require("../gap-cursor/utils");
16
- var _placeGapCursor = require("../gap-cursor/utils/place-gap-cursor");
17
13
  var _gapCursorPluginKey = require("./gap-cursor-plugin-key");
14
+ var _actions = require("./gap-cursor/actions");
15
+ var _direction = require("./gap-cursor/direction");
16
+ var _utils2 = require("./gap-cursor/utils");
17
+ var _placeGapCursor = require("./gap-cursor/utils/place-gap-cursor");
18
18
  var plugin = new _safePlugin.SafePlugin({
19
19
  key: _gapCursorPluginKey.gapCursorPluginKey,
20
20
  state: {
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.default = void 0;
7
7
  var _keymaps = require("@atlaskit/editor-common/keymaps");
8
8
  var _keymap = require("@atlaskit/editor-prosemirror/keymap");
9
- var _commands = require("../commands");
9
+ var _commands = require("./commands");
10
10
  function keymapPlugin() {
11
11
  var list = {};
12
12
  (0, _keymaps.bindKeymapWithCommand)(_keymaps.moveRight.common, _commands.arrowRight, list);
@@ -6,9 +6,9 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.createMarkBoundaryCursorPlugin = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _view = require("@atlaskit/editor-prosemirror/view");
9
- var _markBoundaryCursorDecoration = require("../mark-boundary-cursor/ui/mark-boundary-cursor-decoration");
10
- var _activeMarksSide = require("../mark-boundary-cursor/utils/active-marks-side");
11
9
  var _markBoundaryCursorPluginKey = require("./mark-boundary-cursor-plugin-key");
10
+ var _markBoundaryCursorDecoration = require("./mark-boundary-cursor/ui/mark-boundary-cursor-decoration");
11
+ var _activeMarksSide = require("./mark-boundary-cursor/utils/active-marks-side");
12
12
  var createMarkBoundaryCursorPlugin = exports.createMarkBoundaryCursorPlugin = function createMarkBoundaryCursorPlugin() {
13
13
  return new _safePlugin.SafePlugin({
14
14
  key: _markBoundaryCursorPluginKey.markBoundaryCursorPluginKey,
@@ -10,8 +10,8 @@ var _utils = require("@atlaskit/editor-common/utils");
10
10
  var _state = require("@atlaskit/editor-prosemirror/state");
11
11
  var _view = require("@atlaskit/editor-prosemirror/view");
12
12
  var _cellSelection = require("@atlaskit/editor-tables/cell-selection");
13
+ var _types = require("../types");
13
14
  var _reducer = require("./reducer");
14
- var _types = require("./types");
15
15
  var _utils2 = require("./utils");
16
16
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
17
17
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
@@ -6,12 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.getInitialState = exports.createPlugin = void 0;
7
7
  var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
8
8
  var _state = require("@atlaskit/editor-prosemirror/state");
9
- var _actions = require("../actions");
10
- var _pluginFactory = require("../plugin-factory");
11
9
  var _types = require("../types");
12
- var _utils = require("../utils");
10
+ var _actions = require("./actions");
13
11
  var _createSelectionBetween = require("./events/create-selection-between");
14
12
  var _keydown = require("./events/keydown");
13
+ var _pluginFactory = require("./plugin-factory");
14
+ var _utils = require("./utils");
15
15
  var getInitialState = exports.getInitialState = function getInitialState(state) {
16
16
  return {
17
17
  decorationSet: (0, _utils.getDecorations)(state.tr),
@@ -17,7 +17,7 @@ var _state = require("@atlaskit/editor-prosemirror/state");
17
17
  var _utils2 = require("@atlaskit/editor-prosemirror/utils");
18
18
  var _view = require("@atlaskit/editor-prosemirror/view");
19
19
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
20
- var _types = require("./types");
20
+ var _types = require("../types");
21
21
  var getDecorations = exports.getDecorations = function getDecorations(tr) {
22
22
  if (tr.selection instanceof _state.NodeSelection) {
23
23
  return _view.DecorationSet.create(tr.doc, [_view.Decoration.node(tr.selection.from, tr.selection.to, {
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.selectionPlugin = exports.default = void 0;
8
8
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
9
9
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
10
- var _commands = require("./commands");
10
+ var _commands = require("./pm-plugins/commands");
11
11
  var _gapCursorKeymap = _interopRequireDefault(require("./pm-plugins/gap-cursor-keymap"));
12
12
  var _gapCursorMain = _interopRequireDefault(require("./pm-plugins/gap-cursor-main"));
13
13
  var _gapCursorPluginKey = require("./pm-plugins/gap-cursor-plugin-key");
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -1 +1 @@
1
- export { selectionPlugin } from './plugin';
1
+ export { selectionPlugin } from './selectionPlugin';
@@ -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 const selectNearNode = (selectionRelativeToNode, selection) => ({
11
11
  tr
@@ -1,4 +1,5 @@
1
1
  import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
2
+ import { fg } from '@atlaskit/platform-feature-flags';
2
3
  const 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) === '';
@@ -48,10 +49,23 @@ function findNextSelectionPosition({
48
49
 
49
50
  //ED-20209: If the targetHead position is just before some node, Then return $targetHead and not select any node.
50
51
  let maybeNode = null;
51
- if ($targetHead.pos !== DOC_START_POS) {
52
- const justBeforeHeadPos = $targetHead.pos - 1;
53
- const $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
54
- maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
52
+ if (fg('platform_editor_fix_drag_and_drop_lists')) {
53
+ // prosemirror calls 'createSelectionBetween' for native 'drop' events, it passes $anchor
54
+ // and $head which are based on a transformed document, but only provides the original
55
+ // doc. Need to remap the $head pos to last element in doc to avoid RangeErrors.
56
+ if ($targetHead.pos >= doc.nodeSize) {
57
+ maybeNode = doc.resolve(doc.nodeSize - 2).nodeBefore;
58
+ } else if ($targetHead.pos !== DOC_START_POS) {
59
+ const justBeforeHeadPos = $targetHead.pos - 1;
60
+ const $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
61
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
62
+ }
63
+ } else {
64
+ if ($targetHead.pos !== DOC_START_POS) {
65
+ const justBeforeHeadPos = $targetHead.pos - 1;
66
+ const $resolvedJustBeforeHeadPos = doc.resolve(justBeforeHeadPos);
67
+ maybeNode = $resolvedJustBeforeHeadPos.nodeAfter;
68
+ }
55
69
  }
56
70
  if (maybeNode === null) {
57
71
  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 const isLeftCursor = side => side === Side.LEFT;
5
6
  export function getMediaNearPos(doc, $pos, schema, dir = -1) {
@@ -120,5 +121,11 @@ export const getComputedStyleForLayoutMode = (dom, node, style) => {
120
121
  return window.getComputedStyle(tableContainer);
121
122
  }
122
123
  }
124
+ if (editorExperiment('advanced_layouts', true) && node && node.type.name === 'layoutSection') {
125
+ const layoutSectionContainer = dom.querySelector('.layout-section-container');
126
+ if (layoutSectionContainer) {
127
+ return window.getComputedStyle(layoutSectionContainer);
128
+ }
129
+ }
123
130
  return style;
124
131
  };
@@ -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
  const map = {};
9
9
  bindKeymapWithCommand(insertNewLine.common, (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
  const 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
  const 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 const createMarkBoundaryCursorPlugin = () => {
7
7
  return new SafePlugin({
8
8
  key: markBoundaryCursorPluginKey,
@@ -2,8 +2,8 @@ import { pluginFactory } from '@atlaskit/editor-common/utils';
2
2
  import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
3
3
  import { DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { CellSelection } from '@atlaskit/editor-tables/cell-selection';
5
+ import { selectionPluginKey } from '../types';
5
6
  import { reducer } from './reducer';
6
- import { selectionPluginKey } from './types';
7
7
  import { getDecorations, isSelectableContainerNode } from './utils';
8
8
  const handleDocChanged = (tr, pluginState) => {
9
9
  // 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 const getInitialState = state => ({
10
10
  decorationSet: getDecorations(state.tr),
11
11
  selection: state.selection
@@ -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 const 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,5 +1,5 @@
1
1
  import { fg } from '@atlaskit/platform-feature-flags';
2
- import { selectNearNode } from './commands';
2
+ import { selectNearNode } from './pm-plugins/commands';
3
3
  import gapCursorKeymapPlugin from './pm-plugins/gap-cursor-keymap';
4
4
  import gapCursorPlugin from './pm-plugins/gap-cursor-main';
5
5
  import { gapCursorPluginKey } from './pm-plugins/gap-cursor-plugin-key';
@@ -0,0 +1 @@
1
+ export {};
package/dist/esm/index.js CHANGED
@@ -1 +1 @@
1
- export { selectionPlugin } from './plugin';
1
+ export { selectionPlugin } from './selectionPlugin';
@@ -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,6 @@
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 { selectNearNode as _selectNearNode } from './pm-plugins/commands';
4
4
  import gapCursorKeymapPlugin from './pm-plugins/gap-cursor-keymap';
5
5
  import gapCursorPlugin from './pm-plugins/gap-cursor-main';
6
6
  import { gapCursorPluginKey } from './pm-plugins/gap-cursor-plugin-key';
@@ -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"
@@ -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"
@@ -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.4",
3
+ "version": "1.5.6",
4
4
  "description": "Selection plugin for @atlaskit/editor-core",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -20,12 +20,13 @@
20
20
  "runReact18": true
21
21
  },
22
22
  "dependencies": {
23
- "@atlaskit/editor-common": "^95.0.0",
24
- "@atlaskit/editor-prosemirror": "6.0.0",
23
+ "@atlaskit/editor-common": "^96.3.0",
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/tokens": "^2.3.0",
28
+ "@atlaskit/tmp-editor-statsig": "2.24.0",
29
+ "@atlaskit/tokens": "^2.4.0",
29
30
  "@babel/runtime": "^7.0.0"
30
31
  },
31
32
  "peerDependencies": {
@@ -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,9 @@
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"
85
92
  }
86
93
  }
87
94
  }
@@ -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