@atlaskit/editor-common 122.8.0 → 122.8.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
+ ## 122.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [`2bbc1c84de468`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/2bbc1c84de468) -
8
+ Migrate Volt consumer imports to existing definitions and align affected test mocks without
9
+ changing runtime behavior.
10
+ - Updated dependencies
11
+
12
+ ## 122.8.1
13
+
14
+ ### Patch Changes
15
+
16
+ - [`442abbe2a88e0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/442abbe2a88e0) -
17
+ Normalize documents before relaxed show-diff comparisons when Confluence version-history diffing
18
+ is enabled.
19
+
3
20
  ## 122.8.0
4
21
 
5
22
  ### Minor Changes
@@ -27,7 +27,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
27
27
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
28
28
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
29
29
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
30
- var packageVersion = "122.7.0";
30
+ var packageVersion = "122.8.1";
31
31
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
32
32
  // Remove URL as it has UGC
33
33
  // 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 = "122.7.0";
27
+ var packageVersion = "122.8.1";
28
28
  var halfFocusRing = 1;
29
29
  var dropOffset = '0, 8';
30
30
  var fadeIn = (0, _react2.keyframes)({
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.areDocsEqualByBlockStructureAndText = areDocsEqualByBlockStructureAndText;
7
+ var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
8
+ var _fg = require("@atlaskit/platform-feature-flags/fg");
9
+ var _transform = require("@atlaskit/editor-prosemirror/transform");
10
+ /**
11
+ * Returns true when documents have the same text and block structure, while ignoring marks and
12
+ * attributes. This is useful when comparing documents produced by different serialization paths.
13
+ */
14
+ function areDocsEqualByBlockStructureAndText(node1, node2) {
15
+ if ((0, _fg.fg)('confluence_ncs_step_diffing_version_history')) {
16
+ node1 = normalizeDocument(node1);
17
+ node2 = normalizeDocument(node2);
18
+ }
19
+ if (node1.textContent !== node2.textContent) {
20
+ return false;
21
+ }
22
+ var stripped1 = stripMarks(node1);
23
+ var stripped2 = stripMarks(node2);
24
+ return stripped1.nodeSize === stripped2.nodeSize && isBlockStructureEqual(stripped1, stripped2);
25
+ }
26
+ var transformers = new WeakMap();
27
+ function normalizeDocument(node) {
28
+ var schema = node.type.schema;
29
+ var transformer = transformers.get(schema);
30
+ if (!transformer) {
31
+ transformer = new _editorJsonTransformer.JSONTransformer(schema);
32
+ transformers.set(schema, transformer);
33
+ }
34
+ return transformer.parse(transformer.encode(node));
35
+ }
36
+ function stripMarks(doc) {
37
+ var tr = new _transform.Transform(doc);
38
+ tr.removeMark(0, doc.content.size);
39
+ return tr.doc;
40
+ }
41
+ function isBlockStructureEqual(node1, node2) {
42
+ if (node1.type !== node2.type || node1.childCount !== node2.childCount) {
43
+ return false;
44
+ }
45
+ for (var index = 0; index < node1.childCount; index++) {
46
+ if (!isBlockStructureEqual(node1.child(index), node2.child(index))) {
47
+ return false;
48
+ }
49
+ }
50
+ return true;
51
+ }
@@ -219,6 +219,7 @@ function areFragmentsEqual(frag1, frag2, attributesToIgnore, opts) {
219
219
  });
220
220
  return childrenEqual;
221
221
  }
222
+
222
223
  // eslint-disable-next-line @atlaskit/editor/no-re-export
223
224
 
224
225
  // eslint-disable-next-line @atlaskit/editor/no-re-export
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
7
7
  exports.sanitizeNodeForPrivacy = sanitizeNodeForPrivacy;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _traverse = require("@atlaskit/adf-utils/traverse");
10
- var _resource = require("@atlaskit/mention/resource");
10
+ var _isResolvingMentionProvider = require("@atlaskit/mention/is-resolving-mention-provider");
11
11
  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; }
12
12
  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; }
13
13
  /**
@@ -41,7 +41,7 @@ function sanitizeNodeForPrivacy(json, providerFactory) {
41
41
  var _handler = function handler(_name, providerPromise) {
42
42
  if (providerPromise) {
43
43
  providerPromise.then(function (provider) {
44
- if ((0, _resource.isResolvingMentionProvider)(provider)) {
44
+ if ((0, _isResolvingMentionProvider.isResolvingMentionProvider)(provider)) {
45
45
  mentionNames.forEach(function (name, id) {
46
46
  provider.cacheMentionName(id, name);
47
47
  });
@@ -13,7 +13,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
13
13
  const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
14
14
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
15
15
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
16
- const packageVersion = "122.7.0";
16
+ const packageVersion = "122.8.1";
17
17
  const sanitiseSentryEvents = (data, _hint) => {
18
18
  // Remove URL as it has UGC
19
19
  // Ignored via go/ees007
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import { fg } from '@atlaskit/platform-feature-flags/fg';
15
15
  import Layer from '../Layer';
16
16
  const packageName = "@atlaskit/editor-common";
17
- const packageVersion = "122.7.0";
17
+ const packageVersion = "122.8.1";
18
18
  const halfFocusRing = 1;
19
19
  const dropOffset = '0, 8';
20
20
  const fadeIn = keyframes({
@@ -0,0 +1,46 @@
1
+ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
2
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
+ import { Transform } from '@atlaskit/editor-prosemirror/transform';
4
+
5
+ /**
6
+ * Returns true when documents have the same text and block structure, while ignoring marks and
7
+ * attributes. This is useful when comparing documents produced by different serialization paths.
8
+ */
9
+ export function areDocsEqualByBlockStructureAndText(node1, node2) {
10
+ if (fg('confluence_ncs_step_diffing_version_history')) {
11
+ node1 = normalizeDocument(node1);
12
+ node2 = normalizeDocument(node2);
13
+ }
14
+ if (node1.textContent !== node2.textContent) {
15
+ return false;
16
+ }
17
+ const stripped1 = stripMarks(node1);
18
+ const stripped2 = stripMarks(node2);
19
+ return stripped1.nodeSize === stripped2.nodeSize && isBlockStructureEqual(stripped1, stripped2);
20
+ }
21
+ const transformers = new WeakMap();
22
+ function normalizeDocument(node) {
23
+ const schema = node.type.schema;
24
+ let transformer = transformers.get(schema);
25
+ if (!transformer) {
26
+ transformer = new JSONTransformer(schema);
27
+ transformers.set(schema, transformer);
28
+ }
29
+ return transformer.parse(transformer.encode(node));
30
+ }
31
+ function stripMarks(doc) {
32
+ const tr = new Transform(doc);
33
+ tr.removeMark(0, doc.content.size);
34
+ return tr.doc;
35
+ }
36
+ function isBlockStructureEqual(node1, node2) {
37
+ if (node1.type !== node2.type || node1.childCount !== node2.childCount) {
38
+ return false;
39
+ }
40
+ for (let index = 0; index < node1.childCount; index++) {
41
+ if (!isBlockStructureEqual(node1.child(index), node2.child(index))) {
42
+ return false;
43
+ }
44
+ }
45
+ return true;
46
+ }
@@ -155,6 +155,7 @@ function areFragmentsEqual(frag1, frag2, attributesToIgnore, opts) {
155
155
  });
156
156
  return childrenEqual;
157
157
  }
158
+
158
159
  // eslint-disable-next-line @atlaskit/editor/no-re-export
159
160
  export { getStepRange } from './getStepRange';
160
161
  // eslint-disable-next-line @atlaskit/editor/no-re-export
@@ -1,5 +1,5 @@
1
1
  import { traverse } from '@atlaskit/adf-utils/traverse';
2
- import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
2
+ import { isResolvingMentionProvider } from '@atlaskit/mention/is-resolving-mention-provider';
3
3
  /**
4
4
  * Sanitises a document where some content should not be in the document (e.g. mention names).
5
5
  *
@@ -19,7 +19,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
19
19
  var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
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 = "122.7.0";
22
+ var packageVersion = "122.8.1";
23
23
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
24
24
  // Remove URL as it has UGC
25
25
  // Ignored via go/ees007
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import { fg } from '@atlaskit/platform-feature-flags/fg';
22
22
  import Layer from '../Layer';
23
23
  var packageName = "@atlaskit/editor-common";
24
- var packageVersion = "122.7.0";
24
+ var packageVersion = "122.8.1";
25
25
  var halfFocusRing = 1;
26
26
  var dropOffset = '0, 8';
27
27
  var fadeIn = keyframes({
@@ -0,0 +1,46 @@
1
+ import { JSONTransformer } from '@atlaskit/editor-json-transformer';
2
+ import { fg } from '@atlaskit/platform-feature-flags/fg';
3
+ import { Transform } from '@atlaskit/editor-prosemirror/transform';
4
+
5
+ /**
6
+ * Returns true when documents have the same text and block structure, while ignoring marks and
7
+ * attributes. This is useful when comparing documents produced by different serialization paths.
8
+ */
9
+ export function areDocsEqualByBlockStructureAndText(node1, node2) {
10
+ if (fg('confluence_ncs_step_diffing_version_history')) {
11
+ node1 = normalizeDocument(node1);
12
+ node2 = normalizeDocument(node2);
13
+ }
14
+ if (node1.textContent !== node2.textContent) {
15
+ return false;
16
+ }
17
+ var stripped1 = stripMarks(node1);
18
+ var stripped2 = stripMarks(node2);
19
+ return stripped1.nodeSize === stripped2.nodeSize && isBlockStructureEqual(stripped1, stripped2);
20
+ }
21
+ var transformers = new WeakMap();
22
+ function normalizeDocument(node) {
23
+ var schema = node.type.schema;
24
+ var transformer = transformers.get(schema);
25
+ if (!transformer) {
26
+ transformer = new JSONTransformer(schema);
27
+ transformers.set(schema, transformer);
28
+ }
29
+ return transformer.parse(transformer.encode(node));
30
+ }
31
+ function stripMarks(doc) {
32
+ var tr = new Transform(doc);
33
+ tr.removeMark(0, doc.content.size);
34
+ return tr.doc;
35
+ }
36
+ function isBlockStructureEqual(node1, node2) {
37
+ if (node1.type !== node2.type || node1.childCount !== node2.childCount) {
38
+ return false;
39
+ }
40
+ for (var index = 0; index < node1.childCount; index++) {
41
+ if (!isBlockStructureEqual(node1.child(index), node2.child(index))) {
42
+ return false;
43
+ }
44
+ }
45
+ return true;
46
+ }
@@ -175,6 +175,7 @@ function areFragmentsEqual(frag1, frag2, attributesToIgnore, opts) {
175
175
  });
176
176
  return childrenEqual;
177
177
  }
178
+
178
179
  // eslint-disable-next-line @atlaskit/editor/no-re-export
179
180
  export { getStepRange } from './getStepRange';
180
181
  // eslint-disable-next-line @atlaskit/editor/no-re-export
@@ -2,7 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  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; }
3
3
  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) { _defineProperty(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; }
4
4
  import { traverse } from '@atlaskit/adf-utils/traverse';
5
- import { isResolvingMentionProvider } from '@atlaskit/mention/resource';
5
+ import { isResolvingMentionProvider } from '@atlaskit/mention/is-resolving-mention-provider';
6
6
  /**
7
7
  * Sanitises a document where some content should not be in the document (e.g. mention names).
8
8
  *
@@ -0,0 +1,6 @@
1
+ import type { Node } from '@atlaskit/editor-prosemirror/model';
2
+ /**
3
+ * Returns true when documents have the same text and block structure, while ignoring marks and
4
+ * attributes. This is useful when comparing documents produced by different serialization paths.
5
+ */
6
+ export declare function areDocsEqualByBlockStructureAndText(node1: Node, node2: Node): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "122.8.0",
3
+ "version": "122.8.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/"
@@ -64,7 +64,7 @@
64
64
  "@atlaskit/media-picker": "^72.4.0",
65
65
  "@atlaskit/media-ui": "^30.16.0",
66
66
  "@atlaskit/media-viewer": "^54.8.0",
67
- "@atlaskit/mention": "^29.1.0",
67
+ "@atlaskit/mention": "^29.2.0",
68
68
  "@atlaskit/menu": "^10.2.0",
69
69
  "@atlaskit/object": "^2.3.0",
70
70
  "@atlaskit/onboarding": "^15.4.0",
@@ -84,7 +84,7 @@
84
84
  "@atlaskit/task-decision": "^21.10.0",
85
85
  "@atlaskit/teams-app-config": "^3.1.0",
86
86
  "@atlaskit/textfield": "^10.2.0",
87
- "@atlaskit/tmp-editor-statsig": "^196.0.0",
87
+ "@atlaskit/tmp-editor-statsig": "^197.0.0",
88
88
  "@atlaskit/tokens": "^17.0.0",
89
89
  "@atlaskit/tooltip": "^24.3.0",
90
90
  "@atlaskit/width-detector": "^7.2.0",
@@ -145,6 +145,10 @@
145
145
  "sinon": "^2.2.0"
146
146
  },
147
147
  "platform-feature-flags": {
148
+ "confluence_ncs_step_diffing_version_history": {
149
+ "type": "boolean",
150
+ "referenceOnly": true
151
+ },
148
152
  "platform_editor_add_text_color_tracking": {
149
153
  "type": "boolean"
150
154
  },
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "@atlaskit/editor-common/utils/areDocsEqualByBlockStructureAndText",
3
+ "main": "../../dist/cjs/utils/areDocsEqualByBlockStructureAndText.js",
4
+ "module": "../../dist/esm/utils/areDocsEqualByBlockStructureAndText.js",
5
+ "module:es2019": "../../dist/es2019/utils/areDocsEqualByBlockStructureAndText.js",
6
+ "sideEffects": [
7
+ "**/*.compiled.css"
8
+ ],
9
+ "types": "../../dist/types/utils/areDocsEqualByBlockStructureAndText.d.ts"
10
+ }