@atlaskit/editor-json-transformer 8.8.2 → 8.8.3
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 +8 -0
- package/dist/cjs/index.js +37 -17
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +27 -17
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +31 -14
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +5 -1
- package/package.json +9 -17
- package/report.api.md +21 -6
- package/dist/types-ts4.0/index.d.ts +0 -16
- package/dist/types-ts4.0/markOverrideRules.d.ts +0 -13
- package/dist/types-ts4.0/sanitize/remove-marks.d.ts +0 -8
- package/dist/types-ts4.0/sanitize/sanitize-node.d.ts +0 -2
- package/dist/types-ts4.0/sanitize.d.ts +0 -2
- package/dist/types-ts4.0/types.d.ts +0 -12
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @atlaskit/editor-json-transformer
|
|
2
2
|
|
|
3
|
+
## 8.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`43cb4da169a`](https://bitbucket.org/atlassian/atlassian-frontend/commits/43cb4da169a) - Refactored filterNull to use a for loop rather than reduce
|
|
8
|
+
- [`3e03d26ca36`](https://bitbucket.org/atlassian/atlassian-frontend/commits/3e03d26ca36) - [ESS-3031] Added the capability to parse ADF documents for the stage-0 schema
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
3
11
|
## 8.8.2
|
|
4
12
|
|
|
5
13
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
|
@@ -2,19 +2,23 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
|
+
var _typeof3 = require("@babel/runtime/helpers/typeof");
|
|
6
|
+
|
|
5
7
|
Object.defineProperty(exports, "__esModule", {
|
|
6
8
|
value: true
|
|
7
9
|
});
|
|
8
|
-
exports.JSONTransformer = void 0;
|
|
10
|
+
exports.SchemaStage = exports.JSONTransformer = void 0;
|
|
9
11
|
|
|
10
12
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
13
|
|
|
12
14
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
15
|
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
16
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
17
17
|
|
|
18
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
19
|
+
|
|
20
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
+
|
|
18
22
|
var _isEqual = _interopRequireDefault(require("lodash/isEqual"));
|
|
19
23
|
|
|
20
24
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
@@ -25,10 +29,22 @@ var _markOverrideRules = require("./markOverrideRules");
|
|
|
25
29
|
|
|
26
30
|
var _sanitizeNode = require("./sanitize/sanitize-node");
|
|
27
31
|
|
|
32
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof3(key) === "symbol" ? key : String(key); }
|
|
33
|
+
|
|
34
|
+
function _toPrimitive(input, hint) { if (_typeof3(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof3(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
35
|
+
|
|
28
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
29
37
|
|
|
30
38
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
31
39
|
|
|
40
|
+
var SchemaStage;
|
|
41
|
+
exports.SchemaStage = SchemaStage;
|
|
42
|
+
|
|
43
|
+
(function (SchemaStage) {
|
|
44
|
+
SchemaStage["FINAL"] = "final";
|
|
45
|
+
SchemaStage["STAGE_0"] = "stage0";
|
|
46
|
+
})(SchemaStage || (exports.SchemaStage = SchemaStage = {}));
|
|
47
|
+
|
|
32
48
|
var isType = function isType(type) {
|
|
33
49
|
return function (node) {
|
|
34
50
|
return node.type.name === type;
|
|
@@ -59,19 +75,22 @@ var isDataConsumer = isType('dataConsumer');
|
|
|
59
75
|
var isFragmentMark = isType('fragment');
|
|
60
76
|
|
|
61
77
|
var filterNull = function filterNull(subject) {
|
|
62
|
-
|
|
63
|
-
var current = subject[key];
|
|
78
|
+
var output = _objectSpread({}, subject);
|
|
64
79
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
}
|
|
80
|
+
for (var key in output) {
|
|
81
|
+
var current = output[key];
|
|
68
82
|
|
|
69
|
-
if (
|
|
70
|
-
|
|
83
|
+
if (current === null) {
|
|
84
|
+
var _output = output,
|
|
85
|
+
unusedKey = _output[key],
|
|
86
|
+
filteredObj = (0, _objectWithoutProperties2.default)(_output, [key].map(_toPropertyKey));
|
|
87
|
+
output = filteredObj;
|
|
88
|
+
} else if ((0, _typeof2.default)(current) === 'object' && !Array.isArray(current)) {
|
|
89
|
+
output[key] = filterNull(current);
|
|
71
90
|
}
|
|
91
|
+
}
|
|
72
92
|
|
|
73
|
-
|
|
74
|
-
}, {});
|
|
93
|
+
return output;
|
|
75
94
|
};
|
|
76
95
|
|
|
77
96
|
var createDocFromContent = function createDocFromContent(content) {
|
|
@@ -225,23 +244,24 @@ var JSONTransformer = /*#__PURE__*/function () {
|
|
|
225
244
|
}, {
|
|
226
245
|
key: "internalParse",
|
|
227
246
|
value: function internalParse(content) {
|
|
228
|
-
var
|
|
229
|
-
|
|
247
|
+
var stage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SchemaStage.FINAL;
|
|
248
|
+
var schema = (0, _schemaDefault.getSchemaBasedOnStage)(stage);
|
|
249
|
+
var doc = schema.nodeFromJSON(content);
|
|
230
250
|
doc.check();
|
|
231
251
|
return doc;
|
|
232
252
|
}
|
|
233
253
|
}, {
|
|
234
254
|
key: "parse",
|
|
235
|
-
value: function parse(content) {
|
|
255
|
+
value: function parse(content, stage) {
|
|
236
256
|
if (content.type !== 'doc') {
|
|
237
257
|
throw new Error('Expected content format to be ADF');
|
|
238
258
|
}
|
|
239
259
|
|
|
240
260
|
if (!content.content || content.content.length === 0) {
|
|
241
|
-
return this.internalParse(emptyDoc);
|
|
261
|
+
return this.internalParse(emptyDoc, stage);
|
|
242
262
|
}
|
|
243
263
|
|
|
244
|
-
return this.internalParse(content);
|
|
264
|
+
return this.internalParse(content, stage);
|
|
245
265
|
}
|
|
246
266
|
/**
|
|
247
267
|
* This method is used to encode a single node
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import isEqual from 'lodash/isEqual';
|
|
2
2
|
import { codeBlockToJSON, dataConsumerToJSON, expandToJSON, fragmentToJSON, linkToJSON, mediaSingleToJSON, mediaToJSON, mentionToJSON, tableToJSON, toJSONTableCell, toJSONTableHeader } from '@atlaskit/adf-schema';
|
|
3
|
-
import {
|
|
3
|
+
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
4
4
|
import { markOverrideRuleFor } from './markOverrideRules';
|
|
5
5
|
import { sanitizeNode } from './sanitize/sanitize-node';
|
|
6
|
+
export let SchemaStage;
|
|
7
|
+
|
|
8
|
+
(function (SchemaStage) {
|
|
9
|
+
SchemaStage["FINAL"] = "final";
|
|
10
|
+
SchemaStage["STAGE_0"] = "stage0";
|
|
11
|
+
})(SchemaStage || (SchemaStage = {}));
|
|
6
12
|
|
|
7
13
|
const isType = type => node => node.type.name === type;
|
|
8
14
|
|
|
@@ -28,21 +34,24 @@ const isDataConsumer = isType('dataConsumer');
|
|
|
28
34
|
const isFragmentMark = isType('fragment');
|
|
29
35
|
|
|
30
36
|
const filterNull = subject => {
|
|
31
|
-
|
|
32
|
-
|
|
37
|
+
let output = { ...subject
|
|
38
|
+
};
|
|
33
39
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
40
|
+
for (const key in output) {
|
|
41
|
+
const current = output[key];
|
|
37
42
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
43
|
+
if (current === null) {
|
|
44
|
+
const {
|
|
45
|
+
[key]: unusedKey,
|
|
46
|
+
...filteredObj
|
|
47
|
+
} = output;
|
|
48
|
+
output = filteredObj;
|
|
49
|
+
} else if (typeof current === 'object' && !Array.isArray(current)) {
|
|
50
|
+
output[key] = filterNull(current);
|
|
40
51
|
}
|
|
52
|
+
}
|
|
41
53
|
|
|
42
|
-
|
|
43
|
-
[key]: current
|
|
44
|
-
};
|
|
45
|
-
}, {});
|
|
54
|
+
return output;
|
|
46
55
|
};
|
|
47
56
|
|
|
48
57
|
const createDocFromContent = content => {
|
|
@@ -188,22 +197,23 @@ export class JSONTransformer {
|
|
|
188
197
|
return createDocFromContent(content);
|
|
189
198
|
}
|
|
190
199
|
|
|
191
|
-
internalParse(content) {
|
|
192
|
-
const
|
|
200
|
+
internalParse(content, stage = SchemaStage.FINAL) {
|
|
201
|
+
const schema = getSchemaBasedOnStage(stage);
|
|
202
|
+
const doc = schema.nodeFromJSON(content);
|
|
193
203
|
doc.check();
|
|
194
204
|
return doc;
|
|
195
205
|
}
|
|
196
206
|
|
|
197
|
-
parse(content) {
|
|
207
|
+
parse(content, stage) {
|
|
198
208
|
if (content.type !== 'doc') {
|
|
199
209
|
throw new Error('Expected content format to be ADF');
|
|
200
210
|
}
|
|
201
211
|
|
|
202
212
|
if (!content.content || content.content.length === 0) {
|
|
203
|
-
return this.internalParse(emptyDoc);
|
|
213
|
+
return this.internalParse(emptyDoc, stage);
|
|
204
214
|
}
|
|
205
215
|
|
|
206
|
-
return this.internalParse(content);
|
|
216
|
+
return this.internalParse(content, stage);
|
|
207
217
|
}
|
|
208
218
|
/**
|
|
209
219
|
* This method is used to encode a single node
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
3
|
import _typeof from "@babel/runtime/helpers/typeof";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
5
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
6
|
+
|
|
7
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
8
|
+
|
|
9
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
5
10
|
|
|
6
11
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
12
|
|
|
@@ -9,9 +14,15 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
14
|
|
|
10
15
|
import isEqual from 'lodash/isEqual';
|
|
11
16
|
import { codeBlockToJSON, dataConsumerToJSON, expandToJSON, fragmentToJSON, linkToJSON, mediaSingleToJSON, mediaToJSON, mentionToJSON, tableToJSON, toJSONTableCell, toJSONTableHeader } from '@atlaskit/adf-schema';
|
|
12
|
-
import {
|
|
17
|
+
import { getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
13
18
|
import { markOverrideRuleFor } from './markOverrideRules';
|
|
14
19
|
import { sanitizeNode } from './sanitize/sanitize-node';
|
|
20
|
+
export var SchemaStage;
|
|
21
|
+
|
|
22
|
+
(function (SchemaStage) {
|
|
23
|
+
SchemaStage["FINAL"] = "final";
|
|
24
|
+
SchemaStage["STAGE_0"] = "stage0";
|
|
25
|
+
})(SchemaStage || (SchemaStage = {}));
|
|
15
26
|
|
|
16
27
|
var isType = function isType(type) {
|
|
17
28
|
return function (node) {
|
|
@@ -43,19 +54,23 @@ var isDataConsumer = isType('dataConsumer');
|
|
|
43
54
|
var isFragmentMark = isType('fragment');
|
|
44
55
|
|
|
45
56
|
var filterNull = function filterNull(subject) {
|
|
46
|
-
|
|
47
|
-
|
|
57
|
+
var output = _objectSpread({}, subject);
|
|
58
|
+
|
|
59
|
+
for (var key in output) {
|
|
60
|
+
var current = output[key];
|
|
48
61
|
|
|
49
62
|
if (current === null) {
|
|
50
|
-
|
|
51
|
-
|
|
63
|
+
var _output = output,
|
|
64
|
+
unusedKey = _output[key],
|
|
65
|
+
filteredObj = _objectWithoutProperties(_output, [key].map(_toPropertyKey));
|
|
52
66
|
|
|
53
|
-
|
|
54
|
-
|
|
67
|
+
output = filteredObj;
|
|
68
|
+
} else if (_typeof(current) === 'object' && !Array.isArray(current)) {
|
|
69
|
+
output[key] = filterNull(current);
|
|
55
70
|
}
|
|
71
|
+
}
|
|
56
72
|
|
|
57
|
-
|
|
58
|
-
}, {});
|
|
73
|
+
return output;
|
|
59
74
|
};
|
|
60
75
|
|
|
61
76
|
var createDocFromContent = function createDocFromContent(content) {
|
|
@@ -209,22 +224,24 @@ export var JSONTransformer = /*#__PURE__*/function () {
|
|
|
209
224
|
}, {
|
|
210
225
|
key: "internalParse",
|
|
211
226
|
value: function internalParse(content) {
|
|
212
|
-
var
|
|
227
|
+
var stage = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SchemaStage.FINAL;
|
|
228
|
+
var schema = getSchemaBasedOnStage(stage);
|
|
229
|
+
var doc = schema.nodeFromJSON(content);
|
|
213
230
|
doc.check();
|
|
214
231
|
return doc;
|
|
215
232
|
}
|
|
216
233
|
}, {
|
|
217
234
|
key: "parse",
|
|
218
|
-
value: function parse(content) {
|
|
235
|
+
value: function parse(content, stage) {
|
|
219
236
|
if (content.type !== 'doc') {
|
|
220
237
|
throw new Error('Expected content format to be ADF');
|
|
221
238
|
}
|
|
222
239
|
|
|
223
240
|
if (!content.content || content.content.length === 0) {
|
|
224
|
-
return this.internalParse(emptyDoc);
|
|
241
|
+
return this.internalParse(emptyDoc, stage);
|
|
225
242
|
}
|
|
226
243
|
|
|
227
|
-
return this.internalParse(content);
|
|
244
|
+
return this.internalParse(content, stage);
|
|
228
245
|
}
|
|
229
246
|
/**
|
|
230
247
|
* This method is used to encode a single node
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -5,10 +5,14 @@ interface Transformer<T> {
|
|
|
5
5
|
encode(node: PMNode): T;
|
|
6
6
|
parse(content: T): PMNode;
|
|
7
7
|
}
|
|
8
|
+
export declare enum SchemaStage {
|
|
9
|
+
FINAL = "final",
|
|
10
|
+
STAGE_0 = "stage0"
|
|
11
|
+
}
|
|
8
12
|
export declare class JSONTransformer implements Transformer<JSONDocNode> {
|
|
9
13
|
encode(node: PMNode): JSONDocNode;
|
|
10
14
|
private internalParse;
|
|
11
|
-
parse(content: JSONDocNode): PMNode;
|
|
15
|
+
parse(content: JSONDocNode, stage?: SchemaStage): PMNode;
|
|
12
16
|
/**
|
|
13
17
|
* This method is used to encode a single node
|
|
14
18
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-json-transformer",
|
|
3
|
-
"version": "8.8.
|
|
3
|
+
"version": "8.8.3",
|
|
4
4
|
"description": "JSON transformer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,14 +12,6 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"typesVersions": {
|
|
16
|
-
">=4.0 <4.5": {
|
|
17
|
-
"*": [
|
|
18
|
-
"dist/types-ts4.0/*",
|
|
19
|
-
"dist/types-ts4.0/index.d.ts"
|
|
20
|
-
]
|
|
21
|
-
}
|
|
22
|
-
},
|
|
23
15
|
"sideEffects": false,
|
|
24
16
|
"atlaskit:src": "src/index.ts",
|
|
25
17
|
"atlassian": {
|
|
@@ -37,23 +29,23 @@
|
|
|
37
29
|
"./types": "./src/types.ts"
|
|
38
30
|
},
|
|
39
31
|
"dependencies": {
|
|
40
|
-
"@atlaskit/adf-schema": "^
|
|
41
|
-
"@atlaskit/adf-utils": "^
|
|
32
|
+
"@atlaskit/adf-schema": "^25.0.0",
|
|
33
|
+
"@atlaskit/adf-utils": "^18.0.0",
|
|
42
34
|
"@babel/runtime": "^7.0.0",
|
|
43
35
|
"lodash": "^4.17.21",
|
|
44
36
|
"prosemirror-model": "1.14.3"
|
|
45
37
|
},
|
|
46
38
|
"devDependencies": {
|
|
47
39
|
"@atlaskit/docs": "*",
|
|
48
|
-
"@atlaskit/editor-bitbucket-transformer": "^
|
|
49
|
-
"@atlaskit/editor-common": "^
|
|
40
|
+
"@atlaskit/editor-bitbucket-transformer": "^8.0.0",
|
|
41
|
+
"@atlaskit/editor-common": "^72.0.0",
|
|
50
42
|
"@atlaskit/editor-confluence-transformer": "^8.1.0",
|
|
51
|
-
"@atlaskit/editor-core": "^
|
|
43
|
+
"@atlaskit/editor-core": "^177.0.0",
|
|
52
44
|
"@atlaskit/editor-jira-transformer": "^8.2.0",
|
|
53
|
-
"@atlaskit/editor-markdown-transformer": "^
|
|
54
|
-
"@atlaskit/editor-test-helpers": "^
|
|
45
|
+
"@atlaskit/editor-markdown-transformer": "^5.0.0",
|
|
46
|
+
"@atlaskit/editor-test-helpers": "^18.0.0",
|
|
55
47
|
"@atlaskit/editor-wikimarkup-transformer": "^11.1.0",
|
|
56
|
-
"@atlaskit/util-data-test": "^17.
|
|
48
|
+
"@atlaskit/util-data-test": "^17.6.0",
|
|
57
49
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
58
50
|
"@emotion/react": "^11.7.1",
|
|
59
51
|
"@types/prosemirror-model": "^1.11.0",
|
package/report.api.md
CHANGED
|
@@ -1,12 +1,17 @@
|
|
|
1
|
+
<!-- API Report Version: 2.3 -->
|
|
2
|
+
|
|
1
3
|
## API Report File for "@atlaskit/editor-json-transformer"
|
|
2
4
|
|
|
3
|
-
> Do not edit this file.
|
|
5
|
+
> Do not edit this file. This report is auto-generated using [API Extractor](https://api-extractor.com/).
|
|
6
|
+
> [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports)
|
|
7
|
+
|
|
8
|
+
### Table of contents
|
|
9
|
+
|
|
10
|
+
- [Main Entry Types](#main-entry-types)
|
|
4
11
|
|
|
5
|
-
|
|
6
|
-
Generated API Report version: 2.0
|
|
7
|
-
-->
|
|
12
|
+
### Main Entry Types
|
|
8
13
|
|
|
9
|
-
|
|
14
|
+
<!--SECTION START: Main Entry Types-->
|
|
10
15
|
|
|
11
16
|
```ts
|
|
12
17
|
import { Node as Node_2 } from 'prosemirror-model';
|
|
@@ -33,7 +38,15 @@ export class JSONTransformer implements Transformer_2<JSONDocNode> {
|
|
|
33
38
|
encode(node: Node_2): JSONDocNode;
|
|
34
39
|
encodeNode(node: Node_2): JSONNode;
|
|
35
40
|
// (undocumented)
|
|
36
|
-
parse(content: JSONDocNode): Node_2;
|
|
41
|
+
parse(content: JSONDocNode, stage?: SchemaStage): Node_2;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// @public (undocumented)
|
|
45
|
+
export enum SchemaStage {
|
|
46
|
+
// (undocumented)
|
|
47
|
+
FINAL = 'final',
|
|
48
|
+
// (undocumented)
|
|
49
|
+
STAGE_0 = 'stage0',
|
|
37
50
|
}
|
|
38
51
|
|
|
39
52
|
// @public (undocumented)
|
|
@@ -46,3 +59,5 @@ interface Transformer_2<T> {
|
|
|
46
59
|
|
|
47
60
|
// (No @packageDocumentation comment for this package)
|
|
48
61
|
```
|
|
62
|
+
|
|
63
|
+
<!--SECTION END: Main Entry Types-->
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Node as PMNode } from 'prosemirror-model';
|
|
2
|
-
import { JSONDocNode, JSONNode } from './types';
|
|
3
|
-
export type { JSONDocNode, JSONNode } from './types';
|
|
4
|
-
interface Transformer<T> {
|
|
5
|
-
encode(node: PMNode): T;
|
|
6
|
-
parse(content: T): PMNode;
|
|
7
|
-
}
|
|
8
|
-
export declare class JSONTransformer implements Transformer<JSONDocNode> {
|
|
9
|
-
encode(node: PMNode): JSONDocNode;
|
|
10
|
-
private internalParse;
|
|
11
|
-
parse(content: JSONDocNode): PMNode;
|
|
12
|
-
/**
|
|
13
|
-
* This method is used to encode a single node
|
|
14
|
-
*/
|
|
15
|
-
encodeNode(node: PMNode): JSONNode;
|
|
16
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
interface MarkJson {
|
|
2
|
-
type: string;
|
|
3
|
-
attrs: {
|
|
4
|
-
[key: string]: any;
|
|
5
|
-
};
|
|
6
|
-
}
|
|
7
|
-
declare type CanOverrideUnsupportedMark = (markJson?: MarkJson) => boolean;
|
|
8
|
-
interface MarkOverrideRule {
|
|
9
|
-
canOverrideUnsupportedMark: CanOverrideUnsupportedMark;
|
|
10
|
-
}
|
|
11
|
-
declare type MarkOverrideRules = (type: string) => MarkOverrideRule;
|
|
12
|
-
export declare const markOverrideRuleFor: MarkOverrideRules;
|
|
13
|
-
export {};
|