@atlaskit/adf-schema 19.2.3 → 19.3.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 +14 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/schema/create-schema.js +5 -1
- package/dist/cjs/schema/default-schema.js +4 -8
- package/dist/cjs/schema/marks/link.js +1 -54
- package/dist/cjs/schema/nodes/emoji.js +4 -0
- package/dist/cjs/schema/nodes/panel.js +59 -28
- package/dist/cjs/schema/nodes/paragraph.js +167 -24
- package/dist/cjs/utils/index.js +12 -0
- package/dist/cjs/utils/url.js +55 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/create-schema.js +3 -1
- package/dist/es2019/schema/default-schema.js +5 -8
- package/dist/es2019/schema/marks/link.js +1 -49
- package/dist/es2019/schema/nodes/emoji.js +4 -0
- package/dist/es2019/schema/nodes/panel.js +45 -25
- package/dist/es2019/schema/nodes/paragraph.js +162 -24
- package/dist/es2019/utils/index.js +1 -1
- package/dist/es2019/utils/url.js +50 -3
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/create-schema.js +3 -1
- package/dist/esm/schema/default-schema.js +5 -8
- package/dist/esm/schema/marks/link.js +1 -53
- package/dist/esm/schema/nodes/emoji.js +4 -0
- package/dist/esm/schema/nodes/panel.js +55 -28
- package/dist/esm/schema/nodes/paragraph.js +166 -24
- package/dist/esm/utils/index.js +1 -1
- package/dist/esm/utils/url.js +50 -3
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/schema/create-schema.d.ts +1 -0
- package/dist/types/schema/default-schema.d.ts +1 -1
- package/dist/types/schema/nodes/panel.d.ts +1 -1
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/types/utils/url.d.ts +7 -2
- package/package.json +2 -2
@@ -1,3 +1,9 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
|
3
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
4
|
+
|
5
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
6
|
+
|
1
7
|
export var PanelType;
|
2
8
|
|
3
9
|
(function (PanelType) {
|
@@ -10,12 +16,8 @@ export var PanelType;
|
|
10
16
|
PanelType["CUSTOM"] = "custom";
|
11
17
|
})(PanelType || (PanelType = {}));
|
12
18
|
|
13
|
-
|
14
|
-
|
15
|
-
group: 'block',
|
16
|
-
content: '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
|
17
|
-
marks: 'unsupportedMark unsupportedNodeAttribute',
|
18
|
-
attrs: {
|
19
|
+
var getDefaultAttrs = function getDefaultAttrs() {
|
20
|
+
var attrs = {
|
19
21
|
panelType: {
|
20
22
|
default: 'info'
|
21
23
|
},
|
@@ -25,29 +27,54 @@ export var customPanel = {
|
|
25
27
|
panelColor: {
|
26
28
|
default: null
|
27
29
|
}
|
28
|
-
}
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
30
|
+
};
|
31
|
+
return attrs;
|
32
|
+
};
|
33
|
+
|
34
|
+
var getDomAttrs = function getDomAttrs(nodeAttrs) {
|
35
|
+
var attrs = {
|
36
|
+
'data-panel-type': nodeAttrs.panelType,
|
37
|
+
'data-panel-icon': nodeAttrs.panelIcon,
|
38
|
+
'data-panel-color': nodeAttrs.panelColor
|
39
|
+
};
|
40
|
+
return attrs;
|
41
|
+
};
|
42
|
+
|
43
|
+
var getParseDOMAttrs = function getParseDOMAttrs(allowCustomPanel, dom) {
|
44
|
+
var parseDOMAttrs = {
|
45
|
+
panelType: dom.getAttribute('data-panel-type')
|
46
|
+
};
|
47
|
+
|
48
|
+
if (allowCustomPanel) {
|
49
|
+
parseDOMAttrs = _objectSpread(_objectSpread({}, parseDOMAttrs), {}, {
|
50
|
+
panelIcon: dom.getAttribute('data-panel-icon'),
|
51
|
+
panelColor: dom.getAttribute('data-panel-color')
|
52
|
+
});
|
53
|
+
} else {
|
54
|
+
parseDOMAttrs.panelType = parseDOMAttrs.panelType === PanelType.CUSTOM ? PanelType.INFO : parseDOMAttrs.panelType;
|
50
55
|
}
|
56
|
+
|
57
|
+
return parseDOMAttrs;
|
58
|
+
};
|
59
|
+
|
60
|
+
export var customPanel = function customPanel(allowCustomPanel) {
|
61
|
+
var panelNodeSpec = {
|
62
|
+
group: 'block',
|
63
|
+
content: '(paragraph | heading | bulletList | orderedList | blockCard | unsupportedBlock)+',
|
64
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
65
|
+
attrs: getDefaultAttrs(),
|
66
|
+
parseDOM: [{
|
67
|
+
tag: 'div[data-panel-type]',
|
68
|
+
getAttrs: function getAttrs(dom) {
|
69
|
+
return getParseDOMAttrs(allowCustomPanel, dom);
|
70
|
+
}
|
71
|
+
}],
|
72
|
+
toDOM: function toDOM(node) {
|
73
|
+
var attrs = getDomAttrs(node.attrs);
|
74
|
+
return ['div', attrs, ['div', {}, 0]];
|
75
|
+
}
|
76
|
+
};
|
77
|
+
return panelNodeSpec;
|
51
78
|
};
|
52
79
|
export var panel = {
|
53
80
|
group: 'block',
|
@@ -1,27 +1,105 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
import { Fragment } from 'prosemirror-model';
|
2
|
+
import { isSafeUrl } from '../../utils/url';
|
3
|
+
|
4
|
+
var getLinkContent = function getLinkContent(node, schema) {
|
5
|
+
if (!(node instanceof HTMLAnchorElement)) {
|
6
|
+
return Fragment.empty;
|
7
|
+
}
|
8
|
+
|
9
|
+
var href = node.getAttribute('href') || '';
|
10
|
+
var text = node.innerText;
|
11
|
+
|
12
|
+
if (!text || text.length === 0) {
|
13
|
+
return Fragment.empty;
|
14
|
+
}
|
15
|
+
|
16
|
+
var marks = isSafeUrl(href) ? [schema.marks.link.create({
|
17
|
+
href: href
|
18
|
+
})] : [];
|
19
|
+
var textNode = schema.text(text, marks);
|
20
|
+
return Fragment.from(textNode);
|
21
|
+
};
|
22
|
+
|
23
|
+
var blockTags = {
|
24
|
+
address: true,
|
25
|
+
article: true,
|
26
|
+
aside: true,
|
27
|
+
blockquote: true,
|
28
|
+
canvas: true,
|
29
|
+
dd: true,
|
30
|
+
div: true,
|
31
|
+
dl: true,
|
32
|
+
fieldset: true,
|
33
|
+
figcaption: true,
|
34
|
+
figure: true,
|
35
|
+
footer: true,
|
36
|
+
form: true,
|
37
|
+
h1: true,
|
38
|
+
h2: true,
|
39
|
+
h3: true,
|
40
|
+
h4: true,
|
41
|
+
h5: true,
|
42
|
+
h6: true,
|
43
|
+
header: true,
|
44
|
+
hgroup: true,
|
45
|
+
hr: true,
|
46
|
+
li: true,
|
47
|
+
noscript: true,
|
48
|
+
ol: true,
|
49
|
+
output: true,
|
50
|
+
p: true,
|
51
|
+
pre: true,
|
52
|
+
section: true,
|
53
|
+
table: true,
|
54
|
+
tfoot: true,
|
55
|
+
ul: true
|
56
|
+
};
|
57
|
+
|
58
|
+
var isListItemNode = function isListItemNode(node) {
|
59
|
+
return Boolean(node && node.nodeName.toLowerCase() === 'li');
|
60
|
+
};
|
61
|
+
|
62
|
+
var isTextNode = function isTextNode(node) {
|
63
|
+
return Boolean(node && node.nodeType === Node.TEXT_NODE);
|
64
|
+
};
|
65
|
+
|
66
|
+
var isImageNode = function isImageNode(node) {
|
67
|
+
return Boolean(node && node.nodeName.toLowerCase() === 'img');
|
68
|
+
};
|
69
|
+
|
70
|
+
var hasInlineImage = function hasInlineImage(node) {
|
71
|
+
if (!node) {
|
72
|
+
return false;
|
73
|
+
}
|
74
|
+
|
75
|
+
return Array.from(node.childNodes).some(function (child) {
|
76
|
+
var isImage = isImageNode(child);
|
77
|
+
|
78
|
+
if (!isImage && child.childNodes) {
|
79
|
+
return Array.from(node.childNodes).some(function (node) {
|
80
|
+
return hasInlineImage(node);
|
81
|
+
});
|
82
|
+
}
|
83
|
+
|
84
|
+
return isImage;
|
85
|
+
});
|
86
|
+
};
|
87
|
+
|
88
|
+
var hasWhiteSpacePre = function hasWhiteSpacePre(node) {
|
89
|
+
return Boolean(node instanceof HTMLElement && node.style.whiteSpace === 'pre');
|
90
|
+
};
|
91
|
+
|
92
|
+
var hasFontFamilyMonospace = function hasFontFamilyMonospace(node) {
|
93
|
+
return Boolean(node instanceof HTMLElement && node.style.fontFamily.includes('monospace'));
|
94
|
+
};
|
95
|
+
|
96
|
+
var isBlockLevelNode = function isBlockLevelNode(node) {
|
97
|
+
return Boolean(node && blockTags.hasOwnProperty(node.nodeName.toLowerCase()));
|
98
|
+
};
|
99
|
+
|
100
|
+
var NOT_INTERNAL_LINKS = [':not([data-inline-card])', ':not([data-block-card])', ':not([data-block-link])', ':not([data-skip-paste])'].join('');
|
101
|
+
var ANCHOR_LINK = "a[href]".concat(NOT_INTERNAL_LINKS);
|
102
|
+
var NOT_INTERNAL_ELEMENTS = [':not(.code-block)', ':not([data-node-type])', ':not([data-embed-card])', ':not([data-layout-section])', ':not([data-pm-slice])', ':not([data-mark-type])'].join('');
|
25
103
|
var pDOM = ['p', 0];
|
26
104
|
export var paragraph = {
|
27
105
|
selectable: false,
|
@@ -30,6 +108,70 @@ export var paragraph = {
|
|
30
108
|
marks: 'strong code em link strike subsup textColor typeAheadQuery underline confluenceInlineComment action annotation unsupportedMark unsupportedNodeAttribute dataConsumer',
|
31
109
|
parseDOM: [{
|
32
110
|
tag: 'p'
|
111
|
+
}, {
|
112
|
+
tag: "div".concat(NOT_INTERNAL_ELEMENTS, ", li:not([data-pm-slice])"),
|
113
|
+
priority: 100,
|
114
|
+
getAttrs: function getAttrs(node) {
|
115
|
+
if (!(node instanceof Node)) {
|
116
|
+
return false;
|
117
|
+
}
|
118
|
+
|
119
|
+
var isCodeBlock = hasWhiteSpacePre(node) || hasFontFamilyMonospace(node);
|
120
|
+
|
121
|
+
if (isCodeBlock || !node.hasChildNodes()) {
|
122
|
+
return false;
|
123
|
+
}
|
124
|
+
|
125
|
+
var hasInlineChildren = Array.from(node.childNodes).every(function (child) {
|
126
|
+
return !isBlockLevelNode(child) && // IMG is considered block for mediaSingle
|
127
|
+
!isImageNode(child);
|
128
|
+
});
|
129
|
+
|
130
|
+
if (!hasInlineChildren) {
|
131
|
+
return false;
|
132
|
+
}
|
133
|
+
|
134
|
+
if ( // We can skip this rule for pure list items
|
135
|
+
isListItemNode(node) && Array.from(node.childNodes).every(isTextNode)) {
|
136
|
+
return false;
|
137
|
+
}
|
138
|
+
|
139
|
+
return null;
|
140
|
+
}
|
141
|
+
}, {
|
142
|
+
tag: ":not(span) + ".concat(ANCHOR_LINK),
|
143
|
+
priority: 100,
|
144
|
+
getContent: getLinkContent
|
145
|
+
}, {
|
146
|
+
tag: ":not(span) > ".concat(ANCHOR_LINK, ":first-child"),
|
147
|
+
getAttrs: function getAttrs(node) {
|
148
|
+
if (!(node instanceof Node)) {
|
149
|
+
return false;
|
150
|
+
}
|
151
|
+
|
152
|
+
if (isBlockLevelNode(node.firstChild)) {
|
153
|
+
return null;
|
154
|
+
}
|
155
|
+
|
156
|
+
if (hasInlineImage(node)) {
|
157
|
+
return false;
|
158
|
+
}
|
159
|
+
|
160
|
+
var isNextSiblingValid = node.nextSibling === null || node.nextSibling instanceof Text && (node.nextSibling.textContent || '').trim().length === 0;
|
161
|
+
|
162
|
+
if (isNextSiblingValid) {
|
163
|
+
return null;
|
164
|
+
} // This rule should not match when there is any sibling after the anchor
|
165
|
+
|
166
|
+
|
167
|
+
if (!isBlockLevelNode(node.nextSibling)) {
|
168
|
+
return false;
|
169
|
+
}
|
170
|
+
|
171
|
+
return null;
|
172
|
+
},
|
173
|
+
priority: 100,
|
174
|
+
getContent: getLinkContent
|
33
175
|
}],
|
34
176
|
toDOM: function toDOM() {
|
35
177
|
return pDOM;
|
package/dist/esm/utils/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
1
|
export { acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, getEmojiAcName } from './confluence/emoji';
|
2
2
|
export { generateUuid, uuid } from './uuid';
|
3
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, hexToRgb, hexToRgba, isHex, isRgb, normalizeHexColor, rgbToHex } from './colors';
|
4
|
-
export { getLinkMatch, isSafeUrl, normalizeUrl } from './url';
|
4
|
+
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch } from './url';
|
package/dist/esm/utils/url.js
CHANGED
@@ -5,10 +5,57 @@ export var isSafeUrl = function isSafeUrl(url) {
|
|
5
5
|
return p.test(url.trim()) === true;
|
6
6
|
});
|
7
7
|
};
|
8
|
-
var linkify = LinkifyIt();
|
8
|
+
export var linkify = LinkifyIt();
|
9
9
|
linkify.add('sourcetree:', 'http:');
|
10
|
+
var tlds = 'biz|com|edu|gov|net|org|pro|web|xxx|aero|asia|coop|info|museum|name|shop|рф'.split('|');
|
11
|
+
var tlds2Char = 'a[cdefgilmnoqrtuwxz]|b[abdefghijmnorstvwyz]|c[acdfghiklmnoruvwxyz]|d[ejkmoz]|e[cegrstu]|f[ijkmor]|g[abdefghilmnpqrstuwy]|h[kmnrtu]|i[delmnoqrst]|j[emop]|k[eghimnprwyz]|l[abcikrstuvy]|m[acdeghklmnopqrtuvwxyz]|n[acefgilopruz]|om|p[aefghkmnrtw]|qa|r[eosuw]|s[abcdegijklmnrtuvxyz]|t[cdfghjklmnortvwz]|u[agksyz]|v[aceginu]|w[fs]|y[et]|z[amw]';
|
12
|
+
tlds.push(tlds2Char);
|
13
|
+
linkify.tlds(tlds, false);
|
14
|
+
export var LINK_REGEXP = /(https?|ftp):\/\/[^\s]+/;
|
15
|
+
export var linkifyMatch = function linkifyMatch(text) {
|
16
|
+
var matches = [];
|
17
|
+
|
18
|
+
if (!LINK_REGEXP.test(text)) {
|
19
|
+
return matches;
|
20
|
+
}
|
21
|
+
|
22
|
+
var startpos = 0;
|
23
|
+
var substr;
|
24
|
+
|
25
|
+
while (substr = text.substr(startpos)) {
|
26
|
+
var link = (substr.match(LINK_REGEXP) || [''])[0];
|
27
|
+
|
28
|
+
if (link) {
|
29
|
+
var index = substr.search(LINK_REGEXP);
|
30
|
+
var start = index >= 0 ? index + startpos : index;
|
31
|
+
var end = start + link.length;
|
32
|
+
matches.push({
|
33
|
+
index: start,
|
34
|
+
lastIndex: end,
|
35
|
+
raw: link,
|
36
|
+
url: link,
|
37
|
+
text: link,
|
38
|
+
schema: ''
|
39
|
+
});
|
40
|
+
startpos += end;
|
41
|
+
} else {
|
42
|
+
break;
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
return matches;
|
47
|
+
};
|
10
48
|
export function getLinkMatch(str) {
|
11
|
-
|
49
|
+
if (!str) {
|
50
|
+
return null;
|
51
|
+
}
|
52
|
+
|
53
|
+
var match = linkifyMatch(str);
|
54
|
+
|
55
|
+
if (!match.length) {
|
56
|
+
match = linkify.match(str);
|
57
|
+
}
|
58
|
+
|
12
59
|
return match && match[0];
|
13
60
|
}
|
14
61
|
/**
|
@@ -17,5 +64,5 @@ export function getLinkMatch(str) {
|
|
17
64
|
|
18
65
|
export function normalizeUrl(url) {
|
19
66
|
var match = getLinkMatch(url);
|
20
|
-
return match && match.url ||
|
67
|
+
return match && match.url || '';
|
21
68
|
}
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
@@ -1,4 +1,4 @@
|
|
1
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 type { AlignmentAttributes, AlignmentMarkDefinition, AnnotationMarkAttributes, AnnotationMarkDefinition, BlockCardDefinition, BlockContent, BlockQuoteDefinition, BodiedExtensionDefinition, BodiedExtensionWithMarksDefinition, BreakoutMarkAttrs, BreakoutMarkDefinition, BulletListDefinition, CaptionDefinition, CardAttributes, CellAttributes, CodeBlockAttrs, CodeBlockBaseDefinition, CodeBlockDefinition, CodeBlockWithMarksDefinition, CodeDefinition, DataConsumerAttributes, DataConsumerDefinition, DataType, DateDefinition, DecisionItemDefinition, DecisionListDefinition, DocNode, EmbedCardDefinition, EmbedCardAttributes, EmDefinition, EmojiAttributes, EmojiDefinition, ExpandDefinition, ExtensionDefinition, ExtensionWithMarksDefinition, ExtensionLayout, ExternalMediaAttributes, HardBreakDefinition, HeadingBaseDefinition, HeadingDefinition, HeadingWithAlignmentDefinition, HeadingWithIndentationDefinition, HeadingWithMarksDefinition, IndentationMarkAttributes, IndentationMarkDefinition, Inline, InlineAtomic, InlineCardDefinition, InlineCode, InlineExtensionDefinition, InlineExtensionWithMarksDefinition, InlineFormattedText, InlineLinkText, LayoutColumnDefinition, LayoutSectionDefinition, LayoutSectionFullDefinition, LayoutSectionWithSingleColumnDefinition, LinkAttributes, LinkDefinition, ListItemArray, ListItemDefinition, MarksObject, MediaADFAttrs, MediaAttributes, MediaInlineAttributes, MediaInlineDefinition, MediaBaseAttributes, MediaDefinition, MediaDisplayType, MediaGroupDefinition, MediaSingleDefinition, MediaType, MentionAttributes, MentionDefinition, MentionUserType, NestedExpandContent, NestedExpandDefinition, NoMark, NonNestableBlockContent, OrderedListDefinition, PanelAttributes, PanelDefinition, ParagraphBaseDefinition, ParagraphDefinition, ParagraphWithAlignmentDefinition, ParagraphWithIndentationDefinition, ParagraphWithMarksDefinition, PlaceholderDefinition, RuleDefinition, StatusDefinition, StrikeDefinition, StrongDefinition, SubSupAttributes, SubSupDefinition, TableAttributes, TableCellDefinition, TableDefinition, TableHeaderDefinition, TableLayout, TableRowDefinition, TaskItemDefinition, TaskListContent, TaskListDefinition, TextColorAttributes, TextColorDefinition, TextDefinition, UnderlineDefinition, UrlType, AnnotationId, RichMediaAttributes, RichMediaLayout, AnnotationDataAttributes, CellDomAttrs, } from './schema';
|
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, normalizeHexColor, normalizeUrl, rgbToHex, uuid, } from './utils';
|
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';
|
4
4
|
export type { Match, NameToEmoji } from './utils';
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { SchemaConfig } from './create-schema';
|
2
2
|
declare type DefaultSchemaNodes = 'doc' | 'paragraph' | 'text' | 'bulletList' | 'orderedList' | 'listItem' | 'heading' | 'blockquote' | 'codeBlock' | 'panel' | 'rule' | 'image' | 'mention' | 'media' | 'caption' | 'mediaGroup' | 'mediaSingle' | 'mediaInline' | 'confluenceUnsupportedBlock' | 'confluenceUnsupportedInline' | 'confluenceJiraIssue' | 'expand' | 'nestedExpand' | 'extension' | 'inlineExtension' | 'bodiedExtension' | 'hardBreak' | 'emoji' | 'table' | 'tableCell' | 'tableHeader' | 'tableRow' | 'decisionList' | 'decisionItem' | 'taskList' | 'taskItem' | 'unknownBlock' | 'date' | 'status' | 'placeholder' | 'layoutSection' | 'layoutColumn' | 'inlineCard' | 'blockCard' | 'embedCard' | 'unsupportedBlock' | 'unsupportedInline';
|
3
|
-
declare type DefaultSchemaMarks = 'link' | 'em' | 'strong' | 'strike' | 'subsup' | 'underline' | 'code' | 'textColor' | 'confluenceInlineComment' | 'breakout' | 'alignment' | 'indentation' | 'annotation' | 'unsupportedMark' | 'unsupportedNodeAttribute' | 'typeAheadQuery';
|
3
|
+
declare type DefaultSchemaMarks = 'link' | 'em' | 'strong' | 'strike' | 'subsup' | 'underline' | 'code' | 'textColor' | 'confluenceInlineComment' | 'breakout' | 'alignment' | 'indentation' | 'annotation' | 'unsupportedMark' | 'unsupportedNodeAttribute' | 'typeAheadQuery' | 'dataConsumer';
|
4
4
|
export declare const defaultSchemaConfig: SchemaConfig<DefaultSchemaNodes, DefaultSchemaMarks>;
|
5
5
|
export declare const getSchemaBasedOnStage: (stage?: string) => import("prosemirror-model").Schema<DefaultSchemaNodes, DefaultSchemaMarks>;
|
6
6
|
export declare const defaultSchema: import("prosemirror-model").Schema<DefaultSchemaNodes, DefaultSchemaMarks>;
|
@@ -42,5 +42,5 @@ export interface PanelDefinition {
|
|
42
42
|
export interface DOMAttributes {
|
43
43
|
[propName: string]: string;
|
44
44
|
}
|
45
|
-
export declare const customPanel: NodeSpec;
|
45
|
+
export declare const customPanel: (allowCustomPanel: boolean) => NodeSpec;
|
46
46
|
export declare const panel: NodeSpec;
|
@@ -2,5 +2,5 @@ export { acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, getEmojiAcName, } fr
|
|
2
2
|
export type { NameToEmoji } from './confluence/emoji';
|
3
3
|
export { generateUuid, uuid } from './uuid';
|
4
4
|
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, hexToRgb, hexToRgba, isHex, isRgb, normalizeHexColor, rgbToHex, } from './colors';
|
5
|
-
export { getLinkMatch, isSafeUrl, normalizeUrl } from './url';
|
5
|
+
export { getLinkMatch, isSafeUrl, normalizeUrl, linkify, linkifyMatch, } from './url';
|
6
6
|
export type { Match } from './url';
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import LinkifyIt from 'linkify-it';
|
1
2
|
export declare const isSafeUrl: (url: string) => boolean;
|
2
3
|
export interface Match {
|
3
4
|
schema: any;
|
@@ -7,9 +8,13 @@ export interface Match {
|
|
7
8
|
text: string;
|
8
9
|
url: string;
|
9
10
|
length?: number;
|
11
|
+
input?: string;
|
10
12
|
}
|
11
|
-
export declare
|
13
|
+
export declare const linkify: LinkifyIt.LinkifyIt;
|
14
|
+
export declare const LINK_REGEXP: RegExp;
|
15
|
+
export declare const linkifyMatch: (text: string) => Match[];
|
16
|
+
export declare function getLinkMatch(str?: string): Match | null;
|
12
17
|
/**
|
13
18
|
* Adds protocol to url if needed.
|
14
19
|
*/
|
15
|
-
export declare function normalizeUrl(url
|
20
|
+
export declare function normalizeUrl(url?: string): string;
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@atlaskit/adf-schema",
|
3
|
-
"version": "19.2
|
3
|
+
"version": "19.3.2",
|
4
4
|
"description": "Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs",
|
5
5
|
"publishConfig": {
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
@@ -41,7 +41,7 @@
|
|
41
41
|
},
|
42
42
|
"devDependencies": {
|
43
43
|
"@atlaskit/editor-json-transformer": "^8.6.0",
|
44
|
-
"@atlaskit/editor-test-helpers": "^15.
|
44
|
+
"@atlaskit/editor-test-helpers": "^15.5.0",
|
45
45
|
"@atlaskit/json-schema-generator": "^3.1.0",
|
46
46
|
"@atlassian/adf-sample": "^1.0.0",
|
47
47
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|