@atlaskit/editor-common 98.2.4 → 98.2.5
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 +10 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/utils/page-element-counts.js +39 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/utils/page-element-counts.js +39 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/utils/page-element-counts.js +39 -1
- package/dist/types/utils/page-element-counts.d.ts +3 -0
- package/dist/types-ts4.5/utils/page-element-counts.d.ts +3 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 98.2.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#100845](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100845)
|
|
8
|
+
[`bd4c63b5f9688`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/bd4c63b5f9688) -
|
|
9
|
+
[ED-26055] Export a function from adf-utils used to detect the use of the nested-tables extension,
|
|
10
|
+
and add calculation of unexpectedly nested tables to editor-common utils
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
3
13
|
## 98.2.4
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "98.2.
|
|
20
|
+
var packageVersion = "98.2.5";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
23
23
|
* @jsx jsx
|
|
24
24
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
25
25
|
var packageName = "@atlaskit/editor-common";
|
|
26
|
-
var packageVersion = "98.2.
|
|
26
|
+
var packageVersion = "98.2.5";
|
|
27
27
|
var halfFocusRing = 1;
|
|
28
28
|
var dropOffset = '0, 8';
|
|
29
29
|
// Ignored via go/ees005
|
|
@@ -4,6 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.getPageElementCounts = void 0;
|
|
7
|
+
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
7
8
|
var _traverse = require("@atlaskit/adf-utils/traverse");
|
|
8
9
|
/**
|
|
9
10
|
* Traverses a JSON document and counts the number of unique elements, text formatting and macros.
|
|
@@ -13,7 +14,8 @@ var getPageElementCounts = exports.getPageElementCounts = function getPageElemen
|
|
|
13
14
|
var pageElementCounts = {
|
|
14
15
|
elements: {},
|
|
15
16
|
textFormats: {},
|
|
16
|
-
macros: {}
|
|
17
|
+
macros: {},
|
|
18
|
+
unexpectedElements: {}
|
|
17
19
|
};
|
|
18
20
|
(0, _traverse.reduce)(doc, function (acc, node) {
|
|
19
21
|
if (node.type === 'text') {
|
|
@@ -32,6 +34,22 @@ var getPageElementCounts = exports.getPageElementCounts = function getPageElemen
|
|
|
32
34
|
if ('attrs' in node && node.attrs && 'extensionKey' in node.attrs && node.attrs.extensionKey) {
|
|
33
35
|
var _acc$macros$extension;
|
|
34
36
|
var extensionKey = node.attrs.extensionKey;
|
|
37
|
+
|
|
38
|
+
// If there is a nested table extension
|
|
39
|
+
if ((0, _transforms.isNestedTableExtension)(node)) {
|
|
40
|
+
if ('parameters' in node.attrs && node.attrs.parameters && 'adf' in node.attrs.parameters) {
|
|
41
|
+
// Check to see if the ADF contains a nested table
|
|
42
|
+
var adfString = node.attrs.parameters.adf;
|
|
43
|
+
var adf = JSON.parse(adfString);
|
|
44
|
+
if (adfString.includes('{"type":"table"')) {
|
|
45
|
+
if (getHasNestedTable(adf)) {
|
|
46
|
+
var _acc$unexpectedElemen;
|
|
47
|
+
acc.unexpectedElements['tablesNestedMoreThanOnce'] = ((_acc$unexpectedElemen = acc.unexpectedElements['tablesNestedMoreThanOnce']) !== null && _acc$unexpectedElemen !== void 0 ? _acc$unexpectedElemen : 0) + 1;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
35
53
|
// If macros extensionKey has <UUID>/<UUID>/static/ prepended to it, remove the prefix
|
|
36
54
|
if (extensionKey.includes('/static/')) {
|
|
37
55
|
var extensionKeyParts = extensionKey.split('/');
|
|
@@ -46,4 +64,24 @@ var getPageElementCounts = exports.getPageElementCounts = function getPageElemen
|
|
|
46
64
|
return acc;
|
|
47
65
|
}, pageElementCounts);
|
|
48
66
|
return pageElementCounts;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Return true is the JSON document contains a table nested within a table
|
|
71
|
+
*/
|
|
72
|
+
var getHasNestedTable = function getHasNestedTable(node) {
|
|
73
|
+
return (0, _traverse.reduce)(node, function (hasNestedTable, node) {
|
|
74
|
+
if (hasNestedTable) {
|
|
75
|
+
return hasNestedTable;
|
|
76
|
+
}
|
|
77
|
+
if (node.type === 'table') {
|
|
78
|
+
return (0, _traverse.reduce)(node, function (acc, node) {
|
|
79
|
+
if (node.type === 'table') {
|
|
80
|
+
return true;
|
|
81
|
+
}
|
|
82
|
+
return acc;
|
|
83
|
+
}, false);
|
|
84
|
+
}
|
|
85
|
+
return hasNestedTable;
|
|
86
|
+
}, false);
|
|
49
87
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "98.2.
|
|
4
|
+
const packageVersion = "98.2.5";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
13
13
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
14
14
|
import Layer from '../Layer';
|
|
15
15
|
const packageName = "@atlaskit/editor-common";
|
|
16
|
-
const packageVersion = "98.2.
|
|
16
|
+
const packageVersion = "98.2.5";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isNestedTableExtension } from '@atlaskit/adf-utils/transforms';
|
|
1
2
|
import { reduce } from '@atlaskit/adf-utils/traverse';
|
|
2
3
|
/**
|
|
3
4
|
* Traverses a JSON document and counts the number of unique elements, text formatting and macros.
|
|
@@ -7,7 +8,8 @@ export const getPageElementCounts = doc => {
|
|
|
7
8
|
const pageElementCounts = {
|
|
8
9
|
elements: {},
|
|
9
10
|
textFormats: {},
|
|
10
|
-
macros: {}
|
|
11
|
+
macros: {},
|
|
12
|
+
unexpectedElements: {}
|
|
11
13
|
};
|
|
12
14
|
reduce(doc, (acc, node) => {
|
|
13
15
|
if (node.type === 'text') {
|
|
@@ -26,6 +28,22 @@ export const getPageElementCounts = doc => {
|
|
|
26
28
|
if ('attrs' in node && node.attrs && 'extensionKey' in node.attrs && node.attrs.extensionKey) {
|
|
27
29
|
var _acc$macros$extension;
|
|
28
30
|
let extensionKey = node.attrs.extensionKey;
|
|
31
|
+
|
|
32
|
+
// If there is a nested table extension
|
|
33
|
+
if (isNestedTableExtension(node)) {
|
|
34
|
+
if ('parameters' in node.attrs && node.attrs.parameters && 'adf' in node.attrs.parameters) {
|
|
35
|
+
// Check to see if the ADF contains a nested table
|
|
36
|
+
const adfString = node.attrs.parameters.adf;
|
|
37
|
+
const adf = JSON.parse(adfString);
|
|
38
|
+
if (adfString.includes('{"type":"table"')) {
|
|
39
|
+
if (getHasNestedTable(adf)) {
|
|
40
|
+
var _acc$unexpectedElemen;
|
|
41
|
+
acc.unexpectedElements['tablesNestedMoreThanOnce'] = ((_acc$unexpectedElemen = acc.unexpectedElements['tablesNestedMoreThanOnce']) !== null && _acc$unexpectedElemen !== void 0 ? _acc$unexpectedElemen : 0) + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
// If macros extensionKey has <UUID>/<UUID>/static/ prepended to it, remove the prefix
|
|
30
48
|
if (extensionKey.includes('/static/')) {
|
|
31
49
|
const extensionKeyParts = extensionKey.split('/');
|
|
@@ -40,4 +58,24 @@ export const getPageElementCounts = doc => {
|
|
|
40
58
|
return acc;
|
|
41
59
|
}, pageElementCounts);
|
|
42
60
|
return pageElementCounts;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Return true is the JSON document contains a table nested within a table
|
|
65
|
+
*/
|
|
66
|
+
const getHasNestedTable = node => {
|
|
67
|
+
return reduce(node, (hasNestedTable, node) => {
|
|
68
|
+
if (hasNestedTable) {
|
|
69
|
+
return hasNestedTable;
|
|
70
|
+
}
|
|
71
|
+
if (node.type === 'table') {
|
|
72
|
+
return reduce(node, (acc, node) => {
|
|
73
|
+
if (node.type === 'table') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return acc;
|
|
77
|
+
}, false);
|
|
78
|
+
}
|
|
79
|
+
return hasNestedTable;
|
|
80
|
+
}, false);
|
|
43
81
|
};
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "98.2.
|
|
10
|
+
var packageVersion = "98.2.5";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
20
20
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
21
21
|
import Layer from '../Layer';
|
|
22
22
|
var packageName = "@atlaskit/editor-common";
|
|
23
|
-
var packageVersion = "98.2.
|
|
23
|
+
var packageVersion = "98.2.5";
|
|
24
24
|
var halfFocusRing = 1;
|
|
25
25
|
var dropOffset = '0, 8';
|
|
26
26
|
// Ignored via go/ees005
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { isNestedTableExtension } from '@atlaskit/adf-utils/transforms';
|
|
1
2
|
import { reduce } from '@atlaskit/adf-utils/traverse';
|
|
2
3
|
/**
|
|
3
4
|
* Traverses a JSON document and counts the number of unique elements, text formatting and macros.
|
|
@@ -7,7 +8,8 @@ export var getPageElementCounts = function getPageElementCounts(doc) {
|
|
|
7
8
|
var pageElementCounts = {
|
|
8
9
|
elements: {},
|
|
9
10
|
textFormats: {},
|
|
10
|
-
macros: {}
|
|
11
|
+
macros: {},
|
|
12
|
+
unexpectedElements: {}
|
|
11
13
|
};
|
|
12
14
|
reduce(doc, function (acc, node) {
|
|
13
15
|
if (node.type === 'text') {
|
|
@@ -26,6 +28,22 @@ export var getPageElementCounts = function getPageElementCounts(doc) {
|
|
|
26
28
|
if ('attrs' in node && node.attrs && 'extensionKey' in node.attrs && node.attrs.extensionKey) {
|
|
27
29
|
var _acc$macros$extension;
|
|
28
30
|
var extensionKey = node.attrs.extensionKey;
|
|
31
|
+
|
|
32
|
+
// If there is a nested table extension
|
|
33
|
+
if (isNestedTableExtension(node)) {
|
|
34
|
+
if ('parameters' in node.attrs && node.attrs.parameters && 'adf' in node.attrs.parameters) {
|
|
35
|
+
// Check to see if the ADF contains a nested table
|
|
36
|
+
var adfString = node.attrs.parameters.adf;
|
|
37
|
+
var adf = JSON.parse(adfString);
|
|
38
|
+
if (adfString.includes('{"type":"table"')) {
|
|
39
|
+
if (getHasNestedTable(adf)) {
|
|
40
|
+
var _acc$unexpectedElemen;
|
|
41
|
+
acc.unexpectedElements['tablesNestedMoreThanOnce'] = ((_acc$unexpectedElemen = acc.unexpectedElements['tablesNestedMoreThanOnce']) !== null && _acc$unexpectedElemen !== void 0 ? _acc$unexpectedElemen : 0) + 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
29
47
|
// If macros extensionKey has <UUID>/<UUID>/static/ prepended to it, remove the prefix
|
|
30
48
|
if (extensionKey.includes('/static/')) {
|
|
31
49
|
var extensionKeyParts = extensionKey.split('/');
|
|
@@ -40,4 +58,24 @@ export var getPageElementCounts = function getPageElementCounts(doc) {
|
|
|
40
58
|
return acc;
|
|
41
59
|
}, pageElementCounts);
|
|
42
60
|
return pageElementCounts;
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Return true is the JSON document contains a table nested within a table
|
|
65
|
+
*/
|
|
66
|
+
var getHasNestedTable = function getHasNestedTable(node) {
|
|
67
|
+
return reduce(node, function (hasNestedTable, node) {
|
|
68
|
+
if (hasNestedTable) {
|
|
69
|
+
return hasNestedTable;
|
|
70
|
+
}
|
|
71
|
+
if (node.type === 'table') {
|
|
72
|
+
return reduce(node, function (acc, node) {
|
|
73
|
+
if (node.type === 'table') {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
return acc;
|
|
77
|
+
}, false);
|
|
78
|
+
}
|
|
79
|
+
return hasNestedTable;
|
|
80
|
+
}, false);
|
|
43
81
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "98.2.
|
|
3
|
+
"version": "98.2.5",
|
|
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/"
|
|
@@ -113,7 +113,7 @@
|
|
|
113
113
|
"dependencies": {
|
|
114
114
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
115
115
|
"@atlaskit/adf-schema": "^46.1.0",
|
|
116
|
-
"@atlaskit/adf-utils": "^19.
|
|
116
|
+
"@atlaskit/adf-utils": "^19.15.0",
|
|
117
117
|
"@atlaskit/analytics-listeners": "^8.13.0",
|
|
118
118
|
"@atlaskit/analytics-namespaced-context": "^6.12.0",
|
|
119
119
|
"@atlaskit/analytics-next": "^10.2.0",
|
|
@@ -154,7 +154,7 @@
|
|
|
154
154
|
"@atlaskit/spinner": "^16.3.0",
|
|
155
155
|
"@atlaskit/task-decision": "^17.11.0",
|
|
156
156
|
"@atlaskit/textfield": "^6.7.0",
|
|
157
|
-
"@atlaskit/tmp-editor-statsig": "^2.
|
|
157
|
+
"@atlaskit/tmp-editor-statsig": "^2.33.0",
|
|
158
158
|
"@atlaskit/tokens": "^2.5.0",
|
|
159
159
|
"@atlaskit/tooltip": "^19.0.0",
|
|
160
160
|
"@atlaskit/width-detector": "^4.3.0",
|