@atlaskit/adf-schema 19.0.0 → 19.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/cjs/index.js +14 -2
- package/dist/cjs/schema/create-schema.js +3 -0
- package/dist/cjs/schema/default-schema.js +6 -2
- package/dist/cjs/schema/index.js +20 -2
- package/dist/cjs/schema/nodes/index.js +22 -2
- package/dist/cjs/schema/nodes/layout-section.js +35 -3
- package/dist/cjs/schema/nodes/media-inline.js +11 -0
- package/dist/cjs/schema/nodes/media.js +8 -3
- package/dist/cjs/schema/nodes/tableNodes.js +13 -9
- package/dist/cjs/steps/analytics.js +3 -3
- package/dist/cjs/steps/type-ahead.js +134 -0
- package/dist/cjs/steps.js +14 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/create-schema.js +4 -1
- package/dist/es2019/schema/default-schema.js +5 -2
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/nodes/index.js +3 -2
- package/dist/es2019/schema/nodes/layout-section.js +34 -1
- package/dist/es2019/schema/nodes/media-inline.js +2 -0
- package/dist/es2019/schema/nodes/media.js +70 -64
- package/dist/es2019/schema/nodes/tableNodes.js +10 -9
- package/dist/es2019/steps/analytics.js +2 -2
- package/dist/es2019/steps/type-ahead.js +85 -0
- package/dist/es2019/steps.js +1 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/create-schema.js +4 -1
- package/dist/esm/schema/default-schema.js +5 -2
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/nodes/index.js +3 -2
- package/dist/esm/schema/nodes/layout-section.js +32 -1
- package/dist/esm/schema/nodes/media-inline.js +2 -0
- package/dist/esm/schema/nodes/media.js +8 -3
- package/dist/esm/schema/nodes/tableNodes.js +10 -9
- package/dist/esm/steps/analytics.js +3 -3
- package/dist/esm/steps/type-ahead.js +117 -0
- package/dist/esm/steps.js +1 -0
- package/dist/esm/version.json +1 -1
- package/dist/json-schema/v1/full.json +131 -97
- package/dist/json-schema/v1/stage-0.json +225 -97
- package/dist/types/index.d.ts +2 -2
- package/dist/types/schema/default-schema.d.ts +1 -1
- package/dist/types/schema/index.d.ts +2 -2
- package/dist/types/schema/nodes/index.d.ts +5 -3
- package/dist/types/schema/nodes/layout-section.d.ts +28 -1
- package/dist/types/schema/nodes/media-inline.d.ts +16 -0
- package/dist/types/schema/nodes/media.d.ts +1 -1
- package/dist/types/schema/nodes/tableNodes.d.ts +11 -1
- package/dist/types/schema/nodes/types/inline-content.d.ts +2 -1
- package/dist/types/steps/type-ahead.d.ts +35 -0
- package/dist/types/steps.d.ts +1 -0
- package/json-schema/v1/full.json +131 -97
- package/json-schema/v1/stage-0.json +225 -97
- package/package.json +3 -3
- package/test-helpers/schema-builder.ts +3 -0
- package/test-helpers/schema.ts +1 -0
@@ -21,8 +21,9 @@ export { default as unknownBlock } from './unknown-block';
|
|
21
21
|
export { caption } from './caption';
|
22
22
|
export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as mediaToJSON } from './media';
|
23
23
|
export { mediaGroup } from './media-group';
|
24
|
+
export { mediaInline } from './media-inline';
|
24
25
|
export { mediaSingle, mediaSingleWithCaption, toJSON as mediaSingleToJSON } from './media-single';
|
25
|
-
export { table, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames,
|
26
|
+
export { table, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
|
26
27
|
export { decisionList, decisionListSelector } from './decision-list';
|
27
28
|
export { decisionItem } from './decision-item';
|
28
29
|
export { taskList, taskListSelector } from './task-list';
|
@@ -32,7 +33,7 @@ export { inlineExtension } from './inline-extension';
|
|
32
33
|
export { bodiedExtension } from './bodied-extension';
|
33
34
|
export { date } from './date';
|
34
35
|
export { placeholder } from './placeholder';
|
35
|
-
export { layoutSection } from './layout-section';
|
36
|
+
export { layoutSection, layoutSectionWithSingleColumn } from './layout-section';
|
36
37
|
export { layoutColumn } from './layout-column';
|
37
38
|
export { inlineCard } from './inline-card';
|
38
39
|
export { blockCard } from './block-card';
|
@@ -1,8 +1,41 @@
|
|
1
1
|
/**
|
2
2
|
* @name layoutSection_node
|
3
3
|
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Need duplicate `type` and `marks` to make both validator and json-schema satisfied
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @name layoutSection_full_node
|
11
|
+
*/
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @stage 0
|
15
|
+
* @name layoutSection_with_single_column_node
|
16
|
+
*/
|
4
17
|
export const layoutSection = {
|
5
|
-
content: '(layoutColumn | unsupportedBlock){
|
18
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
19
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
20
|
+
isolating: true,
|
21
|
+
parseDOM: [{
|
22
|
+
context: 'layoutSection//|layoutColumn//',
|
23
|
+
tag: 'div[data-layout-section]',
|
24
|
+
skip: true
|
25
|
+
}, {
|
26
|
+
tag: 'div[data-layout-section]'
|
27
|
+
}],
|
28
|
+
|
29
|
+
toDOM() {
|
30
|
+
const attrs = {
|
31
|
+
'data-layout-section': 'true'
|
32
|
+
};
|
33
|
+
return ['div', attrs, 0];
|
34
|
+
}
|
35
|
+
|
36
|
+
};
|
37
|
+
export const layoutSectionWithSingleColumn = {
|
38
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
6
39
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
7
40
|
isolating: true,
|
8
41
|
parseDOM: [{
|
@@ -43,83 +43,89 @@ export const defaultAttrs = {
|
|
43
43
|
default: false
|
44
44
|
}
|
45
45
|
};
|
46
|
-
export const createMediaSpec = attributes =>
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
46
|
+
export const createMediaSpec = (attributes, inline = false) => {
|
47
|
+
const domNodeType = inline ? 'span' : 'div';
|
48
|
+
const nodeName = inline ? 'mediaInline' : 'media';
|
49
|
+
return {
|
50
|
+
selectable: true,
|
51
|
+
inline,
|
52
|
+
group: inline ? 'inline' : undefined,
|
53
|
+
attrs: attributes,
|
54
|
+
parseDOM: [{
|
55
|
+
tag: `${domNodeType}[data-node-type="${nodeName}"]`,
|
56
|
+
getAttrs: dom => {
|
57
|
+
const attrs = {};
|
53
58
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
59
|
+
if (attributes) {
|
60
|
+
Object.keys(attributes).forEach(k => {
|
61
|
+
const key = camelCaseToKebabCase(k).replace(/^__/, '');
|
62
|
+
const value = dom.getAttribute(`data-${key}`) || '';
|
58
63
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
+
if (value) {
|
65
|
+
attrs[k] = value;
|
66
|
+
}
|
67
|
+
});
|
68
|
+
} // Need to do validation & type conversion manually
|
64
69
|
|
65
70
|
|
66
|
-
|
67
|
-
|
68
|
-
|
71
|
+
if (attrs.__fileSize) {
|
72
|
+
attrs.__fileSize = +attrs.__fileSize;
|
73
|
+
}
|
69
74
|
|
70
|
-
|
75
|
+
const width = Number(attrs.width);
|
71
76
|
|
72
|
-
|
73
|
-
|
74
|
-
|
77
|
+
if (typeof width !== 'undefined' && !isNaN(width)) {
|
78
|
+
attrs.width = width;
|
79
|
+
}
|
75
80
|
|
76
|
-
|
81
|
+
const height = Number(attrs.height);
|
77
82
|
|
78
|
-
|
79
|
-
|
83
|
+
if (typeof height !== 'undefined' && !isNaN(height)) {
|
84
|
+
attrs.height = height;
|
85
|
+
}
|
86
|
+
|
87
|
+
return attrs;
|
88
|
+
}
|
89
|
+
}, // Don't match data URI
|
90
|
+
{
|
91
|
+
tag: 'img[src^="data:image"]',
|
92
|
+
ignore: true
|
93
|
+
}, {
|
94
|
+
tag: 'img:not(.smart-link-icon)',
|
95
|
+
getAttrs: dom => {
|
96
|
+
return {
|
97
|
+
type: 'external',
|
98
|
+
url: dom.getAttribute('src') || '',
|
99
|
+
alt: dom.getAttribute('alt') || ''
|
100
|
+
};
|
80
101
|
}
|
102
|
+
}],
|
81
103
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
104
|
+
toDOM(node) {
|
105
|
+
const attrs = {
|
106
|
+
'data-id': node.attrs.id,
|
107
|
+
'data-node-type': `${nodeName}`,
|
108
|
+
'data-type': node.attrs.type,
|
109
|
+
'data-collection': node.attrs.collection,
|
110
|
+
'data-occurrence-key': node.attrs.occurrenceKey,
|
111
|
+
'data-width': node.attrs.width,
|
112
|
+
'data-height': node.attrs.height,
|
113
|
+
'data-url': node.attrs.url,
|
114
|
+
'data-alt': node.attrs.alt,
|
115
|
+
// toDOM is used for static rendering as well as editor rendering. This comes into play for
|
116
|
+
// emails, copy/paste, etc, so the title and styling here *is* useful (despite a React-based
|
117
|
+
// node view being used for editing).
|
118
|
+
title: 'Attachment',
|
119
|
+
// Manually kept in sync with the style of media cards. The goal is to render a plain gray
|
120
|
+
// rectangle that provides an affordance for media.
|
121
|
+
style: `display: inline-block; border-radius: 3px; background: ${N30}; box-shadow: 0 1px 1px rgba(9, 30, 66, 0.2), 0 0 1px 0 rgba(9, 30, 66, 0.24);`
|
95
122
|
};
|
123
|
+
copyPrivateAttributes(node.attrs, attrs, key => `data-${camelCaseToKebabCase(key.slice(2))}`);
|
124
|
+
return [`${domNodeType}`, attrs];
|
96
125
|
}
|
97
|
-
}],
|
98
|
-
|
99
|
-
toDOM(node) {
|
100
|
-
const attrs = {
|
101
|
-
'data-id': node.attrs.id,
|
102
|
-
'data-node-type': 'media',
|
103
|
-
'data-type': node.attrs.type,
|
104
|
-
'data-collection': node.attrs.collection,
|
105
|
-
'data-occurrence-key': node.attrs.occurrenceKey,
|
106
|
-
'data-width': node.attrs.width,
|
107
|
-
'data-height': node.attrs.height,
|
108
|
-
'data-url': node.attrs.url,
|
109
|
-
'data-alt': node.attrs.alt,
|
110
|
-
// toDOM is used for static rendering as well as editor rendering. This comes into play for
|
111
|
-
// emails, copy/paste, etc, so the title and styling here *is* useful (despite a React-based
|
112
|
-
// node view being used for editing).
|
113
|
-
title: 'Attachment',
|
114
|
-
// Manually kept in sync with the style of media cards. The goal is to render a plain gray
|
115
|
-
// rectangle that provides an affordance for media.
|
116
|
-
style: `display: inline-block; border-radius: 3px; background: ${N30}; box-shadow: 0 1px 1px rgba(9, 30, 66, 0.2), 0 0 1px 0 rgba(9, 30, 66, 0.24);`
|
117
|
-
};
|
118
|
-
copyPrivateAttributes(node.attrs, attrs, key => `data-${camelCaseToKebabCase(key.slice(2))}`);
|
119
|
-
return ['div', attrs];
|
120
|
-
}
|
121
126
|
|
122
|
-
}
|
127
|
+
};
|
128
|
+
};
|
123
129
|
export const media = createMediaSpec(defaultAttrs);
|
124
130
|
export const camelCaseToKebabCase = str => str.replace(/([^A-Z]+)([A-Z])/g, (_, x, y) => `${x}-${y.toLowerCase()}`);
|
125
131
|
export const copyPrivateAttributes = (from, to, map) => {
|
@@ -6,8 +6,7 @@ export const tableHeaderSelector = `${tablePrefixSelector}-header-content-wrap`;
|
|
6
6
|
export const tableCellContentWrapperSelector = `${tablePrefixSelector}-cell-nodeview-wrapper`;
|
7
7
|
export const tableCellContentDomSelector = `${tablePrefixSelector}-cell-nodeview-content-dom`;
|
8
8
|
const DEFAULT_TABLE_HEADER_CELL_BACKGROUND = N20.toLocaleLowerCase();
|
9
|
-
|
10
|
-
const getCellAttrs = (dom, defaultValues = {}) => {
|
9
|
+
export const getCellAttrs = (dom, defaultValues = {}) => {
|
11
10
|
const widthAttr = dom.getAttribute('data-colwidth');
|
12
11
|
const width = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(',').map(str => Number(str)) : null;
|
13
12
|
const colspan = Number(dom.getAttribute('colspan') || 1);
|
@@ -31,17 +30,19 @@ const getCellAttrs = (dom, defaultValues = {}) => {
|
|
31
30
|
};
|
32
31
|
};
|
33
32
|
|
34
|
-
|
33
|
+
/**
|
34
|
+
* gets cell dom attributes based on node attributes
|
35
|
+
* @returns CellDomAttrs
|
36
|
+
*/
|
37
|
+
export const getCellDomAttrs = node => {
|
35
38
|
const attrs = {};
|
36
39
|
const nodeType = node.type.name;
|
37
|
-
const colspan = cell ? parseInt(cell.getAttribute('colspan') || '1', 10) : 1;
|
38
|
-
const rowspan = cell ? parseInt(cell.getAttribute('rowspan') || '1', 10) : 1;
|
39
40
|
|
40
|
-
if (node.attrs.colspan !==
|
41
|
+
if (node.attrs.colspan !== 1) {
|
41
42
|
attrs.colspan = node.attrs.colspan;
|
42
43
|
}
|
43
44
|
|
44
|
-
if (node.attrs.rowspan !==
|
45
|
+
if (node.attrs.rowspan !== 1) {
|
45
46
|
attrs.rowspan = node.attrs.rowspan;
|
46
47
|
}
|
47
48
|
|
@@ -192,7 +193,7 @@ export const tableCell = {
|
|
192
193
|
tag: 'td',
|
193
194
|
getAttrs: dom => getCellAttrs(dom)
|
194
195
|
}],
|
195
|
-
toDOM: node => ['td',
|
196
|
+
toDOM: node => ['td', getCellDomAttrs(node), 0]
|
196
197
|
};
|
197
198
|
export const toJSONTableCell = node => ({
|
198
199
|
attrs: Object.keys(node.attrs).reduce((obj, key) => {
|
@@ -216,6 +217,6 @@ export const tableHeader = {
|
|
216
217
|
background: DEFAULT_TABLE_HEADER_CELL_BACKGROUND
|
217
218
|
})
|
218
219
|
}],
|
219
|
-
toDOM: node => ['th',
|
220
|
+
toDOM: node => ['th', getCellDomAttrs(node), 0]
|
220
221
|
};
|
221
222
|
export const toJSONTableHeader = toJSONTableCell;
|
@@ -46,8 +46,8 @@ function isHistoryAnalyticsEvent(event) {
|
|
46
46
|
* undo/redo events for free
|
47
47
|
*/
|
48
48
|
export class AnalyticsStep extends Step {
|
49
|
-
constructor(analyticsEvents, actionsToIgnore = [], pos
|
50
|
-
{
|
49
|
+
constructor(analyticsEvents, actionsToIgnore = [], pos // Used to create the map, prevent splitting history.
|
50
|
+
) {
|
51
51
|
super();
|
52
52
|
|
53
53
|
_defineProperty(this, "analyticsEvents", []);
|
@@ -0,0 +1,85 @@
|
|
1
|
+
import { Slice } from 'prosemirror-model';
|
2
|
+
import { ReplaceStep, Step, StepMap, StepResult } from 'prosemirror-transform';
|
3
|
+
export const insertTypeAheadStepType = 'atlaskit-insert-type-ahead';
|
4
|
+
export let InsertTypeAheadStages;
|
5
|
+
|
6
|
+
(function (InsertTypeAheadStages) {
|
7
|
+
InsertTypeAheadStages["DELETING_RAW_QUERY"] = "DELETING_RAW_QUERY";
|
8
|
+
InsertTypeAheadStages["INSERTING_ITEM"] = "INSERTING_ITEM";
|
9
|
+
})(InsertTypeAheadStages || (InsertTypeAheadStages = {}));
|
10
|
+
|
11
|
+
export class InsertTypeAheadStep extends Step {
|
12
|
+
constructor({
|
13
|
+
stage,
|
14
|
+
query,
|
15
|
+
trigger,
|
16
|
+
selectedIndex
|
17
|
+
}, isInvertStep = false) {
|
18
|
+
super();
|
19
|
+
this.isInvertStep = isInvertStep;
|
20
|
+
this.stage = stage;
|
21
|
+
this.query = query;
|
22
|
+
this.trigger = trigger;
|
23
|
+
this.selectedIndex = selectedIndex;
|
24
|
+
}
|
25
|
+
|
26
|
+
invert() {
|
27
|
+
const config = {
|
28
|
+
stage: this.stage,
|
29
|
+
query: this.query,
|
30
|
+
trigger: this.trigger,
|
31
|
+
selectedIndex: this.selectedIndex
|
32
|
+
};
|
33
|
+
return new InsertTypeAheadStep(config, !this.isInvertStep);
|
34
|
+
}
|
35
|
+
|
36
|
+
apply(doc) {
|
37
|
+
return StepResult.ok(doc);
|
38
|
+
}
|
39
|
+
|
40
|
+
merge() {
|
41
|
+
return null;
|
42
|
+
}
|
43
|
+
|
44
|
+
isInsertionStep() {
|
45
|
+
return !this.isInvertStep;
|
46
|
+
}
|
47
|
+
|
48
|
+
isUndoingStep() {
|
49
|
+
return this.isInvertStep;
|
50
|
+
}
|
51
|
+
|
52
|
+
map(mapping) {
|
53
|
+
const config = {
|
54
|
+
stage: this.stage,
|
55
|
+
query: this.query,
|
56
|
+
trigger: this.trigger,
|
57
|
+
selectedIndex: this.selectedIndex
|
58
|
+
}; // Return the same events, this step will never be removed
|
59
|
+
|
60
|
+
return new InsertTypeAheadStep(config, this.isInvertStep);
|
61
|
+
}
|
62
|
+
|
63
|
+
getMap() {
|
64
|
+
return new StepMap([0, 0, 0]);
|
65
|
+
}
|
66
|
+
|
67
|
+
toJSON() {
|
68
|
+
// When serialized we should create a noop Replace step
|
69
|
+
return {
|
70
|
+
stepType: 'replace',
|
71
|
+
from: 0,
|
72
|
+
to: 0
|
73
|
+
};
|
74
|
+
}
|
75
|
+
|
76
|
+
static fromJSON() {
|
77
|
+
// This is a "local custom step" once serialized
|
78
|
+
// we need to transform it in a no-operation action
|
79
|
+
return new ReplaceStep(0, 0, Slice.empty);
|
80
|
+
}
|
81
|
+
|
82
|
+
}
|
83
|
+
/** Register this step with Prosemirror */
|
84
|
+
|
85
|
+
Step.jsonID(insertTypeAheadStepType, InsertTypeAheadStep);
|
package/dist/es2019/steps.js
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
export { SortOrder as TableSortOrder } from './steps/table/constants';
|
2
2
|
export { TableSortStep } from './steps/table/sort-column';
|
3
|
+
export { InsertTypeAheadStages, InsertTypeAheadStep } from './steps/type-ahead';
|
3
4
|
export { AddColumnStep } from './steps/table/add-column';
|
4
5
|
export { SetAttrsStep } from './steps/set-attrs';
|
5
6
|
export { AnalyticsStep } from './steps/analytics';
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes,
|
1
|
+
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './schema';
|
2
2
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -7,7 +7,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
7
7
|
import { Schema } from 'prosemirror-model';
|
8
8
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
9
9
|
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer } from './marks';
|
10
|
-
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedList, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaGroup, mediaSingle, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
10
|
+
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedList, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaGroup, mediaSingle, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
11
11
|
|
12
12
|
function addItems(builtInItems, config) {
|
13
13
|
var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
@@ -115,6 +115,9 @@ var nodesInOrder = [{
|
|
115
115
|
}, {
|
116
116
|
name: 'mediaSingle',
|
117
117
|
spec: mediaSingle
|
118
|
+
}, {
|
119
|
+
name: 'mediaInline',
|
120
|
+
spec: mediaInline
|
118
121
|
}, {
|
119
122
|
name: 'placeholder',
|
120
123
|
spec: placeholder
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { customPanel } from './nodes/panel';
|
2
|
+
import { layoutSectionWithSingleColumn } from './nodes/layout-section';
|
2
3
|
import { dataConsumer } from './marks/data-consumer';
|
3
4
|
import { createSchema } from './create-schema';
|
4
5
|
import { mediaSingleWithCaption } from './nodes';
|
5
6
|
|
6
7
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
7
8
|
var defaultSchemaConfig = {
|
8
|
-
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'mention', 'media', 'mediaGroup', 'mediaSingle', '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'],
|
9
|
+
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'mention', 'media', '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'],
|
9
10
|
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery' // https://product-fabric.atlassian.net/browse/ED-10214,
|
10
11
|
]
|
11
12
|
};
|
@@ -20,12 +21,14 @@ export var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
|
|
20
21
|
if (stage === 'stage0') {
|
21
22
|
defaultSchemaConfig.customNodeSpecs = {
|
22
23
|
panel: customPanel,
|
23
|
-
mediaSingle: mediaSingleWithCaption
|
24
|
+
mediaSingle: mediaSingleWithCaption,
|
25
|
+
layoutSection: layoutSectionWithSingleColumn
|
24
26
|
};
|
25
27
|
defaultSchemaConfig.customMarkSpecs = {
|
26
28
|
dataConsumer: dataConsumer
|
27
29
|
};
|
28
30
|
defaultSchemaConfig.nodes.push('caption');
|
31
|
+
defaultSchemaConfig.nodes.push('mediaInline');
|
29
32
|
}
|
30
33
|
|
31
34
|
return createSchema(defaultSchemaConfig);
|
package/dist/esm/schema/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule,
|
1
|
+
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
2
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
|
3
3
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
4
4
|
export { inlineNodes } from './inline-nodes';
|
@@ -21,8 +21,9 @@ export { default as unknownBlock } from './unknown-block';
|
|
21
21
|
export { caption } from './caption';
|
22
22
|
export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as mediaToJSON } from './media';
|
23
23
|
export { mediaGroup } from './media-group';
|
24
|
+
export { mediaInline } from './media-inline';
|
24
25
|
export { mediaSingle, mediaSingleWithCaption, toJSON as mediaSingleToJSON } from './media-single';
|
25
|
-
export { table, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames,
|
26
|
+
export { table, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
|
26
27
|
export { decisionList, decisionListSelector } from './decision-list';
|
27
28
|
export { decisionItem } from './decision-item';
|
28
29
|
export { taskList, taskListSelector } from './task-list';
|
@@ -32,7 +33,7 @@ export { inlineExtension } from './inline-extension';
|
|
32
33
|
export { bodiedExtension } from './bodied-extension';
|
33
34
|
export { date } from './date';
|
34
35
|
export { placeholder } from './placeholder';
|
35
|
-
export { layoutSection } from './layout-section';
|
36
|
+
export { layoutSection, layoutSectionWithSingleColumn } from './layout-section';
|
36
37
|
export { layoutColumn } from './layout-column';
|
37
38
|
export { inlineCard } from './inline-card';
|
38
39
|
export { blockCard } from './block-card';
|
@@ -1,8 +1,39 @@
|
|
1
1
|
/**
|
2
2
|
* @name layoutSection_node
|
3
3
|
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Need duplicate `type` and `marks` to make both validator and json-schema satisfied
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @name layoutSection_full_node
|
11
|
+
*/
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @stage 0
|
15
|
+
* @name layoutSection_with_single_column_node
|
16
|
+
*/
|
4
17
|
export var layoutSection = {
|
5
|
-
content: '(layoutColumn | unsupportedBlock){
|
18
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
19
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
20
|
+
isolating: true,
|
21
|
+
parseDOM: [{
|
22
|
+
context: 'layoutSection//|layoutColumn//',
|
23
|
+
tag: 'div[data-layout-section]',
|
24
|
+
skip: true
|
25
|
+
}, {
|
26
|
+
tag: 'div[data-layout-section]'
|
27
|
+
}],
|
28
|
+
toDOM: function toDOM() {
|
29
|
+
var attrs = {
|
30
|
+
'data-layout-section': 'true'
|
31
|
+
};
|
32
|
+
return ['div', attrs, 0];
|
33
|
+
}
|
34
|
+
};
|
35
|
+
export var layoutSectionWithSingleColumn = {
|
36
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
6
37
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
7
38
|
isolating: true,
|
8
39
|
parseDOM: [{
|
@@ -44,11 +44,16 @@ export var defaultAttrs = {
|
|
44
44
|
}
|
45
45
|
};
|
46
46
|
export var createMediaSpec = function createMediaSpec(attributes) {
|
47
|
+
var inline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
48
|
+
var domNodeType = inline ? 'span' : 'div';
|
49
|
+
var nodeName = inline ? 'mediaInline' : 'media';
|
47
50
|
return {
|
48
51
|
selectable: true,
|
52
|
+
inline: inline,
|
53
|
+
group: inline ? 'inline' : undefined,
|
49
54
|
attrs: attributes,
|
50
55
|
parseDOM: [{
|
51
|
-
tag:
|
56
|
+
tag: "".concat(domNodeType, "[data-node-type=\"").concat(nodeName, "\"]"),
|
52
57
|
getAttrs: function getAttrs(dom) {
|
53
58
|
var attrs = {};
|
54
59
|
|
@@ -99,7 +104,7 @@ export var createMediaSpec = function createMediaSpec(attributes) {
|
|
99
104
|
toDOM: function toDOM(node) {
|
100
105
|
var attrs = {
|
101
106
|
'data-id': node.attrs.id,
|
102
|
-
'data-node-type':
|
107
|
+
'data-node-type': "".concat(nodeName),
|
103
108
|
'data-type': node.attrs.type,
|
104
109
|
'data-collection': node.attrs.collection,
|
105
110
|
'data-occurrence-key': node.attrs.occurrenceKey,
|
@@ -118,7 +123,7 @@ export var createMediaSpec = function createMediaSpec(attributes) {
|
|
118
123
|
copyPrivateAttributes(node.attrs, attrs, function (key) {
|
119
124
|
return "data-".concat(camelCaseToKebabCase(key.slice(2)));
|
120
125
|
});
|
121
|
-
return [
|
126
|
+
return ["".concat(domNodeType), attrs];
|
122
127
|
}
|
123
128
|
};
|
124
129
|
};
|
@@ -7,8 +7,7 @@ export var tableHeaderSelector = "".concat(tablePrefixSelector, "-header-content
|
|
7
7
|
export var tableCellContentWrapperSelector = "".concat(tablePrefixSelector, "-cell-nodeview-wrapper");
|
8
8
|
export var tableCellContentDomSelector = "".concat(tablePrefixSelector, "-cell-nodeview-content-dom");
|
9
9
|
var DEFAULT_TABLE_HEADER_CELL_BACKGROUND = N20.toLocaleLowerCase();
|
10
|
-
|
11
|
-
var getCellAttrs = function getCellAttrs(dom) {
|
10
|
+
export var getCellAttrs = function getCellAttrs(dom) {
|
12
11
|
var defaultValues = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
13
12
|
var widthAttr = dom.getAttribute('data-colwidth');
|
14
13
|
var width = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(',').map(function (str) {
|
@@ -33,17 +32,19 @@ var getCellAttrs = function getCellAttrs(dom) {
|
|
33
32
|
};
|
34
33
|
};
|
35
34
|
|
36
|
-
|
35
|
+
/**
|
36
|
+
* gets cell dom attributes based on node attributes
|
37
|
+
* @returns CellDomAttrs
|
38
|
+
*/
|
39
|
+
export var getCellDomAttrs = function getCellDomAttrs(node) {
|
37
40
|
var attrs = {};
|
38
41
|
var nodeType = node.type.name;
|
39
|
-
var colspan = cell ? parseInt(cell.getAttribute('colspan') || '1', 10) : 1;
|
40
|
-
var rowspan = cell ? parseInt(cell.getAttribute('rowspan') || '1', 10) : 1;
|
41
42
|
|
42
|
-
if (node.attrs.colspan !==
|
43
|
+
if (node.attrs.colspan !== 1) {
|
43
44
|
attrs.colspan = node.attrs.colspan;
|
44
45
|
}
|
45
46
|
|
46
|
-
if (node.attrs.rowspan !==
|
47
|
+
if (node.attrs.rowspan !== 1) {
|
47
48
|
attrs.rowspan = node.attrs.rowspan;
|
48
49
|
}
|
49
50
|
|
@@ -201,7 +202,7 @@ export var tableCell = {
|
|
201
202
|
}
|
202
203
|
}],
|
203
204
|
toDOM: function toDOM(node) {
|
204
|
-
return ['td',
|
205
|
+
return ['td', getCellDomAttrs(node), 0];
|
205
206
|
}
|
206
207
|
};
|
207
208
|
export var toJSONTableCell = function toJSONTableCell(node) {
|
@@ -231,7 +232,7 @@ export var tableHeader = {
|
|
231
232
|
}
|
232
233
|
}],
|
233
234
|
toDOM: function toDOM(node) {
|
234
|
-
return ['th',
|
235
|
+
return ['th', getCellDomAttrs(node), 0];
|
235
236
|
}
|
236
237
|
};
|
237
238
|
export var toJSONTableHeader = toJSONTableCell;
|
@@ -68,12 +68,12 @@ export var AnalyticsStep = /*#__PURE__*/function (_Step) {
|
|
68
68
|
|
69
69
|
var _super = _createSuper(AnalyticsStep);
|
70
70
|
|
71
|
-
function AnalyticsStep(analyticsEvents)
|
72
|
-
{
|
71
|
+
function AnalyticsStep(analyticsEvents) {
|
73
72
|
var _this;
|
74
73
|
|
75
74
|
var actionsToIgnore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
76
|
-
var pos
|
75
|
+
var pos // Used to create the map, prevent splitting history.
|
76
|
+
= arguments.length > 2 ? arguments[2] : undefined;
|
77
77
|
|
78
78
|
_classCallCheck(this, AnalyticsStep);
|
79
79
|
|