@atlaskit/editor-plugin-selection-extension 10.0.2 → 10.0.4

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 CHANGED
@@ -1,5 +1,20 @@
1
1
  # @atlaskit/editor-plugin-selection-extension
2
2
 
3
+ ## 10.0.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`01e7a0b3e1d7a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/01e7a0b3e1d7a) -
8
+ Fix range error when select multiple paragraphs
9
+
10
+ ## 10.0.3
11
+
12
+ ### Patch Changes
13
+
14
+ - [`9e3a102746991`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/9e3a102746991) -
15
+ EDITOR-4273 Block menu extension lozenge rendering
16
+ - Updated dependencies
17
+
3
18
  ## 10.0.2
4
19
 
5
20
  ### Patch Changes
@@ -185,12 +185,17 @@ function getSelectionAdfInfoNew(selection) {
185
185
  } else {
186
186
  var $from = selection.$from,
187
187
  $to = selection.$to;
188
- if ($from.parent === $to.parent) {
188
+ if ($from.parent === $to.parent && $from.depth > 0) {
189
189
  selectionInfo = (0, _selectionHelpers.getSelectionInfoFromSameNode)(selection);
190
190
  }
191
191
  }
192
192
  } else if (selection instanceof _editorTables.CellSelection) {
193
193
  selectionInfo = getSelectionInfoFromCellSelection(selection);
194
+ } else if (selection instanceof _state.NodeSelection) {
195
+ selectionInfo = {
196
+ selectedNode: selection.node,
197
+ nodePos: selection.from
198
+ };
194
199
  }
195
200
  var serializer = new _editorJsonTransformer.JSONTransformer();
196
201
  var selectedNodeAdf = serializer.encodeNode(selectionInfo.selectedNode);
@@ -208,8 +208,8 @@ var getSelectionInfo = exports.getSelectionInfo = function getSelectionInfo(sele
208
208
  var $from = selection.$from,
209
209
  $to = selection.$to;
210
210
 
211
- // For same parent selections, check for parent container
212
- if ($from.parent === $to.parent) {
211
+ // For same parent selections but not the r, check for parent container
212
+ if ($from.parent === $to.parent && $from.depth > 0) {
213
213
  var _getCommonParentConta = getCommonParentContainer($from, $to),
214
214
  parentNode = _getCommonParentConta.node,
215
215
  parentNodePos = _getCommonParentConta.pos;
@@ -0,0 +1 @@
1
+ ._18u01b66{margin-left:var(--ds-space-050,4px)}
@@ -1,3 +1,4 @@
1
+ /* SelectionExtensionDropdownItem.tsx generated by @compiled/babel-plugin v0.38.1 */
1
2
  "use strict";
2
3
 
3
4
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
@@ -5,13 +6,20 @@ Object.defineProperty(exports, "__esModule", {
5
6
  value: true
6
7
  });
7
8
  exports.SelectionExtensionDropdownItem = void 0;
9
+ require("./SelectionExtensionDropdownItem.compiled.css");
10
+ var _runtime = require("@compiled/react/runtime");
8
11
  var _react = _interopRequireDefault(require("react"));
9
12
  var _analytics = require("@atlaskit/editor-common/analytics");
10
13
  var _editorToolbar = require("@atlaskit/editor-toolbar");
14
+ var _lozenge = _interopRequireDefault(require("@atlaskit/lozenge"));
15
+ var _compiled = require("@atlaskit/primitives/compiled");
11
16
  var _main = require("../../pm-plugins/main");
12
17
  var _utils = require("../../pm-plugins/utils");
13
18
  var _types = require("../../types");
14
19
  var _SelectionExtensionComponentContext = require("../SelectionExtensionComponentContext");
20
+ var styles = {
21
+ lozenge: "_18u01b66"
22
+ };
15
23
  var SelectionExtensionDropdownItem = exports.SelectionExtensionDropdownItem = function SelectionExtensionDropdownItem(_ref) {
16
24
  var dropdownItem = _ref.dropdownItem;
17
25
  var IconComponent = dropdownItem.icon;
@@ -65,5 +73,10 @@ var SelectionExtensionDropdownItem = exports.SelectionExtensionDropdownItem = fu
65
73
  }) : undefined,
66
74
  onClick: handleClick,
67
75
  isDisabled: dropdownItem.isDisabled
68
- }, dropdownItem.label);
76
+ }, dropdownItem.label, dropdownItem.lozenge ? /*#__PURE__*/_react.default.createElement(_compiled.Box, {
77
+ as: "span",
78
+ xcss: styles.lozenge
79
+ }, /*#__PURE__*/_react.default.createElement(_lozenge.default, {
80
+ appearance: "new"
81
+ }, dropdownItem.lozenge.label)) : undefined);
69
82
  };
@@ -1,7 +1,7 @@
1
1
  import { logException } from '@atlaskit/editor-common/monitoring';
2
2
  import { JSONTransformer } from '@atlaskit/editor-json-transformer';
3
3
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
4
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
4
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
5
5
  import { Transform } from '@atlaskit/editor-prosemirror/transform';
6
6
  import { akEditorFullPageToolbarHeight } from '@atlaskit/editor-shared-styles';
7
7
  import { CellSelection, TableMap } from '@atlaskit/editor-tables';
@@ -191,12 +191,17 @@ export function getSelectionAdfInfoNew(selection) {
191
191
  $from,
192
192
  $to
193
193
  } = selection;
194
- if ($from.parent === $to.parent) {
194
+ if ($from.parent === $to.parent && $from.depth > 0) {
195
195
  selectionInfo = getSelectionInfoFromSameNode(selection);
196
196
  }
197
197
  }
198
198
  } else if (selection instanceof CellSelection) {
199
199
  selectionInfo = getSelectionInfoFromCellSelection(selection);
200
+ } else if (selection instanceof NodeSelection) {
201
+ selectionInfo = {
202
+ selectedNode: selection.node,
203
+ nodePos: selection.from
204
+ };
200
205
  }
201
206
  const serializer = new JSONTransformer();
202
207
  const selectedNodeAdf = serializer.encodeNode(selectionInfo.selectedNode);
@@ -200,8 +200,8 @@ export const getSelectionInfo = (selection, schema) => {
200
200
  $to
201
201
  } = selection;
202
202
 
203
- // For same parent selections, check for parent container
204
- if ($from.parent === $to.parent) {
203
+ // For same parent selections but not the r, check for parent container
204
+ if ($from.parent === $to.parent && $from.depth > 0) {
205
205
  const {
206
206
  node: parentNode,
207
207
  pos: parentNodePos
@@ -0,0 +1 @@
1
+ ._18u01b66{margin-left:var(--ds-space-050,4px)}
@@ -1,10 +1,18 @@
1
+ /* SelectionExtensionDropdownItem.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./SelectionExtensionDropdownItem.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
1
4
  import React from 'react';
2
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
6
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
7
+ import Lozenge from '@atlaskit/lozenge';
8
+ import { Box } from '@atlaskit/primitives/compiled';
4
9
  import { selectionExtensionPluginKey } from '../../pm-plugins/main';
5
10
  import { getSelectionAdfInfoNew, getSelectionTextInfoNew } from '../../pm-plugins/utils';
6
11
  import { SelectionExtensionActionTypes } from '../../types';
7
12
  import { useSelectionExtensionComponentContext } from '../SelectionExtensionComponentContext';
13
+ const styles = {
14
+ lozenge: "_18u01b66"
15
+ };
8
16
  export const SelectionExtensionDropdownItem = ({
9
17
  dropdownItem
10
18
  }) => {
@@ -62,5 +70,10 @@ export const SelectionExtensionDropdownItem = ({
62
70
  }) : undefined,
63
71
  onClick: handleClick,
64
72
  isDisabled: dropdownItem.isDisabled
65
- }, dropdownItem.label);
73
+ }, dropdownItem.label, dropdownItem.lozenge ? /*#__PURE__*/React.createElement(Box, {
74
+ as: "span",
75
+ xcss: styles.lozenge
76
+ }, /*#__PURE__*/React.createElement(Lozenge, {
77
+ appearance: "new"
78
+ }, dropdownItem.lozenge.label)) : undefined);
66
79
  };
@@ -4,7 +4,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { logException } from '@atlaskit/editor-common/monitoring';
5
5
  import { JSONTransformer } from '@atlaskit/editor-json-transformer';
6
6
  import { Fragment } from '@atlaskit/editor-prosemirror/model';
7
- import { TextSelection } from '@atlaskit/editor-prosemirror/state';
7
+ import { NodeSelection, TextSelection } from '@atlaskit/editor-prosemirror/state';
8
8
  import { Transform } from '@atlaskit/editor-prosemirror/transform';
9
9
  import { akEditorFullPageToolbarHeight } from '@atlaskit/editor-shared-styles';
10
10
  import { CellSelection, TableMap } from '@atlaskit/editor-tables';
@@ -175,12 +175,17 @@ export function getSelectionAdfInfoNew(selection) {
175
175
  } else {
176
176
  var $from = selection.$from,
177
177
  $to = selection.$to;
178
- if ($from.parent === $to.parent) {
178
+ if ($from.parent === $to.parent && $from.depth > 0) {
179
179
  selectionInfo = getSelectionInfoFromSameNode(selection);
180
180
  }
181
181
  }
182
182
  } else if (selection instanceof CellSelection) {
183
183
  selectionInfo = getSelectionInfoFromCellSelection(selection);
184
+ } else if (selection instanceof NodeSelection) {
185
+ selectionInfo = {
186
+ selectedNode: selection.node,
187
+ nodePos: selection.from
188
+ };
184
189
  }
185
190
  var serializer = new JSONTransformer();
186
191
  var selectedNodeAdf = serializer.encodeNode(selectionInfo.selectedNode);
@@ -201,8 +201,8 @@ export var getSelectionInfo = function getSelectionInfo(selection, schema) {
201
201
  var $from = selection.$from,
202
202
  $to = selection.$to;
203
203
 
204
- // For same parent selections, check for parent container
205
- if ($from.parent === $to.parent) {
204
+ // For same parent selections but not the r, check for parent container
205
+ if ($from.parent === $to.parent && $from.depth > 0) {
206
206
  var _getCommonParentConta = getCommonParentContainer($from, $to),
207
207
  parentNode = _getCommonParentConta.node,
208
208
  parentNodePos = _getCommonParentConta.pos;
@@ -0,0 +1 @@
1
+ ._18u01b66{margin-left:var(--ds-space-050,4px)}
@@ -1,10 +1,18 @@
1
+ /* SelectionExtensionDropdownItem.tsx generated by @compiled/babel-plugin v0.38.1 */
2
+ import "./SelectionExtensionDropdownItem.compiled.css";
3
+ import { ax, ix } from "@compiled/react/runtime";
1
4
  import React from 'react';
2
5
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
3
6
  import { ToolbarDropdownItem } from '@atlaskit/editor-toolbar';
7
+ import Lozenge from '@atlaskit/lozenge';
8
+ import { Box } from '@atlaskit/primitives/compiled';
4
9
  import { selectionExtensionPluginKey } from '../../pm-plugins/main';
5
10
  import { getSelectionAdfInfoNew, getSelectionTextInfoNew } from '../../pm-plugins/utils';
6
11
  import { SelectionExtensionActionTypes } from '../../types';
7
12
  import { useSelectionExtensionComponentContext } from '../SelectionExtensionComponentContext';
13
+ var styles = {
14
+ lozenge: "_18u01b66"
15
+ };
8
16
  export var SelectionExtensionDropdownItem = function SelectionExtensionDropdownItem(_ref) {
9
17
  var dropdownItem = _ref.dropdownItem;
10
18
  var IconComponent = dropdownItem.icon;
@@ -58,5 +66,10 @@ export var SelectionExtensionDropdownItem = function SelectionExtensionDropdownI
58
66
  }) : undefined,
59
67
  onClick: handleClick,
60
68
  isDisabled: dropdownItem.isDisabled
61
- }, dropdownItem.label);
69
+ }, dropdownItem.label, dropdownItem.lozenge ? /*#__PURE__*/React.createElement(Box, {
70
+ as: "span",
71
+ xcss: styles.lozenge
72
+ }, /*#__PURE__*/React.createElement(Lozenge, {
73
+ appearance: "new"
74
+ }, dropdownItem.lozenge.label)) : undefined);
62
75
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-selection-extension",
3
- "version": "10.0.2",
3
+ "version": "10.0.4",
4
4
  "description": "editor-plugin-selection-extension plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -33,6 +33,7 @@
33
33
  "atlaskit:src": "src/index.ts",
34
34
  "dependencies": {
35
35
  "@atlaskit/adf-utils": "^19.26.0",
36
+ "@atlaskit/css": "^0.19.0",
36
37
  "@atlaskit/editor-json-transformer": "^8.31.0",
37
38
  "@atlaskit/editor-plugin-analytics": "^7.0.0",
38
39
  "@atlaskit/editor-plugin-block-controls": "^8.0.0",
@@ -47,19 +48,20 @@
47
48
  "@atlaskit/editor-shared-styles": "^3.10.0",
48
49
  "@atlaskit/editor-tables": "^2.9.0",
49
50
  "@atlaskit/editor-toolbar": "^0.18.0",
50
- "@atlaskit/icon": "^29.3.0",
51
+ "@atlaskit/icon": "^29.4.0",
51
52
  "@atlaskit/lozenge": "^13.3.0",
52
53
  "@atlaskit/platform-feature-flags": "^1.1.0",
53
54
  "@atlaskit/platform-feature-flags-react": "^0.4.0",
54
55
  "@atlaskit/primitives": "^17.0.0",
55
- "@atlaskit/tmp-editor-statsig": "^16.5.0",
56
+ "@atlaskit/tmp-editor-statsig": "^16.8.0",
57
+ "@atlaskit/tokens": "^9.1.0",
56
58
  "@babel/runtime": "^7.0.0",
57
59
  "lodash": "^4.17.21",
58
60
  "react-intl-next": "npm:react-intl@^5.18.1",
59
61
  "uuid": "^3.1.0"
60
62
  },
61
63
  "peerDependencies": {
62
- "@atlaskit/editor-common": "^111.2.0",
64
+ "@atlaskit/editor-common": "^111.6.0",
63
65
  "react": "^18.2.0"
64
66
  },
65
67
  "devDependencies": {