@atlaskit/editor-common 110.38.0 → 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,22 @@
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
+
10
+ ## 110.38.1
11
+
12
+ ### Patch Changes
13
+
14
+ - [`0a28b7c7347de`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0a28b7c7347de) -
15
+ EDITOR-1643 Update ADF validator after synced blocks were moved to full schema
16
+ - [`ec4d125798431`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/ec4d125798431) -
17
+ Update translations for view changes
18
+ - Updated dependencies
19
+
3
20
  ## 110.38.0
4
21
 
5
22
  ### Minor 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
  };
@@ -8,7 +8,7 @@ var _reactIntlNext = require("react-intl-next");
8
8
  var trackChangesMessages = exports.trackChangesMessages = (0, _reactIntlNext.defineMessages)({
9
9
  toolbarIconLabel: {
10
10
  id: 'editor.trackChanges.toolbarIconLabel',
11
- defaultMessage: 'Track Changes',
11
+ defaultMessage: 'View changes',
12
12
  description: 'Label for the track changes toolbar icon'
13
13
  },
14
14
  removed: {
@@ -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.37.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.37.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)({
@@ -853,10 +853,13 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
853
853
  }
854
854
  case 'syncBlock':
855
855
  {
856
- if (adfStage === 'stage0' && (0, _experiments.editorExperiment)('platform_synced_block', true)) {
856
+ if (attrs && attrs.resourceId && (0, _experiments.editorExperiment)('platform_synced_block', true)) {
857
857
  return {
858
858
  type: type,
859
- attrs: attrs,
859
+ attrs: {
860
+ resourceId: attrs.resourceId,
861
+ localId: attrs.localId || (0, _adfSchema.generateUuid)()
862
+ },
860
863
  marks: marks
861
864
  };
862
865
  } else {
@@ -865,10 +868,13 @@ var getValidNode = exports.getValidNode = function getValidNode(originalNode) {
865
868
  }
866
869
  case 'bodiedSyncBlock':
867
870
  {
868
- if (adfStage === 'stage0' && attrs && Array.isArray(content) && content.length > 0 && (0, _experiments.editorExperiment)('platform_synced_block', true)) {
871
+ if (attrs && attrs.resourceId && Array.isArray(content) && content.length > 0 && (0, _experiments.editorExperiment)('platform_synced_block', true)) {
869
872
  return {
870
873
  type: type,
871
- attrs: attrs,
874
+ attrs: {
875
+ resourceId: attrs.resourceId,
876
+ localId: attrs.localId || (0, _adfSchema.generateUuid)()
877
+ },
872
878
  marks: marks,
873
879
  content: content
874
880
  };
@@ -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
  };
@@ -2,7 +2,7 @@ import { defineMessages } from 'react-intl-next';
2
2
  export const trackChangesMessages = defineMessages({
3
3
  toolbarIconLabel: {
4
4
  id: 'editor.trackChanges.toolbarIconLabel',
5
- defaultMessage: 'Track Changes',
5
+ defaultMessage: 'View changes',
6
6
  description: 'Label for the track changes toolbar icon'
7
7
  },
8
8
  removed: {
@@ -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.37.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.37.0";
17
+ const packageVersion = "110.38.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -844,10 +844,13 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
844
844
  }
845
845
  case 'syncBlock':
846
846
  {
847
- if (adfStage === 'stage0' && editorExperiment('platform_synced_block', true)) {
847
+ if (attrs && attrs.resourceId && editorExperiment('platform_synced_block', true)) {
848
848
  return {
849
849
  type,
850
- attrs,
850
+ attrs: {
851
+ resourceId: attrs.resourceId,
852
+ localId: attrs.localId || uuid()
853
+ },
851
854
  marks
852
855
  };
853
856
  } else {
@@ -856,10 +859,13 @@ export const getValidNode = (originalNode, schema = defaultSchema, adfStage = 'f
856
859
  }
857
860
  case 'bodiedSyncBlock':
858
861
  {
859
- if (adfStage === 'stage0' && attrs && Array.isArray(content) && content.length > 0 && editorExperiment('platform_synced_block', true)) {
862
+ if (attrs && attrs.resourceId && Array.isArray(content) && content.length > 0 && editorExperiment('platform_synced_block', true)) {
860
863
  return {
861
864
  type,
862
- attrs,
865
+ attrs: {
866
+ resourceId: attrs.resourceId,
867
+ localId: attrs.localId || uuid()
868
+ },
863
869
  marks,
864
870
  content
865
871
  };
@@ -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
  };
@@ -2,7 +2,7 @@ import { defineMessages } from 'react-intl-next';
2
2
  export var trackChangesMessages = defineMessages({
3
3
  toolbarIconLabel: {
4
4
  id: 'editor.trackChanges.toolbarIconLabel',
5
- defaultMessage: 'Track Changes',
5
+ defaultMessage: 'View changes',
6
6
  description: 'Label for the track changes toolbar icon'
7
7
  },
8
8
  removed: {
@@ -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.37.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.37.0";
24
+ var packageVersion = "110.38.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -846,10 +846,13 @@ export var getValidNode = function getValidNode(originalNode) {
846
846
  }
847
847
  case 'syncBlock':
848
848
  {
849
- if (adfStage === 'stage0' && editorExperiment('platform_synced_block', true)) {
849
+ if (attrs && attrs.resourceId && editorExperiment('platform_synced_block', true)) {
850
850
  return {
851
851
  type: type,
852
- attrs: attrs,
852
+ attrs: {
853
+ resourceId: attrs.resourceId,
854
+ localId: attrs.localId || uuid()
855
+ },
853
856
  marks: marks
854
857
  };
855
858
  } else {
@@ -858,10 +861,13 @@ export var getValidNode = function getValidNode(originalNode) {
858
861
  }
859
862
  case 'bodiedSyncBlock':
860
863
  {
861
- if (adfStage === 'stage0' && attrs && Array.isArray(content) && content.length > 0 && editorExperiment('platform_synced_block', true)) {
864
+ if (attrs && attrs.resourceId && Array.isArray(content) && content.length > 0 && editorExperiment('platform_synced_block', true)) {
862
865
  return {
863
866
  type: type,
864
- attrs: attrs,
867
+ attrs: {
868
+ resourceId: attrs.resourceId,
869
+ localId: attrs.localId || uuid()
870
+ },
865
871
  marks: marks,
866
872
  content: content
867
873
  };
@@ -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.0",
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.5.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",