@atlaskit/adf-schema 36.10.9 → 36.10.11
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 +12 -0
- package/dist/cjs/next-schema/full-schema.adf.js +1 -0
- package/dist/cjs/next-schema/marks/alignmentAndIndentation.js +5 -6
- package/dist/cjs/next-schema/marks/annotation.js +5 -2
- package/dist/cjs/next-schema/marks/breakout.js +1 -1
- package/dist/cjs/next-schema/marks/code.js +2 -2
- package/dist/cjs/next-schema/marks/color.js +29 -0
- package/dist/cjs/next-schema/marks/dataConsumer.js +2 -1
- package/dist/cjs/next-schema/nodes/text.js +2 -3
- package/dist/es2019/next-schema/full-schema.adf.js +1 -0
- package/dist/es2019/next-schema/marks/alignmentAndIndentation.js +5 -6
- package/dist/es2019/next-schema/marks/annotation.js +5 -2
- package/dist/es2019/next-schema/marks/breakout.js +1 -1
- package/dist/es2019/next-schema/marks/code.js +1 -1
- package/dist/es2019/next-schema/marks/color.js +24 -0
- package/dist/es2019/next-schema/marks/dataConsumer.js +2 -1
- package/dist/es2019/next-schema/nodes/text.js +1 -2
- package/dist/esm/next-schema/full-schema.adf.js +1 -0
- package/dist/esm/next-schema/marks/alignmentAndIndentation.js +5 -6
- package/dist/esm/next-schema/marks/annotation.js +5 -2
- package/dist/esm/next-schema/marks/breakout.js +1 -1
- package/dist/esm/next-schema/marks/code.js +1 -1
- package/dist/esm/next-schema/marks/color.js +24 -0
- package/dist/esm/next-schema/marks/dataConsumer.js +2 -1
- package/dist/esm/next-schema/nodes/text.js +1 -2
- package/dist/types/next-schema/full-schema.adf.d.ts +1 -0
- package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +7 -0
- package/dist/types/next-schema/marks/annotation.d.ts +1 -0
- package/dist/types/next-schema/marks/color.d.ts +3 -0
- package/dist/types/next-schema/nodes/blockCard.d.ts +1 -0
- package/dist/types/next-schema/nodes/blockquote.d.ts +1 -0
- package/dist/types/next-schema/nodes/bodiedExtension.d.ts +1 -0
- package/dist/types/next-schema/nodes/caption.d.ts +1 -0
- package/dist/types/next-schema/nodes/codeBlock.d.ts +2 -0
- package/dist/types/next-schema/nodes/date.d.ts +1 -0
- package/dist/types/next-schema/nodes/decisionItem.d.ts +1 -0
- package/dist/types/next-schema/nodes/decisionList.d.ts +1 -0
- package/dist/types/next-schema/nodes/embedCard.d.ts +1 -0
- package/dist/types/next-schema/nodes/emoji.d.ts +1 -0
- package/dist/types/next-schema/nodes/expand.d.ts +1 -0
- package/dist/types/next-schema/nodes/extension.d.ts +1 -0
- package/dist/types/next-schema/nodes/extensionFrame.d.ts +1 -0
- package/dist/types/next-schema/nodes/hardBreak.d.ts +1 -0
- package/dist/types/next-schema/nodes/heading.d.ts +2 -0
- package/dist/types/next-schema/nodes/inlineCard.d.ts +1 -0
- package/dist/types/next-schema/nodes/inlineExtension.d.ts +1 -0
- package/dist/types/next-schema/nodes/layoutColumn.d.ts +1 -0
- package/dist/types/next-schema/nodes/layoutSection.d.ts +1 -0
- package/dist/types/next-schema/nodes/list.d.ts +2 -0
- package/dist/types/next-schema/nodes/media.d.ts +1 -0
- package/dist/types/next-schema/nodes/mediaGroup.d.ts +1 -0
- package/dist/types/next-schema/nodes/mediaInline.d.ts +1 -0
- package/dist/types/next-schema/nodes/mediaSingle.d.ts +1 -0
- package/dist/types/next-schema/nodes/mention.d.ts +1 -0
- package/dist/types/next-schema/nodes/multiBodiedExtension.d.ts +1 -0
- package/dist/types/next-schema/nodes/nestedExpand.d.ts +1 -0
- package/dist/types/next-schema/nodes/panel.d.ts +1 -0
- package/dist/types/next-schema/nodes/paragraph.d.ts +1 -0
- package/dist/types/next-schema/nodes/placeholder.d.ts +1 -0
- package/dist/types/next-schema/nodes/rule.d.ts +1 -0
- package/dist/types/next-schema/nodes/status.d.ts +1 -0
- package/dist/types/next-schema/nodes/table.d.ts +1 -0
- package/dist/types/next-schema/nodes/tableCell.d.ts +1 -0
- package/dist/types/next-schema/nodes/tableHeader.d.ts +1 -0
- package/dist/types/next-schema/nodes/tableRow.d.ts +1 -0
- package/dist/types/next-schema/nodes/task.d.ts +2 -0
- package/dist/types/next-schema/nodes/text.d.ts +1 -0
- package/package.json +3 -3
- package/schema-generators/__tests__/unit/jqueries.md +13 -0
- package/schema-generators/__tests__/unit/json-full-schema.unit.ts +3 -0
- package/schema-generators/__tests__/unit/validate-pm-schema.unit.ts +110 -0
- package/dist/cjs/next-schema/groups/annotationGroup.js +0 -8
- package/dist/cjs/next-schema/groups/colorGroup.js +0 -9
- package/dist/cjs/next-schema/marks/backgroundColor.js +0 -15
- package/dist/cjs/next-schema/marks/textColor.js +0 -16
- package/dist/es2019/next-schema/groups/annotationGroup.js +0 -2
- package/dist/es2019/next-schema/groups/colorGroup.js +0 -3
- package/dist/es2019/next-schema/marks/backgroundColor.js +0 -9
- package/dist/es2019/next-schema/marks/textColor.js +0 -10
- package/dist/esm/next-schema/groups/annotationGroup.js +0 -2
- package/dist/esm/next-schema/groups/colorGroup.js +0 -3
- package/dist/esm/next-schema/marks/backgroundColor.js +0 -9
- package/dist/esm/next-schema/marks/textColor.js +0 -10
- package/dist/types/next-schema/groups/annotationGroup.d.ts +0 -1
- package/dist/types/next-schema/groups/colorGroup.d.ts +0 -1
- package/dist/types/next-schema/marks/backgroundColor.d.ts +0 -1
- package/dist/types/next-schema/marks/textColor.d.ts +0 -1
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const inlineExtension: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string, "with_marks"], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const layoutColumn: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const layoutSection: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string, "full"], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const orderedList: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -18,6 +19,7 @@ export declare const orderedList: import("@atlaskit/adf-schema-generator/dist/ty
|
|
18
19
|
export declare const bulletList: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
19
20
|
root?: boolean;
|
20
21
|
atom?: boolean;
|
22
|
+
version?: 1;
|
21
23
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
22
24
|
inline?: true;
|
23
25
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const media: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const mediaGroup: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const mediaInline: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const mediaSingle: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string, "caption", "full"], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const mention: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const multiBodiedExtension: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const nestedExpand: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string, "with_no_marks"], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const panel: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const paragraph: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string, "with_alignment", "with_indentation", "with_marks", "with_no_marks"], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const placeholder: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const rule: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const status: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const table: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const tableCell: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const tableHeader: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const tableRow: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const taskItem: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
@@ -18,6 +19,7 @@ export declare const taskItem: import("@atlaskit/adf-schema-generator/dist/types
|
|
18
19
|
export declare const taskList: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string], {
|
19
20
|
root?: boolean;
|
20
21
|
atom?: boolean;
|
22
|
+
version?: 1;
|
21
23
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
22
24
|
inline?: true;
|
23
25
|
code?: boolean;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
export declare const text: import("@atlaskit/adf-schema-generator/dist/types/adfNode").ADFNode<[string, "formatted", "code_inline"], {
|
2
2
|
root?: boolean;
|
3
3
|
atom?: boolean;
|
4
|
+
version?: 1;
|
4
5
|
attrs?: import("@atlaskit/adf-schema-generator/dist/types/types/ADFAttribute").ADFAttributes;
|
5
6
|
inline?: true;
|
6
7
|
code?: boolean;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "36.10.
|
3
|
+
"version": "36.10.11",
|
4
4
|
"description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
|
5
5
|
"publishConfig": {
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
@@ -21,7 +21,7 @@
|
|
21
21
|
"generate:json-schema:full": "json-schema-generator --outDir=./json-schema/v1/ ./src/schema/nodes/doc.ts",
|
22
22
|
"ak-postbuild": "yarn build:json-schema",
|
23
23
|
"test": "yarn test:unit",
|
24
|
-
"test:unit": "yarn workspace @atlaskit/editor-prosemirror build && jest --testPathPattern=adf-schema/
|
24
|
+
"test:unit": "yarn workspace @atlaskit/editor-prosemirror build && jest --testPathPattern=packages/adf-schema/ --config=../../jest.config.js",
|
25
25
|
"build:cjs": "NODE_ENV=production BABEL_ENV=production:node-cjs babel --config-file ../../babel.config.js src --out-dir dist/cjs -x .ts,.tsx",
|
26
26
|
"build:esm": "NODE_ENV=production BABEL_ENV=production:esm babel --config-file ../../babel.config.js src -d dist/esm -x .ts,.tsx",
|
27
27
|
"build:es2019": "NODE_ENV=production BABEL_ENV=production:es2019 babel --config-file ../../babel.config.js src -d dist/es2019 -x .ts,.tsx",
|
@@ -45,7 +45,7 @@
|
|
45
45
|
},
|
46
46
|
"devDependencies": {
|
47
47
|
"@atlassian/adf-schema-json": "^1.15.0",
|
48
|
-
"@atlaskit/adf-schema-generator": "^1.8.
|
48
|
+
"@atlaskit/adf-schema-generator": "^1.8.4",
|
49
49
|
"@babel/cli": "^7.22.9",
|
50
50
|
"@babel/core": "^7.22.9",
|
51
51
|
"@babel/plugin-proposal-class-properties": "^7.18.6",
|
@@ -127,3 +127,16 @@ A number of nodes have `marks` defined, yet the array is empty. Assuming this is
|
|
127
127
|
.block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
|
128
128
|
.bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)' | pbcopy
|
129
129
|
```
|
130
|
+
|
131
|
+
Base level content objects (not nodes) are deleted. `inline` is also deleted, as it is a content object for paragraph.
|
132
|
+
|
133
|
+
All fields of content except for type and items have been deleted as well.
|
134
|
+
|
135
|
+
A number of nodes have `marks` defined, yet the array is empty. Assuming this is redundant, I've removed them.
|
136
|
+
|
137
|
+
```sh
|
138
|
+
cat packages/adf-schema/json-schema/v1/full.json | jq 'walk(if type == "object" then del(
|
139
|
+
.required, .additionalProperties, .allOf, .content.items.anyOf?, .content.items."$ref"?, .content.items[]?, .content."$ref",
|
140
|
+
.block_content, .nestedExpand_content, .non_nestable_block_content, .table_cell_content, .inline_node,
|
141
|
+
.bodiedExtension_node.properties.marks, .codeBlock_node.properties.marks, .expand_node.properties.marks, .heading_node.properties.marks, .inlineExtension_node.properties.marks, .text_node.properties.marks, .extension_node.properties.marks, .paragraph_node.properties.marks) else . end)' | pbcopy
|
142
|
+
```
|
@@ -0,0 +1,110 @@
|
|
1
|
+
import { MarkSpec, NodeSpec, Schema } from '@atlaskit/editor-prosemirror/model';
|
2
|
+
import * as newMarkSpecs from '@atlaskit/adf-schema-generator/src/generated/markTypes';
|
3
|
+
import * as newNodeSpecs from '@atlaskit/adf-schema-generator/src/generated/nodeTypes';
|
4
|
+
import {
|
5
|
+
MarkSpecFactory,
|
6
|
+
NodeSpecFactory,
|
7
|
+
} from '@atlaskit/adf-schema-generator/src/transforms/adfToPm/createPMSpecFactory';
|
8
|
+
import { defaultSchema } from '../../../src/schema/default-schema';
|
9
|
+
|
10
|
+
function isMarkSpec(value: MarkSpec | NodeSpec): value is MarkSpec {
|
11
|
+
return true;
|
12
|
+
}
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Custom omit function, mainly used to filter out parseDOM and toDOM from old spec
|
16
|
+
* and some special logic to filter out certain field when compare spec
|
17
|
+
* @param data
|
18
|
+
* @param keys
|
19
|
+
* @returns
|
20
|
+
*/
|
21
|
+
function omit<T extends object>(data: T, keys: (keyof T)[]): T {
|
22
|
+
const result = { ...data };
|
23
|
+
for (const k of keys) {
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
25
|
+
delete result[k];
|
26
|
+
}
|
27
|
+
if (isMarkSpec(data)) {
|
28
|
+
// Treat excludes: '' same as no excludes property
|
29
|
+
if (data.excludes !== undefined && data.excludes === '') {
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-dynamic-delete
|
31
|
+
delete result['excludes'];
|
32
|
+
}
|
33
|
+
}
|
34
|
+
return result;
|
35
|
+
}
|
36
|
+
|
37
|
+
describe('validate PM schema', () => {
|
38
|
+
describe('marks', () => {
|
39
|
+
const { marks } = defaultSchema as Schema;
|
40
|
+
const skipLists = [
|
41
|
+
'link', // TODO: new link mark is not matching old link mark
|
42
|
+
'confluenceInlineComment', // TODO: not exist in ADF DSL
|
43
|
+
'unsupportedMark', // TODO: not exist in ADF DSL
|
44
|
+
'unsupportedNodeAttribute', // TODO: not exist in ADF DSL
|
45
|
+
'typeAheadQuery', // TODO: not exist in ADF DSL
|
46
|
+
// Following marks not exported in adf-schema
|
47
|
+
'__colorGroupDeclaration',
|
48
|
+
'__fontStyleGroupDeclaration',
|
49
|
+
'__searchQueryGroupDeclaration',
|
50
|
+
'__linkGroupDeclaration',
|
51
|
+
];
|
52
|
+
|
53
|
+
const testCases = Object.entries(marks).map(([key, value]) => {
|
54
|
+
return {
|
55
|
+
name: key,
|
56
|
+
legacyMarkSpec: value.spec,
|
57
|
+
newMarkSpecFn: newMarkSpecs[`${key}`] as MarkSpecFactory,
|
58
|
+
skip: skipLists.includes(key),
|
59
|
+
};
|
60
|
+
});
|
61
|
+
|
62
|
+
const getTestingMethod = (skip: boolean) => {
|
63
|
+
return skip ? it.skip : it;
|
64
|
+
};
|
65
|
+
|
66
|
+
testCases.forEach(({ name, legacyMarkSpec, newMarkSpecFn, skip }) => {
|
67
|
+
const testMethod = getTestingMethod(skip);
|
68
|
+
|
69
|
+
testMethod(`validate markSpec for mark ${name}`, () => {
|
70
|
+
// check if there's any missing markSpec
|
71
|
+
expect(newMarkSpecFn).toBeDefined();
|
72
|
+
const newMarkSpec = newMarkSpecFn({});
|
73
|
+
expect(omit(newMarkSpec, ['parseDOM', 'toDOM'])).toEqual(
|
74
|
+
omit(legacyMarkSpec, ['parseDOM', 'toDOM']),
|
75
|
+
);
|
76
|
+
});
|
77
|
+
});
|
78
|
+
});
|
79
|
+
|
80
|
+
// TODO: content from node is too strict, need a custom comparor
|
81
|
+
// TODO: marks are not matching, especially missing unsupportedBlock, unsupportedNodeAttribute
|
82
|
+
describe.skip('nodes', () => {
|
83
|
+
const { nodes } = defaultSchema as Schema;
|
84
|
+
const skipLists = ['unknownBlock', 'unsupportedBlock', 'unsupportedInline'];
|
85
|
+
const testCases = Object.entries(nodes).map(([key, value]) => {
|
86
|
+
return {
|
87
|
+
name: key,
|
88
|
+
legacyNodeSpec: value.spec,
|
89
|
+
newNodeSpecFn: newNodeSpecs[`${key}`] as NodeSpecFactory,
|
90
|
+
skip: skipLists.includes(key),
|
91
|
+
};
|
92
|
+
});
|
93
|
+
|
94
|
+
const getTestingMethod = (skip: boolean) => {
|
95
|
+
return skip ? it.skip : it;
|
96
|
+
};
|
97
|
+
|
98
|
+
testCases.forEach(({ name, legacyNodeSpec, newNodeSpecFn, skip }) => {
|
99
|
+
const testMethod = getTestingMethod(skip);
|
100
|
+
testMethod(`validate nodeSpec for node ${name}`, () => {
|
101
|
+
// check if there's any missing nodeSpec
|
102
|
+
expect(newNodeSpecFn).toBeDefined();
|
103
|
+
const newNodeSpec = newNodeSpecFn({});
|
104
|
+
expect(omit(newNodeSpec, ['parseDOM', 'toDOM'])).toEqual(
|
105
|
+
omit(legacyNodeSpec, ['parseDOM', 'toDOM']),
|
106
|
+
);
|
107
|
+
});
|
108
|
+
});
|
109
|
+
});
|
110
|
+
});
|
@@ -1,8 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.annotationGroup = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var annotationGroup = exports.annotationGroup = (0, _adfSchemaGenerator.adfMarkGroup)('annotation');
|
@@ -1,9 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.colorGroup = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var _textColor = require("../marks/textColor");
|
9
|
-
var colorGroup = exports.colorGroup = (0, _adfSchemaGenerator.adfMarkGroup)('color', [_textColor.textColor]);
|
@@ -1,15 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.backgroundColor = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var backgroundColor = exports.backgroundColor = (0, _adfSchemaGenerator.adfMark)('backgroundColor').define({
|
9
|
-
attrs: {
|
10
|
-
color: {
|
11
|
-
pattern: '^#[0-9a-fA-F]{6}$',
|
12
|
-
type: 'string'
|
13
|
-
}
|
14
|
-
}
|
15
|
-
});
|
@@ -1,16 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.textColor = void 0;
|
7
|
-
var _adfSchemaGenerator = require("@atlaskit/adf-schema-generator");
|
8
|
-
var textColor = exports.textColor = (0, _adfSchemaGenerator.adfMark)('textColor').define({
|
9
|
-
inclusive: true,
|
10
|
-
attrs: {
|
11
|
-
color: {
|
12
|
-
type: 'string',
|
13
|
-
pattern: '^#[0-9a-fA-F]{6}$'
|
14
|
-
}
|
15
|
-
}
|
16
|
-
});
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const annotationGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkGroup").ADFMarkGroup;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const colorGroup: import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkGroup").ADFMarkGroup;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const backgroundColor: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare const textColor: import("@atlaskit/adf-schema-generator/dist/types/adfMark").ADFMark<import("@atlaskit/adf-schema-generator/dist/types/types/ADFMarkSpec").ADFMarkSpec>;
|