@atlaskit/adf-schema 28.1.12 → 28.1.13
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 +6 -0
- package/package.json +1 -1
- package/src/__tests__/unit/json-schema/v1.ts +0 -55
- package/src/__tests__/unit/schema/create-schema.ts +0 -214
- package/src/__tests__/unit/schema/default-schema.ts +0 -192
- package/src/__tests__/unit/schema/marks/annotation.ts +0 -46
- package/src/__tests__/unit/schema/marks/border.ts +0 -76
- package/src/__tests__/unit/schema/marks/breakout.ts +0 -24
- package/src/__tests__/unit/schema/marks/code.ts +0 -44
- package/src/__tests__/unit/schema/marks/confluence-inline-comment.ts +0 -25
- package/src/__tests__/unit/schema/marks/data-consumer.ts +0 -52
- package/src/__tests__/unit/schema/marks/em.ts +0 -37
- package/src/__tests__/unit/schema/marks/link.ts +0 -188
- package/src/__tests__/unit/schema/marks/strike.ts +0 -37
- package/src/__tests__/unit/schema/marks/strong.ts +0 -43
- package/src/__tests__/unit/schema/marks/subsup.ts +0 -50
- package/src/__tests__/unit/schema/marks/text-color.ts +0 -61
- package/src/__tests__/unit/schema/marks/underline.ts +0 -36
- package/src/__tests__/unit/schema/nodes/_consts.ts +0 -964
- package/src/__tests__/unit/schema/nodes/block-card.ts +0 -184
- package/src/__tests__/unit/schema/nodes/blockquote.ts +0 -44
- package/src/__tests__/unit/schema/nodes/bodied-extension.ts +0 -101
- package/src/__tests__/unit/schema/nodes/code-block.ts +0 -221
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-block.ts +0 -32
- package/src/__tests__/unit/schema/nodes/confluence-unsupported-inline.ts +0 -35
- package/src/__tests__/unit/schema/nodes/date.ts +0 -51
- package/src/__tests__/unit/schema/nodes/decision-item.ts +0 -46
- package/src/__tests__/unit/schema/nodes/decision-list.ts +0 -52
- package/src/__tests__/unit/schema/nodes/embed-card.ts +0 -60
- package/src/__tests__/unit/schema/nodes/emoji.ts +0 -71
- package/src/__tests__/unit/schema/nodes/expand.ts +0 -51
- package/src/__tests__/unit/schema/nodes/extension.ts +0 -101
- package/src/__tests__/unit/schema/nodes/hard-break.ts +0 -24
- package/src/__tests__/unit/schema/nodes/heading.ts +0 -56
- package/src/__tests__/unit/schema/nodes/image.ts +0 -32
- package/src/__tests__/unit/schema/nodes/inline-card.ts +0 -106
- package/src/__tests__/unit/schema/nodes/inline-extension.ts +0 -79
- package/src/__tests__/unit/schema/nodes/layout-column.ts +0 -54
- package/src/__tests__/unit/schema/nodes/layout-section.ts +0 -95
- package/src/__tests__/unit/schema/nodes/list-item.ts +0 -49
- package/src/__tests__/unit/schema/nodes/media-group.ts +0 -67
- package/src/__tests__/unit/schema/nodes/media-single.ts +0 -171
- package/src/__tests__/unit/schema/nodes/media.ts +0 -384
- package/src/__tests__/unit/schema/nodes/mention.ts +0 -115
- package/src/__tests__/unit/schema/nodes/nestedExpand.ts +0 -72
- package/src/__tests__/unit/schema/nodes/ordered-list.ts +0 -49
- package/src/__tests__/unit/schema/nodes/panel.ts +0 -180
- package/src/__tests__/unit/schema/nodes/paragraph.ts +0 -25
- package/src/__tests__/unit/schema/nodes/placeholder.ts +0 -46
- package/src/__tests__/unit/schema/nodes/rule.ts +0 -24
- package/src/__tests__/unit/schema/nodes/status.ts +0 -120
- package/src/__tests__/unit/schema/nodes/tableNodes.ts +0 -555
- package/src/__tests__/unit/schema/nodes/task-item.ts +0 -39
- package/src/__tests__/unit/schema/nodes/task-list.ts +0 -45
- package/src/__tests__/unit/schema/nodes/unknown-block.ts +0 -42
- package/src/__tests__/unit/schema/nodes/unsupported-block.ts +0 -42
- package/src/__tests__/unit/schema/nodes/unsupported-inline.ts +0 -38
- package/src/__tests__/unit/utils/colors.ts +0 -42
- package/src/__tests__/unit/utils/url.ts +0 -209
- package/src/schema/bitbucket-schema.ts +0 -43
- package/src/schema/confluence-schema.ts +0 -76
- package/src/schema/create-schema.ts +0 -337
- package/src/schema/default-schema.ts +0 -180
- package/src/schema/groups.ts +0 -30
- package/src/schema/inline-nodes.ts +0 -9
- package/src/schema/jira-schema.ts +0 -158
- package/src/schema/marks/__tests__/unit/annotation.ts +0 -18
- package/src/schema/marks/alignment.ts +0 -48
- package/src/schema/marks/annotation.ts +0 -107
- package/src/schema/marks/border.ts +0 -74
- package/src/schema/marks/breakout.ts +0 -42
- package/src/schema/marks/code.ts +0 -45
- package/src/schema/marks/confluence-inline-comment.ts +0 -32
- package/src/schema/marks/data-consumer.ts +0 -100
- package/src/schema/marks/em.ts +0 -19
- package/src/schema/marks/fragment.ts +0 -77
- package/src/schema/marks/indentation.ts +0 -47
- package/src/schema/marks/link.ts +0 -139
- package/src/schema/marks/strike.ts +0 -26
- package/src/schema/marks/strong.ts +0 -45
- package/src/schema/marks/subsup.ts +0 -53
- package/src/schema/marks/text-color.ts +0 -172
- package/src/schema/marks/type-ahead-query.ts +0 -22
- package/src/schema/marks/underline.ts +0 -24
- package/src/schema/marks/unsupported-mark.ts +0 -9
- package/src/schema/marks/unsupported-node-attributes.ts +0 -8
- package/src/schema/nodes/block-card.ts +0 -121
- package/src/schema/nodes/blockquote.ts +0 -25
- package/src/schema/nodes/bodied-extension.ts +0 -75
- package/src/schema/nodes/bullet-list.ts +0 -17
- package/src/schema/nodes/caption.ts +0 -51
- package/src/schema/nodes/code-block.ts +0 -176
- package/src/schema/nodes/confluence-jira-issue.ts +0 -43
- package/src/schema/nodes/confluence-unsupported-block.ts +0 -29
- package/src/schema/nodes/confluence-unsupported-inline.ts +0 -30
- package/src/schema/nodes/date.ts +0 -38
- package/src/schema/nodes/decision-item.ts +0 -50
- package/src/schema/nodes/decision-list.ts +0 -56
- package/src/schema/nodes/doc.ts +0 -30
- package/src/schema/nodes/embed-card.ts +0 -62
- package/src/schema/nodes/emoji.ts +0 -89
- package/src/schema/nodes/expand.ts +0 -101
- package/src/schema/nodes/extension.ts +0 -60
- package/src/schema/nodes/hard-break.ts +0 -21
- package/src/schema/nodes/heading.ts +0 -64
- package/src/schema/nodes/image.ts +0 -32
- package/src/schema/nodes/inline-card.ts +0 -70
- package/src/schema/nodes/inline-extension.ts +0 -57
- package/src/schema/nodes/layout-column.ts +0 -68
- package/src/schema/nodes/layout-section.ts +0 -93
- package/src/schema/nodes/list-item.ts +0 -13
- package/src/schema/nodes/media-group.ts +0 -44
- package/src/schema/nodes/media-inline.ts +0 -19
- package/src/schema/nodes/media-single.ts +0 -179
- package/src/schema/nodes/media.ts +0 -253
- package/src/schema/nodes/mention.ts +0 -86
- package/src/schema/nodes/nested-expand.ts +0 -77
- package/src/schema/nodes/ordered-list.ts +0 -62
- package/src/schema/nodes/panel.ts +0 -133
- package/src/schema/nodes/paragraph.ts +0 -79
- package/src/schema/nodes/placeholder.ts +0 -40
- package/src/schema/nodes/rule.ts +0 -17
- package/src/schema/nodes/status.ts +0 -58
- package/src/schema/nodes/tableNodes.ts +0 -478
- package/src/schema/nodes/task-item.ts +0 -51
- package/src/schema/nodes/task-list.ts +0 -61
- package/src/schema/nodes/text.ts +0 -19
- package/src/schema/nodes/types/block-content.ts +0 -51
- package/src/schema/nodes/types/extensions.ts +0 -36
- package/src/schema/nodes/types/inline-content.ts +0 -56
- package/src/schema/nodes/types/list.ts +0 -54
- package/src/schema/nodes/types/mark.ts +0 -16
- package/src/schema/nodes/types/non-nestable-block-content.ts +0 -39
- package/src/schema/nodes/types/rich-media-common.ts +0 -51
- package/src/schema/nodes/unknown-block.ts +0 -13
- package/src/schema/nodes/unsupported-block.ts +0 -28
- package/src/schema/nodes/unsupported-inline.ts +0 -27
- package/src/schema/unsupported.ts +0 -4
- package/src/steps/__tests__/unit/analytics.ts +0 -72
- package/src/steps/__tests__/unit/link-meta-step.ts +0 -64
- package/src/steps/__tests__/unit/override-document-step.ts +0 -174
- package/src/steps/__tests__/unit/set-attrs.ts +0 -71
- package/src/steps/analytics.ts +0 -189
- package/src/steps/link-meta-step.ts +0 -105
- package/src/steps/override-document-step.ts +0 -97
- package/src/steps/set-attrs.tsx +0 -74
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-0.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-1.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-2.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/add-column-at-3.json +0 -15
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-0.json +0 -9
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-1.json +0 -9
- package/src/steps/table/__tests__/__fixtures__/basic/remove-column-at-2.json +0 -9
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row-inverted.json +0 -98
- package/src/steps/table/__tests__/__fixtures__/basic/remove-table/remove-last-row.json +0 -71
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-0.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1-inverted.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-1.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2-inverted.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-2.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/add-column-at-3.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0-inverted.json +0 -63
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-0.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1-inverted.json +0 -64
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-1.json +0 -22
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2-inverted.json +0 -63
- package/src/steps/table/__tests__/__fixtures__/merge-cells/columns/remove-column-at-2.json +0 -21
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-0.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-1.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-2.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3-inverted.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/add-column-at-3.json +0 -19
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0-inverted.json +0 -52
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-0.json +0 -38
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1-inverted.json +0 -52
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-1.json +0 -38
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2-inverted.json +0 -25
- package/src/steps/table/__tests__/__fixtures__/merge-cells/rows/remove-column-at-2.json +0 -11
- package/src/steps/table/__tests__/_utils.ts +0 -102
- package/src/steps/table/__tests__/add-column-merge-columns.ts +0 -509
- package/src/steps/table/__tests__/add-column-merge-rows.ts +0 -466
- package/src/steps/table/__tests__/add-column.ts +0 -638
- package/src/steps/table/add-column.ts +0 -443
- package/src/steps/table/constants.ts +0 -4
- package/src/steps/table/sort-column.ts +0 -57
- package/src/steps/table/types.ts +0 -48
- package/src/steps/table/utils/cell-step.ts +0 -239
- package/src/steps/table/utils/cells-at-column.ts +0 -75
- package/src/steps/table/utils/find-column.ts +0 -90
- package/src/steps/table/utils/get-table-rect-from-doc.ts +0 -37
- package/src/steps/table/utils/side-effects/rows.ts +0 -327
- package/src/steps/table/utils/side-effects/side-effects.ts +0 -90
- package/src/steps/table/utils/side-effects/table.ts +0 -112
- package/src/steps/table/utils/side-effects/types.ts +0 -34
- package/src/steps/table/utils/table-map.ts +0 -28
- package/src/steps/type-ahead.ts +0 -100
- package/src/steps.ts +0 -16
- package/src/utils/colors.ts +0 -171
- package/src/utils/confluence/emoji.ts +0 -99
- package/src/utils/extensions.ts +0 -32
- package/src/utils/parseDOM.ts +0 -2
- package/src/utils/url.ts +0 -173
- package/src/utils/uuid.ts +0 -19
- package/src/version.json +0 -6
@@ -1,56 +0,0 @@
|
|
1
|
-
import { HardBreakDefinition as HardBreak } from '../hard-break';
|
2
|
-
import { MentionDefinition as Mention } from '../mention';
|
3
|
-
import { EmojiDefinition as Emoji } from '../emoji';
|
4
|
-
import { InlineExtensionDefinition } from '../inline-extension';
|
5
|
-
import { DateDefinition as Date } from '../date';
|
6
|
-
import { PlaceholderDefinition as Placeholder } from '../placeholder';
|
7
|
-
import { InlineCardDefinition as InlineCard } from '../inline-card';
|
8
|
-
import { StatusDefinition as Status } from '../status';
|
9
|
-
import { TextDefinition as Text } from '../text';
|
10
|
-
import { MarksObject } from './mark';
|
11
|
-
import {
|
12
|
-
AnnotationMarkDefinition as Annotation,
|
13
|
-
CodeDefinition as Code,
|
14
|
-
EmDefinition as Em,
|
15
|
-
LinkDefinition as Link,
|
16
|
-
StrikeDefinition as Strike,
|
17
|
-
StrongDefinition as Strong,
|
18
|
-
SubSupDefinition as SubSup,
|
19
|
-
TextColorDefinition as TextColor,
|
20
|
-
UnderlineDefinition as Underline,
|
21
|
-
} from '../../marks';
|
22
|
-
import { MediaInlineDefinition } from '../media-inline';
|
23
|
-
|
24
|
-
/**
|
25
|
-
* @name formatted_text_inline_node
|
26
|
-
*/
|
27
|
-
export type InlineFormattedText = Text &
|
28
|
-
MarksObject<
|
29
|
-
Link | Em | Strong | Strike | SubSup | Underline | TextColor | Annotation
|
30
|
-
>;
|
31
|
-
/**
|
32
|
-
* @name link_text_inline_node
|
33
|
-
*/
|
34
|
-
export type InlineLinkText = Text & MarksObject<Link>;
|
35
|
-
/**
|
36
|
-
* @name code_inline_node
|
37
|
-
*/
|
38
|
-
export type InlineCode = Text & MarksObject<Code | Link | Annotation>;
|
39
|
-
|
40
|
-
/**
|
41
|
-
* @name atomic_inline_node
|
42
|
-
*/
|
43
|
-
export type InlineAtomic =
|
44
|
-
| HardBreak
|
45
|
-
| Mention
|
46
|
-
| Emoji
|
47
|
-
| InlineExtensionDefinition
|
48
|
-
| Date
|
49
|
-
| Placeholder
|
50
|
-
| InlineCard
|
51
|
-
| Status
|
52
|
-
| MediaInlineDefinition;
|
53
|
-
/**
|
54
|
-
* @name inline_node
|
55
|
-
*/
|
56
|
-
export type Inline = InlineFormattedText | InlineCode | InlineAtomic;
|
@@ -1,54 +0,0 @@
|
|
1
|
-
import { ParagraphDefinition as Paragraph } from '../paragraph';
|
2
|
-
import { MediaSingleDefinition as MediaSingle } from '../media-single';
|
3
|
-
import { CodeBlockDefinition as CodeBlock } from '../code-block';
|
4
|
-
|
5
|
-
export interface ListItemArray
|
6
|
-
extends Array<
|
7
|
-
| Paragraph
|
8
|
-
| OrderedListDefinition
|
9
|
-
| BulletListDefinition
|
10
|
-
| MediaSingle
|
11
|
-
| CodeBlock
|
12
|
-
> {
|
13
|
-
0: Paragraph | MediaSingle | CodeBlock;
|
14
|
-
}
|
15
|
-
|
16
|
-
/**
|
17
|
-
* @name listItem_node
|
18
|
-
*/
|
19
|
-
export interface ListItemDefinition {
|
20
|
-
type: 'listItem';
|
21
|
-
/**
|
22
|
-
* @minItems 1
|
23
|
-
* @allowUnsupportedBlock true
|
24
|
-
*/
|
25
|
-
content: ListItemArray;
|
26
|
-
}
|
27
|
-
|
28
|
-
/**
|
29
|
-
* @name bulletList_node
|
30
|
-
*/
|
31
|
-
export interface BulletListDefinition {
|
32
|
-
type: 'bulletList';
|
33
|
-
/**
|
34
|
-
* @minItems 1
|
35
|
-
*/
|
36
|
-
content: Array<ListItemDefinition>;
|
37
|
-
}
|
38
|
-
|
39
|
-
/**
|
40
|
-
* @name orderedList_node
|
41
|
-
*/
|
42
|
-
export interface OrderedListDefinition {
|
43
|
-
type: 'orderedList';
|
44
|
-
/**
|
45
|
-
* @minItems 1
|
46
|
-
*/
|
47
|
-
content: Array<ListItemDefinition>;
|
48
|
-
attrs?: {
|
49
|
-
/**
|
50
|
-
* @minimum 0
|
51
|
-
*/
|
52
|
-
order?: number;
|
53
|
-
};
|
54
|
-
}
|
@@ -1,39 +0,0 @@
|
|
1
|
-
import { PanelDefinition as Panel } from '../panel';
|
2
|
-
import { ParagraphDefinition as Paragraph } from '../paragraph';
|
3
|
-
import { BlockQuoteDefinition as Blockquote } from '../blockquote';
|
4
|
-
import { OrderedListDefinition as OrderedList } from '../types/list';
|
5
|
-
import { BulletListDefinition as BulletList } from '../types/list';
|
6
|
-
import { RuleDefinition as Rule } from '../rule';
|
7
|
-
import { HeadingDefinition as Heading } from '../heading';
|
8
|
-
import { CodeBlockDefinition as CodeBlock } from '../code-block';
|
9
|
-
import { MediaGroupDefinition as MediaGroup } from '../media-group';
|
10
|
-
import { MediaSingleDefinition as MediaSingle } from '../media-single';
|
11
|
-
import { DecisionListDefinition as DecisionList } from '../decision-list';
|
12
|
-
import { TaskListDefinition as TaskList } from '../task-list';
|
13
|
-
import { TableDefinition as Table } from '../tableNodes';
|
14
|
-
import { ExtensionDefinition as Extension } from '../extension';
|
15
|
-
import { BlockCardDefinition as BlockCard } from '../block-card';
|
16
|
-
import { EmbedCardDefinition as EmbedCard } from '../embed-card';
|
17
|
-
|
18
|
-
// We don't want paragraphs/headings with block marks inside bodied extensions or expands.
|
19
|
-
// We also don't want to allow nesting of expands or bodied extensions.
|
20
|
-
/**
|
21
|
-
* @name non_nestable_block_content
|
22
|
-
*/
|
23
|
-
export type NonNestableBlockContent =
|
24
|
-
| Panel
|
25
|
-
| Paragraph
|
26
|
-
| Blockquote
|
27
|
-
| OrderedList
|
28
|
-
| BulletList
|
29
|
-
| Rule
|
30
|
-
| Heading
|
31
|
-
| CodeBlock
|
32
|
-
| MediaGroup
|
33
|
-
| MediaSingle
|
34
|
-
| DecisionList
|
35
|
-
| TaskList
|
36
|
-
| Table
|
37
|
-
| Extension
|
38
|
-
| BlockCard
|
39
|
-
| EmbedCard;
|
@@ -1,51 +0,0 @@
|
|
1
|
-
export type Layout =
|
2
|
-
| 'wrap-right'
|
3
|
-
| 'center'
|
4
|
-
| 'wrap-left'
|
5
|
-
| 'wide'
|
6
|
-
| 'full-width'
|
7
|
-
| 'align-end'
|
8
|
-
| 'align-start';
|
9
|
-
|
10
|
-
export interface RichMediaAttributes {
|
11
|
-
/**
|
12
|
-
* @minimum 0
|
13
|
-
* @maximum 100
|
14
|
-
*/
|
15
|
-
width?: number;
|
16
|
-
layout: Layout;
|
17
|
-
}
|
18
|
-
|
19
|
-
export interface OptionalRichMediaAttributes {
|
20
|
-
width?: number;
|
21
|
-
layout?: Layout;
|
22
|
-
}
|
23
|
-
interface DefaultMediaAttributes extends RichMediaAttributes {
|
24
|
-
/**
|
25
|
-
* @stage 0
|
26
|
-
* @description optional widthType attribute for media with percentage layout
|
27
|
-
*/
|
28
|
-
widthType?: 'percentage';
|
29
|
-
}
|
30
|
-
|
31
|
-
/**
|
32
|
-
* @stage 0
|
33
|
-
* @description The widthType attribute is used to support fixed with media single
|
34
|
-
*/
|
35
|
-
interface FixedLayoutMediaAttributes {
|
36
|
-
/**
|
37
|
-
* @minimum 0
|
38
|
-
*/
|
39
|
-
width: number;
|
40
|
-
widthType: 'pixel';
|
41
|
-
layout: Layout;
|
42
|
-
}
|
43
|
-
|
44
|
-
export enum WidthType {
|
45
|
-
PIXEL = 'pixel',
|
46
|
-
PERCENTAGE = 'percentage',
|
47
|
-
}
|
48
|
-
|
49
|
-
export type ExtendedMediaAttributes =
|
50
|
-
| DefaultMediaAttributes
|
51
|
-
| FixedLayoutMediaAttributes;
|
@@ -1,13 +0,0 @@
|
|
1
|
-
import { NodeSpec } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
|
3
|
-
const name = 'unknownBlock';
|
4
|
-
|
5
|
-
export default {
|
6
|
-
group: 'block',
|
7
|
-
content: 'inline+',
|
8
|
-
marks: '_',
|
9
|
-
toDOM() {
|
10
|
-
return ['div', { 'data-node-type': name }, 0];
|
11
|
-
},
|
12
|
-
parseDOM: [{ tag: `div[data-node-type="${name}"]` }],
|
13
|
-
} as NodeSpec;
|
@@ -1,28 +0,0 @@
|
|
1
|
-
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
|
3
|
-
export const unsupportedBlock: NodeSpec = {
|
4
|
-
inline: false,
|
5
|
-
group: 'block',
|
6
|
-
atom: true,
|
7
|
-
selectable: true,
|
8
|
-
attrs: {
|
9
|
-
originalValue: { default: {} },
|
10
|
-
},
|
11
|
-
parseDOM: [
|
12
|
-
{
|
13
|
-
tag: '[data-node-type="unsupportedBlock"]',
|
14
|
-
getAttrs: (dom) => ({
|
15
|
-
originalValue: JSON.parse(
|
16
|
-
(dom as HTMLElement).getAttribute('data-original-value') || '{}',
|
17
|
-
),
|
18
|
-
}),
|
19
|
-
},
|
20
|
-
],
|
21
|
-
toDOM(node: PMNode) {
|
22
|
-
const attrs = {
|
23
|
-
'data-node-type': 'unsupportedBlock',
|
24
|
-
'data-original-value': JSON.stringify(node.attrs.originalValue),
|
25
|
-
};
|
26
|
-
return ['div', attrs, 'Unsupported content'];
|
27
|
-
},
|
28
|
-
};
|
@@ -1,27 +0,0 @@
|
|
1
|
-
import { NodeSpec, Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
2
|
-
|
3
|
-
export const unsupportedInline: NodeSpec = {
|
4
|
-
inline: true,
|
5
|
-
group: 'inline',
|
6
|
-
selectable: true,
|
7
|
-
attrs: {
|
8
|
-
originalValue: { default: {} },
|
9
|
-
},
|
10
|
-
parseDOM: [
|
11
|
-
{
|
12
|
-
tag: '[data-node-type="unsupportedInline"]',
|
13
|
-
getAttrs: (dom) => ({
|
14
|
-
originalValue: JSON.parse(
|
15
|
-
(dom as HTMLElement).getAttribute('data-original-value') || '{}',
|
16
|
-
),
|
17
|
-
}),
|
18
|
-
},
|
19
|
-
],
|
20
|
-
toDOM(node: PMNode) {
|
21
|
-
const attrs = {
|
22
|
-
'data-node-type': 'unsupportedInline',
|
23
|
-
'data-original-value': JSON.stringify(node.attrs.originalValue),
|
24
|
-
};
|
25
|
-
return ['span', attrs, 'Unsupported content'];
|
26
|
-
},
|
27
|
-
};
|
@@ -1,72 +0,0 @@
|
|
1
|
-
import {
|
2
|
-
AnalyticsPayload,
|
3
|
-
AnalyticsStep,
|
4
|
-
AnalyticsWithChannel,
|
5
|
-
} from '../../analytics';
|
6
|
-
|
7
|
-
describe('Analytics Step', () => {
|
8
|
-
it('should change analytics payload with undo event when inverted', function () {
|
9
|
-
const event: AnalyticsWithChannel<AnalyticsPayload> = {
|
10
|
-
channel: 'test',
|
11
|
-
payload: {
|
12
|
-
action: 'test-action',
|
13
|
-
actionSubject: 'test-action-subject',
|
14
|
-
eventType: 'test-event-type',
|
15
|
-
attributes: {
|
16
|
-
inputMethod: 'keyboard',
|
17
|
-
},
|
18
|
-
},
|
19
|
-
};
|
20
|
-
let analyticsStep = new AnalyticsStep([event]);
|
21
|
-
expect(analyticsStep.analyticsEvents[0]).toEqual(event);
|
22
|
-
|
23
|
-
analyticsStep = analyticsStep.invert();
|
24
|
-
expect(analyticsStep.analyticsEvents[0]).toEqual({
|
25
|
-
...event,
|
26
|
-
payload: {
|
27
|
-
...event.payload,
|
28
|
-
action: 'undid',
|
29
|
-
actionSubjectId: event.payload.action,
|
30
|
-
attributes: {
|
31
|
-
...(event.payload.attributes ? event.payload.attributes : {}),
|
32
|
-
actionSubjectId: event.payload.actionSubjectId,
|
33
|
-
inputMethod: 'keyboard',
|
34
|
-
},
|
35
|
-
eventType: 'track',
|
36
|
-
},
|
37
|
-
});
|
38
|
-
});
|
39
|
-
|
40
|
-
it('should change analytics payload with redid event when inverted twice', function () {
|
41
|
-
const event: AnalyticsWithChannel<AnalyticsPayload> = {
|
42
|
-
channel: 'test',
|
43
|
-
payload: {
|
44
|
-
action: 'test-action',
|
45
|
-
actionSubject: 'test-action-subject',
|
46
|
-
eventType: 'test-event-type',
|
47
|
-
attributes: {
|
48
|
-
inputMethod: 'keyboard',
|
49
|
-
},
|
50
|
-
},
|
51
|
-
};
|
52
|
-
|
53
|
-
let analyticsStep = new AnalyticsStep([event]);
|
54
|
-
expect(analyticsStep.analyticsEvents[0]).toEqual(event);
|
55
|
-
|
56
|
-
analyticsStep = analyticsStep.invert().invert();
|
57
|
-
expect(analyticsStep.analyticsEvents[0]).toEqual({
|
58
|
-
...event,
|
59
|
-
payload: {
|
60
|
-
...event.payload,
|
61
|
-
action: 'redid',
|
62
|
-
actionSubjectId: event.payload.action,
|
63
|
-
attributes: {
|
64
|
-
...(event.payload.attributes ? event.payload.attributes : {}),
|
65
|
-
actionSubjectId: event.payload.actionSubjectId,
|
66
|
-
inputMethod: 'keyboard',
|
67
|
-
},
|
68
|
-
eventType: 'track',
|
69
|
-
},
|
70
|
-
});
|
71
|
-
});
|
72
|
-
});
|
@@ -1,64 +0,0 @@
|
|
1
|
-
import { ReplaceStep, StepMap } from '@atlaskit/editor-prosemirror/transform';
|
2
|
-
|
3
|
-
import { doc, p } from 'adf-test-helpers/src/doc-builder';
|
4
|
-
import { defaultSchema } from 'adf-test-helpers/src/schema';
|
5
|
-
|
6
|
-
import { LinkMetaStep } from '../../link-meta-step';
|
7
|
-
import { Slice } from '@atlaskit/editor-prosemirror/model';
|
8
|
-
|
9
|
-
describe('LinkMetaStep', () => {
|
10
|
-
it('should expose a `getMetadata` method which returns the stored metadata', () => {
|
11
|
-
const metadata = {
|
12
|
-
action: 'some-action',
|
13
|
-
sourceEvent: 'some-event',
|
14
|
-
};
|
15
|
-
|
16
|
-
const step = new LinkMetaStep(0, metadata);
|
17
|
-
|
18
|
-
expect(step.getMetadata()).toStrictEqual(metadata);
|
19
|
-
});
|
20
|
-
|
21
|
-
it('should not include `sourceEvent` when inverted', () => {
|
22
|
-
const step = new LinkMetaStep(0, {
|
23
|
-
action: 'some-action',
|
24
|
-
sourceEvent: 'some-event',
|
25
|
-
});
|
26
|
-
|
27
|
-
expect(step.getMetadata()).toEqual({
|
28
|
-
action: 'some-action',
|
29
|
-
sourceEvent: 'some-event',
|
30
|
-
});
|
31
|
-
|
32
|
-
const inverted = step.invert();
|
33
|
-
|
34
|
-
expect(inverted.getMetadata()).toEqual({
|
35
|
-
action: 'some-action',
|
36
|
-
});
|
37
|
-
});
|
38
|
-
|
39
|
-
it.each([0, 5, 10])(
|
40
|
-
'should return stepmap with correct ranges based on the position argument %p and with sizes of 0',
|
41
|
-
(pos) => {
|
42
|
-
expect(new LinkMetaStep(pos, {}).getMap()).toStrictEqual(
|
43
|
-
new StepMap([pos, 0, 0]),
|
44
|
-
);
|
45
|
-
},
|
46
|
-
);
|
47
|
-
|
48
|
-
it('should succesfully make no change to the document', () => {
|
49
|
-
const document = doc(p('Some content'))(defaultSchema);
|
50
|
-
const step = new LinkMetaStep(0, {});
|
51
|
-
const result = step.apply(document);
|
52
|
-
|
53
|
-
expect(result.failed).toBeFalsy();
|
54
|
-
expect(document).toStrictEqual(result.doc);
|
55
|
-
});
|
56
|
-
|
57
|
-
it('should serialize and de-serialize into a no-op replace step to avoid affecting collab editting', () => {
|
58
|
-
const step = new LinkMetaStep(0, {});
|
59
|
-
|
60
|
-
expect(LinkMetaStep.fromJSON(defaultSchema, step.toJSON())).toStrictEqual(
|
61
|
-
new ReplaceStep(0, 0, Slice.empty),
|
62
|
-
);
|
63
|
-
});
|
64
|
-
});
|
@@ -1,174 +0,0 @@
|
|
1
|
-
import { StepMap } from '@atlaskit/editor-prosemirror/transform';
|
2
|
-
import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
3
|
-
import { createEditorState } from 'adf-test-helpers/src/create-editor-state';
|
4
|
-
import { doc, p } from 'adf-test-helpers/src/doc-builder';
|
5
|
-
import { defaultSchema } from 'adf-test-helpers/src/schema';
|
6
|
-
import { OverrideDocumentStep } from '../../override-document-step';
|
7
|
-
|
8
|
-
describe('Override Document Step', () => {
|
9
|
-
const currentDocument = doc(p('Hello World'));
|
10
|
-
const nextDocument: PMNode = doc(
|
11
|
-
p('Hey, I am the next document'),
|
12
|
-
p('How are you doing?'),
|
13
|
-
)(defaultSchema);
|
14
|
-
|
15
|
-
describe('when using the Override Document Step in a transaction', () => {
|
16
|
-
it('should succesfully override a document when the step is applied', () => {
|
17
|
-
const state = createEditorState(currentDocument);
|
18
|
-
const tr = state.tr;
|
19
|
-
|
20
|
-
tr.step(
|
21
|
-
new OverrideDocumentStep({
|
22
|
-
nextDocument,
|
23
|
-
}),
|
24
|
-
);
|
25
|
-
|
26
|
-
expect(tr.doc).toEqual(nextDocument);
|
27
|
-
expect(tr.docs[0]).toEqual(currentDocument(defaultSchema));
|
28
|
-
});
|
29
|
-
|
30
|
-
describe('when the inverted step is applied', () => {
|
31
|
-
it('should bring the old document back', () => {
|
32
|
-
const state = createEditorState(currentDocument);
|
33
|
-
const tr = state.tr;
|
34
|
-
|
35
|
-
const step = new OverrideDocumentStep({
|
36
|
-
nextDocument,
|
37
|
-
});
|
38
|
-
const stepInverted = step.invert(tr.doc);
|
39
|
-
|
40
|
-
tr.step(step);
|
41
|
-
tr.step(stepInverted);
|
42
|
-
|
43
|
-
expect(tr.doc).toEqual(currentDocument(defaultSchema));
|
44
|
-
expect(tr.docs[1]).toEqual(nextDocument);
|
45
|
-
expect(tr.docs[0]).toEqual(currentDocument(defaultSchema));
|
46
|
-
});
|
47
|
-
});
|
48
|
-
|
49
|
-
describe('when mapping the selection position', () => {
|
50
|
-
const smallDocument = doc(
|
51
|
-
p('Hello {<>}{cursor}World{nextCursorPosition}'),
|
52
|
-
);
|
53
|
-
const bigDocument = doc(
|
54
|
-
p('Hey, I am the next document'),
|
55
|
-
p('How are you{<>}{cursor} doing?{nextCursorPosition}'),
|
56
|
-
);
|
57
|
-
|
58
|
-
describe('and when replacing a small document with a big one ', () => {
|
59
|
-
it('should proper map the positions', () => {
|
60
|
-
const state = createEditorState(smallDocument);
|
61
|
-
const nextDocument = bigDocument(defaultSchema);
|
62
|
-
|
63
|
-
expect(state.selection.from).toEqual(
|
64
|
-
smallDocument(defaultSchema).refs.cursor,
|
65
|
-
);
|
66
|
-
|
67
|
-
const tr = state.tr;
|
68
|
-
|
69
|
-
tr.step(
|
70
|
-
new OverrideDocumentStep({
|
71
|
-
nextDocument,
|
72
|
-
}),
|
73
|
-
);
|
74
|
-
|
75
|
-
const nextCursorPosition = nextDocument.refs.nextCursorPosition;
|
76
|
-
|
77
|
-
expect(tr.selection.from).toEqual(nextCursorPosition);
|
78
|
-
});
|
79
|
-
});
|
80
|
-
|
81
|
-
describe('and when replacing a big document with a small one ', () => {
|
82
|
-
it('should proper map the positions', () => {
|
83
|
-
const state = createEditorState(bigDocument);
|
84
|
-
const nextDocument = smallDocument(defaultSchema);
|
85
|
-
|
86
|
-
expect(state.selection.from).toEqual(
|
87
|
-
bigDocument(defaultSchema).refs.cursor,
|
88
|
-
);
|
89
|
-
|
90
|
-
const tr = state.tr;
|
91
|
-
|
92
|
-
tr.step(
|
93
|
-
new OverrideDocumentStep({
|
94
|
-
nextDocument,
|
95
|
-
}),
|
96
|
-
);
|
97
|
-
|
98
|
-
const nextCursorPosition = nextDocument.refs.nextCursorPosition;
|
99
|
-
|
100
|
-
expect(tr.selection.from).toEqual(nextCursorPosition);
|
101
|
-
});
|
102
|
-
});
|
103
|
-
});
|
104
|
-
});
|
105
|
-
|
106
|
-
describe('when using the Override Document Step functions', () => {
|
107
|
-
it('should succesfully return the StepResult of nextDocument', () => {
|
108
|
-
const step = new OverrideDocumentStep({
|
109
|
-
nextDocument,
|
110
|
-
});
|
111
|
-
|
112
|
-
const result = step.apply(currentDocument(defaultSchema));
|
113
|
-
|
114
|
-
expect(result.failed).toBeFalsy();
|
115
|
-
expect(nextDocument).toStrictEqual(result.doc);
|
116
|
-
});
|
117
|
-
|
118
|
-
it('should succesfully get StepMap', () => {
|
119
|
-
const step = new OverrideDocumentStep({
|
120
|
-
nextDocument,
|
121
|
-
});
|
122
|
-
|
123
|
-
const oldSize = currentDocument(defaultSchema).content.size;
|
124
|
-
const nextDocumentSize = nextDocument.content.size;
|
125
|
-
|
126
|
-
const result = step.apply(currentDocument(defaultSchema));
|
127
|
-
|
128
|
-
expect(result.failed).toBeFalsy();
|
129
|
-
expect(step.getMap()).toStrictEqual(
|
130
|
-
new StepMap([0, oldSize, nextDocumentSize]),
|
131
|
-
);
|
132
|
-
});
|
133
|
-
|
134
|
-
it('should return new mapped step', () => {
|
135
|
-
const step = new OverrideDocumentStep({
|
136
|
-
nextDocument,
|
137
|
-
});
|
138
|
-
|
139
|
-
const mappedStep = step.map();
|
140
|
-
|
141
|
-
expect(mappedStep).toEqual(step);
|
142
|
-
});
|
143
|
-
|
144
|
-
it('should return new inverted step', () => {
|
145
|
-
const step = new OverrideDocumentStep({
|
146
|
-
nextDocument,
|
147
|
-
});
|
148
|
-
|
149
|
-
const invertedStep = step.invert(currentDocument(defaultSchema));
|
150
|
-
|
151
|
-
expect(invertedStep.inverted).toEqual(true);
|
152
|
-
});
|
153
|
-
|
154
|
-
it('should serialize and de-serialize OverrideDocumentStep', () => {
|
155
|
-
const step = new OverrideDocumentStep({
|
156
|
-
nextDocument,
|
157
|
-
});
|
158
|
-
|
159
|
-
const deserializedStep = OverrideDocumentStep.fromJSON(
|
160
|
-
defaultSchema,
|
161
|
-
step.toJSON(),
|
162
|
-
);
|
163
|
-
|
164
|
-
const stepAppliedResult = step.apply(currentDocument(defaultSchema));
|
165
|
-
const deserializedStepAppliedResult = deserializedStep.apply(
|
166
|
-
currentDocument(defaultSchema),
|
167
|
-
);
|
168
|
-
|
169
|
-
expect(stepAppliedResult.doc).toMatchObject(
|
170
|
-
deserializedStepAppliedResult.doc,
|
171
|
-
);
|
172
|
-
});
|
173
|
-
});
|
174
|
-
});
|
@@ -1,71 +0,0 @@
|
|
1
|
-
import { Transform } from '@atlaskit/editor-prosemirror/transform';
|
2
|
-
import { doc, panel, p } from 'adf-test-helpers/src/doc-builder';
|
3
|
-
import { defaultSchema } from 'adf-test-helpers/src/schema';
|
4
|
-
import { SetAttrsStep } from '../../set-attrs';
|
5
|
-
|
6
|
-
describe('SetAttrs Step', () => {
|
7
|
-
const originalDocument = doc(
|
8
|
-
// prettier-ignore
|
9
|
-
panel({ type: 'info' })(
|
10
|
-
p('lol'),
|
11
|
-
),
|
12
|
-
)(defaultSchema);
|
13
|
-
|
14
|
-
describe('when the step is applied in document', () => {
|
15
|
-
it('should apply the attributes at the node', () => {
|
16
|
-
const step = new SetAttrsStep(0, { type: 'error' });
|
17
|
-
const result = step.apply(originalDocument);
|
18
|
-
expect(result.doc.toJSON()).toEqual(
|
19
|
-
doc(panel({ type: 'error' })(p('lol')))(defaultSchema).toJSON(),
|
20
|
-
);
|
21
|
-
});
|
22
|
-
|
23
|
-
it('should generate a revertable step adding the previous attribute', () => {
|
24
|
-
const step = new SetAttrsStep(0, { type: 'error' });
|
25
|
-
|
26
|
-
const revertStep = step.invert(originalDocument);
|
27
|
-
const result = revertStep.apply(originalDocument);
|
28
|
-
|
29
|
-
expect(result.doc.toJSON()).toEqual(
|
30
|
-
doc(panel({ type: 'info' })(p('lol')))(defaultSchema).toJSON(),
|
31
|
-
);
|
32
|
-
});
|
33
|
-
});
|
34
|
-
|
35
|
-
describe('when the node position changes', () => {
|
36
|
-
it('should map its internal positions', () => {
|
37
|
-
const transformer = new Transform(originalDocument);
|
38
|
-
|
39
|
-
const step = new SetAttrsStep(0, { type: 'error' });
|
40
|
-
|
41
|
-
transformer.insert(0, defaultSchema.text('X'));
|
42
|
-
|
43
|
-
step.map(transformer.mapping);
|
44
|
-
|
45
|
-
const result = step.apply(transformer.doc);
|
46
|
-
|
47
|
-
expect(result.doc.toJSON()).toEqual(
|
48
|
-
// prettier-ignore
|
49
|
-
doc(
|
50
|
-
|
51
|
-
p('X'),
|
52
|
-
panel({ type: 'error' })(
|
53
|
-
p('lol'),
|
54
|
-
),
|
55
|
-
)(defaultSchema).toJSON(),
|
56
|
-
);
|
57
|
-
});
|
58
|
-
});
|
59
|
-
|
60
|
-
describe('when the target is a text node', () => {
|
61
|
-
it('should return an invalid step', () => {
|
62
|
-
const invalidDocument = doc(p('lol'))(defaultSchema);
|
63
|
-
|
64
|
-
const step = new SetAttrsStep(1, { type: 'error' });
|
65
|
-
|
66
|
-
const result = step.apply(invalidDocument);
|
67
|
-
|
68
|
-
expect(result.failed).toBeTruthy();
|
69
|
-
});
|
70
|
-
});
|
71
|
-
});
|