@atlaskit/editor-json-transformer 8.11.4 → 8.11.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 CHANGED
@@ -1,5 +1,14 @@
1
1
  # @atlaskit/editor-json-transformer
2
2
 
3
+ ## 8.11.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#98083](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/98083)
8
+ [`d22da28a5f6c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/d22da28a5f6c) -
9
+ Added step to ADF JSON transformer to remove empty attributes property from paragraph nodes
10
+ - Updated dependencies
11
+
3
12
  ## 8.11.4
4
13
 
5
14
  ### Patch Changes
package/dist/cjs/index.js CHANGED
@@ -106,6 +106,11 @@ var toJSON = function toJSON(node) {
106
106
  if (obj.attrs) {
107
107
  obj.attrs = filterNull(obj.attrs);
108
108
  }
109
+
110
+ // Remove the attrs property if it's empty, this is currently limited to paragraph nodes.
111
+ if (isParagraph(node) && obj.attrs && !Object.keys(obj.attrs).length) {
112
+ delete obj.attrs;
113
+ }
109
114
  if (node.isText) {
110
115
  obj.text = node.textContent;
111
116
  } else {
@@ -86,6 +86,11 @@ const toJSON = node => {
86
86
  if (obj.attrs) {
87
87
  obj.attrs = filterNull(obj.attrs);
88
88
  }
89
+
90
+ // Remove the attrs property if it's empty, this is currently limited to paragraph nodes.
91
+ if (isParagraph(node) && obj.attrs && !Object.keys(obj.attrs).length) {
92
+ delete obj.attrs;
93
+ }
89
94
  if (node.isText) {
90
95
  obj.text = node.textContent;
91
96
  } else {
package/dist/esm/index.js CHANGED
@@ -98,6 +98,11 @@ var toJSON = function toJSON(node) {
98
98
  if (obj.attrs) {
99
99
  obj.attrs = filterNull(obj.attrs);
100
100
  }
101
+
102
+ // Remove the attrs property if it's empty, this is currently limited to paragraph nodes.
103
+ if (isParagraph(node) && obj.attrs && !Object.keys(obj.attrs).length) {
104
+ delete obj.attrs;
105
+ }
101
106
  if (node.isText) {
102
107
  obj.text = node.textContent;
103
108
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-json-transformer",
3
- "version": "8.11.4",
3
+ "version": "8.11.5",
4
4
  "description": "JSON transformer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@atlaskit/adf-schema": "^35.12.2",
45
- "@atlaskit/adf-utils": "^19.0.0",
45
+ "@atlaskit/adf-utils": "^19.1.0",
46
46
  "@atlaskit/editor-prosemirror": "4.0.1",
47
47
  "@babel/runtime": "^7.0.0",
48
48
  "lodash": "^4.17.21"