@atlaskit/editor-json-transformer 9.5.0 → 9.6.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
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# @atlaskit/editor-json-transformer
|
|
2
2
|
|
|
3
|
+
## 9.6.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1ba964c23baef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1ba964c23baef) -
|
|
8
|
+
`JSONTransformer.parse` no longer upgrades container nodes (`panel` -> `panel_c1`) while
|
|
9
|
+
deserialising — it is again a plain `schema.nodeFromJSON`, so the ProseMirror node types it
|
|
10
|
+
produces match the input ADF exactly.
|
|
11
|
+
|
|
12
|
+
Removed under HOT-305774, which impacted FedRAMP customers. The upgrade was unconditional: a
|
|
13
|
+
`panel` at the root of the document became a `panel_c1` whenever the supplied schema declared that
|
|
14
|
+
node. That is unsafe across a service boundary, because the two sides do not agree on the schema —
|
|
15
|
+
pf-collab-service (NCS) unconditionally uses the stage-0 schema, which does declare `panel_c1`,
|
|
16
|
+
while the editor does not support `panel_c1` unless the `platform_editor_nest_table_in_panel`
|
|
17
|
+
experiment is enabled. NCS therefore produced drafts whose panels had been converted to
|
|
18
|
+
`panel_c1`, which the editor does not unconditionally support.
|
|
19
|
+
|
|
20
|
+
Consumers that need to deserialise table-in-panel ADF (`{ type: 'panel' }` containing a `table`,
|
|
21
|
+
which ProseMirror models as the separate `panel_c1` node) should apply `transformContainerNodes`
|
|
22
|
+
from `@atlaskit/adf-utils/transforms` to the document before calling `parse`, as the editor and
|
|
23
|
+
renderer already do.
|
|
24
|
+
|
|
3
25
|
## 9.5.0
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -9,7 +9,6 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
11
11
|
var _schemaDefault = require("@atlaskit/adf-schema/schema-default");
|
|
12
|
-
var _transforms = require("@atlaskit/adf-utils/transforms");
|
|
13
12
|
var _sanitizeNode = require("./sanitize/sanitize-node");
|
|
14
13
|
var _toJSON = require("./toJSON");
|
|
15
14
|
var createDocFromContent = function createDocFromContent(content) {
|
|
@@ -54,21 +53,7 @@ var JSONTransformer = exports.JSONTransformer = /*#__PURE__*/function () {
|
|
|
54
53
|
}, {
|
|
55
54
|
key: "internalParse",
|
|
56
55
|
value: function internalParse(content, schema) {
|
|
57
|
-
|
|
58
|
-
// table-in-panel deserialises consistently for JSONTransformer consumers. Schema-driven and
|
|
59
|
-
// flag-free, and best-effort: malformed input falls through to `nodeFromJSON`, which stays
|
|
60
|
-
// the source of truth for validation errors.
|
|
61
|
-
var promoted = content;
|
|
62
|
-
try {
|
|
63
|
-
var _upgradeContainerNode = (0, _transforms.upgradeContainerNodes)(content, schema),
|
|
64
|
-
transformedAdf = _upgradeContainerNode.transformedAdf;
|
|
65
|
-
if (transformedAdf) {
|
|
66
|
-
promoted = transformedAdf;
|
|
67
|
-
}
|
|
68
|
-
} catch (_unused) {
|
|
69
|
-
// Malformed input — leave `promoted` as the original `content`.
|
|
70
|
-
}
|
|
71
|
-
var doc = schema.nodeFromJSON(promoted);
|
|
56
|
+
var doc = schema.nodeFromJSON(content);
|
|
72
57
|
doc.check();
|
|
73
58
|
return doc;
|
|
74
59
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import isEqual from 'lodash/isEqual';
|
|
2
2
|
import { defaultSchema, getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
3
|
-
import { upgradeContainerNodes } from '@atlaskit/adf-utils/transforms';
|
|
4
3
|
import { sanitizeNode } from './sanitize/sanitize-node';
|
|
5
4
|
import { toJSON } from './toJSON';
|
|
6
5
|
const createDocFromContent = content => {
|
|
@@ -36,22 +35,7 @@ export class JSONTransformer {
|
|
|
36
35
|
return createDocFromContent(content);
|
|
37
36
|
}
|
|
38
37
|
internalParse(content, schema) {
|
|
39
|
-
|
|
40
|
-
// table-in-panel deserialises consistently for JSONTransformer consumers. Schema-driven and
|
|
41
|
-
// flag-free, and best-effort: malformed input falls through to `nodeFromJSON`, which stays
|
|
42
|
-
// the source of truth for validation errors.
|
|
43
|
-
let promoted = content;
|
|
44
|
-
try {
|
|
45
|
-
const {
|
|
46
|
-
transformedAdf
|
|
47
|
-
} = upgradeContainerNodes(content, schema);
|
|
48
|
-
if (transformedAdf) {
|
|
49
|
-
promoted = transformedAdf;
|
|
50
|
-
}
|
|
51
|
-
} catch {
|
|
52
|
-
// Malformed input — leave `promoted` as the original `content`.
|
|
53
|
-
}
|
|
54
|
-
const doc = schema.nodeFromJSON(promoted);
|
|
38
|
+
const doc = schema.nodeFromJSON(content);
|
|
55
39
|
doc.check();
|
|
56
40
|
return doc;
|
|
57
41
|
}
|
|
@@ -2,7 +2,6 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import isEqual from 'lodash/isEqual';
|
|
4
4
|
import { defaultSchema, getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
5
|
-
import { upgradeContainerNodes } from '@atlaskit/adf-utils/transforms';
|
|
6
5
|
import { sanitizeNode } from './sanitize/sanitize-node';
|
|
7
6
|
import { toJSON } from './toJSON';
|
|
8
7
|
var createDocFromContent = function createDocFromContent(content) {
|
|
@@ -47,21 +46,7 @@ export var JSONTransformer = /*#__PURE__*/function () {
|
|
|
47
46
|
}, {
|
|
48
47
|
key: "internalParse",
|
|
49
48
|
value: function internalParse(content, schema) {
|
|
50
|
-
|
|
51
|
-
// table-in-panel deserialises consistently for JSONTransformer consumers. Schema-driven and
|
|
52
|
-
// flag-free, and best-effort: malformed input falls through to `nodeFromJSON`, which stays
|
|
53
|
-
// the source of truth for validation errors.
|
|
54
|
-
var promoted = content;
|
|
55
|
-
try {
|
|
56
|
-
var _upgradeContainerNode = upgradeContainerNodes(content, schema),
|
|
57
|
-
transformedAdf = _upgradeContainerNode.transformedAdf;
|
|
58
|
-
if (transformedAdf) {
|
|
59
|
-
promoted = transformedAdf;
|
|
60
|
-
}
|
|
61
|
-
} catch (_unused) {
|
|
62
|
-
// Malformed input — leave `promoted` as the original `content`.
|
|
63
|
-
}
|
|
64
|
-
var doc = schema.nodeFromJSON(promoted);
|
|
49
|
+
var doc = schema.nodeFromJSON(content);
|
|
65
50
|
doc.check();
|
|
66
51
|
return doc;
|
|
67
52
|
}
|