@atlaskit/adf-schema 25.10.0 → 26.0.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 +12 -0
- package/dist/cjs/index.js +18 -0
- package/dist/cjs/schema/default-schema.js +2 -1
- package/dist/cjs/schema/index.js +18 -0
- package/dist/cjs/schema/nodes/block-card.js +2 -2
- package/dist/cjs/schema/nodes/index.js +18 -0
- package/dist/cjs/schema/nodes/media-single.js +69 -23
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/create-schema.js +1 -1
- package/dist/es2019/schema/default-schema.js +3 -2
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/nodes/block-card.js +2 -2
- package/dist/es2019/schema/nodes/index.js +1 -1
- package/dist/es2019/schema/nodes/media-single.js +69 -21
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/create-schema.js +1 -1
- package/dist/esm/schema/default-schema.js +3 -2
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/nodes/block-card.js +2 -2
- package/dist/esm/schema/nodes/index.js +1 -1
- package/dist/esm/schema/nodes/media-single.js +65 -22
- package/dist/esm/version.json +1 -1
- package/dist/json-schema/v1/stage-0.json +82 -42
- package/dist/types/index.d.ts +2 -2
- package/dist/types/schema/index.d.ts +2 -2
- package/dist/types/schema/nodes/block-card.d.ts +1 -1
- package/dist/types/schema/nodes/index.d.ts +2 -2
- package/dist/types/schema/nodes/media-single.d.ts +10 -4
- package/dist/types/schema/nodes/types/rich-media-common.d.ts +21 -0
- package/dist/types-ts4.5/index.d.ts +2 -2
- package/dist/types-ts4.5/schema/index.d.ts +2 -2
- package/dist/types-ts4.5/schema/nodes/block-card.d.ts +1 -1
- package/dist/types-ts4.5/schema/nodes/index.d.ts +2 -2
- package/dist/types-ts4.5/schema/nodes/media-single.d.ts +10 -4
- package/dist/types-ts4.5/schema/nodes/types/rich-media-common.d.ts +21 -0
- package/json-schema/v1/stage-0.json +82 -42
- package/package.json +2 -2
- package/report.api.md +36 -1
- package/tmp/api-report-tmp.d.ts +31 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 26.0.0
|
4
|
+
|
5
|
+
### Major Changes
|
6
|
+
|
7
|
+
- [`68ef7e6146c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/68ef7e6146c) - [ADF change] added widthType attribute to mediaSingle node, to support fixed width media node.
|
8
|
+
|
9
|
+
## 25.10.1
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [`54c95071cce`](https://bitbucket.org/atlassian/atlassian-frontend/commits/54c95071cce) - Move around order of BlockCardDefinition attribute variations.
|
14
|
+
|
3
15
|
## 25.10.0
|
4
16
|
|
5
17
|
### Minor Changes
|
package/dist/cjs/index.js
CHANGED
@@ -711,6 +711,18 @@ Object.defineProperty(exports, "mediaSingle", {
|
|
711
711
|
return _schema.mediaSingle;
|
712
712
|
}
|
713
713
|
});
|
714
|
+
Object.defineProperty(exports, "mediaSingleFull", {
|
715
|
+
enumerable: true,
|
716
|
+
get: function get() {
|
717
|
+
return _schema.mediaSingleFull;
|
718
|
+
}
|
719
|
+
});
|
720
|
+
Object.defineProperty(exports, "mediaSingleSpec", {
|
721
|
+
enumerable: true,
|
722
|
+
get: function get() {
|
723
|
+
return _schema.mediaSingleSpec;
|
724
|
+
}
|
725
|
+
});
|
714
726
|
Object.defineProperty(exports, "mediaSingleToJSON", {
|
715
727
|
enumerable: true,
|
716
728
|
get: function get() {
|
@@ -723,6 +735,12 @@ Object.defineProperty(exports, "mediaSingleWithCaption", {
|
|
723
735
|
return _schema.mediaSingleWithCaption;
|
724
736
|
}
|
725
737
|
});
|
738
|
+
Object.defineProperty(exports, "mediaSingleWithWidthType", {
|
739
|
+
enumerable: true,
|
740
|
+
get: function get() {
|
741
|
+
return _schema.mediaSingleWithWidthType;
|
742
|
+
}
|
743
|
+
});
|
726
744
|
Object.defineProperty(exports, "mediaToJSON", {
|
727
745
|
enumerable: true,
|
728
746
|
get: function get() {
|
@@ -26,7 +26,8 @@ var getSchemaBasedOnStage = (0, _memoizeOne.default)(function () {
|
|
26
26
|
if (stage === 'stage0') {
|
27
27
|
defaultSchemaConfig.customNodeSpecs = {
|
28
28
|
layoutSection: _nodes.layoutSectionWithSingleColumn,
|
29
|
-
table: _nodes.tableWithCustomWidth
|
29
|
+
table: _nodes.tableWithCustomWidth,
|
30
|
+
mediaSingle: _nodes.mediaSingleFull
|
30
31
|
};
|
31
32
|
defaultSchemaConfig.customMarkSpecs = {
|
32
33
|
border: _marks.border
|
package/dist/cjs/schema/index.js
CHANGED
@@ -369,6 +369,18 @@ Object.defineProperty(exports, "mediaSingle", {
|
|
369
369
|
return _nodes.mediaSingle;
|
370
370
|
}
|
371
371
|
});
|
372
|
+
Object.defineProperty(exports, "mediaSingleFull", {
|
373
|
+
enumerable: true,
|
374
|
+
get: function get() {
|
375
|
+
return _nodes.mediaSingleFull;
|
376
|
+
}
|
377
|
+
});
|
378
|
+
Object.defineProperty(exports, "mediaSingleSpec", {
|
379
|
+
enumerable: true,
|
380
|
+
get: function get() {
|
381
|
+
return _nodes.mediaSingleSpec;
|
382
|
+
}
|
383
|
+
});
|
372
384
|
Object.defineProperty(exports, "mediaSingleToJSON", {
|
373
385
|
enumerable: true,
|
374
386
|
get: function get() {
|
@@ -381,6 +393,12 @@ Object.defineProperty(exports, "mediaSingleWithCaption", {
|
|
381
393
|
return _nodes.mediaSingleWithCaption;
|
382
394
|
}
|
383
395
|
});
|
396
|
+
Object.defineProperty(exports, "mediaSingleWithWidthType", {
|
397
|
+
enumerable: true,
|
398
|
+
get: function get() {
|
399
|
+
return _nodes.mediaSingleWithWidthType;
|
400
|
+
}
|
401
|
+
});
|
384
402
|
Object.defineProperty(exports, "mediaToJSON", {
|
385
403
|
enumerable: true,
|
386
404
|
get: function get() {
|
@@ -232,6 +232,18 @@ Object.defineProperty(exports, "mediaSingle", {
|
|
232
232
|
return _mediaSingle.mediaSingle;
|
233
233
|
}
|
234
234
|
});
|
235
|
+
Object.defineProperty(exports, "mediaSingleFull", {
|
236
|
+
enumerable: true,
|
237
|
+
get: function get() {
|
238
|
+
return _mediaSingle.mediaSingleFull;
|
239
|
+
}
|
240
|
+
});
|
241
|
+
Object.defineProperty(exports, "mediaSingleSpec", {
|
242
|
+
enumerable: true,
|
243
|
+
get: function get() {
|
244
|
+
return _mediaSingle.mediaSingleSpec;
|
245
|
+
}
|
246
|
+
});
|
235
247
|
Object.defineProperty(exports, "mediaSingleToJSON", {
|
236
248
|
enumerable: true,
|
237
249
|
get: function get() {
|
@@ -244,6 +256,12 @@ Object.defineProperty(exports, "mediaSingleWithCaption", {
|
|
244
256
|
return _mediaSingle.mediaSingleWithCaption;
|
245
257
|
}
|
246
258
|
});
|
259
|
+
Object.defineProperty(exports, "mediaSingleWithWidthType", {
|
260
|
+
enumerable: true,
|
261
|
+
get: function get() {
|
262
|
+
return _mediaSingle.mediaSingleWithWidthType;
|
263
|
+
}
|
264
|
+
});
|
247
265
|
Object.defineProperty(exports, "mediaToJSON", {
|
248
266
|
enumerable: true,
|
249
267
|
get: function get() {
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.toJSON = exports.mediaSingleWithCaption = exports.mediaSingle = exports.defaultAttrs = void 0;
|
7
|
+
exports.toJSON = exports.mediaSingleWithWidthType = exports.mediaSingleWithCaption = exports.mediaSingleSpec = exports.mediaSingleFull = exports.mediaSingle = exports.defaultAttrs = void 0;
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
9
9
|
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; }
|
10
10
|
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) { (0, _defineProperty2.default)(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; }
|
@@ -39,24 +39,29 @@ var defaultAttrs = {
|
|
39
39
|
}
|
40
40
|
};
|
41
41
|
exports.defaultAttrs = defaultAttrs;
|
42
|
-
var
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
content: 'media|unsupportedBlock+|media unsupportedBlock+'
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
42
|
+
var mediaSingleSpec = function mediaSingleSpec(_ref) {
|
43
|
+
var _ref$withCaption = _ref.withCaption,
|
44
|
+
withCaption = _ref$withCaption === void 0 ? false : _ref$withCaption,
|
45
|
+
_ref$withExtendedWidt = _ref.withExtendedWidthTypes,
|
46
|
+
withExtendedWidthTypes = _ref$withExtendedWidt === void 0 ? false : _ref$withExtendedWidt;
|
47
|
+
var content = withCaption ? 'media|unsupportedBlock+|media (caption|unsupportedBlock) unsupportedBlock*' : 'media|unsupportedBlock+|media unsupportedBlock+';
|
48
|
+
var atom = !withCaption;
|
49
|
+
var getAttrs = function getAttrs(dom) {
|
50
|
+
var domAttrs = {
|
51
|
+
layout: dom.getAttribute('data-layout') || 'center',
|
52
|
+
width: Number(dom.getAttribute('data-width')) || null
|
53
|
+
};
|
54
|
+
if (withExtendedWidthTypes) {
|
55
|
+
var widthType = dom.getAttribute('data-width-type');
|
56
|
+
if (widthType) {
|
57
|
+
return _objectSpread(_objectSpread({}, domAttrs), {}, {
|
58
|
+
widthType: widthType
|
59
|
+
});
|
60
|
+
}
|
57
61
|
}
|
58
|
-
|
59
|
-
|
62
|
+
return domAttrs;
|
63
|
+
};
|
64
|
+
var getAttrsFromNode = function getAttrsFromNode(node) {
|
60
65
|
var _node$attrs = node.attrs,
|
61
66
|
layout = _node$attrs.layout,
|
62
67
|
width = _node$attrs.width;
|
@@ -68,15 +73,56 @@ var mediaSingle = {
|
|
68
73
|
if (width) {
|
69
74
|
attrs['data-width'] = isFinite(width) && Math.floor(width) === width ? width : width.toFixed(2);
|
70
75
|
}
|
71
|
-
|
72
|
-
|
76
|
+
if (withExtendedWidthTypes && node.attrs.widthType) {
|
77
|
+
var widthType = node.attrs.widthType;
|
78
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
79
|
+
'data-width-type': widthType || 'percentage'
|
80
|
+
});
|
81
|
+
}
|
82
|
+
return attrs;
|
83
|
+
};
|
84
|
+
return {
|
85
|
+
inline: false,
|
86
|
+
group: 'block',
|
87
|
+
selectable: true,
|
88
|
+
atom: atom,
|
89
|
+
content: content,
|
90
|
+
attrs: withExtendedWidthTypes ? _objectSpread(_objectSpread({}, defaultAttrs), {}, {
|
91
|
+
widthType: {
|
92
|
+
default: null
|
93
|
+
}
|
94
|
+
}) : defaultAttrs,
|
95
|
+
marks: 'unsupportedMark unsupportedNodeAttribute border link',
|
96
|
+
parseDOM: [{
|
97
|
+
tag: 'div[data-node-type="mediaSingle"]',
|
98
|
+
getAttrs: getAttrs
|
99
|
+
}],
|
100
|
+
toDOM: function toDOM(node) {
|
101
|
+
return ['div', getAttrsFromNode(node), 0];
|
102
|
+
}
|
103
|
+
};
|
73
104
|
};
|
105
|
+
exports.mediaSingleSpec = mediaSingleSpec;
|
106
|
+
var mediaSingle = mediaSingleSpec({
|
107
|
+
withCaption: false,
|
108
|
+
withExtendedWidthTypes: false
|
109
|
+
});
|
74
110
|
exports.mediaSingle = mediaSingle;
|
75
|
-
var mediaSingleWithCaption =
|
76
|
-
|
77
|
-
|
111
|
+
var mediaSingleWithCaption = mediaSingleSpec({
|
112
|
+
withCaption: true,
|
113
|
+
withExtendedWidthTypes: false
|
78
114
|
});
|
79
115
|
exports.mediaSingleWithCaption = mediaSingleWithCaption;
|
116
|
+
var mediaSingleWithWidthType = mediaSingleSpec({
|
117
|
+
withCaption: false,
|
118
|
+
withExtendedWidthTypes: true
|
119
|
+
});
|
120
|
+
exports.mediaSingleWithWidthType = mediaSingleWithWidthType;
|
121
|
+
var mediaSingleFull = mediaSingleSpec({
|
122
|
+
withCaption: true,
|
123
|
+
withExtendedWidthTypes: true
|
124
|
+
});
|
125
|
+
exports.mediaSingleFull = mediaSingleFull;
|
80
126
|
var toJSON = function toJSON(node) {
|
81
127
|
return {
|
82
128
|
attrs: Object.keys(node.attrs).reduce(function (obj, key) {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
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. */
|
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, tableWithCustomWidth, 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, border, borderColorPalette } from './schema';
|
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, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, 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, border, borderColorPalette } from './schema';
|
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, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Schema } from 'prosemirror-model';
|
2
2
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
3
3
|
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
|
4
|
-
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline,
|
4
|
+
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaSingleWithCaption, mediaGroup, 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';
|
5
5
|
function addItems(builtInItems, config, customSpecs = {}) {
|
6
6
|
if (!config) {
|
7
7
|
return {};
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
2
|
-
import { layoutSectionWithSingleColumn, tableWithCustomWidth } from './nodes';
|
2
|
+
import { mediaSingleFull, layoutSectionWithSingleColumn, tableWithCustomWidth } from './nodes';
|
3
3
|
import { border } from './marks';
|
4
4
|
import { createSchema } from './create-schema';
|
5
5
|
const getDefaultSchemaConfig = () => {
|
@@ -17,7 +17,8 @@ export const getSchemaBasedOnStage = memoizeOne((stage = 'final') => {
|
|
17
17
|
if (stage === 'stage0') {
|
18
18
|
defaultSchemaConfig.customNodeSpecs = {
|
19
19
|
layoutSection: layoutSectionWithSingleColumn,
|
20
|
-
table: tableWithCustomWidth
|
20
|
+
table: tableWithCustomWidth,
|
21
|
+
mediaSingle: mediaSingleFull
|
21
22
|
};
|
22
23
|
defaultSchemaConfig.customMarkSpecs = {
|
23
24
|
border
|
@@ -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, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
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, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, 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, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
3
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
|
4
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
@@ -22,7 +22,7 @@ export { caption } from './caption';
|
|
22
22
|
export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as mediaToJSON } from './media';
|
23
23
|
export { mediaGroup } from './media-group';
|
24
24
|
export { mediaInline } from './media-inline';
|
25
|
-
export { mediaSingle, mediaSingleWithCaption, toJSON as mediaSingleToJSON } from './media-single';
|
25
|
+
export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, toJSON as mediaSingleToJSON } from './media-single';
|
26
26
|
export { table, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
|
27
27
|
export { decisionList, decisionListSelector } from './decision-list';
|
28
28
|
export { decisionItem } from './decision-item';
|
@@ -28,22 +28,29 @@ export const defaultAttrs = {
|
|
28
28
|
default: 'center'
|
29
29
|
}
|
30
30
|
};
|
31
|
-
export const
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
parseDOM: [{
|
40
|
-
tag: 'div[data-node-type="mediaSingle"]',
|
41
|
-
getAttrs: dom => ({
|
31
|
+
export const mediaSingleSpec = ({
|
32
|
+
withCaption = false,
|
33
|
+
withExtendedWidthTypes = false
|
34
|
+
}) => {
|
35
|
+
const content = withCaption ? 'media|unsupportedBlock+|media (caption|unsupportedBlock) unsupportedBlock*' : 'media|unsupportedBlock+|media unsupportedBlock+';
|
36
|
+
const atom = !withCaption;
|
37
|
+
const getAttrs = dom => {
|
38
|
+
const domAttrs = {
|
42
39
|
layout: dom.getAttribute('data-layout') || 'center',
|
43
40
|
width: Number(dom.getAttribute('data-width')) || null
|
44
|
-
}
|
45
|
-
|
46
|
-
|
41
|
+
};
|
42
|
+
if (withExtendedWidthTypes) {
|
43
|
+
const widthType = dom.getAttribute('data-width-type');
|
44
|
+
if (widthType) {
|
45
|
+
return {
|
46
|
+
...domAttrs,
|
47
|
+
widthType
|
48
|
+
};
|
49
|
+
}
|
50
|
+
}
|
51
|
+
return domAttrs;
|
52
|
+
};
|
53
|
+
const getAttrsFromNode = node => {
|
47
54
|
const {
|
48
55
|
layout,
|
49
56
|
width
|
@@ -56,14 +63,55 @@ export const mediaSingle = {
|
|
56
63
|
if (width) {
|
57
64
|
attrs['data-width'] = isFinite(width) && Math.floor(width) === width ? width : width.toFixed(2);
|
58
65
|
}
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
+
if (withExtendedWidthTypes && node.attrs.widthType) {
|
67
|
+
const {
|
68
|
+
widthType
|
69
|
+
} = node.attrs;
|
70
|
+
return {
|
71
|
+
...attrs,
|
72
|
+
'data-width-type': widthType || 'percentage'
|
73
|
+
};
|
74
|
+
}
|
75
|
+
return attrs;
|
76
|
+
};
|
77
|
+
return {
|
78
|
+
inline: false,
|
79
|
+
group: 'block',
|
80
|
+
selectable: true,
|
81
|
+
atom,
|
82
|
+
content,
|
83
|
+
attrs: withExtendedWidthTypes ? {
|
84
|
+
...defaultAttrs,
|
85
|
+
widthType: {
|
86
|
+
default: null
|
87
|
+
}
|
88
|
+
} : defaultAttrs,
|
89
|
+
marks: 'unsupportedMark unsupportedNodeAttribute border link',
|
90
|
+
parseDOM: [{
|
91
|
+
tag: 'div[data-node-type="mediaSingle"]',
|
92
|
+
getAttrs
|
93
|
+
}],
|
94
|
+
toDOM(node) {
|
95
|
+
return ['div', getAttrsFromNode(node), 0];
|
96
|
+
}
|
97
|
+
};
|
66
98
|
};
|
99
|
+
export const mediaSingle = mediaSingleSpec({
|
100
|
+
withCaption: false,
|
101
|
+
withExtendedWidthTypes: false
|
102
|
+
});
|
103
|
+
export const mediaSingleWithCaption = mediaSingleSpec({
|
104
|
+
withCaption: true,
|
105
|
+
withExtendedWidthTypes: false
|
106
|
+
});
|
107
|
+
export const mediaSingleWithWidthType = mediaSingleSpec({
|
108
|
+
withCaption: false,
|
109
|
+
withExtendedWidthTypes: true
|
110
|
+
});
|
111
|
+
export const mediaSingleFull = mediaSingleSpec({
|
112
|
+
withCaption: true,
|
113
|
+
withExtendedWidthTypes: true
|
114
|
+
});
|
67
115
|
export const toJSON = node => ({
|
68
116
|
attrs: Object.keys(node.attrs).reduce((obj, key) => {
|
69
117
|
if (node.attrs[key] !== null) {
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
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. */
|
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, tableWithCustomWidth, 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, border, borderColorPalette } from './schema';
|
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, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, 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, border, borderColorPalette } from './schema';
|
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, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -4,7 +4,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
4
4
|
import { Schema } from 'prosemirror-model';
|
5
5
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
6
6
|
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
|
7
|
-
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline,
|
7
|
+
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaSingleWithCaption, mediaGroup, 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';
|
8
8
|
function addItems(builtInItems, config) {
|
9
9
|
var customSpecs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
10
10
|
if (!config) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import memoizeOne from 'memoize-one';
|
2
|
-
import { layoutSectionWithSingleColumn, tableWithCustomWidth } from './nodes';
|
2
|
+
import { mediaSingleFull, layoutSectionWithSingleColumn, tableWithCustomWidth } from './nodes';
|
3
3
|
import { border } from './marks';
|
4
4
|
import { createSchema } from './create-schema';
|
5
5
|
var getDefaultSchemaConfig = function getDefaultSchemaConfig() {
|
@@ -18,7 +18,8 @@ export var getSchemaBasedOnStage = memoizeOne(function () {
|
|
18
18
|
if (stage === 'stage0') {
|
19
19
|
defaultSchemaConfig.customNodeSpecs = {
|
20
20
|
layoutSection: layoutSectionWithSingleColumn,
|
21
|
-
table: tableWithCustomWidth
|
21
|
+
table: tableWithCustomWidth,
|
22
|
+
mediaSingle: mediaSingleFull
|
22
23
|
};
|
23
24
|
defaultSchemaConfig.customMarkSpecs = {
|
24
25
|
border: border
|
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, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
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, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, 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, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
3
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
|
4
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
@@ -22,7 +22,7 @@ export { caption } from './caption';
|
|
22
22
|
export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as mediaToJSON } from './media';
|
23
23
|
export { mediaGroup } from './media-group';
|
24
24
|
export { mediaInline } from './media-inline';
|
25
|
-
export { mediaSingle, mediaSingleWithCaption, toJSON as mediaSingleToJSON } from './media-single';
|
25
|
+
export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, toJSON as mediaSingleToJSON } from './media-single';
|
26
26
|
export { table, tableWithCustomWidth, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
|
27
27
|
export { decisionList, decisionListSelector } from './decision-list';
|
28
28
|
export { decisionItem } from './decision-item';
|
@@ -31,24 +31,29 @@ export var defaultAttrs = {
|
|
31
31
|
default: 'center'
|
32
32
|
}
|
33
33
|
};
|
34
|
-
export var
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
content: 'media|unsupportedBlock+|media unsupportedBlock+'
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
34
|
+
export var mediaSingleSpec = function mediaSingleSpec(_ref) {
|
35
|
+
var _ref$withCaption = _ref.withCaption,
|
36
|
+
withCaption = _ref$withCaption === void 0 ? false : _ref$withCaption,
|
37
|
+
_ref$withExtendedWidt = _ref.withExtendedWidthTypes,
|
38
|
+
withExtendedWidthTypes = _ref$withExtendedWidt === void 0 ? false : _ref$withExtendedWidt;
|
39
|
+
var content = withCaption ? 'media|unsupportedBlock+|media (caption|unsupportedBlock) unsupportedBlock*' : 'media|unsupportedBlock+|media unsupportedBlock+';
|
40
|
+
var atom = !withCaption;
|
41
|
+
var getAttrs = function getAttrs(dom) {
|
42
|
+
var domAttrs = {
|
43
|
+
layout: dom.getAttribute('data-layout') || 'center',
|
44
|
+
width: Number(dom.getAttribute('data-width')) || null
|
45
|
+
};
|
46
|
+
if (withExtendedWidthTypes) {
|
47
|
+
var widthType = dom.getAttribute('data-width-type');
|
48
|
+
if (widthType) {
|
49
|
+
return _objectSpread(_objectSpread({}, domAttrs), {}, {
|
50
|
+
widthType: widthType
|
51
|
+
});
|
52
|
+
}
|
49
53
|
}
|
50
|
-
|
51
|
-
|
54
|
+
return domAttrs;
|
55
|
+
};
|
56
|
+
var getAttrsFromNode = function getAttrsFromNode(node) {
|
52
57
|
var _node$attrs = node.attrs,
|
53
58
|
layout = _node$attrs.layout,
|
54
59
|
width = _node$attrs.width;
|
@@ -60,12 +65,50 @@ export var mediaSingle = {
|
|
60
65
|
if (width) {
|
61
66
|
attrs['data-width'] = isFinite(width) && Math.floor(width) === width ? width : width.toFixed(2);
|
62
67
|
}
|
63
|
-
|
64
|
-
|
68
|
+
if (withExtendedWidthTypes && node.attrs.widthType) {
|
69
|
+
var widthType = node.attrs.widthType;
|
70
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
71
|
+
'data-width-type': widthType || 'percentage'
|
72
|
+
});
|
73
|
+
}
|
74
|
+
return attrs;
|
75
|
+
};
|
76
|
+
return {
|
77
|
+
inline: false,
|
78
|
+
group: 'block',
|
79
|
+
selectable: true,
|
80
|
+
atom: atom,
|
81
|
+
content: content,
|
82
|
+
attrs: withExtendedWidthTypes ? _objectSpread(_objectSpread({}, defaultAttrs), {}, {
|
83
|
+
widthType: {
|
84
|
+
default: null
|
85
|
+
}
|
86
|
+
}) : defaultAttrs,
|
87
|
+
marks: 'unsupportedMark unsupportedNodeAttribute border link',
|
88
|
+
parseDOM: [{
|
89
|
+
tag: 'div[data-node-type="mediaSingle"]',
|
90
|
+
getAttrs: getAttrs
|
91
|
+
}],
|
92
|
+
toDOM: function toDOM(node) {
|
93
|
+
return ['div', getAttrsFromNode(node), 0];
|
94
|
+
}
|
95
|
+
};
|
65
96
|
};
|
66
|
-
export var
|
67
|
-
|
68
|
-
|
97
|
+
export var mediaSingle = mediaSingleSpec({
|
98
|
+
withCaption: false,
|
99
|
+
withExtendedWidthTypes: false
|
100
|
+
});
|
101
|
+
export var mediaSingleWithCaption = mediaSingleSpec({
|
102
|
+
withCaption: true,
|
103
|
+
withExtendedWidthTypes: false
|
104
|
+
});
|
105
|
+
export var mediaSingleWithWidthType = mediaSingleSpec({
|
106
|
+
withCaption: false,
|
107
|
+
withExtendedWidthTypes: true
|
108
|
+
});
|
109
|
+
export var mediaSingleFull = mediaSingleSpec({
|
110
|
+
withCaption: true,
|
111
|
+
withExtendedWidthTypes: true
|
69
112
|
});
|
70
113
|
export var toJSON = function toJSON(node) {
|
71
114
|
return {
|