@atlaskit/adf-utils 14.2.0 → 15.0.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 +42 -0
- package/dist/cjs/builders/marks/fragment.js +19 -0
- package/dist/cjs/builders/nodes/mention.js +2 -2
- package/dist/cjs/builders/utils/create-text-nodes.js +1 -1
- package/dist/cjs/builders/utils/is-duplicate-mark.js +1 -1
- package/dist/cjs/builders.js +128 -120
- package/dist/cjs/index.js +49 -41
- package/dist/cjs/scrub/default-node-replacements.js +2 -2
- package/dist/cjs/scrub/scrub-adf.js +2 -2
- package/dist/cjs/scrub/scrub-content.js +3 -3
- package/dist/cjs/transforms/text-link-code-transform.js +58 -0
- package/dist/cjs/traverse/traverse.js +3 -3
- package/dist/cjs/traverse.js +4 -4
- package/dist/cjs/validator/rules.js +13 -0
- package/dist/cjs/validator/specs/atomic_inline.js +1 -1
- package/dist/cjs/validator/specs/blockCard.js +2 -1
- package/dist/cjs/validator/specs/block_content.js +1 -1
- package/dist/cjs/validator/specs/bodiedExtension_with_marks.js +1 -1
- package/dist/cjs/validator/specs/doc.js +1 -1
- package/dist/cjs/validator/specs/embedCard.js +2 -1
- package/dist/cjs/validator/specs/extension_with_marks.js +1 -1
- package/dist/cjs/validator/specs/fragment.js +27 -0
- package/dist/cjs/validator/specs/index.js +170 -170
- package/dist/cjs/validator/specs/inline.js +1 -1
- package/dist/cjs/validator/specs/inlineCard.js +2 -1
- package/dist/cjs/validator/specs/inlineExtension_with_marks.js +1 -1
- package/dist/cjs/validator/specs/layoutSection.js +4 -7
- package/dist/cjs/validator/specs/layoutSection_full.js +27 -0
- package/dist/cjs/validator/specs/layoutSection_with_single_column.js +27 -0
- package/dist/cjs/validator/specs/link.js +2 -1
- package/dist/cjs/validator/specs/non_nestable_block_content.js +1 -1
- package/dist/cjs/validator/specs/panel.js +8 -0
- package/dist/cjs/validator/specs/table.js +5 -0
- package/dist/cjs/validator/specs/tableCell_content.js +1 -1
- package/dist/cjs/validator/utils.js +1 -1
- package/dist/cjs/validator/validator.js +27 -19
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/builders/marks/fragment.js +7 -0
- package/dist/es2019/builders.js +2 -1
- package/dist/es2019/index.js +2 -1
- package/dist/es2019/transforms/text-link-code-transform.js +37 -0
- package/dist/es2019/validator/rules.js +4 -0
- package/dist/es2019/validator/specs/atomic_inline.js +1 -1
- package/dist/es2019/validator/specs/blockCard.js +2 -1
- package/dist/es2019/validator/specs/block_content.js +1 -1
- package/dist/es2019/validator/specs/bodiedExtension_with_marks.js +1 -1
- package/dist/es2019/validator/specs/doc.js +1 -1
- package/dist/es2019/validator/specs/embedCard.js +2 -1
- package/dist/es2019/validator/specs/extension_with_marks.js +1 -1
- package/dist/es2019/validator/specs/fragment.js +20 -0
- package/dist/es2019/validator/specs/index.js +3 -3
- package/dist/es2019/validator/specs/inline.js +1 -1
- package/dist/es2019/validator/specs/inlineCard.js +2 -1
- package/dist/es2019/validator/specs/inlineExtension_with_marks.js +1 -1
- package/dist/es2019/validator/specs/layoutSection.js +4 -7
- package/dist/es2019/validator/specs/layoutSection_full.js +20 -0
- package/dist/es2019/validator/specs/layoutSection_with_single_column.js +20 -0
- package/dist/es2019/validator/specs/link.js +2 -1
- package/dist/es2019/validator/specs/non_nestable_block_content.js +1 -1
- package/dist/es2019/validator/specs/panel.js +8 -0
- package/dist/es2019/validator/specs/table.js +5 -0
- package/dist/es2019/validator/specs/tableCell_content.js +1 -1
- package/dist/es2019/validator/validator.js +19 -16
- package/dist/es2019/version.json +1 -1
- package/dist/esm/builders/marks/fragment.js +9 -0
- package/dist/esm/builders/nodes/mention.js +2 -2
- package/dist/esm/builders.js +2 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/scrub/default-node-replacements.js +2 -2
- package/dist/esm/scrub/scrub-adf.js +2 -2
- package/dist/esm/scrub/scrub-content.js +2 -2
- package/dist/esm/transforms/text-link-code-transform.js +47 -0
- package/dist/esm/traverse/traverse.js +2 -2
- package/dist/esm/validator/rules.js +4 -0
- package/dist/esm/validator/specs/atomic_inline.js +1 -1
- package/dist/esm/validator/specs/blockCard.js +2 -1
- package/dist/esm/validator/specs/block_content.js +1 -1
- package/dist/esm/validator/specs/bodiedExtension_with_marks.js +1 -1
- package/dist/esm/validator/specs/doc.js +1 -1
- package/dist/esm/validator/specs/embedCard.js +2 -1
- package/dist/esm/validator/specs/extension_with_marks.js +1 -1
- package/dist/esm/validator/specs/fragment.js +20 -0
- package/dist/esm/validator/specs/index.js +3 -3
- package/dist/esm/validator/specs/inline.js +1 -1
- package/dist/esm/validator/specs/inlineCard.js +2 -1
- package/dist/esm/validator/specs/inlineExtension_with_marks.js +1 -1
- package/dist/esm/validator/specs/layoutSection.js +4 -7
- package/dist/esm/validator/specs/layoutSection_full.js +20 -0
- package/dist/esm/validator/specs/layoutSection_with_single_column.js +20 -0
- package/dist/esm/validator/specs/link.js +2 -1
- package/dist/esm/validator/specs/non_nestable_block_content.js +1 -1
- package/dist/esm/validator/specs/panel.js +8 -0
- package/dist/esm/validator/specs/table.js +5 -0
- package/dist/esm/validator/specs/tableCell_content.js +1 -1
- package/dist/esm/validator/validator.js +25 -19
- package/dist/esm/version.json +1 -1
- package/dist/types/builders/marks/breakout.d.ts +1 -1
- package/dist/types/builders/marks/fragment.d.ts +3 -0
- package/dist/types/builders.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/transforms/text-link-code-transform.d.ts +5 -0
- package/dist/types/types/validatorTypes.d.ts +1 -0
- package/dist/types/validator/rules.d.ts +3 -0
- package/dist/types/validator/specs/blockCard.d.ts +1 -0
- package/dist/types/validator/specs/bodiedExtension_with_marks.d.ts +1 -1
- package/dist/types/validator/specs/embedCard.d.ts +1 -0
- package/dist/types/validator/specs/extension_with_marks.d.ts +1 -1
- package/dist/types/validator/specs/fragment.d.ts +21 -0
- package/dist/types/validator/specs/index.d.ts +3 -3
- package/dist/types/validator/specs/inlineCard.d.ts +1 -0
- package/dist/types/validator/specs/inlineExtension_with_marks.d.ts +1 -1
- package/dist/types/validator/specs/layoutSection.d.ts +3 -6
- package/dist/types/validator/specs/layoutSection_full.d.ts +21 -0
- package/dist/types/validator/specs/layoutSection_with_single_column.d.ts +21 -0
- package/dist/types/validator/specs/link.d.ts +1 -0
- package/dist/types/validator/specs/panel.d.ts +8 -0
- package/dist/types/validator/specs/table.d.ts +5 -0
- package/package.json +6 -3
- package/dist/cjs/validator/specs/bodiedExtension_with_no_marks.js +0 -17
- package/dist/cjs/validator/specs/extension_with_no_marks.js +0 -17
- package/dist/cjs/validator/specs/inlineExtension_with_no_marks.js +0 -17
- package/dist/es2019/validator/specs/bodiedExtension_with_no_marks.js +0 -10
- package/dist/es2019/validator/specs/extension_with_no_marks.js +0 -10
- package/dist/es2019/validator/specs/inlineExtension_with_no_marks.js +0 -10
- package/dist/esm/validator/specs/bodiedExtension_with_no_marks.js +0 -10
- package/dist/esm/validator/specs/extension_with_no_marks.js +0 -10
- package/dist/esm/validator/specs/inlineExtension_with_no_marks.js +0 -10
- package/dist/types/validator/specs/bodiedExtension_with_no_marks.d.ts +0 -11
- package/dist/types/validator/specs/extension_with_no_marks.d.ts +0 -11
- package/dist/types/validator/specs/inlineExtension_with_no_marks.d.ts +0 -11
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ['hardBreak', 'mention', 'emoji', '
|
|
7
|
+
var _default = ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
|
|
8
8
|
exports.default = _default;
|
|
@@ -10,17 +10,14 @@ var _default = {
|
|
|
10
10
|
type: 'enum',
|
|
11
11
|
values: ['layoutSection']
|
|
12
12
|
},
|
|
13
|
-
content: {
|
|
14
|
-
type: 'array',
|
|
15
|
-
items: ['layoutColumn'],
|
|
16
|
-
minItems: 2,
|
|
17
|
-
maxItems: 3,
|
|
18
|
-
allowUnsupportedBlock: true
|
|
19
|
-
},
|
|
20
13
|
marks: {
|
|
21
14
|
type: 'array',
|
|
22
15
|
items: ['breakout'],
|
|
23
16
|
optional: true
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: ['layoutColumn']
|
|
24
21
|
}
|
|
25
22
|
}
|
|
26
23
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = ['layoutSection', {
|
|
8
|
+
props: {
|
|
9
|
+
type: {
|
|
10
|
+
type: 'enum',
|
|
11
|
+
values: ['layoutSection']
|
|
12
|
+
},
|
|
13
|
+
marks: {
|
|
14
|
+
type: 'array',
|
|
15
|
+
items: ['breakout'],
|
|
16
|
+
optional: true
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: ['layoutColumn'],
|
|
21
|
+
minItems: 2,
|
|
22
|
+
maxItems: 3,
|
|
23
|
+
allowUnsupportedBlock: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}];
|
|
27
|
+
exports.default = _default;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _default = ['layoutSection', {
|
|
8
|
+
props: {
|
|
9
|
+
type: {
|
|
10
|
+
type: 'enum',
|
|
11
|
+
values: ['layoutSection']
|
|
12
|
+
},
|
|
13
|
+
marks: {
|
|
14
|
+
type: 'array',
|
|
15
|
+
items: ['breakout'],
|
|
16
|
+
optional: true
|
|
17
|
+
},
|
|
18
|
+
content: {
|
|
19
|
+
type: 'array',
|
|
20
|
+
items: ['layoutColumn'],
|
|
21
|
+
minItems: 1,
|
|
22
|
+
maxItems: 3,
|
|
23
|
+
allowUnsupportedBlock: true
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}];
|
|
27
|
+
exports.default = _default;
|
|
@@ -4,5 +4,5 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _default = ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', '
|
|
7
|
+
var _default = ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table'];
|
|
8
8
|
exports.default = _default;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _default = {
|
|
8
8
|
type: 'array',
|
|
9
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', '
|
|
9
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
|
|
10
10
|
minItems: 1,
|
|
11
11
|
allowUnsupportedBlock: true
|
|
12
12
|
};
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.makeArray = exports.
|
|
8
|
+
exports.makeArray = exports.isString = exports.isPlainObject = exports.isNumber = exports.isInteger = exports.isDefined = exports.isBoolean = exports.copy = void 0;
|
|
9
9
|
|
|
10
10
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
11
|
|
|
@@ -20,13 +20,17 @@ var specs = _interopRequireWildcard(require("./specs"));
|
|
|
20
20
|
|
|
21
21
|
var _utils = require("./utils");
|
|
22
22
|
|
|
23
|
+
var _rules = require("./rules");
|
|
24
|
+
|
|
25
|
+
var _excluded = ["items"];
|
|
26
|
+
|
|
23
27
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
24
28
|
|
|
25
29
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
26
30
|
|
|
27
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object);
|
|
31
|
+
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; }
|
|
28
32
|
|
|
29
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]
|
|
33
|
+
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; }
|
|
30
34
|
|
|
31
35
|
function mapMarksItems(spec) {
|
|
32
36
|
var fn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function (x) {
|
|
@@ -36,7 +40,7 @@ function mapMarksItems(spec) {
|
|
|
36
40
|
if (spec.props && spec.props.marks) {
|
|
37
41
|
var _ref = spec.props.marks,
|
|
38
42
|
items = _ref.items,
|
|
39
|
-
rest = (0, _objectWithoutProperties2.default)(_ref,
|
|
43
|
+
rest = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
40
44
|
return _objectSpread(_objectSpread({}, spec), {}, {
|
|
41
45
|
props: _objectSpread(_objectSpread({}, spec.props), {}, {
|
|
42
46
|
marks: _objectSpread(_objectSpread({}, rest), {}, {
|
|
@@ -99,9 +103,9 @@ function createSpec(nodes, marks) {
|
|
|
99
103
|
spec.props.content = _objectSpread({}, spec.props.content);
|
|
100
104
|
}
|
|
101
105
|
|
|
102
|
-
spec.props.content.items = spec.props.content.items
|
|
106
|
+
spec.props.content.items = spec.props.content.items // ['inline'] => [['emoji', 'hr', ...]]
|
|
103
107
|
// ['media'] => [['media']]
|
|
104
|
-
map(function (item) {
|
|
108
|
+
.map(function (item) {
|
|
105
109
|
return (0, _utils.isString)(item) ? Array.isArray(specs[item]) ? specs[item] : [item] : item;
|
|
106
110
|
}) // [['emoji', 'hr', 'inline_code']] => [['emoji', 'hr', ['text', { marks: {} }]]]
|
|
107
111
|
.map(function (item) {
|
|
@@ -196,7 +200,11 @@ function validateAttrs(spec, value) {
|
|
|
196
200
|
return (0, _utils.isInteger)(value) && ((0, _utils.isDefined)(spec.minimum) ? spec.minimum <= value : true) && ((0, _utils.isDefined)(spec.maximum) ? spec.maximum >= value : true);
|
|
197
201
|
|
|
198
202
|
case 'string':
|
|
199
|
-
|
|
203
|
+
var validatorFnPassed = function validatorFnPassed(rule) {
|
|
204
|
+
return typeof value === 'string' && (0, _utils.isDefined)(_rules.validatorFnMap[rule]) && _rules.validatorFnMap[rule](value);
|
|
205
|
+
};
|
|
206
|
+
|
|
207
|
+
return (0, _utils.isString)(value) && ((0, _utils.isDefined)(spec.minLength) ? spec.minLength <= value.length : true) && ((0, _utils.isDefined)(spec.validatorFn) ? validatorFnPassed(spec.validatorFn) : true) && (spec.pattern ? new RegExp(spec.pattern).test(value) : true);
|
|
200
208
|
|
|
201
209
|
case 'object':
|
|
202
210
|
return (0, _utils.isPlainObject)(value);
|
|
@@ -403,19 +411,19 @@ function validator(nodes, marks, options) {
|
|
|
403
411
|
} // this checks for mark level attribute errors
|
|
404
412
|
// and propagates error code and message
|
|
405
413
|
else if (finalResult.marksValidationOutput && finalResult.marksValidationOutput.length) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
414
|
+
return {
|
|
415
|
+
valid: false,
|
|
416
|
+
originalMark: mark,
|
|
417
|
+
errorCode: finalResult.marksValidationOutput[0].errorCode,
|
|
418
|
+
message: finalResult.marksValidationOutput[0].message
|
|
419
|
+
};
|
|
420
|
+
} else {
|
|
421
|
+
return {
|
|
422
|
+
valid: false,
|
|
423
|
+
originalMark: mark,
|
|
424
|
+
errorCode: 'INVALID_TYPE'
|
|
425
|
+
};
|
|
426
|
+
}
|
|
419
427
|
} else {
|
|
420
428
|
return {
|
|
421
429
|
valid: false,
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/builders.js
CHANGED
|
@@ -13,7 +13,8 @@ export { underline } from './builders/marks/underline';
|
|
|
13
13
|
export { underline as u } from './builders/marks/underline';
|
|
14
14
|
export { alignment } from './builders/marks/alignment';
|
|
15
15
|
export { indentation } from './builders/marks/indentation';
|
|
16
|
-
export { dataConsumer } from './builders/marks/data-consumer';
|
|
16
|
+
export { dataConsumer } from './builders/marks/data-consumer';
|
|
17
|
+
export { fragment } from './builders/marks/fragment'; // Nodes Builders
|
|
17
18
|
|
|
18
19
|
export { blockQuote } from './builders/nodes/blockquote';
|
|
19
20
|
export { bodiedExtension } from './builders/nodes/bodied-extension';
|
package/dist/es2019/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { a, alignment, b, blockCard, blockQuote, bodiedExtension, br, breakout,
|
|
|
2
2
|
export { filter, map, reduce, traverse } from './traverse';
|
|
3
3
|
export { scrubAdf } from './scrub';
|
|
4
4
|
export { validateAttrs, validator } from './validator';
|
|
5
|
-
export { getEmptyADF } from './empty-adf';
|
|
5
|
+
export { getEmptyADF } from './empty-adf';
|
|
6
|
+
export { transformTextLinkCodeMarks } from './transforms/text-link-code-transform';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { traverse } from '../traverse/traverse';
|
|
2
|
+
|
|
3
|
+
const hasLinkAndCodeMarks = node => {
|
|
4
|
+
var _node$marks;
|
|
5
|
+
|
|
6
|
+
const marks = (_node$marks = node.marks) === null || _node$marks === void 0 ? void 0 : _node$marks.map(mark => mark.type);
|
|
7
|
+
return (marks === null || marks === void 0 ? void 0 : marks.includes('link')) && (marks === null || marks === void 0 ? void 0 : marks.includes('code'));
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const removeCodeMarks = node => {
|
|
11
|
+
if (node.marks) {
|
|
12
|
+
return { ...node,
|
|
13
|
+
marks: node.marks.filter(mark => mark.type !== 'code')
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return node;
|
|
18
|
+
}; // See: HOT-97965 https://product-fabric.atlassian.net/browse/ED-14400
|
|
19
|
+
// We declared in code mark spec that links and marks should not co-exist on
|
|
20
|
+
// text nodes. This util strips code marks from bad text nodes and preserves links.
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
export const transformTextLinkCodeMarks = adf => {
|
|
24
|
+
let isTransformed = false;
|
|
25
|
+
const transformedAdf = traverse(adf, {
|
|
26
|
+
text: node => {
|
|
27
|
+
if (hasLinkAndCodeMarks(node)) {
|
|
28
|
+
isTransformed = true;
|
|
29
|
+
return removeCodeMarks(node);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
return {
|
|
34
|
+
transformedAdf,
|
|
35
|
+
isTransformed
|
|
36
|
+
};
|
|
37
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['hardBreak', 'mention', 'emoji', '
|
|
1
|
+
export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', '
|
|
1
|
+
export default ['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'bodiedExtension_with_marks'];
|
|
@@ -10,7 +10,7 @@ export default {
|
|
|
10
10
|
},
|
|
11
11
|
content: {
|
|
12
12
|
type: 'array',
|
|
13
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', '
|
|
13
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'paragraph_with_indentation', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'codeBlock_with_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table', 'expand_with_no_mark', 'expand_with_breakout_mark', 'bodiedExtension_with_marks', 'layoutSection_full', 'layoutSection_with_single_column']],
|
|
14
14
|
allowUnsupportedBlock: true
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -13,11 +13,11 @@ export { default as alignment } from './alignment';
|
|
|
13
13
|
export { default as indentation } from './indentation';
|
|
14
14
|
export { default as annotation } from './annotation';
|
|
15
15
|
export { default as dataConsumer } from './dataConsumer';
|
|
16
|
+
export { default as fragment } from './fragment';
|
|
16
17
|
export { default as hardBreak } from './hardBreak';
|
|
17
18
|
export { default as mention } from './mention';
|
|
18
19
|
export { default as emoji } from './emoji';
|
|
19
20
|
export { default as inlineExtension } from './inlineExtension';
|
|
20
|
-
export { default as inlineExtension_with_no_marks } from './inlineExtension_with_no_marks';
|
|
21
21
|
export { default as inlineExtension_with_marks } from './inlineExtension_with_marks';
|
|
22
22
|
export { default as date } from './date';
|
|
23
23
|
export { default as placeholder } from './placeholder';
|
|
@@ -59,7 +59,6 @@ export { default as decisionList } from './decisionList';
|
|
|
59
59
|
export { default as taskItem } from './taskItem';
|
|
60
60
|
export { default as taskList } from './taskList';
|
|
61
61
|
export { default as extension } from './extension';
|
|
62
|
-
export { default as extension_with_no_marks } from './extension_with_no_marks';
|
|
63
62
|
export { default as extension_with_marks } from './extension_with_marks';
|
|
64
63
|
export { default as embedCard } from './embedCard';
|
|
65
64
|
export { default as nestedExpand_content } from './nestedExpand_content';
|
|
@@ -75,9 +74,10 @@ export { default as expand } from './expand';
|
|
|
75
74
|
export { default as expand_with_no_mark } from './expand_with_no_mark';
|
|
76
75
|
export { default as expand_with_breakout_mark } from './expand_with_breakout_mark';
|
|
77
76
|
export { default as bodiedExtension } from './bodiedExtension';
|
|
78
|
-
export { default as bodiedExtension_with_no_marks } from './bodiedExtension_with_no_marks';
|
|
79
77
|
export { default as bodiedExtension_with_marks } from './bodiedExtension_with_marks';
|
|
80
78
|
export { default as block_content } from './block_content';
|
|
81
79
|
export { default as layoutColumn } from './layoutColumn';
|
|
82
80
|
export { default as layoutSection } from './layoutSection';
|
|
81
|
+
export { default as layoutSection_full } from './layoutSection_full';
|
|
82
|
+
export { default as layoutSection_with_single_column } from './layoutSection_with_single_column';
|
|
83
83
|
export { default as doc } from './doc';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['hardBreak', 'mention', 'emoji', '
|
|
1
|
+
export default ['hardBreak', 'mention', 'emoji', 'inlineExtension_with_marks', 'date', 'placeholder', 'inlineCard', 'status', 'mediaInline', 'formatted_text_inline', 'code_inline'];
|
|
@@ -4,17 +4,14 @@ export default {
|
|
|
4
4
|
type: 'enum',
|
|
5
5
|
values: ['layoutSection']
|
|
6
6
|
},
|
|
7
|
-
content: {
|
|
8
|
-
type: 'array',
|
|
9
|
-
items: ['layoutColumn'],
|
|
10
|
-
minItems: 2,
|
|
11
|
-
maxItems: 3,
|
|
12
|
-
allowUnsupportedBlock: true
|
|
13
|
-
},
|
|
14
7
|
marks: {
|
|
15
8
|
type: 'array',
|
|
16
9
|
items: ['breakout'],
|
|
17
10
|
optional: true
|
|
11
|
+
},
|
|
12
|
+
content: {
|
|
13
|
+
type: 'array',
|
|
14
|
+
items: ['layoutColumn']
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default ['layoutSection', {
|
|
2
|
+
props: {
|
|
3
|
+
type: {
|
|
4
|
+
type: 'enum',
|
|
5
|
+
values: ['layoutSection']
|
|
6
|
+
},
|
|
7
|
+
marks: {
|
|
8
|
+
type: 'array',
|
|
9
|
+
items: ['breakout'],
|
|
10
|
+
optional: true
|
|
11
|
+
},
|
|
12
|
+
content: {
|
|
13
|
+
type: 'array',
|
|
14
|
+
items: ['layoutColumn'],
|
|
15
|
+
minItems: 2,
|
|
16
|
+
maxItems: 3,
|
|
17
|
+
allowUnsupportedBlock: true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}];
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default ['layoutSection', {
|
|
2
|
+
props: {
|
|
3
|
+
type: {
|
|
4
|
+
type: 'enum',
|
|
5
|
+
values: ['layoutSection']
|
|
6
|
+
},
|
|
7
|
+
marks: {
|
|
8
|
+
type: 'array',
|
|
9
|
+
items: ['breakout'],
|
|
10
|
+
optional: true
|
|
11
|
+
},
|
|
12
|
+
content: {
|
|
13
|
+
type: 'array',
|
|
14
|
+
items: ['layoutColumn'],
|
|
15
|
+
minItems: 1,
|
|
16
|
+
maxItems: 3,
|
|
17
|
+
allowUnsupportedBlock: true
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', '
|
|
1
|
+
export default ['blockCard', 'paragraph_with_no_marks', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'table'];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export default {
|
|
2
2
|
type: 'array',
|
|
3
|
-
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', '
|
|
3
|
+
items: [['blockCard', 'paragraph_with_no_marks', 'paragraph_with_alignment', 'bulletList', 'mediaSingle_full', 'mediaSingle_caption', 'codeBlock_with_no_marks', 'orderedList', 'heading_with_no_marks', 'heading_with_alignment', 'heading_with_indentation', 'panel', 'blockquote', 'rule', 'mediaGroup', 'decisionList', 'taskList', 'extension_with_marks', 'embedCard', 'nestedExpand_with_no_marks']],
|
|
4
4
|
minItems: 1,
|
|
5
5
|
allowUnsupportedBlock: true
|
|
6
6
|
};
|