@atlaskit/adf-schema 19.1.0 → 19.2.3
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 +28 -0
- package/dist/cjs/index.js +8 -2
- package/dist/cjs/schema/default-schema.js +4 -1
- package/dist/cjs/schema/index.js +14 -2
- package/dist/cjs/schema/marks/link.js +31 -2
- package/dist/cjs/schema/nodes/index.js +14 -2
- package/dist/cjs/schema/nodes/layout-section.js +35 -3
- package/dist/cjs/schema/nodes/tableNodes.js +13 -9
- package/dist/cjs/steps/analytics.js +3 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/default-schema.js +3 -1
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/marks/link.js +27 -2
- package/dist/es2019/schema/nodes/index.js +2 -2
- package/dist/es2019/schema/nodes/layout-section.js +34 -1
- package/dist/es2019/schema/nodes/tableNodes.js +10 -9
- package/dist/es2019/steps/analytics.js +2 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/default-schema.js +3 -1
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/marks/link.js +31 -2
- package/dist/esm/schema/nodes/index.js +2 -2
- package/dist/esm/schema/nodes/layout-section.js +32 -1
- package/dist/esm/schema/nodes/tableNodes.js +10 -9
- package/dist/esm/steps/analytics.js +3 -3
- package/dist/esm/version.json +1 -1
- package/dist/json-schema/v1/full.json +42 -8
- package/dist/json-schema/v1/stage-0.json +81 -8
- package/dist/types/index.d.ts +2 -2
- package/dist/types/schema/index.d.ts +2 -2
- package/dist/types/schema/nodes/index.d.ts +3 -3
- package/dist/types/schema/nodes/layout-section.d.ts +28 -1
- package/dist/types/schema/nodes/tableNodes.d.ts +11 -1
- package/json-schema/v1/full.json +42 -8
- package/json-schema/v1/stage-0.json +81 -8
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,33 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 19.2.3
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [`a80f50a843c`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a80f50a843c) - [HOT-97158] Fix paste link heading issue
|
8
|
+
|
9
|
+
## 19.2.2
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- [`b85e7ce12cd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/b85e7ce12cd) - Internal upgrade of memoize-one to 6.0.0
|
14
|
+
|
15
|
+
## 19.2.1
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- [`a55dbcb3ecd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a55dbcb3ecd) - [ED-13882] Fix layout section ProseMirror Schema content
|
20
|
+
|
21
|
+
## 19.2.0
|
22
|
+
|
23
|
+
### Minor Changes
|
24
|
+
|
25
|
+
- [`cf853e39278`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf853e39278) - CETI-72 Web: Copy from renderer loses custom panel attributes
|
26
|
+
- [`cf853e39278`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf853e39278) - Add single column support for layouts
|
27
|
+
- [`9fbaa50c904`](https://bitbucket.org/atlassian/atlassian-frontend/commits/9fbaa50c904) - ED-13133 fixed broken table with sticky headers after undo merge cells with tableCellOptimisation on
|
28
|
+
- [`cf853e39278`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf853e39278) - [ux] add single layout support for layout
|
29
|
+
- [`6840e64d105`](https://bitbucket.org/atlassian/atlassian-frontend/commits/6840e64d105) - CETI-124: Revert panel content wrapper from span to div
|
30
|
+
|
3
31
|
## 19.1.0
|
4
32
|
|
5
33
|
### Minor Changes
|
package/dist/cjs/index.js
CHANGED
@@ -507,10 +507,16 @@ Object.defineProperty(exports, "sanitizeNodes", {
|
|
507
507
|
return _schema.sanitizeNodes;
|
508
508
|
}
|
509
509
|
});
|
510
|
-
Object.defineProperty(exports, "
|
510
|
+
Object.defineProperty(exports, "getCellAttrs", {
|
511
511
|
enumerable: true,
|
512
512
|
get: function get() {
|
513
|
-
return _schema.
|
513
|
+
return _schema.getCellAttrs;
|
514
|
+
}
|
515
|
+
});
|
516
|
+
Object.defineProperty(exports, "getCellDomAttrs", {
|
517
|
+
enumerable: true,
|
518
|
+
get: function get() {
|
519
|
+
return _schema.getCellDomAttrs;
|
514
520
|
}
|
515
521
|
});
|
516
522
|
Object.defineProperty(exports, "status", {
|
@@ -7,6 +7,8 @@ exports.defaultSchema = exports.getSchemaBasedOnStage = exports.defaultSchemaCon
|
|
7
7
|
|
8
8
|
var _panel = require("./nodes/panel");
|
9
9
|
|
10
|
+
var _layoutSection = require("./nodes/layout-section");
|
11
|
+
|
10
12
|
var _dataConsumer = require("./marks/data-consumer");
|
11
13
|
|
12
14
|
var _createSchema = require("./create-schema");
|
@@ -32,7 +34,8 @@ var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
|
|
32
34
|
if (stage === 'stage0') {
|
33
35
|
defaultSchemaConfig.customNodeSpecs = {
|
34
36
|
panel: _panel.customPanel,
|
35
|
-
mediaSingle: _nodes.mediaSingleWithCaption
|
37
|
+
mediaSingle: _nodes.mediaSingleWithCaption,
|
38
|
+
layoutSection: _layoutSection.layoutSectionWithSingleColumn
|
36
39
|
};
|
37
40
|
defaultSchemaConfig.customMarkSpecs = {
|
38
41
|
dataConsumer: _dataConsumer.dataConsumer
|
package/dist/cjs/schema/index.js
CHANGED
@@ -185,6 +185,12 @@ Object.defineProperty(exports, "layoutSection", {
|
|
185
185
|
return _nodes.layoutSection;
|
186
186
|
}
|
187
187
|
});
|
188
|
+
Object.defineProperty(exports, "layoutSectionWithSingleColumn", {
|
189
|
+
enumerable: true,
|
190
|
+
get: function get() {
|
191
|
+
return _nodes.layoutSectionWithSingleColumn;
|
192
|
+
}
|
193
|
+
});
|
188
194
|
Object.defineProperty(exports, "listItem", {
|
189
195
|
enumerable: true,
|
190
196
|
get: function get() {
|
@@ -293,10 +299,16 @@ Object.defineProperty(exports, "rule", {
|
|
293
299
|
return _nodes.rule;
|
294
300
|
}
|
295
301
|
});
|
296
|
-
Object.defineProperty(exports, "
|
302
|
+
Object.defineProperty(exports, "getCellAttrs", {
|
303
|
+
enumerable: true,
|
304
|
+
get: function get() {
|
305
|
+
return _nodes.getCellAttrs;
|
306
|
+
}
|
307
|
+
});
|
308
|
+
Object.defineProperty(exports, "getCellDomAttrs", {
|
297
309
|
enumerable: true,
|
298
310
|
get: function get() {
|
299
|
-
return _nodes.
|
311
|
+
return _nodes.getCellDomAttrs;
|
300
312
|
}
|
301
313
|
});
|
302
314
|
Object.defineProperty(exports, "status", {
|
@@ -37,6 +37,32 @@ var getLinkAttrs = function getLinkAttrs(attribute) {
|
|
37
37
|
};
|
38
38
|
};
|
39
39
|
|
40
|
+
var getLinkAttrsWithCheck = function getLinkAttrsWithCheck(attribute) {
|
41
|
+
return function (domNode) {
|
42
|
+
var dom = domNode;
|
43
|
+
var hasTextOnlyChildren = Array.from(dom.childNodes).every(function (node) {
|
44
|
+
return node.nodeType === Node.TEXT_NODE || node.nodeName === 'SPAN';
|
45
|
+
});
|
46
|
+
|
47
|
+
if (hasTextOnlyChildren) {
|
48
|
+
var href = dom.getAttribute(attribute) || '';
|
49
|
+
var attrs = {
|
50
|
+
__confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
|
51
|
+
};
|
52
|
+
|
53
|
+
if ((0, _url.isSafeUrl)(href)) {
|
54
|
+
attrs.href = (0, _url.normalizeUrl)(href);
|
55
|
+
} else {
|
56
|
+
return false;
|
57
|
+
}
|
58
|
+
|
59
|
+
return attrs;
|
60
|
+
}
|
61
|
+
|
62
|
+
return false;
|
63
|
+
};
|
64
|
+
};
|
65
|
+
|
40
66
|
var link = {
|
41
67
|
excludes: "".concat(_groups.LINK, " ").concat(_groups.COLOR),
|
42
68
|
// ED-5844 No multiple links in media node
|
@@ -60,8 +86,11 @@ var link = {
|
|
60
86
|
}
|
61
87
|
}, {
|
62
88
|
tag: 'a[href]',
|
63
|
-
context: '
|
89
|
+
context: 'mediaSingle/|taskItem/|decisionItem/',
|
64
90
|
getAttrs: getLinkAttrs('href')
|
91
|
+
}, {
|
92
|
+
tag: 'a[href]',
|
93
|
+
getAttrs: getLinkAttrsWithCheck('href')
|
65
94
|
}, {
|
66
95
|
/**
|
67
96
|
* When links aren't wrapped in a paragraph and due to
|
@@ -72,7 +101,7 @@ var link = {
|
|
72
101
|
* This change comes through via prosemirror-model@1.9.1
|
73
102
|
*/
|
74
103
|
tag: 'a[href]',
|
75
|
-
getAttrs:
|
104
|
+
getAttrs: getLinkAttrsWithCheck('href'),
|
76
105
|
getContent: function getContent(node, schema) {
|
77
106
|
if (node instanceof HTMLAnchorElement) {
|
78
107
|
var href = node.getAttribute('href');
|
@@ -281,10 +281,16 @@ Object.defineProperty(exports, "tableBackgroundColorNames", {
|
|
281
281
|
return _tableNodes.tableBackgroundColorNames;
|
282
282
|
}
|
283
283
|
});
|
284
|
-
Object.defineProperty(exports, "
|
284
|
+
Object.defineProperty(exports, "getCellAttrs", {
|
285
285
|
enumerable: true,
|
286
286
|
get: function get() {
|
287
|
-
return _tableNodes.
|
287
|
+
return _tableNodes.getCellAttrs;
|
288
|
+
}
|
289
|
+
});
|
290
|
+
Object.defineProperty(exports, "getCellDomAttrs", {
|
291
|
+
enumerable: true,
|
292
|
+
get: function get() {
|
293
|
+
return _tableNodes.getCellDomAttrs;
|
288
294
|
}
|
289
295
|
});
|
290
296
|
Object.defineProperty(exports, "tablePrefixSelector", {
|
@@ -389,6 +395,12 @@ Object.defineProperty(exports, "layoutSection", {
|
|
389
395
|
return _layoutSection.layoutSection;
|
390
396
|
}
|
391
397
|
});
|
398
|
+
Object.defineProperty(exports, "layoutSectionWithSingleColumn", {
|
399
|
+
enumerable: true,
|
400
|
+
get: function get() {
|
401
|
+
return _layoutSection.layoutSectionWithSingleColumn;
|
402
|
+
}
|
403
|
+
});
|
392
404
|
Object.defineProperty(exports, "layoutColumn", {
|
393
405
|
enumerable: true,
|
394
406
|
get: function get() {
|
@@ -3,13 +3,45 @@
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
4
4
|
value: true
|
5
5
|
});
|
6
|
-
exports.layoutSection = void 0;
|
6
|
+
exports.layoutSectionWithSingleColumn = exports.layoutSection = void 0;
|
7
7
|
|
8
8
|
/**
|
9
9
|
* @name layoutSection_node
|
10
10
|
*/
|
11
|
+
|
12
|
+
/**
|
13
|
+
* Need duplicate `type` and `marks` to make both validator and json-schema satisfied
|
14
|
+
*/
|
15
|
+
|
16
|
+
/**
|
17
|
+
* @name layoutSection_full_node
|
18
|
+
*/
|
19
|
+
|
20
|
+
/**
|
21
|
+
* @stage 0
|
22
|
+
* @name layoutSection_with_single_column_node
|
23
|
+
*/
|
11
24
|
var layoutSection = {
|
12
|
-
content: '(layoutColumn | unsupportedBlock){
|
25
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
26
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
27
|
+
isolating: true,
|
28
|
+
parseDOM: [{
|
29
|
+
context: 'layoutSection//|layoutColumn//',
|
30
|
+
tag: 'div[data-layout-section]',
|
31
|
+
skip: true
|
32
|
+
}, {
|
33
|
+
tag: 'div[data-layout-section]'
|
34
|
+
}],
|
35
|
+
toDOM: function toDOM() {
|
36
|
+
var attrs = {
|
37
|
+
'data-layout-section': 'true'
|
38
|
+
};
|
39
|
+
return ['div', attrs, 0];
|
40
|
+
}
|
41
|
+
};
|
42
|
+
exports.layoutSection = layoutSection;
|
43
|
+
var layoutSectionWithSingleColumn = {
|
44
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
13
45
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
14
46
|
isolating: true,
|
15
47
|
parseDOM: [{
|
@@ -26,4 +58,4 @@ var layoutSection = {
|
|
26
58
|
return ['div', attrs, 0];
|
27
59
|
}
|
28
60
|
};
|
29
|
-
exports.
|
61
|
+
exports.layoutSectionWithSingleColumn = layoutSectionWithSingleColumn;
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
6
6
|
value: true
|
7
7
|
});
|
8
|
-
exports.toJSONTableHeader = exports.tableHeader = exports.toJSONTableCell = exports.tableCell = exports.tableRow = exports.tableToJSON = exports.table = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.tableBackgroundColorPalette = exports.
|
8
|
+
exports.toJSONTableHeader = exports.tableHeader = exports.toJSONTableCell = exports.tableCell = exports.tableRow = exports.tableToJSON = exports.table = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.tableBackgroundColorPalette = exports.getCellDomAttrs = exports.getCellAttrs = exports.tableCellContentDomSelector = exports.tableCellContentWrapperSelector = exports.tableHeaderSelector = exports.tableCellSelector = exports.tablePrefixSelector = void 0;
|
9
9
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
11
11
|
|
@@ -51,17 +51,21 @@ var getCellAttrs = function getCellAttrs(dom) {
|
|
51
51
|
};
|
52
52
|
};
|
53
53
|
|
54
|
-
|
54
|
+
exports.getCellAttrs = getCellAttrs;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* gets cell dom attributes based on node attributes
|
58
|
+
* @returns CellDomAttrs
|
59
|
+
*/
|
60
|
+
var getCellDomAttrs = function getCellDomAttrs(node) {
|
55
61
|
var attrs = {};
|
56
62
|
var nodeType = node.type.name;
|
57
|
-
var colspan = cell ? parseInt(cell.getAttribute('colspan') || '1', 10) : 1;
|
58
|
-
var rowspan = cell ? parseInt(cell.getAttribute('rowspan') || '1', 10) : 1;
|
59
63
|
|
60
|
-
if (node.attrs.colspan !==
|
64
|
+
if (node.attrs.colspan !== 1) {
|
61
65
|
attrs.colspan = node.attrs.colspan;
|
62
66
|
}
|
63
67
|
|
64
|
-
if (node.attrs.rowspan !==
|
68
|
+
if (node.attrs.rowspan !== 1) {
|
65
69
|
attrs.rowspan = node.attrs.rowspan;
|
66
70
|
}
|
67
71
|
|
@@ -94,7 +98,7 @@ var setCellAttrs = function setCellAttrs(node, cell) {
|
|
94
98
|
return attrs;
|
95
99
|
};
|
96
100
|
|
97
|
-
exports.
|
101
|
+
exports.getCellDomAttrs = getCellDomAttrs;
|
98
102
|
var tableBackgroundColorPalette = new Map();
|
99
103
|
exports.tableBackgroundColorPalette = tableBackgroundColorPalette;
|
100
104
|
|
@@ -230,7 +234,7 @@ var tableCell = {
|
|
230
234
|
}
|
231
235
|
}],
|
232
236
|
toDOM: function toDOM(node) {
|
233
|
-
return ['td',
|
237
|
+
return ['td', getCellDomAttrs(node), 0];
|
234
238
|
}
|
235
239
|
};
|
236
240
|
exports.tableCell = tableCell;
|
@@ -264,7 +268,7 @@ var tableHeader = {
|
|
264
268
|
}
|
265
269
|
}],
|
266
270
|
toDOM: function toDOM(node) {
|
267
|
-
return ['th',
|
271
|
+
return ['th', getCellDomAttrs(node), 0];
|
268
272
|
}
|
269
273
|
};
|
270
274
|
exports.tableHeader = tableHeader;
|
@@ -88,12 +88,12 @@ var AnalyticsStep = /*#__PURE__*/function (_Step) {
|
|
88
88
|
|
89
89
|
var _super = _createSuper(AnalyticsStep);
|
90
90
|
|
91
|
-
function AnalyticsStep(analyticsEvents)
|
92
|
-
{
|
91
|
+
function AnalyticsStep(analyticsEvents) {
|
93
92
|
var _this;
|
94
93
|
|
95
94
|
var actionsToIgnore = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
96
|
-
var pos
|
95
|
+
var pos // Used to create the map, prevent splitting history.
|
96
|
+
= arguments.length > 2 ? arguments[2] : undefined;
|
97
97
|
(0, _classCallCheck2.default)(this, AnalyticsStep);
|
98
98
|
_this = _super.call(this);
|
99
99
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "analyticsEvents", []);
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes,
|
1
|
+
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './schema';
|
2
2
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { customPanel } from './nodes/panel';
|
2
|
+
import { layoutSectionWithSingleColumn } from './nodes/layout-section';
|
2
3
|
import { dataConsumer } from './marks/data-consumer';
|
3
4
|
import { createSchema } from './create-schema';
|
4
5
|
import { mediaSingleWithCaption } from './nodes';
|
@@ -19,7 +20,8 @@ export const getSchemaBasedOnStage = (stage = 'final') => {
|
|
19
20
|
if (stage === 'stage0') {
|
20
21
|
defaultSchemaConfig.customNodeSpecs = {
|
21
22
|
panel: customPanel,
|
22
|
-
mediaSingle: mediaSingleWithCaption
|
23
|
+
mediaSingle: mediaSingleWithCaption,
|
24
|
+
layoutSection: layoutSectionWithSingleColumn
|
23
25
|
};
|
24
26
|
defaultSchemaConfig.customMarkSpecs = {
|
25
27
|
dataConsumer: dataConsumer
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule,
|
1
|
+
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
2
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
|
3
3
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
4
4
|
export { inlineNodes } from './inline-nodes';
|
@@ -18,6 +18,28 @@ const getLinkAttrs = attribute => domNode => {
|
|
18
18
|
return attrs;
|
19
19
|
};
|
20
20
|
|
21
|
+
const getLinkAttrsWithCheck = attribute => domNode => {
|
22
|
+
const dom = domNode;
|
23
|
+
const hasTextOnlyChildren = Array.from(dom.childNodes).every(node => node.nodeType === Node.TEXT_NODE || node.nodeName === 'SPAN');
|
24
|
+
|
25
|
+
if (hasTextOnlyChildren) {
|
26
|
+
const href = dom.getAttribute(attribute) || '';
|
27
|
+
const attrs = {
|
28
|
+
__confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
|
29
|
+
};
|
30
|
+
|
31
|
+
if (isSafeUrl(href)) {
|
32
|
+
attrs.href = normalizeUrl(href);
|
33
|
+
} else {
|
34
|
+
return false;
|
35
|
+
}
|
36
|
+
|
37
|
+
return attrs;
|
38
|
+
}
|
39
|
+
|
40
|
+
return false;
|
41
|
+
};
|
42
|
+
|
21
43
|
export const link = {
|
22
44
|
excludes: `${LINK} ${COLOR}`,
|
23
45
|
// ED-5844 No multiple links in media node
|
@@ -41,8 +63,11 @@ export const link = {
|
|
41
63
|
}
|
42
64
|
}, {
|
43
65
|
tag: 'a[href]',
|
44
|
-
context: '
|
66
|
+
context: 'mediaSingle/|taskItem/|decisionItem/',
|
45
67
|
getAttrs: getLinkAttrs('href')
|
68
|
+
}, {
|
69
|
+
tag: 'a[href]',
|
70
|
+
getAttrs: getLinkAttrsWithCheck('href')
|
46
71
|
}, {
|
47
72
|
/**
|
48
73
|
* When links aren't wrapped in a paragraph and due to
|
@@ -53,7 +78,7 @@ export const link = {
|
|
53
78
|
* This change comes through via prosemirror-model@1.9.1
|
54
79
|
*/
|
55
80
|
tag: 'a[href]',
|
56
|
-
getAttrs:
|
81
|
+
getAttrs: getLinkAttrsWithCheck('href'),
|
57
82
|
getContent: (node, schema) => {
|
58
83
|
if (node instanceof HTMLAnchorElement) {
|
59
84
|
const href = node.getAttribute('href');
|
@@ -23,7 +23,7 @@ export { media, copyPrivateAttributes as copyPrivateMediaAttributes, toJSON as m
|
|
23
23
|
export { mediaGroup } from './media-group';
|
24
24
|
export { mediaInline } from './media-inline';
|
25
25
|
export { mediaSingle, mediaSingleWithCaption, toJSON as mediaSingleToJSON } from './media-single';
|
26
|
-
export { table, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames,
|
26
|
+
export { table, tableToJSON, tableCell, toJSONTableCell, tableHeader, toJSONTableHeader, tableRow, tableBackgroundColorPalette, tableBackgroundBorderColor, tableBackgroundColorNames, getCellAttrs, getCellDomAttrs, tablePrefixSelector, tableCellSelector, tableHeaderSelector, tableCellContentWrapperSelector, tableCellContentDomSelector } from './tableNodes';
|
27
27
|
export { decisionList, decisionListSelector } from './decision-list';
|
28
28
|
export { decisionItem } from './decision-item';
|
29
29
|
export { taskList, taskListSelector } from './task-list';
|
@@ -33,7 +33,7 @@ export { inlineExtension } from './inline-extension';
|
|
33
33
|
export { bodiedExtension } from './bodied-extension';
|
34
34
|
export { date } from './date';
|
35
35
|
export { placeholder } from './placeholder';
|
36
|
-
export { layoutSection } from './layout-section';
|
36
|
+
export { layoutSection, layoutSectionWithSingleColumn } from './layout-section';
|
37
37
|
export { layoutColumn } from './layout-column';
|
38
38
|
export { inlineCard } from './inline-card';
|
39
39
|
export { blockCard } from './block-card';
|
@@ -1,8 +1,41 @@
|
|
1
1
|
/**
|
2
2
|
* @name layoutSection_node
|
3
3
|
*/
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Need duplicate `type` and `marks` to make both validator and json-schema satisfied
|
7
|
+
*/
|
8
|
+
|
9
|
+
/**
|
10
|
+
* @name layoutSection_full_node
|
11
|
+
*/
|
12
|
+
|
13
|
+
/**
|
14
|
+
* @stage 0
|
15
|
+
* @name layoutSection_with_single_column_node
|
16
|
+
*/
|
4
17
|
export const layoutSection = {
|
5
|
-
content: '(layoutColumn | unsupportedBlock){
|
18
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
19
|
+
marks: 'unsupportedMark unsupportedNodeAttribute',
|
20
|
+
isolating: true,
|
21
|
+
parseDOM: [{
|
22
|
+
context: 'layoutSection//|layoutColumn//',
|
23
|
+
tag: 'div[data-layout-section]',
|
24
|
+
skip: true
|
25
|
+
}, {
|
26
|
+
tag: 'div[data-layout-section]'
|
27
|
+
}],
|
28
|
+
|
29
|
+
toDOM() {
|
30
|
+
const attrs = {
|
31
|
+
'data-layout-section': 'true'
|
32
|
+
};
|
33
|
+
return ['div', attrs, 0];
|
34
|
+
}
|
35
|
+
|
36
|
+
};
|
37
|
+
export const layoutSectionWithSingleColumn = {
|
38
|
+
content: '(layoutColumn | unsupportedBlock){1,3} unsupportedBlock* | unsupportedBlock+',
|
6
39
|
marks: 'unsupportedMark unsupportedNodeAttribute',
|
7
40
|
isolating: true,
|
8
41
|
parseDOM: [{
|
@@ -6,8 +6,7 @@ export const tableHeaderSelector = `${tablePrefixSelector}-header-content-wrap`;
|
|
6
6
|
export const tableCellContentWrapperSelector = `${tablePrefixSelector}-cell-nodeview-wrapper`;
|
7
7
|
export const tableCellContentDomSelector = `${tablePrefixSelector}-cell-nodeview-content-dom`;
|
8
8
|
const DEFAULT_TABLE_HEADER_CELL_BACKGROUND = N20.toLocaleLowerCase();
|
9
|
-
|
10
|
-
const getCellAttrs = (dom, defaultValues = {}) => {
|
9
|
+
export const getCellAttrs = (dom, defaultValues = {}) => {
|
11
10
|
const widthAttr = dom.getAttribute('data-colwidth');
|
12
11
|
const width = widthAttr && /^\d+(,\d+)*$/.test(widthAttr) ? widthAttr.split(',').map(str => Number(str)) : null;
|
13
12
|
const colspan = Number(dom.getAttribute('colspan') || 1);
|
@@ -31,17 +30,19 @@ const getCellAttrs = (dom, defaultValues = {}) => {
|
|
31
30
|
};
|
32
31
|
};
|
33
32
|
|
34
|
-
|
33
|
+
/**
|
34
|
+
* gets cell dom attributes based on node attributes
|
35
|
+
* @returns CellDomAttrs
|
36
|
+
*/
|
37
|
+
export const getCellDomAttrs = node => {
|
35
38
|
const attrs = {};
|
36
39
|
const nodeType = node.type.name;
|
37
|
-
const colspan = cell ? parseInt(cell.getAttribute('colspan') || '1', 10) : 1;
|
38
|
-
const rowspan = cell ? parseInt(cell.getAttribute('rowspan') || '1', 10) : 1;
|
39
40
|
|
40
|
-
if (node.attrs.colspan !==
|
41
|
+
if (node.attrs.colspan !== 1) {
|
41
42
|
attrs.colspan = node.attrs.colspan;
|
42
43
|
}
|
43
44
|
|
44
|
-
if (node.attrs.rowspan !==
|
45
|
+
if (node.attrs.rowspan !== 1) {
|
45
46
|
attrs.rowspan = node.attrs.rowspan;
|
46
47
|
}
|
47
48
|
|
@@ -192,7 +193,7 @@ export const tableCell = {
|
|
192
193
|
tag: 'td',
|
193
194
|
getAttrs: dom => getCellAttrs(dom)
|
194
195
|
}],
|
195
|
-
toDOM: node => ['td',
|
196
|
+
toDOM: node => ['td', getCellDomAttrs(node), 0]
|
196
197
|
};
|
197
198
|
export const toJSONTableCell = node => ({
|
198
199
|
attrs: Object.keys(node.attrs).reduce((obj, key) => {
|
@@ -216,6 +217,6 @@ export const tableHeader = {
|
|
216
217
|
background: DEFAULT_TABLE_HEADER_CELL_BACKGROUND
|
217
218
|
})
|
218
219
|
}],
|
219
|
-
toDOM: node => ['th',
|
220
|
+
toDOM: node => ['th', getCellDomAttrs(node), 0]
|
220
221
|
};
|
221
222
|
export const toJSONTableHeader = toJSONTableCell;
|
@@ -46,8 +46,8 @@ function isHistoryAnalyticsEvent(event) {
|
|
46
46
|
* undo/redo events for free
|
47
47
|
*/
|
48
48
|
export class AnalyticsStep extends Step {
|
49
|
-
constructor(analyticsEvents, actionsToIgnore = [], pos
|
50
|
-
{
|
49
|
+
constructor(analyticsEvents, actionsToIgnore = [], pos // Used to create the map, prevent splitting history.
|
50
|
+
) {
|
51
51
|
super();
|
52
52
|
|
53
53
|
_defineProperty(this, "analyticsEvents", []);
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes,
|
1
|
+
export { AnnotationTypes, PanelType, alignment, alignmentPositionMap, annotation, bitbucketSchema, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceSchema, confluenceSchemaWithMediaSingle, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createJIRASchema, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, defaultSchema, defaultSchemaConfig, doc, em, embedCard, emoji, expand, expandToJSON, extension, getSchemaBasedOnStage, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, isSchemaWithAdvancedTextFormattingMarks, isSchemaWithBlockQuotes, isSchemaWithCodeBlock, isSchemaWithEmojis, isSchemaWithLinks, isSchemaWithLists, isSchemaWithMedia, isSchemaWithMentions, isSchemaWithSubSupMark, isSchemaWithTables, isSchemaWithTextColor, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './schema';
|
2
2
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { customPanel } from './nodes/panel';
|
2
|
+
import { layoutSectionWithSingleColumn } from './nodes/layout-section';
|
2
3
|
import { dataConsumer } from './marks/data-consumer';
|
3
4
|
import { createSchema } from './create-schema';
|
4
5
|
import { mediaSingleWithCaption } from './nodes';
|
@@ -20,7 +21,8 @@ export var getSchemaBasedOnStage = function getSchemaBasedOnStage() {
|
|
20
21
|
if (stage === 'stage0') {
|
21
22
|
defaultSchemaConfig.customNodeSpecs = {
|
22
23
|
panel: customPanel,
|
23
|
-
mediaSingle: mediaSingleWithCaption
|
24
|
+
mediaSingle: mediaSingleWithCaption,
|
25
|
+
layoutSection: layoutSectionWithSingleColumn
|
24
26
|
};
|
25
27
|
defaultSchemaConfig.customMarkSpecs = {
|
26
28
|
dataConsumer: dataConsumer
|
package/dist/esm/schema/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule,
|
1
|
+
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, panel, customPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
2
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
|
3
3
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
4
4
|
export { inlineNodes } from './inline-nodes';
|
@@ -26,6 +26,32 @@ var getLinkAttrs = function getLinkAttrs(attribute) {
|
|
26
26
|
};
|
27
27
|
};
|
28
28
|
|
29
|
+
var getLinkAttrsWithCheck = function getLinkAttrsWithCheck(attribute) {
|
30
|
+
return function (domNode) {
|
31
|
+
var dom = domNode;
|
32
|
+
var hasTextOnlyChildren = Array.from(dom.childNodes).every(function (node) {
|
33
|
+
return node.nodeType === Node.TEXT_NODE || node.nodeName === 'SPAN';
|
34
|
+
});
|
35
|
+
|
36
|
+
if (hasTextOnlyChildren) {
|
37
|
+
var href = dom.getAttribute(attribute) || '';
|
38
|
+
var attrs = {
|
39
|
+
__confluenceMetadata: dom.hasAttribute('__confluenceMetadata') ? JSON.parse(dom.getAttribute('__confluenceMetadata') || '') : undefined
|
40
|
+
};
|
41
|
+
|
42
|
+
if (isSafeUrl(href)) {
|
43
|
+
attrs.href = normalizeUrl(href);
|
44
|
+
} else {
|
45
|
+
return false;
|
46
|
+
}
|
47
|
+
|
48
|
+
return attrs;
|
49
|
+
}
|
50
|
+
|
51
|
+
return false;
|
52
|
+
};
|
53
|
+
};
|
54
|
+
|
29
55
|
export var link = {
|
30
56
|
excludes: "".concat(LINK, " ").concat(COLOR),
|
31
57
|
// ED-5844 No multiple links in media node
|
@@ -49,8 +75,11 @@ export var link = {
|
|
49
75
|
}
|
50
76
|
}, {
|
51
77
|
tag: 'a[href]',
|
52
|
-
context: '
|
78
|
+
context: 'mediaSingle/|taskItem/|decisionItem/',
|
53
79
|
getAttrs: getLinkAttrs('href')
|
80
|
+
}, {
|
81
|
+
tag: 'a[href]',
|
82
|
+
getAttrs: getLinkAttrsWithCheck('href')
|
54
83
|
}, {
|
55
84
|
/**
|
56
85
|
* When links aren't wrapped in a paragraph and due to
|
@@ -61,7 +90,7 @@ export var link = {
|
|
61
90
|
* This change comes through via prosemirror-model@1.9.1
|
62
91
|
*/
|
63
92
|
tag: 'a[href]',
|
64
|
-
getAttrs:
|
93
|
+
getAttrs: getLinkAttrsWithCheck('href'),
|
65
94
|
getContent: function getContent(node, schema) {
|
66
95
|
if (node instanceof HTMLAnchorElement) {
|
67
96
|
var href = node.getAttribute('href');
|