@atlaskit/renderer 114.0.0 → 114.2.0
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 +24 -0
- package/dist/cjs/react/nodes/multiBodiedExtension.js +3 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/cjs/ui/Renderer/rendererHelper.js +13 -6
- package/dist/es2019/react/nodes/multiBodiedExtension.js +3 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/es2019/ui/Renderer/rendererHelper.js +15 -6
- package/dist/esm/react/nodes/multiBodiedExtension.js +3 -0
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/esm/ui/Renderer/rendererHelper.js +13 -6
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,29 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 114.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#125286](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/125286)
|
|
8
|
+
[`c930e08d002dd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c930e08d002dd) -
|
|
9
|
+
Include non paragraph nodes when rendering comment without surrounding whitespace
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 114.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [#124272](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/124272)
|
|
20
|
+
[`5b434be943575`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5b434be943575) -
|
|
21
|
+
[ux] Added logic to not render empty text spaces around comment content
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 114.0.0
|
|
4
28
|
|
|
5
29
|
### Major Changes
|
|
@@ -50,6 +50,9 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
50
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
51
|
getChildren: function getChildren() {
|
|
52
52
|
return [];
|
|
53
|
+
},
|
|
54
|
+
getChildrenContainer: function getChildrenContainer() {
|
|
55
|
+
return null;
|
|
53
56
|
}
|
|
54
57
|
};
|
|
55
58
|
}, [updateActiveChild, children]);
|
|
@@ -67,7 +67,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
67
67
|
var NORMAL_SEVERITY_THRESHOLD = exports.NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
68
68
|
var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
69
69
|
var packageName = "@atlaskit/renderer";
|
|
70
|
-
var packageVersion = "114.
|
|
70
|
+
var packageVersion = "114.2.0";
|
|
71
71
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
72
72
|
containerName: 'ak-renderer-wrapper',
|
|
73
73
|
containerType: 'inline-size',
|
|
@@ -13,22 +13,29 @@ var removeEmptySpaceAroundContent = exports.removeEmptySpaceAroundContent = func
|
|
|
13
13
|
if (!document || !document.content || !Array.isArray(document.content)) {
|
|
14
14
|
return document;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
// Check if the node is a meaningful content node meaning it is not an empty paragraph or a paragraph with only whitespace
|
|
18
|
+
var isMeaningfulContentNode = function isMeaningfulContentNode(node) {
|
|
19
|
+
// Check if the node is a non-empty paragraph or a non-paragraph node
|
|
20
|
+
if (node.type !== 'paragraph') {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
// If the paragraph is empty, return false
|
|
24
|
+
if (!node.content || node.content.length === 0) {
|
|
18
25
|
return false;
|
|
19
26
|
}
|
|
20
|
-
// Check if paragraph has any content other than `hardBreak`
|
|
27
|
+
// Check if paragraph has any content other than `hardBreak` or whitespace text nodes
|
|
21
28
|
return node.content.some(function (child) {
|
|
22
|
-
return (child === null || child === void 0 ? void 0 : child.type)
|
|
29
|
+
return !((child === null || child === void 0 ? void 0 : child.type) === 'hardBreak' || (child === null || child === void 0 ? void 0 : child.type) === 'text' && typeof child.text === 'string' && child.text.trim() === '');
|
|
23
30
|
});
|
|
24
31
|
};
|
|
25
32
|
var content = document.content;
|
|
26
33
|
var firstContentIndex = -1;
|
|
27
34
|
var lastContentIndex = -1;
|
|
28
35
|
|
|
29
|
-
// Find the first and last paragraphs with content
|
|
36
|
+
// Find the first and last paragraphs with content and check if they are meaningful
|
|
30
37
|
for (var i = 0; i < content.length; i++) {
|
|
31
|
-
if (
|
|
38
|
+
if (isMeaningfulContentNode(content[i])) {
|
|
32
39
|
if (firstContentIndex === -1) {
|
|
33
40
|
firstContentIndex = i;
|
|
34
41
|
}
|
|
@@ -48,7 +48,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
48
48
|
export const NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
49
49
|
export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
50
50
|
const packageName = "@atlaskit/renderer";
|
|
51
|
-
const packageVersion = "114.
|
|
51
|
+
const packageVersion = "114.2.0";
|
|
52
52
|
const setAsQueryContainerStyles = css({
|
|
53
53
|
containerName: 'ak-renderer-wrapper',
|
|
54
54
|
containerType: 'inline-size',
|
|
@@ -3,20 +3,29 @@ export const removeEmptySpaceAroundContent = document => {
|
|
|
3
3
|
if (!document || !document.content || !Array.isArray(document.content)) {
|
|
4
4
|
return document;
|
|
5
5
|
}
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
|
|
7
|
+
// Check if the node is a meaningful content node meaning it is not an empty paragraph or a paragraph with only whitespace
|
|
8
|
+
const isMeaningfulContentNode = node => {
|
|
9
|
+
// Check if the node is a non-empty paragraph or a non-paragraph node
|
|
10
|
+
if (node.type !== 'paragraph') {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
// If the paragraph is empty, return false
|
|
14
|
+
if (!node.content || node.content.length === 0) {
|
|
8
15
|
return false;
|
|
9
16
|
}
|
|
10
|
-
// Check if paragraph has any content other than `hardBreak`
|
|
11
|
-
return node.content.some(child =>
|
|
17
|
+
// Check if paragraph has any content other than `hardBreak` or whitespace text nodes
|
|
18
|
+
return node.content.some(child => {
|
|
19
|
+
return !((child === null || child === void 0 ? void 0 : child.type) === 'hardBreak' || (child === null || child === void 0 ? void 0 : child.type) === 'text' && typeof child.text === 'string' && child.text.trim() === '');
|
|
20
|
+
});
|
|
12
21
|
};
|
|
13
22
|
const content = document.content;
|
|
14
23
|
let firstContentIndex = -1;
|
|
15
24
|
let lastContentIndex = -1;
|
|
16
25
|
|
|
17
|
-
// Find the first and last paragraphs with content
|
|
26
|
+
// Find the first and last paragraphs with content and check if they are meaningful
|
|
18
27
|
for (let i = 0; i < content.length; i++) {
|
|
19
|
-
if (
|
|
28
|
+
if (isMeaningfulContentNode(content[i])) {
|
|
20
29
|
if (firstContentIndex === -1) {
|
|
21
30
|
firstContentIndex = i;
|
|
22
31
|
}
|
|
@@ -41,6 +41,9 @@ var useMultiBodiedExtensionActions = function useMultiBodiedExtensionActions(_re
|
|
|
41
41
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
42
42
|
getChildren: function getChildren() {
|
|
43
43
|
return [];
|
|
44
|
+
},
|
|
45
|
+
getChildrenContainer: function getChildrenContainer() {
|
|
46
|
+
return null;
|
|
44
47
|
}
|
|
45
48
|
};
|
|
46
49
|
}, [updateActiveChild, children]);
|
|
@@ -57,7 +57,7 @@ import { removeEmptySpaceAroundContent } from './rendererHelper';
|
|
|
57
57
|
export var NORMAL_SEVERITY_THRESHOLD = 2000;
|
|
58
58
|
export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
59
59
|
var packageName = "@atlaskit/renderer";
|
|
60
|
-
var packageVersion = "114.
|
|
60
|
+
var packageVersion = "114.2.0";
|
|
61
61
|
var setAsQueryContainerStyles = css({
|
|
62
62
|
containerName: 'ak-renderer-wrapper',
|
|
63
63
|
containerType: 'inline-size',
|
|
@@ -6,22 +6,29 @@ export var removeEmptySpaceAroundContent = function removeEmptySpaceAroundConten
|
|
|
6
6
|
if (!document || !document.content || !Array.isArray(document.content)) {
|
|
7
7
|
return document;
|
|
8
8
|
}
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
|
|
10
|
+
// Check if the node is a meaningful content node meaning it is not an empty paragraph or a paragraph with only whitespace
|
|
11
|
+
var isMeaningfulContentNode = function isMeaningfulContentNode(node) {
|
|
12
|
+
// Check if the node is a non-empty paragraph or a non-paragraph node
|
|
13
|
+
if (node.type !== 'paragraph') {
|
|
14
|
+
return true;
|
|
15
|
+
}
|
|
16
|
+
// If the paragraph is empty, return false
|
|
17
|
+
if (!node.content || node.content.length === 0) {
|
|
11
18
|
return false;
|
|
12
19
|
}
|
|
13
|
-
// Check if paragraph has any content other than `hardBreak`
|
|
20
|
+
// Check if paragraph has any content other than `hardBreak` or whitespace text nodes
|
|
14
21
|
return node.content.some(function (child) {
|
|
15
|
-
return (child === null || child === void 0 ? void 0 : child.type)
|
|
22
|
+
return !((child === null || child === void 0 ? void 0 : child.type) === 'hardBreak' || (child === null || child === void 0 ? void 0 : child.type) === 'text' && typeof child.text === 'string' && child.text.trim() === '');
|
|
16
23
|
});
|
|
17
24
|
};
|
|
18
25
|
var content = document.content;
|
|
19
26
|
var firstContentIndex = -1;
|
|
20
27
|
var lastContentIndex = -1;
|
|
21
28
|
|
|
22
|
-
// Find the first and last paragraphs with content
|
|
29
|
+
// Find the first and last paragraphs with content and check if they are meaningful
|
|
23
30
|
for (var i = 0; i < content.length; i++) {
|
|
24
|
-
if (
|
|
31
|
+
if (isMeaningfulContentNode(content[i])) {
|
|
25
32
|
if (firstContentIndex === -1) {
|
|
26
33
|
firstContentIndex = i;
|
|
27
34
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "114.
|
|
3
|
+
"version": "114.2.0",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
32
32
|
"@atlaskit/button": "^21.1.0",
|
|
33
33
|
"@atlaskit/code": "^16.0.0",
|
|
34
|
-
"@atlaskit/editor-common": "^102.
|
|
34
|
+
"@atlaskit/editor-common": "^102.4.0",
|
|
35
35
|
"@atlaskit/editor-json-transformer": "^8.24.0",
|
|
36
36
|
"@atlaskit/editor-palette": "^2.0.0",
|
|
37
37
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
38
38
|
"@atlaskit/editor-shared-styles": "^3.4.0",
|
|
39
39
|
"@atlaskit/emoji": "^68.0.0",
|
|
40
40
|
"@atlaskit/feature-gate-js-client": "^4.26.0",
|
|
41
|
-
"@atlaskit/icon": "^
|
|
41
|
+
"@atlaskit/icon": "^25.0.0",
|
|
42
42
|
"@atlaskit/link-datasource": "^3.22.0",
|
|
43
43
|
"@atlaskit/media-card": "^79.0.0",
|
|
44
44
|
"@atlaskit/media-client": "^32.0.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"@atlaskit/status": "^3.0.0",
|
|
54
54
|
"@atlaskit/task-decision": "^19.0.0",
|
|
55
55
|
"@atlaskit/theme": "^18.0.0",
|
|
56
|
-
"@atlaskit/tmp-editor-statsig": "^3.
|
|
56
|
+
"@atlaskit/tmp-editor-statsig": "^3.6.0",
|
|
57
57
|
"@atlaskit/tokens": "^4.4.0",
|
|
58
58
|
"@atlaskit/tooltip": "^20.0.0",
|
|
59
59
|
"@atlaskit/visually-hidden": "^3.0.0",
|