@atlaskit/editor-json-transformer 8.21.0 → 8.21.2
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 +16 -0
- package/afm-post-office/tsconfig.json +1 -1
- package/dist/cjs/index.js +8 -3
- package/dist/es2019/index.js +8 -0
- package/dist/es2019/sanitize/remove-marks.js +2 -2
- package/dist/es2019/sanitize.js +3 -0
- package/dist/esm/index.js +9 -2
- package/dist/esm/sanitize.js +3 -0
- package/docs/0-intro.tsx +4 -0
- package/package.json +5 -5
- package/tsconfig.json +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-json-transformer
|
|
2
2
|
|
|
3
|
+
## 8.21.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#107139](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/107139)
|
|
8
|
+
[`3721ee9d53429`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3721ee9d53429) -
|
|
9
|
+
[ux] ED-26378 Editor Implementation - Clean up previous project FF in blockQuote
|
|
10
|
+
|
|
11
|
+
## 8.21.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#165765](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/165765)
|
|
16
|
+
[`3f441f30e6507`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3f441f30e6507) -
|
|
17
|
+
Bump adf-schema to 46.0.0
|
|
18
|
+
|
|
3
19
|
## 8.21.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"compilerOptions": {
|
|
4
4
|
"declaration": true,
|
|
5
5
|
"target": "es5",
|
|
6
|
-
"outDir": "../../../../../tsDist/@atlaskit__editor-json-transformer/app",
|
|
6
|
+
"outDir": "../../../../../post-office/tsDist/@atlaskit__editor-json-transformer/app",
|
|
7
7
|
"rootDir": "../",
|
|
8
8
|
"composite": true
|
|
9
9
|
},
|
package/dist/cjs/index.js
CHANGED
|
@@ -19,7 +19,8 @@ var _sanitizeNode = require("./sanitize/sanitize-node");
|
|
|
19
19
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof3(i) ? i : i + ""; }
|
|
20
20
|
function _toPrimitive(t, r) { if ("object" != _typeof3(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof3(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
21
21
|
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; }
|
|
22
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
22
|
+
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) { (0, _defineProperty2.default)(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; } // Disable no-re-export rule for entry point files
|
|
23
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
23
24
|
var SchemaStage = exports.SchemaStage = /*#__PURE__*/function (SchemaStage) {
|
|
24
25
|
SchemaStage["FINAL"] = "final";
|
|
25
26
|
SchemaStage["STAGE_0"] = "stage0";
|
|
@@ -55,6 +56,7 @@ var isHardBreak = isType('hardBreak');
|
|
|
55
56
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
57
|
var filterNull = function filterNull(subject) {
|
|
57
58
|
var output = _objectSpread({}, subject);
|
|
59
|
+
// eslint-disable-next-line guard-for-in
|
|
58
60
|
for (var key in output) {
|
|
59
61
|
var current = output[key];
|
|
60
62
|
if (current === null) {
|
|
@@ -113,6 +115,8 @@ var toJSON = function toJSON(node, mentionMap) {
|
|
|
113
115
|
var _text, _obj$attrs;
|
|
114
116
|
// If the mentionMap exists and has a name defined then we should use it and prepend @ to the begining of it.
|
|
115
117
|
var name = !!(mentionMap !== null && mentionMap !== void 0 && mentionMap[node.attrs.id]) ? "@".concat(mentionMap[node.attrs.id]) : '';
|
|
118
|
+
// Ignored via go/ees005
|
|
119
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
116
120
|
var text = (_text = (_obj$attrs = obj.attrs) === null || _obj$attrs === void 0 ? void 0 : _obj$attrs.text) !== null && _text !== void 0 ? _text : '';
|
|
117
121
|
obj.attrs = _objectSpread(_objectSpread({}, obj.attrs), {}, {
|
|
118
122
|
// If an explicit text value is set on the mention then that should take priority over the mentionMap value.
|
|
@@ -187,6 +191,8 @@ var canOverrideMark = function canOverrideMark(mark, existingMarks) {
|
|
|
187
191
|
var getUnwrappedNodeAttributes = function getUnwrappedNodeAttributes(node, mark, obj) {
|
|
188
192
|
var nodeAttributes = node.type.spec.attrs;
|
|
189
193
|
var attributes = _objectSpread(_objectSpread({}, mark.attrs.unsupported), obj.attrs);
|
|
194
|
+
// Ignored via go/ees005
|
|
195
|
+
// eslint-disable-next-line no-var
|
|
190
196
|
for (var key in obj.attrs) {
|
|
191
197
|
if (obj.attrs.hasOwnProperty(key)) {
|
|
192
198
|
var attribute = nodeAttributes ? nodeAttributes[key] : null;
|
|
@@ -212,7 +218,7 @@ var JSONTransformer = exports.JSONTransformer = /*#__PURE__*/function () {
|
|
|
212
218
|
this.schema = schema;
|
|
213
219
|
this.mentionMap = mentionMap;
|
|
214
220
|
}
|
|
215
|
-
(0, _createClass2.default)(JSONTransformer, [{
|
|
221
|
+
return (0, _createClass2.default)(JSONTransformer, [{
|
|
216
222
|
key: "encode",
|
|
217
223
|
value: function encode(node) {
|
|
218
224
|
var _this = this;
|
|
@@ -254,5 +260,4 @@ var JSONTransformer = exports.JSONTransformer = /*#__PURE__*/function () {
|
|
|
254
260
|
return (0, _sanitizeNode.sanitizeNode)(toJSON(node, this.mentionMap));
|
|
255
261
|
}
|
|
256
262
|
}]);
|
|
257
|
-
return JSONTransformer;
|
|
258
263
|
}();
|
package/dist/es2019/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// Disable no-re-export rule for entry point files
|
|
2
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
3
|
+
|
|
1
4
|
import isEqual from 'lodash/isEqual';
|
|
2
5
|
import { codeBlockToJSON, dataConsumerToJSON, expandToJSON, fragmentToJSON, linkToJSON, mediaSingleToJSON, mediaToJSON, mentionToJSON, tableToJSON, toJSONTableCell, toJSONTableHeader } from '@atlaskit/adf-schema';
|
|
3
6
|
import { defaultSchema, getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
@@ -34,6 +37,7 @@ const filterNull = subject => {
|
|
|
34
37
|
let output = {
|
|
35
38
|
...subject
|
|
36
39
|
};
|
|
40
|
+
// eslint-disable-next-line guard-for-in
|
|
37
41
|
for (const key in output) {
|
|
38
42
|
const current = output[key];
|
|
39
43
|
if (current === null) {
|
|
@@ -93,6 +97,8 @@ const toJSON = (node, mentionMap) => {
|
|
|
93
97
|
var _text, _obj$attrs;
|
|
94
98
|
// If the mentionMap exists and has a name defined then we should use it and prepend @ to the begining of it.
|
|
95
99
|
const name = !!(mentionMap !== null && mentionMap !== void 0 && mentionMap[node.attrs.id]) ? `@${mentionMap[node.attrs.id]}` : '';
|
|
100
|
+
// Ignored via go/ees005
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
96
102
|
const text = (_text = (_obj$attrs = obj.attrs) === null || _obj$attrs === void 0 ? void 0 : _obj$attrs.text) !== null && _text !== void 0 ? _text : '';
|
|
97
103
|
obj.attrs = {
|
|
98
104
|
...obj.attrs,
|
|
@@ -169,6 +175,8 @@ const getUnwrappedNodeAttributes = (node, mark, obj) => {
|
|
|
169
175
|
...mark.attrs.unsupported,
|
|
170
176
|
...obj.attrs
|
|
171
177
|
};
|
|
178
|
+
// Ignored via go/ees005
|
|
179
|
+
// eslint-disable-next-line no-var
|
|
172
180
|
for (var key in obj.attrs) {
|
|
173
181
|
if (obj.attrs.hasOwnProperty(key)) {
|
|
174
182
|
const attribute = nodeAttributes ? nodeAttributes[key] : null;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export function removeMarks(node) {
|
|
2
|
-
|
|
2
|
+
const newNode = {
|
|
3
3
|
...node
|
|
4
4
|
};
|
|
5
5
|
delete newNode.marks;
|
|
6
6
|
return newNode;
|
|
7
7
|
}
|
|
8
8
|
export function removeNonAnnotationMarks(node) {
|
|
9
|
-
|
|
9
|
+
const newNode = {
|
|
10
10
|
...node
|
|
11
11
|
};
|
|
12
12
|
if (node.marks) {
|
package/dist/es2019/sanitize.js
CHANGED
package/dist/esm/index.js
CHANGED
|
@@ -7,6 +7,9 @@ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol"
|
|
|
7
7
|
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); }
|
|
8
8
|
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; }
|
|
9
9
|
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; }
|
|
10
|
+
// Disable no-re-export rule for entry point files
|
|
11
|
+
/* eslint-disable @atlaskit/editor/no-re-export */
|
|
12
|
+
|
|
10
13
|
import isEqual from 'lodash/isEqual';
|
|
11
14
|
import { codeBlockToJSON, dataConsumerToJSON, expandToJSON, fragmentToJSON, linkToJSON, mediaSingleToJSON, mediaToJSON, mentionToJSON, tableToJSON, toJSONTableCell, toJSONTableHeader } from '@atlaskit/adf-schema';
|
|
12
15
|
import { defaultSchema, getSchemaBasedOnStage } from '@atlaskit/adf-schema/schema-default';
|
|
@@ -47,6 +50,7 @@ var isHardBreak = isType('hardBreak');
|
|
|
47
50
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
48
51
|
var filterNull = function filterNull(subject) {
|
|
49
52
|
var output = _objectSpread({}, subject);
|
|
53
|
+
// eslint-disable-next-line guard-for-in
|
|
50
54
|
for (var key in output) {
|
|
51
55
|
var current = output[key];
|
|
52
56
|
if (current === null) {
|
|
@@ -105,6 +109,8 @@ var toJSON = function toJSON(node, mentionMap) {
|
|
|
105
109
|
var _text, _obj$attrs;
|
|
106
110
|
// If the mentionMap exists and has a name defined then we should use it and prepend @ to the begining of it.
|
|
107
111
|
var name = !!(mentionMap !== null && mentionMap !== void 0 && mentionMap[node.attrs.id]) ? "@".concat(mentionMap[node.attrs.id]) : '';
|
|
112
|
+
// Ignored via go/ees005
|
|
113
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
114
|
var text = (_text = (_obj$attrs = obj.attrs) === null || _obj$attrs === void 0 ? void 0 : _obj$attrs.text) !== null && _text !== void 0 ? _text : '';
|
|
109
115
|
obj.attrs = _objectSpread(_objectSpread({}, obj.attrs), {}, {
|
|
110
116
|
// If an explicit text value is set on the mention then that should take priority over the mentionMap value.
|
|
@@ -179,6 +185,8 @@ var canOverrideMark = function canOverrideMark(mark, existingMarks) {
|
|
|
179
185
|
var getUnwrappedNodeAttributes = function getUnwrappedNodeAttributes(node, mark, obj) {
|
|
180
186
|
var nodeAttributes = node.type.spec.attrs;
|
|
181
187
|
var attributes = _objectSpread(_objectSpread({}, mark.attrs.unsupported), obj.attrs);
|
|
188
|
+
// Ignored via go/ees005
|
|
189
|
+
// eslint-disable-next-line no-var
|
|
182
190
|
for (var key in obj.attrs) {
|
|
183
191
|
if (obj.attrs.hasOwnProperty(key)) {
|
|
184
192
|
var attribute = nodeAttributes ? nodeAttributes[key] : null;
|
|
@@ -204,7 +212,7 @@ export var JSONTransformer = /*#__PURE__*/function () {
|
|
|
204
212
|
this.schema = schema;
|
|
205
213
|
this.mentionMap = mentionMap;
|
|
206
214
|
}
|
|
207
|
-
_createClass(JSONTransformer, [{
|
|
215
|
+
return _createClass(JSONTransformer, [{
|
|
208
216
|
key: "encode",
|
|
209
217
|
value: function encode(node) {
|
|
210
218
|
var _this = this;
|
|
@@ -246,5 +254,4 @@ export var JSONTransformer = /*#__PURE__*/function () {
|
|
|
246
254
|
return sanitizeNode(toJSON(node, this.mentionMap));
|
|
247
255
|
}
|
|
248
256
|
}]);
|
|
249
|
-
return JSONTransformer;
|
|
250
257
|
}();
|
package/dist/esm/sanitize.js
CHANGED
package/docs/0-intro.tsx
CHANGED
|
@@ -18,8 +18,12 @@ This transformer allows encoding ProseMirror Node in JSON format.
|
|
|
18
18
|
${(
|
|
19
19
|
<Example
|
|
20
20
|
packageName="@atlaskit/editor-json-transformer"
|
|
21
|
+
// Ignored via go/ees005
|
|
22
|
+
// eslint-disable-next-line import/no-commonjs
|
|
21
23
|
Component={require('../examples/0-json-transformer').default}
|
|
22
24
|
title="Json Transformer"
|
|
25
|
+
// Ignored via go/ees005
|
|
26
|
+
// eslint-disable-next-line import/no-commonjs
|
|
23
27
|
source={require('!!raw-loader!../examples/0-json-transformer')}
|
|
24
28
|
/>
|
|
25
29
|
)}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-json-transformer",
|
|
3
|
-
"version": "8.21.
|
|
3
|
+
"version": "8.21.2",
|
|
4
4
|
"description": "JSON transformer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -36,15 +36,15 @@
|
|
|
36
36
|
"./types": "./src/types.ts"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@atlaskit/adf-schema": "^
|
|
40
|
-
"@atlaskit/adf-utils": "^19.
|
|
41
|
-
"@atlaskit/editor-prosemirror": "6.
|
|
39
|
+
"@atlaskit/adf-schema": "^46.1.0",
|
|
40
|
+
"@atlaskit/adf-utils": "^19.17.0",
|
|
41
|
+
"@atlaskit/editor-prosemirror": "6.2.1",
|
|
42
42
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
43
43
|
"@babel/runtime": "^7.0.0",
|
|
44
44
|
"lodash": "^4.17.21"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@atlaskit/editor-plugin-highlight": "1.
|
|
47
|
+
"@atlaskit/editor-plugin-highlight": "1.19.9",
|
|
48
48
|
"react": "^16.8.0",
|
|
49
49
|
"typescript": "~5.4.2"
|
|
50
50
|
},
|