@atlaskit/editor-json-transformer 9.7.0 → 9.8.1
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 +17 -0
- package/SchemaStage/package.json +8 -0
- package/dist/cjs/toJSON.js +19 -11
- package/dist/es2019/toJSON.js +9 -1
- package/dist/esm/toJSON.js +9 -1
- package/dist/types/sanitize/remove-marks.d.ts +1 -1
- package/dist/types/sanitize/remove-non-annotation-marks.d.ts +1 -1
- package/package.json +17 -18
- package/remove-non-annotation-marks/package.json +8 -0
- package/afm-cc/tsconfig.json +0 -35
- package/report.api.md +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# @atlaskit/editor-json-transformer
|
|
2
2
|
|
|
3
|
+
## 9.8.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 9.8.0
|
|
10
|
+
|
|
11
|
+
### Minor Changes
|
|
12
|
+
|
|
13
|
+
- [`bd2c5b0112185`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/bd2c5b0112185) -
|
|
14
|
+
Remove stale API report artifacts from published Platform packages.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
3
20
|
## 9.7.0
|
|
4
21
|
|
|
5
22
|
### Minor Changes
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-json-transformer/SchemaStage",
|
|
3
|
+
"main": "../dist/cjs/SchemaStage.js",
|
|
4
|
+
"module": "../dist/esm/SchemaStage.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/SchemaStage.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/SchemaStage.d.ts"
|
|
8
|
+
}
|
package/dist/cjs/toJSON.js
CHANGED
|
@@ -9,6 +9,14 @@ exports.toJSON = void 0;
|
|
|
9
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
10
|
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
11
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
+
var _codeBlock = require("@atlaskit/adf-schema/code-block");
|
|
13
|
+
var _dataConsumer = require("@atlaskit/adf-schema/data-consumer");
|
|
14
|
+
var _expand = require("@atlaskit/adf-schema/expand");
|
|
15
|
+
var _fragment = require("@atlaskit/adf-schema/fragment");
|
|
16
|
+
var _toJson = require("@atlaskit/adf-schema/to-json");
|
|
17
|
+
var _toJson2 = require("@atlaskit/adf-schema/to-json-2");
|
|
18
|
+
var _mention = require("@atlaskit/adf-schema/mention");
|
|
19
|
+
var _tableNodes = require("@atlaskit/adf-schema/tableNodes");
|
|
12
20
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
13
21
|
var _markOverrideRules = require("./markOverrideRules");
|
|
14
22
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof3(i) ? i : i + ""; }
|
|
@@ -103,23 +111,23 @@ var _toJSON = exports.toJSON = function toJSON(node, mentionMap) {
|
|
|
103
111
|
if (isUnsupportedNode(node)) {
|
|
104
112
|
return node.attrs.originalValue;
|
|
105
113
|
} else if (isMediaNode(node)) {
|
|
106
|
-
obj.attrs = (0,
|
|
114
|
+
obj.attrs = (0, _toJson2.toJSON)(node).attrs;
|
|
107
115
|
} else if (isMediaSingleNode(node)) {
|
|
108
|
-
obj.attrs = (0,
|
|
116
|
+
obj.attrs = (0, _toJson.toJSON)(node).attrs;
|
|
109
117
|
} else if (isMediaInline(node)) {
|
|
110
|
-
obj.attrs = (0,
|
|
118
|
+
obj.attrs = (0, _toJson2.toJSON)(node).attrs;
|
|
111
119
|
} else if (isMentionNode(node)) {
|
|
112
|
-
obj.attrs = (0,
|
|
120
|
+
obj.attrs = (0, _mention.toJSON)(node).attrs;
|
|
113
121
|
} else if (isCodeBlock(node)) {
|
|
114
|
-
obj.attrs = (0,
|
|
122
|
+
obj.attrs = (0, _codeBlock.toJSON)(node).attrs;
|
|
115
123
|
} else if (isTable(node)) {
|
|
116
|
-
obj.attrs = (0,
|
|
124
|
+
obj.attrs = (0, _tableNodes.tableToJSON)(node).attrs;
|
|
117
125
|
} else if (isTableCell(node)) {
|
|
118
|
-
obj.attrs = (0,
|
|
126
|
+
obj.attrs = (0, _tableNodes.toJSONTableCell)(node).attrs;
|
|
119
127
|
} else if (isTableHeader(node)) {
|
|
120
|
-
obj.attrs = (0,
|
|
128
|
+
obj.attrs = (0, _tableNodes.toJSONTableHeader)(node).attrs;
|
|
121
129
|
} else if (isExpand(node) || isNestedExpand(node)) {
|
|
122
|
-
obj.attrs = (0,
|
|
130
|
+
obj.attrs = (0, _expand.toJSON)(node).attrs;
|
|
123
131
|
} else if (node.attrs && Object.keys(node.attrs).length) {
|
|
124
132
|
obj.attrs = node.attrs;
|
|
125
133
|
}
|
|
@@ -163,10 +171,10 @@ var _toJSON = exports.toJSON = function toJSON(node, mentionMap) {
|
|
|
163
171
|
return (0, _adfSchema.linkToJSON)(mark);
|
|
164
172
|
} else if (isDataConsumer(mark)) {
|
|
165
173
|
var _serialised$attrs$sou;
|
|
166
|
-
var serialised = (0,
|
|
174
|
+
var serialised = (0, _dataConsumer.toJSON)(mark);
|
|
167
175
|
return !serialised.attrs.sources || ((_serialised$attrs$sou = serialised.attrs.sources) === null || _serialised$attrs$sou === void 0 ? void 0 : _serialised$attrs$sou.length) === 0 ? null : serialised;
|
|
168
176
|
} else if (isFragmentMark(mark)) {
|
|
169
|
-
var fragmentMark = (0,
|
|
177
|
+
var fragmentMark = (0, _fragment.toJSON)(mark);
|
|
170
178
|
if (!fragmentMark.attrs.localId) {
|
|
171
179
|
return null;
|
|
172
180
|
}
|
package/dist/es2019/toJSON.js
CHANGED
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { toJSON as codeBlockToJSON } from '@atlaskit/adf-schema/code-block';
|
|
2
|
+
import { toJSON as dataConsumerToJSON } from '@atlaskit/adf-schema/data-consumer';
|
|
3
|
+
import { toJSON as expandToJSON } from '@atlaskit/adf-schema/expand';
|
|
4
|
+
import { toJSON as fragmentToJSON } from '@atlaskit/adf-schema/fragment';
|
|
5
|
+
import { toJSON as mediaSingleToJSON } from '@atlaskit/adf-schema/to-json';
|
|
6
|
+
import { toJSON as mediaToJSON } from '@atlaskit/adf-schema/to-json-2';
|
|
7
|
+
import { toJSON as mentionToJSON } from '@atlaskit/adf-schema/mention';
|
|
8
|
+
import { tableToJSON, toJSONTableCell, toJSONTableHeader } from '@atlaskit/adf-schema/tableNodes';
|
|
9
|
+
import { linkToJSON } from '@atlaskit/adf-schema';
|
|
2
10
|
import { markOverrideRuleFor } from './markOverrideRules';
|
|
3
11
|
const isType = type => node => node.type.name === type;
|
|
4
12
|
|
package/dist/esm/toJSON.js
CHANGED
|
@@ -5,7 +5,15 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
5
5
|
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
|
-
import {
|
|
8
|
+
import { toJSON as codeBlockToJSON } from '@atlaskit/adf-schema/code-block';
|
|
9
|
+
import { toJSON as dataConsumerToJSON } from '@atlaskit/adf-schema/data-consumer';
|
|
10
|
+
import { toJSON as expandToJSON } from '@atlaskit/adf-schema/expand';
|
|
11
|
+
import { toJSON as fragmentToJSON } from '@atlaskit/adf-schema/fragment';
|
|
12
|
+
import { toJSON as mediaSingleToJSON } from '@atlaskit/adf-schema/to-json';
|
|
13
|
+
import { toJSON as mediaToJSON } from '@atlaskit/adf-schema/to-json-2';
|
|
14
|
+
import { toJSON as mentionToJSON } from '@atlaskit/adf-schema/mention';
|
|
15
|
+
import { tableToJSON, toJSONTableCell, toJSONTableHeader } from '@atlaskit/adf-schema/tableNodes';
|
|
16
|
+
import { linkToJSON } from '@atlaskit/adf-schema';
|
|
9
17
|
import { markOverrideRuleFor } from './markOverrideRules';
|
|
10
18
|
var isType = function isType(type) {
|
|
11
19
|
return function (node) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-json-transformer",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.1",
|
|
4
4
|
"description": "JSON transformer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -17,33 +17,32 @@
|
|
|
17
17
|
"atlassian": {
|
|
18
18
|
"team": "Editor: Collaboration",
|
|
19
19
|
"website": {
|
|
20
|
+
"tags": [
|
|
21
|
+
"platform-labs"
|
|
22
|
+
],
|
|
20
23
|
"name": "Editor Json Transformer"
|
|
21
24
|
}
|
|
22
25
|
},
|
|
23
26
|
"dependencies": {
|
|
24
|
-
"@atlaskit/adf-schema": "^57.
|
|
25
|
-
"@atlaskit/adf-utils": "^20.
|
|
26
|
-
"@atlaskit/editor-prosemirror": "^
|
|
27
|
+
"@atlaskit/adf-schema": "^57.5.0",
|
|
28
|
+
"@atlaskit/adf-utils": "^20.9.0",
|
|
29
|
+
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
27
30
|
"@babel/runtime": "^7.0.0",
|
|
28
31
|
"lodash": "^4.17.21"
|
|
29
32
|
},
|
|
30
33
|
"devDependencies": {
|
|
34
|
+
"@atlaskit/editor-common": "^123.0.0",
|
|
35
|
+
"@atlaskit/editor-core": "^229.0.0",
|
|
36
|
+
"@atlaskit/editor-plugin-grid": "^19.0.0",
|
|
37
|
+
"@atlaskit/editor-plugin-media": "^21.0.0",
|
|
38
|
+
"@atlaskit/editor-plugins": "^16.1.0",
|
|
39
|
+
"@atlaskit/editor-test-helpers": "workspace:^",
|
|
40
|
+
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
41
|
+
"@atlaskit/tokens": "^18.2.0",
|
|
42
|
+
"@atlaskit/util-data-test": "^19.1.0",
|
|
31
43
|
"@atlassian/a11y-jest-testing": "^0.17.0",
|
|
32
44
|
"@atlassian/structured-docs-types": "workspace:^",
|
|
45
|
+
"@atlassian/workbench": "workspace:*",
|
|
33
46
|
"react": "^19.2.0"
|
|
34
|
-
},
|
|
35
|
-
"techstack": {
|
|
36
|
-
"@atlassian/frontend": {
|
|
37
|
-
"import-structure": "atlassian-conventions"
|
|
38
|
-
},
|
|
39
|
-
"@repo/internal": {
|
|
40
|
-
"deprecation": "no-deprecated-imports",
|
|
41
|
-
"design-tokens": [
|
|
42
|
-
"color"
|
|
43
|
-
],
|
|
44
|
-
"styling": [
|
|
45
|
-
"emotion"
|
|
46
|
-
]
|
|
47
|
-
}
|
|
48
47
|
}
|
|
49
48
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-json-transformer/remove-non-annotation-marks",
|
|
3
|
+
"main": "../dist/cjs/sanitize/remove-non-annotation-marks.js",
|
|
4
|
+
"module": "../dist/esm/sanitize/remove-non-annotation-marks.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/sanitize/remove-non-annotation-marks.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/sanitize/remove-non-annotation-marks.d.ts"
|
|
8
|
+
}
|
package/afm-cc/tsconfig.json
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"extends": "../../../../tsconfig.local-consumption.json",
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
"outDir": "../../../../../confluence/tsDist/@atlaskit__editor-json-transformer",
|
|
5
|
-
"rootDir": "../",
|
|
6
|
-
"composite": true,
|
|
7
|
-
"noCheck": true
|
|
8
|
-
},
|
|
9
|
-
"include": [
|
|
10
|
-
"../src/**/*.ts",
|
|
11
|
-
"../src/**/*.tsx"
|
|
12
|
-
],
|
|
13
|
-
"exclude": [
|
|
14
|
-
"../src/**/__tests__/*",
|
|
15
|
-
"../src/**/*.test.*",
|
|
16
|
-
"../src/**/test.*",
|
|
17
|
-
"../src/**/examples.*",
|
|
18
|
-
"../src/**/examples/*",
|
|
19
|
-
"../src/**/examples/**/*",
|
|
20
|
-
"../src/**/*.stories.*",
|
|
21
|
-
"../src/**/stories/*",
|
|
22
|
-
"../src/**/stories/**/*"
|
|
23
|
-
],
|
|
24
|
-
"references": [
|
|
25
|
-
{
|
|
26
|
-
"path": "../../adf-schema/afm-cc/tsconfig.json"
|
|
27
|
-
},
|
|
28
|
-
{
|
|
29
|
-
"path": "../../adf-utils/afm-cc/tsconfig.json"
|
|
30
|
-
},
|
|
31
|
-
{
|
|
32
|
-
"path": "../../editor-prosemirror/afm-cc/tsconfig.json"
|
|
33
|
-
}
|
|
34
|
-
]
|
|
35
|
-
}
|
package/report.api.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
<!-- API Report Version: 2.3 -->
|
|
2
|
-
|
|
3
|
-
## API Report File for "@atlaskit/editor-json-transformer"
|
|
4
|
-
|
|
5
|
-
> Do not edit this file. This report is auto-generated using
|
|
6
|
-
> [API Extractor](https://api-extractor.com/).
|
|
7
|
-
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
8
|
-
|
|
9
|
-
### Table of contents
|
|
10
|
-
|
|
11
|
-
- [Main Entry Types](#main-entry-types)
|
|
12
|
-
- [Peer Dependencies](#peer-dependencies)
|
|
13
|
-
|
|
14
|
-
### Main Entry Types
|
|
15
|
-
|
|
16
|
-
<!--SECTION START: Main Entry Types-->
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
import type { Node as Node_2 } from '@atlaskit/editor-prosemirror/model';
|
|
20
|
-
|
|
21
|
-
// @public (undocumented)
|
|
22
|
-
export type JSONDocNode = {
|
|
23
|
-
version: number;
|
|
24
|
-
type: 'doc';
|
|
25
|
-
content: JSONNode[];
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
// @public (undocumented)
|
|
29
|
-
export type JSONNode = {
|
|
30
|
-
type: string;
|
|
31
|
-
attrs?: object;
|
|
32
|
-
content?: Array<JSONNode | undefined>;
|
|
33
|
-
marks?: any[];
|
|
34
|
-
text?: string;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// @public (undocumented)
|
|
38
|
-
export class JSONTransformer implements Transformer_2<JSONDocNode> {
|
|
39
|
-
// (undocumented)
|
|
40
|
-
encode(node: Node_2): JSONDocNode;
|
|
41
|
-
encodeNode(node: Node_2): JSONNode;
|
|
42
|
-
// (undocumented)
|
|
43
|
-
parse(content: JSONDocNode, stage?: SchemaStage): Node_2;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// @public (undocumented)
|
|
47
|
-
export enum SchemaStage {
|
|
48
|
-
// (undocumented)
|
|
49
|
-
FINAL = 'final',
|
|
50
|
-
// (undocumented)
|
|
51
|
-
STAGE_0 = 'stage0',
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// @public (undocumented)
|
|
55
|
-
interface Transformer_2<T> {
|
|
56
|
-
// (undocumented)
|
|
57
|
-
encode(node: Node_2): T;
|
|
58
|
-
// (undocumented)
|
|
59
|
-
parse(content: T): Node_2;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// (No @packageDocumentation comment for this package)
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
<!--SECTION END: Main Entry Types-->
|
|
66
|
-
|
|
67
|
-
### Peer Dependencies
|
|
68
|
-
|
|
69
|
-
<!--SECTION START: Peer Dependencies-->
|
|
70
|
-
|
|
71
|
-
```json
|
|
72
|
-
{}
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
<!--SECTION END: Peer Dependencies-->
|