@atlaskit/adf-schema 25.1.0 → 25.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/json-schema/index.js +0 -3
- package/dist/cjs/schema/bitbucket-schema.js +0 -2
- package/dist/cjs/schema/confluence-schema.js +1 -4
- package/dist/cjs/schema/create-schema.js +12 -38
- package/dist/cjs/schema/default-schema.js +3 -16
- package/dist/cjs/schema/groups.js +13 -6
- package/dist/cjs/schema/index.js +0 -5
- package/dist/cjs/schema/inline-nodes.js +0 -5
- package/dist/cjs/schema/jira-schema.js +0 -36
- package/dist/cjs/schema/marks/alignment.js +0 -2
- package/dist/cjs/schema/marks/annotation.js +2 -14
- package/dist/cjs/schema/marks/code.js +0 -5
- package/dist/cjs/schema/marks/confluence-inline-comment.js +1 -1
- package/dist/cjs/schema/marks/data-consumer.js +2 -7
- package/dist/cjs/schema/marks/em.js +0 -2
- package/dist/cjs/schema/marks/fragment.js +0 -13
- package/dist/cjs/schema/marks/indentation.js +0 -2
- package/dist/cjs/schema/marks/index.js +0 -18
- package/dist/cjs/schema/marks/link.js +0 -17
- package/dist/cjs/schema/marks/strike.js +0 -2
- package/dist/cjs/schema/marks/strong.js +2 -3
- package/dist/cjs/schema/marks/subsup.js +0 -5
- package/dist/cjs/schema/marks/text-color.js +46 -37
- package/dist/cjs/schema/marks/type-ahead-query.js +0 -3
- package/dist/cjs/schema/marks/underline.js +0 -2
- package/dist/cjs/schema/nodes/block-card.js +1 -2
- package/dist/cjs/schema/nodes/blockquote.js +1 -1
- package/dist/cjs/schema/nodes/bodied-extension.js +0 -3
- package/dist/cjs/schema/nodes/caption.js +1 -1
- package/dist/cjs/schema/nodes/code-block.js +11 -29
- package/dist/cjs/schema/nodes/date.js +1 -1
- package/dist/cjs/schema/nodes/decision-item.js +2 -4
- package/dist/cjs/schema/nodes/decision-list.js +0 -2
- package/dist/cjs/schema/nodes/doc.js +1 -1
- package/dist/cjs/schema/nodes/embed-card.js +6 -6
- package/dist/cjs/schema/nodes/emoji.js +11 -9
- package/dist/cjs/schema/nodes/expand.js +1 -4
- package/dist/cjs/schema/nodes/extension.js +0 -3
- package/dist/cjs/schema/nodes/hard-break.js +1 -1
- package/dist/cjs/schema/nodes/heading.js +2 -2
- package/dist/cjs/schema/nodes/index.js +0 -45
- package/dist/cjs/schema/nodes/inline-card.js +4 -4
- package/dist/cjs/schema/nodes/inline-extension.js +0 -3
- package/dist/cjs/schema/nodes/layout-column.js +4 -5
- package/dist/cjs/schema/nodes/layout-section.js +1 -1
- package/dist/cjs/schema/nodes/media-group.js +1 -1
- package/dist/cjs/schema/nodes/media-inline.js +0 -2
- package/dist/cjs/schema/nodes/media-single.js +3 -14
- package/dist/cjs/schema/nodes/media.js +10 -28
- package/dist/cjs/schema/nodes/mention.js +4 -14
- package/dist/cjs/schema/nodes/nested-expand.js +1 -1
- package/dist/cjs/schema/nodes/ordered-list.js +3 -17
- package/dist/cjs/schema/nodes/panel.js +1 -13
- package/dist/cjs/schema/nodes/paragraph.js +1 -6
- package/dist/cjs/schema/nodes/placeholder.js +1 -1
- package/dist/cjs/schema/nodes/rule.js +1 -1
- package/dist/cjs/schema/nodes/status.js +4 -6
- package/dist/cjs/schema/nodes/tableNodes.js +12 -39
- package/dist/cjs/schema/nodes/task-item.js +2 -4
- package/dist/cjs/schema/nodes/task-list.js +0 -2
- package/dist/cjs/schema/nodes/text.js +1 -1
- package/dist/cjs/steps/analytics.js +4 -38
- package/dist/cjs/steps/set-attrs.js +0 -26
- package/dist/cjs/steps/table/add-column.js +33 -105
- package/dist/cjs/steps/table/constants.js +0 -1
- package/dist/cjs/steps/table/sort-column.js +0 -19
- package/dist/cjs/steps/table/utils/cell-step.js +18 -49
- package/dist/cjs/steps/table/utils/cells-at-column.js +2 -21
- package/dist/cjs/steps/table/utils/find-column.js +13 -17
- package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +6 -8
- package/dist/cjs/steps/table/utils/side-effects/rows.js +23 -78
- package/dist/cjs/steps/table/utils/side-effects/side-effects.js +0 -23
- package/dist/cjs/steps/table/utils/side-effects/table.js +2 -18
- package/dist/cjs/steps/table/utils/table-map.js +0 -6
- package/dist/cjs/steps/type-ahead.js +5 -25
- package/dist/cjs/steps.js +0 -6
- package/dist/cjs/utils/colors.js +13 -36
- package/dist/cjs/utils/confluence/emoji.js +6 -13
- package/dist/cjs/utils/extensions.js +0 -8
- package/dist/cjs/utils/index.js +0 -4
- package/dist/cjs/utils/parseDOM.js +0 -2
- package/dist/cjs/utils/url.js +3 -20
- package/dist/cjs/utils/uuid.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/schema/bitbucket-schema.js +1 -1
- package/dist/es2019/schema/confluence-schema.js +1 -2
- package/dist/es2019/schema/create-schema.js +12 -25
- package/dist/es2019/schema/default-schema.js +3 -11
- package/dist/es2019/schema/groups.js +13 -6
- package/dist/es2019/schema/index.js +1 -2
- package/dist/es2019/schema/jira-schema.js +0 -24
- package/dist/es2019/schema/marks/alignment.js +1 -3
- package/dist/es2019/schema/marks/annotation.js +3 -9
- package/dist/es2019/schema/marks/breakout.js +0 -4
- package/dist/es2019/schema/marks/code.js +1 -5
- package/dist/es2019/schema/marks/confluence-inline-comment.js +1 -2
- package/dist/es2019/schema/marks/data-consumer.js +3 -5
- package/dist/es2019/schema/marks/em.js +1 -2
- package/dist/es2019/schema/marks/fragment.js +0 -8
- package/dist/es2019/schema/marks/indentation.js +0 -4
- package/dist/es2019/schema/marks/link.js +2 -11
- package/dist/es2019/schema/marks/strike.js +1 -2
- package/dist/es2019/schema/marks/strong.js +3 -7
- package/dist/es2019/schema/marks/subsup.js +0 -6
- package/dist/es2019/schema/marks/text-color.js +44 -29
- package/dist/es2019/schema/marks/type-ahead-query.js +0 -2
- package/dist/es2019/schema/marks/underline.js +1 -2
- package/dist/es2019/schema/marks/unsupported-mark.js +0 -1
- package/dist/es2019/schema/marks/unsupported-node-attributes.js +0 -1
- package/dist/es2019/schema/nodes/block-card.js +1 -3
- package/dist/es2019/schema/nodes/blockquote.js +1 -2
- package/dist/es2019/schema/nodes/bodied-extension.js +0 -4
- package/dist/es2019/schema/nodes/bullet-list.js +0 -2
- package/dist/es2019/schema/nodes/caption.js +1 -2
- package/dist/es2019/schema/nodes/code-block.js +11 -28
- package/dist/es2019/schema/nodes/confluence-jira-issue.js +0 -2
- package/dist/es2019/schema/nodes/confluence-unsupported-block.js +0 -4
- package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +0 -4
- package/dist/es2019/schema/nodes/date.js +1 -2
- package/dist/es2019/schema/nodes/decision-item.js +0 -2
- package/dist/es2019/schema/nodes/decision-list.js +1 -2
- package/dist/es2019/schema/nodes/doc.js +1 -0
- package/dist/es2019/schema/nodes/embed-card.js +1 -2
- package/dist/es2019/schema/nodes/emoji.js +9 -6
- package/dist/es2019/schema/nodes/expand.js +1 -3
- package/dist/es2019/schema/nodes/extension.js +0 -4
- package/dist/es2019/schema/nodes/hard-break.js +1 -2
- package/dist/es2019/schema/nodes/heading.js +2 -3
- package/dist/es2019/schema/nodes/image.js +0 -4
- package/dist/es2019/schema/nodes/inline-card.js +4 -5
- package/dist/es2019/schema/nodes/inline-extension.js +0 -4
- package/dist/es2019/schema/nodes/layout-column.js +4 -6
- package/dist/es2019/schema/nodes/layout-section.js +1 -4
- package/dist/es2019/schema/nodes/list-item.js +0 -2
- package/dist/es2019/schema/nodes/media-group.js +1 -2
- package/dist/es2019/schema/nodes/media-single.js +3 -6
- package/dist/es2019/schema/nodes/media.js +10 -20
- package/dist/es2019/schema/nodes/mention.js +0 -11
- package/dist/es2019/schema/nodes/nested-expand.js +1 -2
- package/dist/es2019/schema/nodes/ordered-list.js +4 -14
- package/dist/es2019/schema/nodes/panel.js +3 -10
- package/dist/es2019/schema/nodes/paragraph.js +1 -7
- package/dist/es2019/schema/nodes/placeholder.js +1 -2
- package/dist/es2019/schema/nodes/rule.js +1 -2
- package/dist/es2019/schema/nodes/status.js +1 -2
- package/dist/es2019/schema/nodes/tableNodes.js +10 -26
- package/dist/es2019/schema/nodes/task-item.js +0 -2
- package/dist/es2019/schema/nodes/task-list.js +0 -2
- package/dist/es2019/schema/nodes/text.js +1 -0
- package/dist/es2019/schema/nodes/unknown-block.js +0 -2
- package/dist/es2019/schema/nodes/unsupported-block.js +0 -2
- package/dist/es2019/schema/nodes/unsupported-inline.js +0 -2
- package/dist/es2019/steps/analytics.js +13 -30
- package/dist/es2019/steps/set-attrs.js +3 -12
- package/dist/es2019/steps/table/add-column.js +33 -76
- package/dist/es2019/steps/table/constants.js +0 -1
- package/dist/es2019/steps/table/sort-column.js +1 -8
- package/dist/es2019/steps/table/utils/cell-step.js +15 -32
- package/dist/es2019/steps/table/utils/cells-at-column.js +6 -11
- package/dist/es2019/steps/table/utils/find-column.js +12 -15
- package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +7 -6
- package/dist/es2019/steps/table/utils/side-effects/rows.js +19 -59
- package/dist/es2019/steps/table/utils/side-effects/side-effects.js +0 -21
- package/dist/es2019/steps/table/utils/side-effects/table.js +0 -17
- package/dist/es2019/steps/type-ahead.js +3 -15
- package/dist/es2019/utils/colors.js +8 -18
- package/dist/es2019/utils/confluence/emoji.js +5 -8
- package/dist/es2019/utils/extensions.js +0 -4
- package/dist/es2019/utils/url.js +2 -12
- package/dist/es2019/utils/uuid.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/schema/bitbucket-schema.js +1 -1
- package/dist/esm/schema/confluence-schema.js +1 -2
- package/dist/esm/schema/create-schema.js +12 -31
- package/dist/esm/schema/default-schema.js +3 -11
- package/dist/esm/schema/groups.js +13 -6
- package/dist/esm/schema/index.js +1 -2
- package/dist/esm/schema/jira-schema.js +0 -24
- package/dist/esm/schema/marks/alignment.js +1 -1
- package/dist/esm/schema/marks/annotation.js +3 -11
- package/dist/esm/schema/marks/code.js +1 -3
- package/dist/esm/schema/marks/confluence-inline-comment.js +1 -0
- package/dist/esm/schema/marks/data-consumer.js +3 -3
- package/dist/esm/schema/marks/em.js +1 -0
- package/dist/esm/schema/marks/fragment.js +0 -9
- package/dist/esm/schema/marks/link.js +0 -12
- package/dist/esm/schema/marks/strike.js +1 -0
- package/dist/esm/schema/marks/strong.js +3 -1
- package/dist/esm/schema/marks/subsup.js +0 -4
- package/dist/esm/schema/marks/text-color.js +46 -30
- package/dist/esm/schema/marks/underline.js +1 -0
- package/dist/esm/schema/nodes/block-card.js +1 -1
- package/dist/esm/schema/nodes/blockquote.js +1 -0
- package/dist/esm/schema/nodes/bodied-extension.js +0 -2
- package/dist/esm/schema/nodes/caption.js +1 -0
- package/dist/esm/schema/nodes/code-block.js +11 -26
- package/dist/esm/schema/nodes/date.js +1 -0
- package/dist/esm/schema/nodes/decision-item.js +2 -2
- package/dist/esm/schema/nodes/decision-list.js +1 -0
- package/dist/esm/schema/nodes/doc.js +1 -0
- package/dist/esm/schema/nodes/embed-card.js +6 -5
- package/dist/esm/schema/nodes/emoji.js +12 -7
- package/dist/esm/schema/nodes/expand.js +1 -1
- package/dist/esm/schema/nodes/extension.js +0 -2
- package/dist/esm/schema/nodes/hard-break.js +1 -0
- package/dist/esm/schema/nodes/heading.js +2 -1
- package/dist/esm/schema/nodes/inline-card.js +4 -3
- package/dist/esm/schema/nodes/inline-extension.js +0 -2
- package/dist/esm/schema/nodes/layout-column.js +4 -4
- package/dist/esm/schema/nodes/layout-section.js +1 -0
- package/dist/esm/schema/nodes/media-group.js +1 -0
- package/dist/esm/schema/nodes/media-single.js +3 -8
- package/dist/esm/schema/nodes/media.js +10 -18
- package/dist/esm/schema/nodes/mention.js +4 -13
- package/dist/esm/schema/nodes/nested-expand.js +1 -0
- package/dist/esm/schema/nodes/ordered-list.js +3 -13
- package/dist/esm/schema/nodes/panel.js +1 -10
- package/dist/esm/schema/nodes/paragraph.js +1 -5
- package/dist/esm/schema/nodes/placeholder.js +1 -0
- package/dist/esm/schema/nodes/rule.js +1 -0
- package/dist/esm/schema/nodes/status.js +5 -4
- package/dist/esm/schema/nodes/tableNodes.js +12 -25
- package/dist/esm/schema/nodes/task-item.js +2 -2
- package/dist/esm/schema/nodes/text.js +1 -0
- package/dist/esm/steps/analytics.js +5 -31
- package/dist/esm/steps/set-attrs.js +1 -17
- package/dist/esm/steps/table/add-column.js +33 -91
- package/dist/esm/steps/table/constants.js +0 -1
- package/dist/esm/steps/table/sort-column.js +1 -10
- package/dist/esm/steps/table/utils/cell-step.js +18 -42
- package/dist/esm/steps/table/utils/cells-at-column.js +2 -18
- package/dist/esm/steps/table/utils/find-column.js +13 -16
- package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +7 -6
- package/dist/esm/steps/table/utils/side-effects/rows.js +23 -76
- package/dist/esm/steps/table/utils/side-effects/side-effects.js +0 -18
- package/dist/esm/steps/table/utils/side-effects/table.js +2 -13
- package/dist/esm/steps/type-ahead.js +6 -18
- package/dist/esm/utils/colors.js +12 -23
- package/dist/esm/utils/confluence/emoji.js +6 -10
- package/dist/esm/utils/extensions.js +0 -4
- package/dist/esm/utils/url.js +2 -12
- package/dist/esm/version.json +1 -1
- package/dist/types/schema/default-schema.d.ts +1 -1
- package/dist/types/utils/colors.d.ts +1 -1
- package/package.json +2 -2
@@ -52,18 +52,17 @@ export const T75 = '#B3F5FF';
|
|
52
52
|
export const T100 = '#79E2F2';
|
53
53
|
export const T300 = '#00B8D9';
|
54
54
|
export const T500 = '#008DA6';
|
55
|
+
|
55
56
|
/**
|
56
|
-
* @return String with HEX-coded color
|
57
|
+
* @return String with HEX-coded color.
|
57
58
|
*/
|
58
|
-
|
59
59
|
export function normalizeHexColor(color, defaultColor) {
|
60
60
|
if (!color) {
|
61
61
|
return null;
|
62
|
-
}
|
63
|
-
|
62
|
+
}
|
64
63
|
|
64
|
+
// Normalize to hex
|
65
65
|
color = color.trim().toLowerCase();
|
66
|
-
|
67
66
|
if (isHex(color)) {
|
68
67
|
// Normalize 3-hex to 6-hex colours
|
69
68
|
if (color.length === 4) {
|
@@ -83,55 +82,46 @@ export function normalizeHexColor(color, defaultColor) {
|
|
83
82
|
return null;
|
84
83
|
}
|
85
84
|
}
|
86
|
-
|
87
85
|
if (color === defaultColor) {
|
88
86
|
return null;
|
89
87
|
}
|
90
|
-
|
91
88
|
return color;
|
92
89
|
}
|
90
|
+
|
93
91
|
/**
|
94
92
|
* Converts hex color format to rgb.
|
95
93
|
* Works well with full hex color format and shortcut as well.
|
96
94
|
*
|
97
95
|
* @param hex - hex color string (#xxx, or #xxxxxx)
|
98
96
|
*/
|
99
|
-
|
100
97
|
export function hexToRgb(color) {
|
101
98
|
if (!isHex(color)) {
|
102
99
|
return null;
|
103
100
|
}
|
104
|
-
|
105
101
|
let colorBits = color.substring(1).split('');
|
106
|
-
|
107
102
|
if (colorBits.length === 3) {
|
108
103
|
colorBits = [colorBits[0], colorBits[0], colorBits[1], colorBits[1], colorBits[2], colorBits[2]];
|
109
104
|
}
|
110
|
-
|
111
|
-
|
112
|
-
|
105
|
+
const rgb = Number(`0x${colorBits.join('')}`);
|
106
|
+
// eslint-disable-next-line no-bitwise
|
113
107
|
return `rgb(${rgb >> 16 & 255},${rgb >> 8 & 255},${rgb & 255})`;
|
114
108
|
}
|
109
|
+
|
115
110
|
/**
|
116
111
|
* Converts hex color format to rgba.
|
117
112
|
*
|
118
113
|
* @param hex - hex color string (#xxx, or #xxxxxx)
|
119
114
|
*/
|
120
|
-
|
121
115
|
export function hexToRgba(rawColor, alpha) {
|
122
116
|
let color = normalizeHexColor(rawColor);
|
123
|
-
|
124
117
|
if (!color) {
|
125
118
|
return null;
|
126
119
|
}
|
127
|
-
|
128
120
|
const hex2rgb = color => color.match(/[a-z0-9]{2}/gi).map(hex => parseInt(hex, 16));
|
129
|
-
|
130
121
|
return `rgba(${hex2rgb(color).concat(alpha).join(',')})`;
|
131
122
|
}
|
132
123
|
export function rgbToHex(value) {
|
133
124
|
const matches = value.match(/(0?\.?\d{1,3})%?\b/g);
|
134
|
-
|
135
125
|
if (matches && matches.length >= 3) {
|
136
126
|
const [red, green, blue] = matches.map(Number);
|
137
127
|
return '#' + (blue | green << 8 | red << 16 | 1 << 24).toString(16).slice(1) // eslint-disable-line no-bitwise
|
@@ -1,9 +1,12 @@
|
|
1
1
|
// Default emoji id for Confluence glyphs that has no match to Fabric Emoji
|
2
|
-
const DEFAULT_EMOJI_ID = '2b50';
|
2
|
+
const DEFAULT_EMOJI_ID = '2b50';
|
3
3
|
|
4
|
-
|
4
|
+
// Default ac:name for emoticons as a fallback is `blue-star`
|
5
|
+
const DEFAULT_EMOJI_ACNAME = 'blue-star';
|
5
6
|
|
7
|
+
// ac:hipchat-emoticon prefix when converting to Emoji ID
|
6
8
|
const HC_EMOTICON_PREFIX = 'atlassian-';
|
9
|
+
|
7
10
|
/**
|
8
11
|
* Confluence glyphs ac:name of <ac:emoticon /> map to new emojis
|
9
12
|
* {
|
@@ -13,7 +16,6 @@ const HC_EMOTICON_PREFIX = 'atlassian-';
|
|
13
16
|
* Glyphs that do not map to Fabric Emoji
|
14
17
|
* will be mapped to Emoji Id '2b50' (:star:) with preserving ac:name as shortName attribute;
|
15
18
|
*/
|
16
|
-
|
17
19
|
const acNameToEmojiMap = {
|
18
20
|
smile: ['1f642', ':slight_smile:', '\uD83D\uDE42'],
|
19
21
|
sad: ['1f641', ':slight_frown:', '\uD83D\uDE41'],
|
@@ -52,7 +54,6 @@ export function acNameToEmoji(acName) {
|
|
52
54
|
}
|
53
55
|
export function emojiIdToAcName(emojiId) {
|
54
56
|
const filterEmojis = acName => acNameToEmojiMap[acName] ? acNameToEmojiMap[acName][0] === emojiId : false;
|
55
|
-
|
56
57
|
return Object.keys(acNameToEmojiMap).filter(filterEmojis)[0];
|
57
58
|
}
|
58
59
|
export function acShortcutToEmoji(hipchatEmoticonShortName) {
|
@@ -62,22 +63,18 @@ export function acShortcutToEmoji(hipchatEmoticonShortName) {
|
|
62
63
|
text: ''
|
63
64
|
};
|
64
65
|
}
|
65
|
-
|
66
66
|
function getAcNameFromShortName(shortName) {
|
67
67
|
return shortName.slice(shortName[0] === ':' ? 1 : 0, shortName[shortName.length - 1] === ':' ? -1 : shortName.length);
|
68
68
|
}
|
69
|
-
|
70
69
|
export function getEmojiAcName({
|
71
70
|
id,
|
72
71
|
shortName
|
73
72
|
}) {
|
74
73
|
if (DEFAULT_EMOJI_ID === id) {
|
75
74
|
const possibleName = getAcNameFromShortName(shortName);
|
76
|
-
|
77
75
|
if (possibleName in acNameToEmojiMap) {
|
78
76
|
return possibleName;
|
79
77
|
}
|
80
78
|
}
|
81
|
-
|
82
79
|
return emojiIdToAcName(id) || DEFAULT_EMOJI_ACNAME;
|
83
80
|
}
|
@@ -4,11 +4,9 @@ export const isValidLayout = name => {
|
|
4
4
|
export const getExtensionAttrs = (dom, isInline = false) => {
|
5
5
|
const extensionType = dom.getAttribute('data-extension-type');
|
6
6
|
const extensionKey = dom.getAttribute('data-extension-key');
|
7
|
-
|
8
7
|
if (!extensionType || !extensionKey) {
|
9
8
|
return false;
|
10
9
|
}
|
11
|
-
|
12
10
|
const attrs = {
|
13
11
|
extensionType,
|
14
12
|
extensionKey,
|
@@ -16,11 +14,9 @@ export const getExtensionAttrs = (dom, isInline = false) => {
|
|
16
14
|
parameters: JSON.parse(dom.getAttribute('data-parameters') || '{}'),
|
17
15
|
localId: dom.getAttribute('data-local-id') || undefined
|
18
16
|
};
|
19
|
-
|
20
17
|
if (!isInline) {
|
21
18
|
const rawLayout = dom.getAttribute('data-layout');
|
22
19
|
attrs.layout = isValidLayout(rawLayout) ? rawLayout : 'default';
|
23
20
|
}
|
24
|
-
|
25
21
|
return attrs;
|
26
22
|
};
|
package/dist/es2019/utils/url.js
CHANGED
@@ -4,17 +4,15 @@
|
|
4
4
|
*/
|
5
5
|
import LinkifyIt from 'linkify-it';
|
6
6
|
const whitelistedURLPatterns = [/^https?:\/\//im, /^ftps?:\/\//im, /^jamfselfservice:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:/im, /^facetime:/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im, /^#/im];
|
7
|
+
|
7
8
|
/**
|
8
9
|
* Please notify the Editor Mobile team (Slack: #help-mobilekit) if the logic for this changes.
|
9
10
|
*/
|
10
|
-
|
11
11
|
export const isSafeUrl = url => {
|
12
12
|
const urlTrimmed = url.trim();
|
13
|
-
|
14
13
|
if (urlTrimmed.length === 0) {
|
15
14
|
return true;
|
16
15
|
}
|
17
|
-
|
18
16
|
return whitelistedURLPatterns.some(p => p.test(urlTrimmed));
|
19
17
|
};
|
20
18
|
export const linkify = LinkifyIt();
|
@@ -27,17 +25,13 @@ linkify.tlds(tlds, false);
|
|
27
25
|
export const LINK_REGEXP = /(https?|ftp|jamfselfservice):\/\/[^\s]+/;
|
28
26
|
export const linkifyMatch = text => {
|
29
27
|
const matches = [];
|
30
|
-
|
31
28
|
if (!LINK_REGEXP.test(text)) {
|
32
29
|
return matches;
|
33
30
|
}
|
34
|
-
|
35
31
|
let startpos = 0;
|
36
32
|
let substr;
|
37
|
-
|
38
33
|
while (substr = text.substr(startpos)) {
|
39
34
|
const link = (substr.match(LINK_REGEXP) || [''])[0];
|
40
|
-
|
41
35
|
if (link) {
|
42
36
|
const index = substr.search(LINK_REGEXP);
|
43
37
|
const start = index >= 0 ? index + startpos : index;
|
@@ -55,26 +49,22 @@ export const linkifyMatch = text => {
|
|
55
49
|
break;
|
56
50
|
}
|
57
51
|
}
|
58
|
-
|
59
52
|
return matches;
|
60
53
|
};
|
61
54
|
export function getLinkMatch(str) {
|
62
55
|
if (!str) {
|
63
56
|
return null;
|
64
57
|
}
|
65
|
-
|
66
58
|
let match = linkifyMatch(str);
|
67
|
-
|
68
59
|
if (!match.length) {
|
69
60
|
match = linkify.match(str);
|
70
61
|
}
|
71
|
-
|
72
62
|
return match && match[0];
|
73
63
|
}
|
64
|
+
|
74
65
|
/**
|
75
66
|
* Adds protocol to url if needed.
|
76
67
|
*/
|
77
|
-
|
78
68
|
export function normalizeUrl(url) {
|
79
69
|
const match = getLinkMatch(url);
|
80
70
|
return match && match.url || '';
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette,
|
2
|
-
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
1
|
+
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
2
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, 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';
|
4
3
|
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, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { createSchema } from './create-schema';
|
2
|
+
|
2
3
|
/**
|
3
4
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
4
5
|
**/
|
5
|
-
|
6
6
|
export var bitbucketSchema = createSchema({
|
7
7
|
nodes: ['doc', 'caption', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'hardBreak', 'rule', 'image', 'media', 'mediaSingle', 'mention', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'],
|
8
8
|
marks: ['em', 'strong', 'strike', 'link', 'code', 'unsupportedMark', 'unsupportedNodeAttribute']
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { createSchema } from './create-schema';
|
2
2
|
var nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaInline', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
|
3
3
|
var marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
|
4
|
+
|
4
5
|
/**
|
5
6
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
6
7
|
**/
|
7
|
-
|
8
8
|
export var confluenceSchema = createSchema({
|
9
9
|
nodes: nodes,
|
10
10
|
marks: marks
|
@@ -12,7 +12,6 @@ export var confluenceSchema = createSchema({
|
|
12
12
|
/**
|
13
13
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
14
14
|
**/
|
15
|
-
|
16
15
|
export var confluenceSchemaWithMediaSingle = createSchema({
|
17
16
|
nodes: nodes.concat('mediaSingle'),
|
18
17
|
marks: marks
|
@@ -1,56 +1,47 @@
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
-
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
4
|
-
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
6
|
-
|
7
4
|
import { Schema } from 'prosemirror-model';
|
8
5
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
9
6
|
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment } from './marks';
|
10
7
|
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaGroup, mediaSingleWithCaption, 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
|
-
|
12
8
|
function addItems(builtInItems, config) {
|
13
9
|
var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
14
|
-
|
15
10
|
if (!config) {
|
16
11
|
return {};
|
17
12
|
}
|
13
|
+
|
18
14
|
/**
|
19
15
|
* Add built-in Node / Mark specs
|
20
16
|
*/
|
21
|
-
|
22
|
-
|
23
17
|
var items = builtInItems.reduce(function (items, _ref) {
|
24
18
|
var name = _ref.name,
|
25
|
-
|
26
|
-
|
19
|
+
spec = _ref.spec;
|
27
20
|
if (config.indexOf(name) !== -1) {
|
28
21
|
items[name] = customSpecs[name] || spec;
|
29
22
|
}
|
30
|
-
|
31
23
|
return items;
|
32
24
|
}, {});
|
25
|
+
|
33
26
|
/**
|
34
27
|
* Add Custom Node / Mark specs
|
35
28
|
*/
|
36
|
-
|
37
29
|
return Object.keys(customSpecs).reduce(function (items, name) {
|
38
30
|
if (items[name]) {
|
39
31
|
return items;
|
40
32
|
}
|
41
|
-
|
42
33
|
items[name] = customSpecs[name];
|
43
34
|
return items;
|
44
35
|
}, items);
|
45
|
-
}
|
36
|
+
}
|
37
|
+
|
38
|
+
// We use groups to allow schemas to be constructed in different shapes without changing node/mark
|
46
39
|
// specs, but this means nodes/marks are defined with groups that might never be used in the schema.
|
47
40
|
// In this scenario ProseMirror will complain and prevent the schema from being constructed.
|
48
41
|
//
|
49
42
|
// To avoid the problem, we include items that serve to "declare" the groups in the schema. This
|
50
43
|
// approach unfortunately leaves unused items in the schema, but has the benefit of avoiding the
|
51
44
|
// need to manipulate `exclude` or content expression values for potentially every schema item.
|
52
|
-
|
53
|
-
|
54
45
|
function groupDeclaration(name) {
|
55
46
|
return {
|
56
47
|
name: "__".concat(name, "GroupDeclaration"),
|
@@ -59,7 +50,6 @@ function groupDeclaration(name) {
|
|
59
50
|
}
|
60
51
|
};
|
61
52
|
}
|
62
|
-
|
63
53
|
var markGroupDeclarations = [groupDeclaration(COLOR), groupDeclaration(FONT_STYLE), groupDeclaration(SEARCH_QUERY), groupDeclaration(LINK)];
|
64
54
|
var markGroupDeclarationsNames = markGroupDeclarations.map(function (groupMark) {
|
65
55
|
return groupMark.name;
|
@@ -261,13 +251,13 @@ var marksInOrder = [{
|
|
261
251
|
name: 'unsupportedNodeAttribute',
|
262
252
|
spec: unsupportedNodeAttribute
|
263
253
|
}]);
|
254
|
+
|
264
255
|
/**
|
265
256
|
* Creates a schema preserving order of marks and nodes.
|
266
257
|
*/
|
267
|
-
|
268
258
|
export function createSchema(config) {
|
269
259
|
var customNodeSpecs = config.customNodeSpecs,
|
270
|
-
|
260
|
+
customMarkSpecs = config.customMarkSpecs;
|
271
261
|
var nodesConfig = Object.keys(customNodeSpecs || {}).concat(config.nodes);
|
272
262
|
var marksConfig = Object.keys(customMarkSpecs || {}).concat(config.marks || []).concat(markGroupDeclarationsNames);
|
273
263
|
var nodes = addItems(nodesInOrder, nodesConfig, customNodeSpecs);
|
@@ -282,17 +272,14 @@ export function sanitizeNodes(nodes, supportedMarks) {
|
|
282
272
|
var nodeNames = Object.keys(nodes);
|
283
273
|
nodeNames.forEach(function (nodeKey) {
|
284
274
|
var nodeSpec = _objectSpread({}, nodes[nodeKey]);
|
285
|
-
|
286
275
|
if (nodeSpec.marks && nodeSpec.marks !== '_') {
|
287
276
|
nodeSpec.marks = nodeSpec.marks.split(' ').filter(function (mark) {
|
288
277
|
return !!supportedMarks[mark];
|
289
278
|
}).join(' ');
|
290
279
|
}
|
291
|
-
|
292
280
|
if (nodeSpec.content) {
|
293
281
|
nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
|
294
282
|
}
|
295
|
-
|
296
283
|
nodes[nodeKey] = nodeSpec;
|
297
284
|
});
|
298
285
|
return nodes;
|
@@ -307,37 +294,31 @@ export function sanitizeNodeSpecContent(nodes, rawContent) {
|
|
307
294
|
return sanitizedContent(newContent, nodeName);
|
308
295
|
}, rawContent);
|
309
296
|
}
|
310
|
-
|
311
297
|
function sanitizedContent(content, invalidContent) {
|
312
298
|
if (!invalidContent.length) {
|
313
299
|
return content || '';
|
314
300
|
}
|
315
|
-
|
316
301
|
if (!content || !content.match(/\w/)) {
|
317
302
|
return '';
|
318
303
|
}
|
319
|
-
|
320
304
|
var pattern = "(".concat(invalidContent, "((\\s)*\\|)+)|((\\|(\\s)*)+").concat(invalidContent, ")|(").concat(invalidContent, "$)|(").concat(invalidContent, "(\\+|\\*))");
|
321
305
|
return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
|
322
306
|
}
|
323
|
-
|
324
307
|
function isContentSupported(nodes, contentKey) {
|
325
|
-
var nodeKeys = Object.keys(nodes);
|
308
|
+
var nodeKeys = Object.keys(nodes);
|
326
309
|
|
310
|
+
// content is with valid node
|
327
311
|
if (nodeKeys.indexOf(contentKey) > -1) {
|
328
312
|
return true;
|
329
|
-
}
|
330
|
-
|
313
|
+
}
|
331
314
|
|
315
|
+
// content is with valid group
|
332
316
|
for (var supportedKey in nodes) {
|
333
317
|
var nodeSpec = nodes[supportedKey];
|
334
|
-
|
335
318
|
if (nodeSpec && nodeSpec.group === contentKey) {
|
336
319
|
return true;
|
337
320
|
}
|
338
321
|
}
|
339
|
-
|
340
322
|
return false;
|
341
323
|
}
|
342
|
-
|
343
324
|
export var allowCustomPanel = true;
|
@@ -1,31 +1,23 @@
|
|
1
1
|
import { layoutSectionWithSingleColumn } from './nodes';
|
2
|
-
import { fragment } from './marks';
|
3
2
|
import { createSchema } from './create-schema';
|
4
|
-
|
5
3
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
6
4
|
var defaultSchemaConfig = {
|
7
5
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', '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'],
|
8
|
-
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery'
|
9
|
-
|
6
|
+
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
|
7
|
+
// https://product-fabric.atlassian.net/browse/ED-10214,
|
8
|
+
'fragment']
|
10
9
|
};
|
11
10
|
return defaultSchemaConfig;
|
12
11
|
};
|
13
|
-
|
14
12
|
export var defaultSchemaConfig = getDefaultSchemaConfig();
|
15
13
|
export var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
|
16
14
|
var stage = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'final';
|
17
15
|
var defaultSchemaConfig = getDefaultSchemaConfig();
|
18
|
-
|
19
16
|
if (stage === 'stage0') {
|
20
17
|
defaultSchemaConfig.customNodeSpecs = {
|
21
18
|
layoutSection: layoutSectionWithSingleColumn
|
22
19
|
};
|
23
|
-
defaultSchemaConfig.customMarkSpecs = {
|
24
|
-
fragment: fragment
|
25
|
-
};
|
26
|
-
defaultSchemaConfig.nodes.push('mediaInline');
|
27
20
|
}
|
28
|
-
|
29
21
|
return createSchema(defaultSchemaConfig);
|
30
22
|
};
|
31
23
|
export var defaultSchema = getSchemaBasedOnStage();
|
@@ -7,17 +7,24 @@
|
|
7
7
|
//
|
8
8
|
// Groups provide a level of indirection, and solve this problem. For the immediate use-case, one
|
9
9
|
// group called "not_code" would have sufficed, but this an ultra-specialised to code.
|
10
|
+
|
10
11
|
// Mark group for font styling (e.g. bold, italic, underline, superscript).
|
11
|
-
export var FONT_STYLE = 'fontStyle';
|
12
|
+
export var FONT_STYLE = 'fontStyle';
|
13
|
+
|
14
|
+
// Marks group for search queries.
|
15
|
+
export var SEARCH_QUERY = 'searchQuery';
|
12
16
|
|
13
|
-
|
17
|
+
// Marks group for links.
|
18
|
+
export var LINK = 'link';
|
14
19
|
|
15
|
-
|
20
|
+
// Marks group for colors (text-color, background-color, etc).
|
21
|
+
export var COLOR = 'color';
|
16
22
|
|
17
|
-
|
23
|
+
// They need to be on their own group so that they can exclude each other
|
18
24
|
// and also work when one of them is disabled.
|
19
|
-
// Marks group for alignment.
|
20
25
|
|
21
|
-
|
26
|
+
// Marks group for alignment.
|
27
|
+
export var ALIGNMENT = 'alignment';
|
22
28
|
|
29
|
+
// Marks group for indentation.
|
23
30
|
export var INDENTATION = 'indentation';
|
package/dist/esm/schema/index.js
CHANGED
@@ -1,6 +1,5 @@
|
|
1
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, orderedListWithOrder, panel, 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
|
-
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette,
|
3
|
-
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
2
|
+
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
4
3
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
|
5
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
6
5
|
export { inlineNodes } from './inline-nodes';
|
@@ -1,57 +1,44 @@
|
|
1
1
|
import { createSchema } from './create-schema';
|
2
|
-
|
3
2
|
/**
|
4
3
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
5
4
|
**/
|
6
5
|
export default function makeSchema(config) {
|
7
6
|
var nodes = ['doc', 'paragraph', 'text', 'hardBreak', 'heading', 'rule'];
|
8
7
|
var marks = ['strong', 'em', 'underline', 'typeAheadQuery', 'unsupportedMark', 'unsupportedNodeAttribute'];
|
9
|
-
|
10
8
|
if (config.allowLinks) {
|
11
9
|
marks.push('link');
|
12
10
|
}
|
13
|
-
|
14
11
|
if (config.allowLists) {
|
15
12
|
nodes.push('orderedList', 'bulletList', 'listItem');
|
16
13
|
}
|
17
|
-
|
18
14
|
if (config.allowMentions) {
|
19
15
|
nodes.push('mention');
|
20
16
|
marks.push('mentionQuery');
|
21
17
|
}
|
22
|
-
|
23
18
|
if (config.allowEmojis) {
|
24
19
|
nodes.push('emoji');
|
25
20
|
}
|
26
|
-
|
27
21
|
if (config.allowAdvancedTextFormatting) {
|
28
22
|
marks.push('strike', 'code');
|
29
23
|
}
|
30
|
-
|
31
24
|
if (config.allowSubSup) {
|
32
25
|
marks.push('subsup');
|
33
26
|
}
|
34
|
-
|
35
27
|
if (config.allowCodeBlock) {
|
36
28
|
nodes.push('codeBlock');
|
37
29
|
}
|
38
|
-
|
39
30
|
if (config.allowBlockQuote) {
|
40
31
|
nodes.push('blockquote');
|
41
32
|
}
|
42
|
-
|
43
33
|
if (config.allowMedia) {
|
44
34
|
nodes.push('mediaGroup', 'mediaSingle', 'media', 'caption', 'mediaInline');
|
45
35
|
}
|
46
|
-
|
47
36
|
if (config.allowTextColor) {
|
48
37
|
marks.push('textColor');
|
49
38
|
}
|
50
|
-
|
51
39
|
if (config.allowTables) {
|
52
40
|
nodes.push('table', 'tableCell', 'tableHeader', 'tableRow');
|
53
41
|
}
|
54
|
-
|
55
42
|
return createSchema({
|
56
43
|
nodes: nodes,
|
57
44
|
marks: marks
|
@@ -60,77 +47,66 @@ export default function makeSchema(config) {
|
|
60
47
|
/**
|
61
48
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
62
49
|
**/
|
63
|
-
|
64
50
|
export function isSchemaWithLists(schema) {
|
65
51
|
return !!schema.nodes.bulletList;
|
66
52
|
}
|
67
53
|
/**
|
68
54
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
69
55
|
**/
|
70
|
-
|
71
56
|
export function isSchemaWithMentions(schema) {
|
72
57
|
return !!schema.nodes.mention;
|
73
58
|
}
|
74
59
|
/**
|
75
60
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
76
61
|
**/
|
77
|
-
|
78
62
|
export function isSchemaWithEmojis(schema) {
|
79
63
|
return !!schema.nodes.emoji;
|
80
64
|
}
|
81
65
|
/**
|
82
66
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
83
67
|
**/
|
84
|
-
|
85
68
|
export function isSchemaWithLinks(schema) {
|
86
69
|
return !!schema.marks.link;
|
87
70
|
}
|
88
71
|
/**
|
89
72
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
90
73
|
**/
|
91
|
-
|
92
74
|
export function isSchemaWithAdvancedTextFormattingMarks(schema) {
|
93
75
|
return !!schema.marks.code && !!schema.marks.strike;
|
94
76
|
}
|
95
77
|
/**
|
96
78
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
97
79
|
**/
|
98
|
-
|
99
80
|
export function isSchemaWithSubSupMark(schema) {
|
100
81
|
return !!schema.marks.subsup;
|
101
82
|
}
|
102
83
|
/**
|
103
84
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
104
85
|
**/
|
105
|
-
|
106
86
|
export function isSchemaWithCodeBlock(schema) {
|
107
87
|
return !!schema.nodes.codeBlock;
|
108
88
|
}
|
109
89
|
/**
|
110
90
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
111
91
|
**/
|
112
|
-
|
113
92
|
export function isSchemaWithBlockQuotes(schema) {
|
114
93
|
return !!schema.nodes.blockquote;
|
115
94
|
}
|
116
95
|
/**
|
117
96
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
118
97
|
**/
|
119
|
-
|
120
98
|
export function isSchemaWithMedia(schema) {
|
121
99
|
return !!schema.nodes.mediaGroup && !!schema.nodes.media && !!schema.nodes.mediaInline;
|
122
100
|
}
|
123
101
|
/**
|
124
102
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
125
103
|
**/
|
126
|
-
|
127
104
|
export function isSchemaWithTextColor(schema) {
|
128
105
|
return !!schema.marks.textColor;
|
129
106
|
}
|
130
107
|
/**
|
131
108
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
132
109
|
**/
|
133
|
-
|
134
110
|
export function isSchemaWithTables(schema) {
|
135
111
|
return !!schema.nodes.table && !!schema.nodes.tableCell && !!schema.nodes.tableHeader && !!schema.nodes.tableRow;
|
136
112
|
}
|