@atlaskit/editor-common 110.38.1 → 110.38.2

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,12 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 110.38.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f1f7fc05afab1`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/f1f7fc05afab1) -
8
+ [ux] EDITOR-2461 Set selection in expand title when using arrow key to navigate into expand
9
+
3
10
  ## 110.38.1
4
11
 
5
12
  ### Patch Changes
@@ -3,7 +3,8 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.isExpandCollapsed = exports.expandedState = void 0;
6
+ exports.isExpandCollapsed = exports.getNextNodeExpandPos = exports.expandedState = void 0;
7
+ var _utils = require("@atlaskit/editor-prosemirror/utils");
7
8
  // Used to store the state of the new single player expand node
8
9
  var expandedState = exports.expandedState = new WeakMap();
9
10
 
@@ -12,4 +13,28 @@ var isExpandCollapsed = exports.isExpandCollapsed = function isExpandCollapsed(n
12
13
  var _expandedState$get;
13
14
  // @ts-ignore - TS2869 TypeScript 5.9.2 upgrade
14
15
  return (_expandedState$get = !expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false;
16
+ };
17
+ var getNextNodeExpandPos = exports.getNextNodeExpandPos = function getNextNodeExpandPos(editorView, selection) {
18
+ var parentNodePos = (0, _utils.findParentNodeOfType)([editorView.state.schema.nodes.listItem, editorView.state.schema.nodes.heading, editorView.state.schema.nodes.blockquote, editorView.state.schema.nodes.taskItem, editorView.state.schema.nodes.mediaSingle])(selection);
19
+ if (!parentNodePos) {
20
+ var paragraphNode = (0, _utils.findParentNodeOfType)([editorView.state.schema.nodes.paragraph])(selection);
21
+ if (!paragraphNode) {
22
+ return;
23
+ }
24
+ parentNodePos = paragraphNode;
25
+ }
26
+ var tableRowNodePos = (0, _utils.findParentNodeOfType)([editorView.state.schema.nodes.tableRow])(selection);
27
+ if (tableRowNodePos) {
28
+ parentNodePos = tableRowNodePos;
29
+ }
30
+ var endPosOffset = parentNodePos && ['taskItem', 'listItem', 'tableRow'].includes(parentNodePos.node.type.name) ? 1 : 0;
31
+ var endOfTextblockPos = parentNodePos.start + parentNodePos.node.content.size + endPosOffset + 1;
32
+ if (endOfTextblockPos > editorView.state.doc.content.size) {
33
+ return undefined;
34
+ }
35
+ var $endOfTextblockPos = editorView.state.doc.resolve(endOfTextblockPos);
36
+ if ($endOfTextblockPos !== null && $endOfTextblockPos !== void 0 && $endOfTextblockPos.nodeAfter && ['expand', 'nestedExpand'].includes($endOfTextblockPos.nodeAfter.type.name)) {
37
+ return endOfTextblockPos + 1;
38
+ }
39
+ return undefined;
15
40
  };
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
19
19
  function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
20
20
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
21
21
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
22
- var packageVersion = "110.38.0";
22
+ var packageVersion = "110.38.1";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
24
24
  * @jsx jsx
25
25
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
26
26
  var packageName = "@atlaskit/editor-common";
27
- var packageVersion = "110.38.0";
27
+ var packageVersion = "110.38.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -1,3 +1,4 @@
1
+ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
1
2
  // Used to store the state of the new single player expand node
2
3
  export const expandedState = new WeakMap();
3
4
 
@@ -6,4 +7,28 @@ export const isExpandCollapsed = node => {
6
7
  var _expandedState$get;
7
8
  // @ts-ignore - TS2869 TypeScript 5.9.2 upgrade
8
9
  return (_expandedState$get = !expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false;
10
+ };
11
+ export const getNextNodeExpandPos = (editorView, selection) => {
12
+ let parentNodePos = findParentNodeOfType([editorView.state.schema.nodes.listItem, editorView.state.schema.nodes.heading, editorView.state.schema.nodes.blockquote, editorView.state.schema.nodes.taskItem, editorView.state.schema.nodes.mediaSingle])(selection);
13
+ if (!parentNodePos) {
14
+ const paragraphNode = findParentNodeOfType([editorView.state.schema.nodes.paragraph])(selection);
15
+ if (!paragraphNode) {
16
+ return;
17
+ }
18
+ parentNodePos = paragraphNode;
19
+ }
20
+ const tableRowNodePos = findParentNodeOfType([editorView.state.schema.nodes.tableRow])(selection);
21
+ if (tableRowNodePos) {
22
+ parentNodePos = tableRowNodePos;
23
+ }
24
+ const endPosOffset = parentNodePos && ['taskItem', 'listItem', 'tableRow'].includes(parentNodePos.node.type.name) ? 1 : 0;
25
+ const endOfTextblockPos = parentNodePos.start + parentNodePos.node.content.size + endPosOffset + 1;
26
+ if (endOfTextblockPos > editorView.state.doc.content.size) {
27
+ return undefined;
28
+ }
29
+ const $endOfTextblockPos = editorView.state.doc.resolve(endOfTextblockPos);
30
+ if ($endOfTextblockPos !== null && $endOfTextblockPos !== void 0 && $endOfTextblockPos.nodeAfter && ['expand', 'nestedExpand'].includes($endOfTextblockPos.nodeAfter.type.name)) {
31
+ return endOfTextblockPos + 1;
32
+ }
33
+ return undefined;
9
34
  };
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
4
4
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
5
5
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
6
6
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
7
- const packageVersion = "110.38.0";
7
+ const packageVersion = "110.38.1";
8
8
  const sanitiseSentryEvents = (data, _hint) => {
9
9
  // Remove URL as it has UGC
10
10
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "110.38.0";
17
+ const packageVersion = "110.38.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -1,3 +1,4 @@
1
+ import { findParentNodeOfType } from '@atlaskit/editor-prosemirror/utils';
1
2
  // Used to store the state of the new single player expand node
2
3
  export var expandedState = new WeakMap();
3
4
 
@@ -6,4 +7,28 @@ export var isExpandCollapsed = function isExpandCollapsed(node) {
6
7
  var _expandedState$get;
7
8
  // @ts-ignore - TS2869 TypeScript 5.9.2 upgrade
8
9
  return (_expandedState$get = !expandedState.get(node)) !== null && _expandedState$get !== void 0 ? _expandedState$get : false;
10
+ };
11
+ export var getNextNodeExpandPos = function getNextNodeExpandPos(editorView, selection) {
12
+ var parentNodePos = findParentNodeOfType([editorView.state.schema.nodes.listItem, editorView.state.schema.nodes.heading, editorView.state.schema.nodes.blockquote, editorView.state.schema.nodes.taskItem, editorView.state.schema.nodes.mediaSingle])(selection);
13
+ if (!parentNodePos) {
14
+ var paragraphNode = findParentNodeOfType([editorView.state.schema.nodes.paragraph])(selection);
15
+ if (!paragraphNode) {
16
+ return;
17
+ }
18
+ parentNodePos = paragraphNode;
19
+ }
20
+ var tableRowNodePos = findParentNodeOfType([editorView.state.schema.nodes.tableRow])(selection);
21
+ if (tableRowNodePos) {
22
+ parentNodePos = tableRowNodePos;
23
+ }
24
+ var endPosOffset = parentNodePos && ['taskItem', 'listItem', 'tableRow'].includes(parentNodePos.node.type.name) ? 1 : 0;
25
+ var endOfTextblockPos = parentNodePos.start + parentNodePos.node.content.size + endPosOffset + 1;
26
+ if (endOfTextblockPos > editorView.state.doc.content.size) {
27
+ return undefined;
28
+ }
29
+ var $endOfTextblockPos = editorView.state.doc.resolve(endOfTextblockPos);
30
+ if ($endOfTextblockPos !== null && $endOfTextblockPos !== void 0 && $endOfTextblockPos.nodeAfter && ['expand', 'nestedExpand'].includes($endOfTextblockPos.nodeAfter.type.name)) {
31
+ return endOfTextblockPos + 1;
32
+ }
33
+ return undefined;
9
34
  };
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
10
10
  import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
11
11
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
12
12
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
13
- var packageVersion = "110.38.0";
13
+ var packageVersion = "110.38.1";
14
14
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
15
15
  // Remove URL as it has UGC
16
16
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "110.38.0";
24
+ var packageVersion = "110.38.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -1,3 +1,6 @@
1
1
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
4
  export declare const expandedState: WeakMap<PmNode, boolean>;
3
5
  export declare const isExpandCollapsed: (node: PmNode) => boolean;
6
+ export declare const getNextNodeExpandPos: (editorView: EditorView, selection: Selection) => number | undefined;
@@ -1,3 +1,6 @@
1
1
  import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
2
+ import type { Selection } from '@atlaskit/editor-prosemirror/state';
3
+ import type { EditorView } from '@atlaskit/editor-prosemirror/view';
2
4
  export declare const expandedState: WeakMap<PmNode, boolean>;
3
5
  export declare const isExpandCollapsed: (node: PmNode) => boolean;
6
+ export declare const getNextNodeExpandPos: (editorView: EditorView, selection: Selection) => number | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "110.38.1",
3
+ "version": "110.38.2",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -74,14 +74,14 @@
74
74
  "@atlaskit/prosemirror-history": "^0.2.0",
75
75
  "@atlaskit/react-ufo": "^4.15.0",
76
76
  "@atlaskit/section-message": "^8.9.0",
77
- "@atlaskit/smart-card": "^43.12.0",
77
+ "@atlaskit/smart-card": "^43.13.0",
78
78
  "@atlaskit/smart-user-picker": "^8.4.0",
79
79
  "@atlaskit/spinner": "^19.0.0",
80
80
  "@atlaskit/status": "^3.0.0",
81
81
  "@atlaskit/task-decision": "^19.2.0",
82
82
  "@atlaskit/textfield": "^8.1.0",
83
83
  "@atlaskit/theme": "^21.0.0",
84
- "@atlaskit/tmp-editor-statsig": "^14.6.0",
84
+ "@atlaskit/tmp-editor-statsig": "^14.7.0",
85
85
  "@atlaskit/tokens": "^8.4.0",
86
86
  "@atlaskit/tooltip": "^20.10.0",
87
87
  "@atlaskit/width-detector": "^5.0.0",