@atlaskit/adf-schema 28.1.8 → 28.1.9
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 +10 -0
- package/dist/cjs/schema/create-schema.js +2 -2
- package/dist/cjs/schema/marks/annotation.js +2 -2
- package/dist/cjs/schema/marks/data-consumer.js +2 -2
- package/dist/cjs/schema/marks/fragment.js +2 -2
- package/dist/cjs/schema/marks/link.js +2 -2
- package/dist/cjs/schema/nodes/block-card.js +2 -2
- package/dist/cjs/schema/nodes/expand.js +2 -2
- package/dist/cjs/schema/nodes/media-single.js +2 -2
- package/dist/cjs/schema/nodes/mention.js +2 -2
- package/dist/cjs/schema/nodes/ordered-list.js +2 -2
- package/dist/cjs/schema/nodes/panel.js +2 -2
- package/dist/cjs/schema/nodes/tableNodes.js +2 -2
- package/dist/cjs/steps/analytics.js +2 -2
- package/dist/cjs/steps/set-attrs.js +2 -2
- package/dist/cjs/steps/table/add-column.js +2 -2
- package/dist/cjs/steps/table/utils/cell-step.js +2 -2
- package/dist/cjs/steps/table/utils/side-effects/rows.js +2 -2
- package/dist/esm/schema/create-schema.js +2 -2
- package/dist/esm/schema/marks/annotation.js +2 -2
- package/dist/esm/schema/marks/data-consumer.js +2 -2
- package/dist/esm/schema/marks/fragment.js +2 -2
- package/dist/esm/schema/marks/link.js +2 -2
- package/dist/esm/schema/nodes/block-card.js +2 -2
- package/dist/esm/schema/nodes/expand.js +2 -2
- package/dist/esm/schema/nodes/media-single.js +2 -2
- package/dist/esm/schema/nodes/mention.js +2 -2
- package/dist/esm/schema/nodes/ordered-list.js +2 -2
- package/dist/esm/schema/nodes/panel.js +2 -2
- package/dist/esm/schema/nodes/tableNodes.js +2 -2
- package/dist/esm/steps/analytics.js +2 -2
- package/dist/esm/steps/set-attrs.js +2 -2
- package/dist/esm/steps/table/add-column.js +2 -2
- package/dist/esm/steps/table/utils/cell-step.js +2 -2
- package/dist/esm/steps/table/utils/side-effects/rows.js +2 -2
- package/dist/types/schema/default-schema.d.ts +2 -2
- package/dist/types/schema/jira-schema.d.ts +1 -1
- package/dist/types/schema/marks/data-consumer.d.ts +2 -2
- package/dist/types/schema/marks/fragment.d.ts +1 -1
- package/dist/types/schema/marks/link.d.ts +2 -2
- package/dist/types/schema/nodes/bodied-extension.d.ts +1 -0
- package/dist/types/schema/nodes/code-block.d.ts +1 -1
- package/dist/types/schema/nodes/expand.d.ts +2 -2
- package/dist/types/schema/nodes/extension.d.ts +1 -0
- package/dist/types/schema/nodes/inline-extension.d.ts +1 -0
- package/dist/types/schema/nodes/media-single.d.ts +1 -1
- package/dist/types/schema/nodes/media.d.ts +2 -2
- package/dist/types/schema/nodes/mention.d.ts +2 -2
- package/dist/types/schema/nodes/panel.d.ts +1 -0
- package/dist/types/schema/nodes/tableNodes.d.ts +2 -2
- package/dist/types/schema/nodes/unknown-block.d.ts +1 -0
- package/dist/types/steps/analytics.d.ts +4 -4
- package/dist/types/steps/link-meta-step.d.ts +4 -4
- package/dist/types/steps/set-attrs.d.ts +2 -2
- package/dist/types/steps/table/sort-column.d.ts +4 -4
- package/dist/types/steps/type-ahead.d.ts +4 -4
- package/package.json +2 -2
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +1 -5
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +1 -1
- package/src/__tests__/unit/schema/nodes/date.ts +1 -1
- package/src/__tests__/unit/schema/nodes/expand.ts +1 -1
- package/src/__tests__/unit/schema/nodes/inline-extension.ts +1 -1
- package/src/__tests__/unit/schema/nodes/list-item.ts +1 -1
- package/src/__tests__/unit/schema/nodes/media-group.ts +1 -1
- package/src/__tests__/unit/schema/nodes/media-single.ts +1 -1
- package/src/__tests__/unit/schema/nodes/media.ts +1 -5
- package/src/__tests__/unit/schema/nodes/nestedExpand.ts +1 -1
- package/src/__tests__/unit/schema/nodes/ordered-list.ts +1 -1
- package/src/__tests__/unit/schema/nodes/placeholder.ts +1 -1
- package/src/__tests__/unit/schema/nodes/status.ts +1 -1
- package/src/__tests__/unit/schema/nodes/unknown-block.ts +1 -1
- package/src/__tests__/unit/schema/nodes/unsupported-block.ts +1 -1
- package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +1 -1
- package/src/schema/nodes/media-single.ts +2 -2
- package/src/schema/nodes/media.ts +5 -1
- package/src/schema/nodes/tableNodes.ts +3 -5
- package/src/steps/table/__tests__/_utils.ts +6 -7
- package/src/steps/table/__tests__/add-column-merge-columns.ts +27 -9
- package/src/steps/table/__tests__/add-column-merge-rows.ts +24 -8
- package/src/steps/table/__tests__/add-column.ts +46 -18
- package/src/steps/table/add-column.ts +4 -1
- package/src/steps/table/utils/cells-at-column.ts +4 -1
- package/src/utils/colors.ts +1 -1
@@ -2,6 +2,6 @@ import { SchemaConfig } from './create-schema';
|
|
2
2
|
type DefaultSchemaNodes = 'doc' | 'paragraph' | 'text' | 'bulletList' | 'orderedList' | 'listItem' | 'heading' | 'blockquote' | 'codeBlock' | 'panel' | 'rule' | 'image' | 'mention' | 'media' | 'caption' | 'mediaGroup' | 'mediaSingle' | 'mediaInline' | 'confluenceUnsupportedBlock' | 'confluenceUnsupportedInline' | 'confluenceJiraIssue' | 'expand' | 'nestedExpand' | 'extension' | 'inlineExtension' | 'bodiedExtension' | 'hardBreak' | 'emoji' | 'table' | 'tableCell' | 'tableHeader' | 'tableRow' | 'decisionList' | 'decisionItem' | 'taskList' | 'taskItem' | 'unknownBlock' | 'date' | 'status' | 'placeholder' | 'layoutSection' | 'layoutColumn' | 'inlineCard' | 'blockCard' | 'embedCard' | 'unsupportedBlock' | 'unsupportedInline';
|
3
3
|
type DefaultSchemaMarks = 'link' | 'em' | 'strong' | 'strike' | 'subsup' | 'underline' | 'code' | 'textColor' | 'confluenceInlineComment' | 'breakout' | 'alignment' | 'indentation' | 'annotation' | 'border' | 'unsupportedMark' | 'unsupportedNodeAttribute' | 'typeAheadQuery' | 'dataConsumer' | 'fragment';
|
4
4
|
export declare const defaultSchemaConfig: SchemaConfig<DefaultSchemaNodes, DefaultSchemaMarks>;
|
5
|
-
export declare const getSchemaBasedOnStage: import("memoize-one").MemoizedFn<(this: any, stage?: any) => Schema<
|
6
|
-
export declare const defaultSchema: Schema<
|
5
|
+
export declare const getSchemaBasedOnStage: import("memoize-one").MemoizedFn<(this: any, stage?: any) => import("prosemirror-model").Schema<DefaultSchemaNodes, DefaultSchemaMarks>>;
|
6
|
+
export declare const defaultSchema: import("prosemirror-model").Schema<DefaultSchemaNodes, DefaultSchemaMarks>;
|
7
7
|
export {};
|
@@ -18,7 +18,7 @@ export interface JIRASchemaConfig {
|
|
18
18
|
/**
|
19
19
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
20
20
|
**/
|
21
|
-
export default function makeSchema(config: JIRASchemaConfig): Schema<
|
21
|
+
export default function makeSchema(config: JIRASchemaConfig): Schema<string, string>;
|
22
22
|
/**
|
23
23
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
24
24
|
**/
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { MarkSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { MarkSpec, Mark } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
export interface ConfluenceLinkMetadata {
|
3
3
|
linkType: string;
|
4
4
|
versionAtSave?: string | null;
|
@@ -30,6 +30,6 @@ export interface LinkDefinition {
|
|
30
30
|
}
|
31
31
|
export declare const link: MarkSpec;
|
32
32
|
export declare const toJSON: (mark: Mark) => {
|
33
|
-
type:
|
33
|
+
type: string;
|
34
34
|
attrs: Record<string, string>;
|
35
35
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { TextDefinition as Text } from './text';
|
3
3
|
import { BreakoutMarkDefinition } from '../marks/breakout';
|
4
4
|
import { MarksObject, NoMark } from './types/mark';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { BreakoutMarkDefinition } from '../marks';
|
3
3
|
import { MarksObject, NoMark } from './types/mark';
|
4
4
|
import { NonNestableBlockContent } from './types/non-nestable-block-content';
|
@@ -27,5 +27,5 @@ export type ExpandDefinition = ExpandBaseDefinition & NoMark;
|
|
27
27
|
export type ExpandWithBreakoutDefinition = ExpandBaseDefinition & MarksObject<BreakoutMarkDefinition>;
|
28
28
|
export declare const expand: NodeSpec;
|
29
29
|
export declare const toJSON: (node: PMNode) => {
|
30
|
-
attrs:
|
30
|
+
attrs: import("prosemirror-model").Attrs;
|
31
31
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { MediaDefinition as Media } from './media';
|
3
3
|
import { LinkDefinition } from '../marks/link';
|
4
4
|
import { ExtendedMediaAttributes } from './types/rich-media-common';
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { BorderMarkDefinition } from '../marks/border';
|
3
3
|
import { LinkDefinition } from '../marks/link';
|
4
4
|
export type MediaType = 'file' | 'link' | 'external';
|
@@ -53,7 +53,7 @@ export interface ExternalMediaAttributes {
|
|
53
53
|
}
|
54
54
|
export type MediaADFAttrs = MediaAttributes | ExternalMediaAttributes;
|
55
55
|
export declare const defaultAttrs: DefaultAttributes<MediaADFAttrs>;
|
56
|
-
export declare const createMediaSpec: (attributes: NodeSpec
|
56
|
+
export declare const createMediaSpec: (attributes: Partial<NodeSpec['attrs']>, inline?: boolean) => NodeSpec;
|
57
57
|
export declare const media: NodeSpec;
|
58
58
|
export declare const camelCaseToKebabCase: (str: string) => string;
|
59
59
|
export declare const copyPrivateAttributes: (from: Record<string, any>, to: Record<string, any>, map?: ((str: string) => string) | undefined) => void;
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
export declare enum USER_TYPES {
|
3
3
|
DEFAULT = "DEFAULT",
|
4
4
|
SPECIAL = "SPECIAL",
|
@@ -20,5 +20,5 @@ export interface MentionDefinition {
|
|
20
20
|
}
|
21
21
|
export declare const mention: NodeSpec;
|
22
22
|
export declare const toJSON: (node: PMNode) => {
|
23
|
-
attrs:
|
23
|
+
attrs: import("prosemirror-model").Attrs;
|
24
24
|
};
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
1
|
+
import { Node as PmNode, NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { CellAttributes } from '@atlaskit/editor-tables/types';
|
3
3
|
import { PanelDefinition as Panel } from './panel';
|
4
4
|
import { ParagraphDefinition as Paragraph, ParagraphWithAlignmentDefinition as ParagraphWithMarks } from './paragraph';
|
@@ -104,7 +104,7 @@ export interface TableHeader {
|
|
104
104
|
export declare const table: NodeSpec;
|
105
105
|
export declare const tableWithCustomWidth: NodeSpec;
|
106
106
|
export declare const tableToJSON: (node: PmNode) => {
|
107
|
-
attrs:
|
107
|
+
attrs: import("prosemirror-model").Attrs;
|
108
108
|
};
|
109
109
|
export declare const tableRow: NodeSpec;
|
110
110
|
export declare const tableCell: NodeSpec;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
import { Step, Mappable } from '@atlaskit/editor-prosemirror/transform';
|
2
|
+
import { Step, StepResult, StepMap, ReplaceStep, Mappable } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
export declare const analyticsStepType = "atlaskit-analytics";
|
4
4
|
export declare const analyticsInvertStepType = "atlaskit-analytics-invert";
|
5
5
|
export interface AnalyticsPayload {
|
@@ -47,13 +47,13 @@ export declare class AnalyticsStep<P extends AnalyticsPayload> extends Step {
|
|
47
47
|
* Generate new undo/redo analytics event when step is inverted
|
48
48
|
*/
|
49
49
|
invert(): AnalyticsStep<AnalyticsInvertPayload>;
|
50
|
-
apply(doc: PMNode):
|
50
|
+
apply(doc: PMNode): StepResult;
|
51
51
|
map(mapping: Mappable): AnalyticsStep<P>;
|
52
|
-
getMap():
|
52
|
+
getMap(): StepMap;
|
53
53
|
merge(other: Step): AnalyticsStep<P> | null;
|
54
54
|
toJSON(): {
|
55
55
|
stepType: string;
|
56
56
|
};
|
57
|
-
static fromJSON():
|
57
|
+
static fromJSON(): ReplaceStep;
|
58
58
|
}
|
59
59
|
export {};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Node as PMNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
import { Step, Mappable } from '@atlaskit/editor-prosemirror/transform';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult, Mappable } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
export declare const stepType = "editor-linking-meta";
|
4
4
|
export declare const invertStepType = "editor-linking-meta-invert";
|
5
5
|
export type LinkStepMetadata = {
|
@@ -36,9 +36,9 @@ export declare class LinkMetaStep extends Step {
|
|
36
36
|
* Generate new undo/redo analytics event when step is inverted
|
37
37
|
*/
|
38
38
|
invert(): LinkMetaStep;
|
39
|
-
apply(doc: PMNode):
|
39
|
+
apply(doc: PMNode): StepResult;
|
40
40
|
map(mapping: Mappable): LinkMetaStep;
|
41
|
-
getMap():
|
41
|
+
getMap(): StepMap;
|
42
42
|
merge(): null;
|
43
43
|
toJSON(): {
|
44
44
|
stepType: string;
|
@@ -47,5 +47,5 @@ export declare class LinkMetaStep extends Step {
|
|
47
47
|
};
|
48
48
|
static fromJSON<S extends Schema = any>(_: S, __: {
|
49
49
|
[key: string]: any;
|
50
|
-
}):
|
50
|
+
}): ReplaceStep;
|
51
51
|
}
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { Mappable, Step } from '@atlaskit/editor-prosemirror/transform';
|
1
|
+
import { Mappable, Step, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
2
2
|
import { Node as ProseMirrorNode, Schema } from '@atlaskit/editor-prosemirror/model';
|
3
3
|
/**
|
4
4
|
* For more context on what this is about:
|
@@ -8,7 +8,7 @@ export declare class SetAttrsStep extends Step {
|
|
8
8
|
pos: number;
|
9
9
|
attrs: object;
|
10
10
|
constructor(pos: number, attrs: object);
|
11
|
-
apply(doc: ProseMirrorNode):
|
11
|
+
apply(doc: ProseMirrorNode): StepResult;
|
12
12
|
invert(doc: ProseMirrorNode): SetAttrsStep;
|
13
13
|
map(mapping: Mappable): SetAttrsStep | null;
|
14
14
|
toJSON(): {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
import { Step } from '@atlaskit/editor-prosemirror/transform';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
import { TableColumnOrdering } from './types';
|
4
4
|
export declare const tableSortingStepType = "atlaskit-table-sorting-ordering";
|
5
5
|
export declare class TableSortStep extends Step {
|
@@ -8,11 +8,11 @@ export declare class TableSortStep extends Step {
|
|
8
8
|
pos: number;
|
9
9
|
constructor(pos: number, prev?: TableColumnOrdering, next?: TableColumnOrdering);
|
10
10
|
invert(): TableSortStep;
|
11
|
-
apply(doc: PMNode):
|
11
|
+
apply(doc: PMNode): StepResult;
|
12
12
|
map(): null;
|
13
|
-
getMap():
|
13
|
+
getMap(): StepMap;
|
14
14
|
toJSON(): {
|
15
15
|
stepType: string;
|
16
16
|
};
|
17
|
-
static fromJSON():
|
17
|
+
static fromJSON(): ReplaceStep;
|
18
18
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
import { Mappable, Step } from '@atlaskit/editor-prosemirror/transform';
|
2
|
+
import { Mappable, ReplaceStep, Step, StepMap, StepResult } from '@atlaskit/editor-prosemirror/transform';
|
3
3
|
export declare const insertTypeAheadStepType = "atlaskit-insert-type-ahead";
|
4
4
|
export declare enum InsertTypeAheadStages {
|
5
5
|
DELETING_RAW_QUERY = "DELETING_RAW_QUERY",
|
@@ -19,17 +19,17 @@ export declare class InsertTypeAheadStep extends Step {
|
|
19
19
|
trigger: string;
|
20
20
|
constructor({ stage, query, trigger, selectedIndex }: Config, isInvertStep?: boolean);
|
21
21
|
invert(): InsertTypeAheadStep;
|
22
|
-
apply(doc: PMNode):
|
22
|
+
apply(doc: PMNode): StepResult;
|
23
23
|
merge(): null;
|
24
24
|
isInsertionStep(): boolean;
|
25
25
|
isUndoingStep(): boolean;
|
26
26
|
map(mapping: Mappable): InsertTypeAheadStep;
|
27
|
-
getMap():
|
27
|
+
getMap(): StepMap;
|
28
28
|
toJSON(): {
|
29
29
|
stepType: string;
|
30
30
|
from: number;
|
31
31
|
to: number;
|
32
32
|
};
|
33
|
-
static fromJSON():
|
33
|
+
static fromJSON(): ReplaceStep;
|
34
34
|
}
|
35
35
|
export {};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "28.1.
|
3
|
+
"version": "28.1.9",
|
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/"
|
@@ -27,7 +27,7 @@
|
|
27
27
|
"build:types": "NODE_ENV=production tsc --project ./build/tsconfig.json --emitDeclarationOnly --outDir ./dist/types --rootDir ./src && yarn build:jsontypes",
|
28
28
|
"build:jsontypes": "mkdir -p dist/types/json-schema && cp src/json-schema/index.ts dist/types/json-schema/index.d.ts",
|
29
29
|
"build:all": "yarn build:cjs && yarn build:esm && yarn build:es2019 && yarn build:types",
|
30
|
-
"build": "yarn run build:all && yarn run generate:json-schema && yarn run build:json-schema",
|
30
|
+
"build": "yarn workspace @atlaskit/editor-prosemirror build && yarn run build:all && yarn run generate:json-schema && yarn run build:json-schema",
|
31
31
|
"clean": "../../scripts/build-clean.sh"
|
32
32
|
},
|
33
33
|
"dependencies": {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { date } from '../../../..';
|
3
3
|
|
4
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
4
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
5
5
|
|
6
6
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
7
7
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { expand } from '../../../..';
|
3
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
3
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
4
4
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
5
5
|
|
6
6
|
describe(`${packageName}/schema expand node`, () => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { inlineExtension } from '../../../..';
|
3
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
3
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
4
4
|
|
5
5
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
6
6
|
|
@@ -2,7 +2,7 @@ import { toHTML, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
|
2
2
|
|
3
3
|
import { doc, ol, li, p } from 'adf-test-helpers/src/adf-schema/schema-builder';
|
4
4
|
|
5
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
5
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
6
6
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
7
7
|
|
8
8
|
describe(`${packageName}/schema listItem node`, () => {
|
@@ -6,11 +6,7 @@ import {
|
|
6
6
|
createMediaSpec,
|
7
7
|
} from '../../../../schema/nodes/media';
|
8
8
|
import { image as ImageNodeSpec } from '../../../../schema/nodes/image';
|
9
|
-
import {
|
10
|
-
fromHTML,
|
11
|
-
toDOM,
|
12
|
-
schema,
|
13
|
-
} from 'adf-test-helpers/src/adf-schema';
|
9
|
+
import { fromHTML, toDOM, schema } from 'adf-test-helpers/src/adf-schema';
|
14
10
|
|
15
11
|
// Note: We can't use dom.dataset in jest until it's upgraded to use latest version
|
16
12
|
// of jsdom. In the meantime we can use this helper-method.
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { nestedExpand } from '../../../..';
|
3
3
|
import { Schema, Node } from '@atlaskit/editor-prosemirror/model';
|
4
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
4
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
5
5
|
|
6
6
|
const findNestedExpand = (doc: Node, schema: Schema) => {
|
7
7
|
let expand: Node | null = null;
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
2
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
3
3
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
4
4
|
|
5
5
|
describe(`${packageName}/schema orderedList node`, () => {
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { placeholder } from '../../../..';
|
3
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
3
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
4
4
|
|
5
5
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
6
6
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { toDOM, fromHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { status } from '../../../..';
|
3
3
|
import { StatusLocalIdRegex } from 'adf-test-helpers/src/constants';
|
4
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
4
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
5
5
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
6
6
|
|
7
7
|
describe(`${packageName}/schema status node`, () => {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { fromHTML, toHTML } from 'adf-test-helpers/src/adf-schema/html-helpers';
|
2
2
|
import { inlineNodes } from '../../../../schema/inline-nodes';
|
3
3
|
|
4
|
-
import { schema } from 'adf-test-helpers/src/adf-schema'
|
4
|
+
import { schema } from 'adf-test-helpers/src/adf-schema';
|
5
5
|
|
6
6
|
const packageName = process.env._PACKAGE_NAME_ as string;
|
7
7
|
|
@@ -57,10 +57,10 @@ export type MediaSingleFullDefinition = MediaSingleBaseDefinition &
|
|
57
57
|
|
58
58
|
export const defaultAttrs: {
|
59
59
|
width: {
|
60
|
-
|
60
|
+
default: null;
|
61
61
|
};
|
62
62
|
layout: {
|
63
|
-
|
63
|
+
default: string;
|
64
64
|
};
|
65
65
|
} = {
|
66
66
|
width: { default: null }, // null makes small images to have original size by default
|
@@ -201,7 +201,11 @@ export const media: NodeSpec = createMediaSpec(defaultAttrs);
|
|
201
201
|
export const camelCaseToKebabCase = (str: string) =>
|
202
202
|
str.replace(/([^A-Z]+)([A-Z])/g, (_, x, y) => `${x}-${y.toLowerCase()}`);
|
203
203
|
|
204
|
-
export const copyPrivateAttributes: (
|
204
|
+
export const copyPrivateAttributes: (
|
205
|
+
from: Record<string, any>,
|
206
|
+
to: Record<string, any>,
|
207
|
+
map?: ((str: string) => string) | undefined,
|
208
|
+
) => void = (
|
205
209
|
from: Record<string, any>,
|
206
210
|
to: Record<string, any>,
|
207
211
|
map?: (str: string) => string,
|
@@ -65,16 +65,14 @@ export const tableCellContentDomSelector = `${tablePrefixSelector}-cell-nodeview
|
|
65
65
|
const DEFAULT_TABLE_HEADER_CELL_BACKGROUND = N20.toLocaleLowerCase();
|
66
66
|
|
67
67
|
export const getCellAttrs: (
|
68
|
-
dom: HTMLElement,
|
68
|
+
dom: HTMLElement,
|
69
|
+
defaultValues?: CellAttributes,
|
69
70
|
) => {
|
70
71
|
colspan: number;
|
71
72
|
rowspan: number;
|
72
73
|
colwidth: number[] | null;
|
73
74
|
background: string | null;
|
74
|
-
} = (
|
75
|
-
dom: HTMLElement,
|
76
|
-
defaultValues: CellAttributes = {},
|
77
|
-
) => {
|
75
|
+
} = (dom: HTMLElement, defaultValues: CellAttributes = {}) => {
|
78
76
|
const widthAttr = dom.getAttribute('data-colwidth');
|
79
77
|
const width =
|
80
78
|
widthAttr && /^\d+(,\d+)*$/.test(widthAttr)
|
@@ -1,12 +1,11 @@
|
|
1
1
|
import { Node as ProseMirrorNode } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
import { EditorState, Plugin, Transaction } from '@atlaskit/editor-prosemirror/state';
|
3
|
-
import { history, undo } from '@atlaskit/editor-prosemirror/history';
|
4
2
|
import {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
} from '
|
3
|
+
EditorState,
|
4
|
+
Plugin,
|
5
|
+
Transaction,
|
6
|
+
} from '@atlaskit/editor-prosemirror/state';
|
7
|
+
import { history, undo } from '@atlaskit/editor-prosemirror/history';
|
8
|
+
import { DocBuilder, p, Refs, td } from 'adf-test-helpers/src/doc-builder';
|
10
9
|
import { setSelectionTransform } from 'adf-test-helpers/src/set-selection-transform';
|
11
10
|
|
12
11
|
import { defaultSchema } from '../../../schema/default-schema';
|
@@ -147,7 +147,9 @@ describe('AddColumnStep', () => {
|
|
147
147
|
addColumnAtFactory('table', column)(editorState, refs),
|
148
148
|
);
|
149
149
|
|
150
|
-
expect(editorState.doc).
|
150
|
+
expect(editorState.doc.toJSON()).toEqual(
|
151
|
+
expectedDoc(defaultSchema).toJSON(),
|
152
|
+
);
|
151
153
|
},
|
152
154
|
);
|
153
155
|
});
|
@@ -165,7 +167,9 @@ describe('AddColumnStep', () => {
|
|
165
167
|
removeColumnAtFactory('table', column)(editorState, refs),
|
166
168
|
);
|
167
169
|
|
168
|
-
expect(editorState.doc).
|
170
|
+
expect(editorState.doc.toJSON()).toEqual(
|
171
|
+
expectedDoc(defaultSchema).toJSON(),
|
172
|
+
);
|
169
173
|
},
|
170
174
|
);
|
171
175
|
});
|
@@ -195,7 +199,9 @@ describe('AddColumnStep', () => {
|
|
195
199
|
transaction,
|
196
200
|
editorState,
|
197
201
|
);
|
198
|
-
expect(editorState.doc).
|
202
|
+
expect(editorState.doc.toJSON()).toEqual(
|
203
|
+
originalDoc(defaultSchema).toJSON(),
|
204
|
+
);
|
199
205
|
});
|
200
206
|
});
|
201
207
|
|
@@ -285,7 +291,9 @@ describe('AddColumnStep', () => {
|
|
285
291
|
|
286
292
|
editorState = editorState.apply(editorState.tr.step(addColumnStep!));
|
287
293
|
|
288
|
-
expect(editorState.doc).
|
294
|
+
expect(editorState.doc.toJSON()).toEqual(
|
295
|
+
expectedDoc(defaultSchema).toJSON(),
|
296
|
+
);
|
289
297
|
},
|
290
298
|
);
|
291
299
|
});
|
@@ -359,7 +367,9 @@ describe('AddColumnStep', () => {
|
|
359
367
|
historyTransactions,
|
360
368
|
);
|
361
369
|
|
362
|
-
expect(editorState.doc).
|
370
|
+
expect(editorState.doc.toJSON()).toEqual(
|
371
|
+
expectDoc(defaultSchema).toJSON(),
|
372
|
+
);
|
363
373
|
});
|
364
374
|
},
|
365
375
|
);
|
@@ -380,7 +390,9 @@ describe('AddColumnStep', () => {
|
|
380
390
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
381
391
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
382
392
|
|
383
|
-
expect(editorState.doc).
|
393
|
+
expect(editorState.doc.toJSON()).toEqual(
|
394
|
+
expectedDoc(defaultSchema).toJSON(),
|
395
|
+
);
|
384
396
|
},
|
385
397
|
);
|
386
398
|
|
@@ -398,7 +410,9 @@ describe('AddColumnStep', () => {
|
|
398
410
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
399
411
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
400
412
|
|
401
|
-
expect(editorState.doc).
|
413
|
+
expect(editorState.doc.toJSON()).toEqual(
|
414
|
+
expectedDoc(defaultSchema).toJSON(),
|
415
|
+
);
|
402
416
|
},
|
403
417
|
);
|
404
418
|
|
@@ -413,7 +427,9 @@ describe('AddColumnStep', () => {
|
|
413
427
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
414
428
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
415
429
|
|
416
|
-
expect(editorState.doc).
|
430
|
+
expect(editorState.doc.toJSON()).toEqual(
|
431
|
+
expectedDoc(defaultSchema).toJSON(),
|
432
|
+
);
|
417
433
|
},
|
418
434
|
);
|
419
435
|
|
@@ -430,7 +446,9 @@ describe('AddColumnStep', () => {
|
|
430
446
|
const addColumnStep = Step.fromJSON(defaultSchema, jsonStep);
|
431
447
|
editorState = editorState.apply(editorState.tr.step(addColumnStep));
|
432
448
|
|
433
|
-
expect(editorState.doc).
|
449
|
+
expect(editorState.doc.toJSON()).toEqual(
|
450
|
+
expectedDoc(defaultSchema).toJSON(),
|
451
|
+
);
|
434
452
|
},
|
435
453
|
);
|
436
454
|
});
|