@atlaskit/adf-schema 49.0.6 → 49.1.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 +6 -0
- package/dist/cjs/index.js +114 -0
- package/dist/cjs/next-schema/generated/nodeTypes.js +118 -1
- package/dist/cjs/next-schema/nodes/blockCard.js +15 -0
- package/dist/cjs/next-schema/nodes/blockquote.js +16 -2
- package/dist/cjs/next-schema/nodes/caption.js +7 -0
- package/dist/cjs/next-schema/nodes/codeBlock.js +5 -0
- package/dist/cjs/next-schema/nodes/date.js +5 -0
- package/dist/cjs/next-schema/nodes/embedCard.js +5 -0
- package/dist/cjs/next-schema/nodes/emoji.js +5 -0
- package/dist/cjs/next-schema/nodes/expand.js +5 -0
- package/dist/cjs/next-schema/nodes/hardBreak.js +5 -0
- package/dist/cjs/next-schema/nodes/inlineCard.js +10 -0
- package/dist/cjs/next-schema/nodes/layoutColumn.js +5 -0
- package/dist/cjs/next-schema/nodes/layoutSection.js +12 -0
- package/dist/cjs/next-schema/nodes/list.js +20 -1
- package/dist/cjs/next-schema/nodes/media.js +10 -0
- package/dist/cjs/next-schema/nodes/mediaInline.js +5 -0
- package/dist/cjs/next-schema/nodes/mediaSingle.js +10 -0
- package/dist/cjs/next-schema/nodes/nestedExpand.js +5 -0
- package/dist/cjs/next-schema/nodes/panel.js +5 -0
- package/dist/cjs/next-schema/nodes/placeholder.js +5 -0
- package/dist/cjs/next-schema/nodes/rule.js +9 -1
- package/dist/cjs/schema/index.js +120 -0
- package/dist/cjs/schema/nodes/block-card.js +48 -1
- package/dist/cjs/schema/nodes/blockquote.js +20 -2
- package/dist/cjs/schema/nodes/bullet-list.js +20 -1
- package/dist/cjs/schema/nodes/caption.js +20 -1
- package/dist/cjs/schema/nodes/code-block.js +72 -2
- package/dist/cjs/schema/nodes/date.js +22 -1
- package/dist/cjs/schema/nodes/embed-card.js +36 -1
- package/dist/cjs/schema/nodes/emoji.js +73 -1
- package/dist/cjs/schema/nodes/expand.js +56 -1
- package/dist/cjs/schema/nodes/hard-break.js +18 -1
- package/dist/cjs/schema/nodes/index.js +120 -0
- package/dist/cjs/schema/nodes/inline-card.js +46 -1
- package/dist/cjs/schema/nodes/layout-column.js +37 -1
- package/dist/cjs/schema/nodes/layout-section.js +31 -1
- package/dist/cjs/schema/nodes/list-item.js +34 -1
- package/dist/cjs/schema/nodes/media-inline.js +12 -2
- package/dist/cjs/schema/nodes/media-single.js +22 -2
- package/dist/cjs/schema/nodes/media.js +21 -4
- package/dist/cjs/schema/nodes/nested-expand.js +34 -7
- package/dist/cjs/schema/nodes/ordered-list.js +54 -3
- package/dist/cjs/schema/nodes/panel.js +13 -5
- package/dist/cjs/schema/nodes/placeholder.js +24 -1
- package/dist/cjs/schema/nodes/rule.js +18 -1
- package/dist/cjs/validator-schema/generated/validatorSpec.js +142 -0
- package/dist/es2019/index.js +2 -2
- package/dist/es2019/next-schema/generated/nodeTypes.js +118 -1
- package/dist/es2019/next-schema/nodes/blockCard.js +15 -0
- package/dist/es2019/next-schema/nodes/blockquote.js +16 -2
- package/dist/es2019/next-schema/nodes/caption.js +7 -0
- package/dist/es2019/next-schema/nodes/codeBlock.js +5 -0
- package/dist/es2019/next-schema/nodes/date.js +5 -0
- package/dist/es2019/next-schema/nodes/embedCard.js +5 -0
- package/dist/es2019/next-schema/nodes/emoji.js +5 -0
- package/dist/es2019/next-schema/nodes/expand.js +5 -0
- package/dist/es2019/next-schema/nodes/hardBreak.js +5 -0
- package/dist/es2019/next-schema/nodes/inlineCard.js +10 -0
- package/dist/es2019/next-schema/nodes/layoutColumn.js +5 -0
- package/dist/es2019/next-schema/nodes/layoutSection.js +12 -0
- package/dist/es2019/next-schema/nodes/list.js +20 -1
- package/dist/es2019/next-schema/nodes/media.js +10 -0
- package/dist/es2019/next-schema/nodes/mediaInline.js +5 -0
- package/dist/es2019/next-schema/nodes/mediaSingle.js +10 -0
- package/dist/es2019/next-schema/nodes/nestedExpand.js +5 -0
- package/dist/es2019/next-schema/nodes/panel.js +5 -0
- package/dist/es2019/next-schema/nodes/placeholder.js +5 -0
- package/dist/es2019/next-schema/nodes/rule.js +9 -1
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/nodes/block-card.js +50 -0
- package/dist/es2019/schema/nodes/blockquote.js +19 -1
- package/dist/es2019/schema/nodes/bullet-list.js +19 -0
- package/dist/es2019/schema/nodes/caption.js +19 -0
- package/dist/es2019/schema/nodes/code-block.js +68 -0
- package/dist/es2019/schema/nodes/date.js +19 -0
- package/dist/es2019/schema/nodes/embed-card.js +34 -0
- package/dist/es2019/schema/nodes/emoji.js +71 -0
- package/dist/es2019/schema/nodes/expand.js +59 -0
- package/dist/es2019/schema/nodes/hard-break.js +15 -0
- package/dist/es2019/schema/nodes/index.js +19 -19
- package/dist/es2019/schema/nodes/inline-card.js +45 -0
- package/dist/es2019/schema/nodes/layout-column.js +38 -0
- package/dist/es2019/schema/nodes/layout-section.js +32 -0
- package/dist/es2019/schema/nodes/list-item.js +29 -0
- package/dist/es2019/schema/nodes/media-inline.js +8 -1
- package/dist/es2019/schema/nodes/media-single.js +20 -1
- package/dist/es2019/schema/nodes/media.js +17 -4
- package/dist/es2019/schema/nodes/nested-expand.js +21 -6
- package/dist/es2019/schema/nodes/ordered-list.js +51 -2
- package/dist/es2019/schema/nodes/panel.js +11 -5
- package/dist/es2019/schema/nodes/placeholder.js +23 -0
- package/dist/es2019/schema/nodes/rule.js +15 -0
- package/dist/es2019/validator-schema/generated/validatorSpec.js +142 -0
- package/dist/esm/index.js +2 -2
- package/dist/esm/next-schema/generated/nodeTypes.js +118 -1
- package/dist/esm/next-schema/nodes/blockCard.js +15 -0
- package/dist/esm/next-schema/nodes/blockquote.js +16 -2
- package/dist/esm/next-schema/nodes/caption.js +7 -0
- package/dist/esm/next-schema/nodes/codeBlock.js +5 -0
- package/dist/esm/next-schema/nodes/date.js +5 -0
- package/dist/esm/next-schema/nodes/embedCard.js +5 -0
- package/dist/esm/next-schema/nodes/emoji.js +5 -0
- package/dist/esm/next-schema/nodes/expand.js +5 -0
- package/dist/esm/next-schema/nodes/hardBreak.js +5 -0
- package/dist/esm/next-schema/nodes/inlineCard.js +10 -0
- package/dist/esm/next-schema/nodes/layoutColumn.js +5 -0
- package/dist/esm/next-schema/nodes/layoutSection.js +12 -0
- package/dist/esm/next-schema/nodes/list.js +20 -1
- package/dist/esm/next-schema/nodes/media.js +10 -0
- package/dist/esm/next-schema/nodes/mediaInline.js +5 -0
- package/dist/esm/next-schema/nodes/mediaSingle.js +10 -0
- package/dist/esm/next-schema/nodes/nestedExpand.js +5 -0
- package/dist/esm/next-schema/nodes/panel.js +5 -0
- package/dist/esm/next-schema/nodes/placeholder.js +5 -0
- package/dist/esm/next-schema/nodes/rule.js +9 -1
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/nodes/block-card.js +47 -0
- package/dist/esm/schema/nodes/blockquote.js +19 -1
- package/dist/esm/schema/nodes/bullet-list.js +19 -0
- package/dist/esm/schema/nodes/caption.js +19 -0
- package/dist/esm/schema/nodes/code-block.js +71 -1
- package/dist/esm/schema/nodes/date.js +21 -0
- package/dist/esm/schema/nodes/embed-card.js +35 -0
- package/dist/esm/schema/nodes/emoji.js +71 -0
- package/dist/esm/schema/nodes/expand.js +55 -0
- package/dist/esm/schema/nodes/hard-break.js +17 -0
- package/dist/esm/schema/nodes/index.js +19 -19
- package/dist/esm/schema/nodes/inline-card.js +45 -0
- package/dist/esm/schema/nodes/layout-column.js +36 -0
- package/dist/esm/schema/nodes/layout-section.js +30 -0
- package/dist/esm/schema/nodes/list-item.js +33 -0
- package/dist/esm/schema/nodes/media-inline.js +10 -1
- package/dist/esm/schema/nodes/media-single.js +21 -1
- package/dist/esm/schema/nodes/media.js +19 -3
- package/dist/esm/schema/nodes/nested-expand.js +32 -6
- package/dist/esm/schema/nodes/ordered-list.js +53 -2
- package/dist/esm/schema/nodes/panel.js +12 -4
- package/dist/esm/schema/nodes/placeholder.js +23 -0
- package/dist/esm/schema/nodes/rule.js +17 -0
- package/dist/esm/validator-schema/generated/validatorSpec.js +142 -0
- package/dist/json-schema/v1/full.json +125 -2
- package/dist/json-schema/v1/stage-0.json +137 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/types/next-schema/generated/nodeTypes.d.ts +62 -0
- package/dist/types/next-schema/groups/nonNestableBlockContentGroup.d.ts +7 -0
- package/dist/types/next-schema/groups/tableCellContentPseudoGroup.d.ts +7 -0
- package/dist/types/next-schema/nodes/blockquote.d.ts +7 -0
- package/dist/types/next-schema/nodes/layoutSection.d.ts +5 -0
- package/dist/types/schema/index.d.ts +1 -1
- package/dist/types/schema/nodes/block-card.d.ts +4 -0
- package/dist/types/schema/nodes/blockquote.d.ts +4 -0
- package/dist/types/schema/nodes/bullet-list.d.ts +1 -0
- package/dist/types/schema/nodes/caption.d.ts +4 -0
- package/dist/types/schema/nodes/code-block.d.ts +2 -0
- package/dist/types/schema/nodes/date.d.ts +2 -0
- package/dist/types/schema/nodes/embed-card.d.ts +2 -0
- package/dist/types/schema/nodes/emoji.d.ts +2 -0
- package/dist/types/schema/nodes/expand.d.ts +2 -0
- package/dist/types/schema/nodes/hard-break.d.ts +2 -0
- package/dist/types/schema/nodes/index.d.ts +19 -19
- package/dist/types/schema/nodes/inline-card.d.ts +1 -0
- package/dist/types/schema/nodes/layout-column.d.ts +2 -0
- package/dist/types/schema/nodes/layout-section.d.ts +4 -0
- package/dist/types/schema/nodes/list-item.d.ts +2 -0
- package/dist/types/schema/nodes/media-inline.d.ts +1 -0
- package/dist/types/schema/nodes/media-single.d.ts +3 -1
- package/dist/types/schema/nodes/media.d.ts +3 -1
- package/dist/types/schema/nodes/nested-expand.d.ts +2 -0
- package/dist/types/schema/nodes/ordered-list.d.ts +2 -0
- package/dist/types/schema/nodes/panel.d.ts +2 -0
- package/dist/types/schema/nodes/placeholder.d.ts +2 -0
- package/dist/types/schema/nodes/rule.d.ts +4 -0
- package/dist/types/schema/nodes/types/list.d.ts +7 -0
- package/dist/types/schema/nodes/types/rich-media-common.d.ts +1 -0
- package/dist/types/validator-schema/generated/validatorSpec.d.ts +142 -0
- package/json-schema/v1/full.json +125 -2
- package/json-schema/v1/stage-0.json +137 -2
- package/package.json +2 -2
- package/schema-generators/__tests__/unit/adfToValidatorSpec.unit.ts +1 -0
package/dist/esm/schema/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
export { PanelType, blockCard, blockquote, extendedBlockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expandWithNestedExpand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, extendedPanel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } from './nodes';
|
1
|
+
export { PanelType, blockCard, blockCardWithLocalId, blockquote, extendedBlockquote, extendedBlockquoteWithLocalId, bodiedExtension, bulletList, bulletListSelector, bulletListWithLocalId, caption, captionWithLocalId, codeBlock, codeBlockWithLocalId, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, dateWithLocalId, decisionItem, decisionList, decisionListSelector, doc, embedCard, embedCardWithLocalId, emoji, emojiWithLocalId, expandWithNestedExpand, expandWithNestedExpandLocalId, expandToJSON, extension, hardBreak, hardBreakWithLocalId, heading, image, inlineCard, inlineCardWithLocalId, inlineExtension, layoutColumn, layoutColumnWithLocalId, layoutSection, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId, listItem, listItemWithDecisionStage0, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, nestedExpandWithLocalId, orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId, extendedPanel, extendedPanelWithLocalId, paragraph, placeholder, placeholderWithLocalId, rule, ruleWithLocalId, getCellAttrs, getCellDomAttrs, status, table, tableStage0, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable } 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, backgroundColor, backgroundColorPalette, backgroundColorPaletteNext } from './marks';
|
4
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
4
|
import { blockCard as blockCardFactory } from '../../next-schema/generated/nodeTypes';
|
5
|
+
import { uuid } from '../../utils';
|
5
6
|
|
6
7
|
/**
|
7
8
|
* @name blockCard_node
|
@@ -58,4 +59,50 @@ export var blockCard = blockCardFactory({
|
|
58
59
|
};
|
59
60
|
return ['a', attrs, (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.url) || ' '];
|
60
61
|
}
|
62
|
+
});
|
63
|
+
export var blockCardWithLocalId = blockCardFactory({
|
64
|
+
parseDOM: [{
|
65
|
+
tag: 'a[data-block-card]',
|
66
|
+
// bump priority higher than hyperlink
|
67
|
+
priority: 100,
|
68
|
+
getAttrs: function getAttrs(dom) {
|
69
|
+
var anchor = dom;
|
70
|
+
return _objectSpread(_objectSpread({
|
71
|
+
url: anchor.getAttribute('href') || undefined
|
72
|
+
}, getCommonAttributesFromDom(dom)), {}, {
|
73
|
+
localId: uuid.generate()
|
74
|
+
});
|
75
|
+
}
|
76
|
+
}, {
|
77
|
+
tag: 'div[data-block-card]',
|
78
|
+
getAttrs: function getAttrs(dom) {
|
79
|
+
var anchor = dom;
|
80
|
+
return _objectSpread(_objectSpread({
|
81
|
+
url: anchor.getAttribute('data-card-url') || undefined
|
82
|
+
}, getCommonAttributesFromDom(dom)), {}, {
|
83
|
+
localId: uuid.generate()
|
84
|
+
});
|
85
|
+
}
|
86
|
+
}],
|
87
|
+
toDOM: function toDOM(node) {
|
88
|
+
var _node$attrs2, _node$attrs3;
|
89
|
+
var _ref4 = node.attrs,
|
90
|
+
url = _ref4.url;
|
91
|
+
var _ref5 = node.attrs,
|
92
|
+
data = _ref5.data;
|
93
|
+
var _ref6 = node.attrs,
|
94
|
+
layout = _ref6.layout,
|
95
|
+
width = _ref6.width,
|
96
|
+
datasource = _ref6.datasource;
|
97
|
+
var attrs = {
|
98
|
+
'data-block-card': '',
|
99
|
+
href: url || '',
|
100
|
+
'data-card-data': data ? JSON.stringify(data) : '',
|
101
|
+
'data-datasource': datasource ? JSON.stringify(datasource) : '',
|
102
|
+
'data-layout': layout,
|
103
|
+
'data-width': "".concat(width),
|
104
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.localId) || undefined
|
105
|
+
};
|
106
|
+
return ['a', attrs, (node === null || node === void 0 ? void 0 : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.url) || ' '];
|
107
|
+
}
|
61
108
|
});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { blockquote as blockquoteFactory } from '../../next-schema/generated/nodeTypes';
|
2
2
|
import { blockquoteLegacy as blockquoteLegacyFactory } from '../../next-schema/generated/nodeTypes';
|
3
|
+
import { uuid } from '../../utils';
|
3
4
|
|
4
5
|
/**
|
5
6
|
* @name blockquote_node
|
@@ -19,4 +20,21 @@ export var blockquote = blockquoteLegacyFactory(nodeSpecOptions);
|
|
19
20
|
* @name extentedBlockquote
|
20
21
|
* @description the block quote node with nested code block, media, and extension
|
21
22
|
*/
|
22
|
-
export var extendedBlockquote = blockquoteFactory(nodeSpecOptions);
|
23
|
+
export var extendedBlockquote = blockquoteFactory(nodeSpecOptions);
|
24
|
+
var nodeSpecOptionsWithLocalId = {
|
25
|
+
parseDOM: [{
|
26
|
+
tag: 'blockquote',
|
27
|
+
getAttrs: function getAttrs() {
|
28
|
+
return {
|
29
|
+
localId: uuid.generate()
|
30
|
+
};
|
31
|
+
}
|
32
|
+
}],
|
33
|
+
toDOM: function toDOM(node) {
|
34
|
+
var _node$attrs;
|
35
|
+
return ['blockquote', {
|
36
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
37
|
+
}, 0];
|
38
|
+
}
|
39
|
+
};
|
40
|
+
export var extendedBlockquoteWithLocalId = blockquoteFactory(nodeSpecOptionsWithLocalId);
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { uuid } from '../../utils';
|
1
2
|
import { bulletList as bulletListFactory } from '../../next-schema/generated/nodeTypes';
|
2
3
|
export var bulletListSelector = '.ak-ul';
|
3
4
|
export var bulletList = bulletListFactory({
|
@@ -10,4 +11,22 @@ export var bulletList = bulletListFactory({
|
|
10
11
|
};
|
11
12
|
return ['ul', attrs, 0];
|
12
13
|
}
|
14
|
+
});
|
15
|
+
export var bulletListWithLocalId = bulletListFactory({
|
16
|
+
parseDOM: [{
|
17
|
+
tag: 'ul',
|
18
|
+
getAttrs: function getAttrs() {
|
19
|
+
return {
|
20
|
+
localId: uuid.generate()
|
21
|
+
};
|
22
|
+
}
|
23
|
+
}],
|
24
|
+
toDOM: function toDOM(node) {
|
25
|
+
var _node$attrs;
|
26
|
+
var attrs = {
|
27
|
+
class: bulletListSelector.substr(1),
|
28
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
29
|
+
};
|
30
|
+
return ['ul', attrs, 0];
|
31
|
+
}
|
13
32
|
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { caption as captionFactory } from '../../next-schema/generated/nodeTypes';
|
2
|
+
import { uuid } from '../../utils';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @name caption_node
|
@@ -14,4 +15,22 @@ export var caption = captionFactory({
|
|
14
15
|
};
|
15
16
|
return ['figcaption', attrs, 0];
|
16
17
|
}
|
18
|
+
});
|
19
|
+
export var captionWithLocalId = captionFactory({
|
20
|
+
parseDOM: [{
|
21
|
+
tag: 'figcaption[data-caption]',
|
22
|
+
getAttrs: function getAttrs() {
|
23
|
+
return {
|
24
|
+
localId: uuid.generate()
|
25
|
+
};
|
26
|
+
}
|
27
|
+
}],
|
28
|
+
toDOM: function toDOM(node) {
|
29
|
+
var _node$attrs;
|
30
|
+
var attrs = {
|
31
|
+
'data-caption': 'true',
|
32
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
33
|
+
};
|
34
|
+
return ['figcaption', attrs, 0];
|
35
|
+
}
|
17
36
|
});
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { Fragment } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { codeBlock as codeBlockFactory } from '../../next-schema/generated/nodeTypes';
|
3
|
+
import { uuid } from '../../utils';
|
3
4
|
|
4
5
|
/**
|
5
6
|
* @name codeBlock_with_no_marks_node
|
@@ -145,4 +146,73 @@ export var toJSON = function toJSON(node) {
|
|
145
146
|
return memo;
|
146
147
|
}, {})
|
147
148
|
};
|
148
|
-
};
|
149
|
+
};
|
150
|
+
export var codeBlockWithLocalId = codeBlockFactory({
|
151
|
+
parseDOM: [{
|
152
|
+
tag: 'pre',
|
153
|
+
preserveWhitespace: 'full',
|
154
|
+
getAttrs: function getAttrs(domNode) {
|
155
|
+
var dom = domNode;
|
156
|
+
var language = getLanguageFromBitbucketStyle(dom.parentElement) || getLanguageFromEditorStyle(dom.parentElement) || getLanguageFromCode(dom) || dom.getAttribute('data-language');
|
157
|
+
dom = removeLastNewLine(dom);
|
158
|
+
return {
|
159
|
+
language: language,
|
160
|
+
localId: uuid.generate()
|
161
|
+
};
|
162
|
+
}
|
163
|
+
},
|
164
|
+
// Handle VSCode, Android Studio paste
|
165
|
+
// Checking `white-space: pre-wrap` is too aggressive @see ED-2627
|
166
|
+
{
|
167
|
+
tag: 'div[style]',
|
168
|
+
preserveWhitespace: 'full',
|
169
|
+
getAttrs: function getAttrs(domNode) {
|
170
|
+
var dom = domNode;
|
171
|
+
if (dom.style.whiteSpace === 'pre' || dom.style.fontFamily && dom.style.fontFamily.toLowerCase().indexOf('monospace') > -1) {
|
172
|
+
return {};
|
173
|
+
}
|
174
|
+
return false;
|
175
|
+
},
|
176
|
+
getContent: function getContent(domNode, schema) {
|
177
|
+
var code = parseCodeFromHtml(domNode);
|
178
|
+
return code ? Fragment.from(schema.text(code)) : Fragment.empty;
|
179
|
+
}
|
180
|
+
},
|
181
|
+
// Handle GitHub/Gist paste
|
182
|
+
{
|
183
|
+
tag: 'table[style]',
|
184
|
+
preserveWhitespace: 'full',
|
185
|
+
getAttrs: function getAttrs(dom) {
|
186
|
+
if (dom.querySelector('td[class*="blob-code"]')) {
|
187
|
+
return {};
|
188
|
+
}
|
189
|
+
return false;
|
190
|
+
}
|
191
|
+
}, {
|
192
|
+
tag: 'div.code-block',
|
193
|
+
preserveWhitespace: 'full',
|
194
|
+
getAttrs: function getAttrs(domNode) {
|
195
|
+
var dom = domNode;
|
196
|
+
// TODO: ED-5604 Fix it inside `react-syntax-highlighter`
|
197
|
+
// Remove line numbers
|
198
|
+
var lineNumber = dom.querySelectorAll('.react-syntax-highlighter-line-number');
|
199
|
+
if (lineNumber.length > 0) {
|
200
|
+
// It's possible to copy without the line numbers too hence this
|
201
|
+
// `react-syntax-highlighter-line-number` check, so that we don't remove real code
|
202
|
+
lineNumber.forEach(function (line) {
|
203
|
+
return line.remove();
|
204
|
+
});
|
205
|
+
}
|
206
|
+
return {};
|
207
|
+
}
|
208
|
+
}],
|
209
|
+
toDOM: function toDOM(node) {
|
210
|
+
var _node$attrs;
|
211
|
+
var attrs = {
|
212
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
213
|
+
};
|
214
|
+
return ['pre', attrs, ['code', {
|
215
|
+
'data-language': node.attrs.language
|
216
|
+
}, 0]];
|
217
|
+
}
|
218
|
+
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { date as dateFactory } from '../../next-schema/generated/nodeTypes';
|
2
|
+
import { uuid } from '../../utils';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @name date_node
|
@@ -20,4 +21,24 @@ export var date = dateFactory({
|
|
20
21
|
};
|
21
22
|
return ['span', attrs];
|
22
23
|
}
|
24
|
+
});
|
25
|
+
export var dateWithLocalId = dateFactory({
|
26
|
+
parseDOM: [{
|
27
|
+
tag: 'span[data-node-type="date"]',
|
28
|
+
getAttrs: function getAttrs(dom) {
|
29
|
+
return {
|
30
|
+
timestamp: dom.getAttribute('data-timestamp'),
|
31
|
+
localId: uuid.generate()
|
32
|
+
};
|
33
|
+
}
|
34
|
+
}],
|
35
|
+
toDOM: function toDOM(node) {
|
36
|
+
var _node$attrs;
|
37
|
+
var attrs = {
|
38
|
+
'data-node-type': 'date',
|
39
|
+
'data-timestamp': node.attrs.timestamp,
|
40
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
41
|
+
};
|
42
|
+
return ['span', attrs];
|
43
|
+
}
|
23
44
|
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { embedCard as embedCardFactory } from '../../next-schema/generated/nodeTypes';
|
2
|
+
import { uuid } from '../../utils/uuid';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @name embedCard_node
|
@@ -34,4 +35,38 @@ export var embedCard = embedCardFactory({
|
|
34
35
|
};
|
35
36
|
return ['div', attrs];
|
36
37
|
}
|
38
|
+
});
|
39
|
+
export var embedCardWithLocalId = embedCardFactory({
|
40
|
+
parseDOM: [{
|
41
|
+
tag: 'div[data-embed-card]',
|
42
|
+
getAttrs: function getAttrs(dom) {
|
43
|
+
return {
|
44
|
+
url: dom.getAttribute('data-card-url'),
|
45
|
+
layout: dom.getAttribute('data-layout') || 'center',
|
46
|
+
width: Number(dom.getAttribute('data-width')) || null,
|
47
|
+
originalWidth: Number(dom.getAttribute('data-card-original-width')) || null,
|
48
|
+
originalHeight: Number(dom.getAttribute('data-card-original-height')) || null,
|
49
|
+
localId: uuid.generate()
|
50
|
+
};
|
51
|
+
}
|
52
|
+
}],
|
53
|
+
toDOM: function toDOM(node) {
|
54
|
+
var _node$attrs3;
|
55
|
+
var _node$attrs2 = node.attrs,
|
56
|
+
url = _node$attrs2.url,
|
57
|
+
layout = _node$attrs2.layout,
|
58
|
+
width = _node$attrs2.width,
|
59
|
+
originalWidth = _node$attrs2.originalWidth,
|
60
|
+
originalHeight = _node$attrs2.originalHeight;
|
61
|
+
var attrs = {
|
62
|
+
'data-embed-card': '',
|
63
|
+
'data-card-url': url,
|
64
|
+
'data-layout': layout,
|
65
|
+
'data-width': width,
|
66
|
+
'data-original-width': originalWidth,
|
67
|
+
'data-original-height': originalHeight,
|
68
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId) || undefined
|
69
|
+
};
|
70
|
+
return ['div', attrs];
|
71
|
+
}
|
37
72
|
});
|
@@ -1,5 +1,9 @@
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
1
4
|
import { acNameToEmoji, acShortcutToEmoji } from '../../utils/confluence/emoji';
|
2
5
|
import { emoji as emojiFactory } from '../../next-schema/generated/nodeTypes';
|
6
|
+
import { uuid } from '../../utils/uuid';
|
3
7
|
|
4
8
|
/**
|
5
9
|
* @name emoji_node
|
@@ -61,4 +65,71 @@ export var emoji = emojiFactory({
|
|
61
65
|
};
|
62
66
|
return ['span', attrs, text];
|
63
67
|
}
|
68
|
+
});
|
69
|
+
export var emojiWithLocalId = emojiFactory({
|
70
|
+
parseDOM: [
|
71
|
+
// Handle copy/paste beautiful panel from renderer />
|
72
|
+
{
|
73
|
+
tag: 'div.ak-editor-panel__icon span',
|
74
|
+
ignore: true
|
75
|
+
}, {
|
76
|
+
tag: 'span[data-emoji-short-name]',
|
77
|
+
getAttrs: function getAttrs(domNode) {
|
78
|
+
var dom = domNode;
|
79
|
+
return {
|
80
|
+
shortName: dom.getAttribute('data-emoji-short-name') || emoji.attrs.shortName.default,
|
81
|
+
id: dom.getAttribute('data-emoji-id') || emoji.attrs.id.default,
|
82
|
+
text: dom.getAttribute('data-emoji-text') || emoji.attrs.text.default,
|
83
|
+
localId: uuid.generate()
|
84
|
+
};
|
85
|
+
}
|
86
|
+
},
|
87
|
+
// Handle copy/paste from old <ac:emoticon />
|
88
|
+
{
|
89
|
+
tag: 'img[data-emoticon-name]',
|
90
|
+
getAttrs: function getAttrs(dom) {
|
91
|
+
var attrs = acNameToEmoji(dom.getAttribute('data-emoticon-name'));
|
92
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
93
|
+
localId: uuid.generate()
|
94
|
+
});
|
95
|
+
}
|
96
|
+
},
|
97
|
+
// Handle copy/paste from old <ac:hipchat-emoticons />
|
98
|
+
{
|
99
|
+
tag: 'img[data-hipchat-emoticon]',
|
100
|
+
getAttrs: function getAttrs(dom) {
|
101
|
+
var attrs = acShortcutToEmoji(dom.getAttribute('data-hipchat-emoticon'));
|
102
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
103
|
+
localId: uuid.generate()
|
104
|
+
});
|
105
|
+
}
|
106
|
+
},
|
107
|
+
// Handle copy/paste from bitbucket's <img class="emoji" />
|
108
|
+
{
|
109
|
+
tag: 'img.emoji[data-emoji-short-name]',
|
110
|
+
getAttrs: function getAttrs(domNode) {
|
111
|
+
var dom = domNode;
|
112
|
+
return {
|
113
|
+
shortName: dom.getAttribute('data-emoji-short-name') || emoji.attrs.shortName.default,
|
114
|
+
id: dom.getAttribute('data-emoji-id') || emoji.attrs.id.default,
|
115
|
+
text: dom.getAttribute('data-emoji-text') || emoji.attrs.text.default,
|
116
|
+
localId: uuid.generate()
|
117
|
+
};
|
118
|
+
}
|
119
|
+
}],
|
120
|
+
toDOM: function toDOM(node) {
|
121
|
+
var _node$attrs3;
|
122
|
+
var _node$attrs2 = node.attrs,
|
123
|
+
shortName = _node$attrs2.shortName,
|
124
|
+
id = _node$attrs2.id,
|
125
|
+
text = _node$attrs2.text;
|
126
|
+
var attrs = {
|
127
|
+
'data-emoji-short-name': shortName,
|
128
|
+
'data-emoji-id': id,
|
129
|
+
'data-emoji-text': text,
|
130
|
+
contenteditable: 'false',
|
131
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.localId) || undefined
|
132
|
+
};
|
133
|
+
return ['span', attrs, text];
|
134
|
+
}
|
64
135
|
});
|
@@ -2,6 +2,7 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
3
3
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
4
4
|
import { expand as expandFactory } from '../../next-schema/generated/nodeTypes';
|
5
|
+
import { uuid } from '../../utils/uuid';
|
5
6
|
|
6
7
|
/**
|
7
8
|
* @name expand_node
|
@@ -55,6 +56,60 @@ var nodeSpecOptions = {
|
|
55
56
|
}
|
56
57
|
};
|
57
58
|
export var expandWithNestedExpand = expandFactory(nodeSpecOptions);
|
59
|
+
export var expandWithNestedExpandLocalId = expandFactory({
|
60
|
+
parseDOM: [{
|
61
|
+
context: 'table//',
|
62
|
+
tag: 'div[data-node-type="expand"]',
|
63
|
+
getAttrs: function getAttrs(dom) {
|
64
|
+
var attrs = getExpandAttrs(dom);
|
65
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
66
|
+
localId: uuid.generate()
|
67
|
+
});
|
68
|
+
}
|
69
|
+
}, {
|
70
|
+
context: 'expand//',
|
71
|
+
tag: '[data-node-type="expand"]',
|
72
|
+
getAttrs: function getAttrs(dom) {
|
73
|
+
var attrs = getExpandAttrs(dom);
|
74
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
75
|
+
localId: uuid.generate()
|
76
|
+
});
|
77
|
+
}
|
78
|
+
}, {
|
79
|
+
context: 'nestedExpand//',
|
80
|
+
tag: '[data-node-type="expand"]',
|
81
|
+
getAttrs: function getAttrs(dom) {
|
82
|
+
var attrs = getExpandAttrs(dom);
|
83
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
84
|
+
localId: uuid.generate()
|
85
|
+
});
|
86
|
+
}
|
87
|
+
}, {
|
88
|
+
tag: '[data-node-type="nestedExpand"] button',
|
89
|
+
ignore: true
|
90
|
+
}, {
|
91
|
+
tag: '[data-node-type="expand"] button',
|
92
|
+
ignore: true
|
93
|
+
}, {
|
94
|
+
tag: 'div[data-node-type="expand"]',
|
95
|
+
getAttrs: function getAttrs(dom) {
|
96
|
+
var attrs = getExpandAttrs(dom);
|
97
|
+
return _objectSpread(_objectSpread({}, attrs), {}, {
|
98
|
+
localId: uuid.generate()
|
99
|
+
});
|
100
|
+
}
|
101
|
+
}],
|
102
|
+
toDOM: function toDOM(node) {
|
103
|
+
var _node$attrs;
|
104
|
+
var attrs = {
|
105
|
+
'data-node-type': 'expand',
|
106
|
+
'data-title': node.attrs.title,
|
107
|
+
'data-expanded': node.attrs.__expanded,
|
108
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
109
|
+
};
|
110
|
+
return ['div', attrs, 0];
|
111
|
+
}
|
112
|
+
});
|
58
113
|
export var toJSON = function toJSON(node) {
|
59
114
|
return {
|
60
115
|
attrs: Object.keys(node.attrs).filter(function (key) {
|
@@ -1,3 +1,4 @@
|
|
1
|
+
import { uuid } from '../../utils/uuid';
|
1
2
|
import { hardBreak as hardBreakFactory } from '../../next-schema/generated/nodeTypes';
|
2
3
|
|
3
4
|
/**
|
@@ -11,4 +12,20 @@ export var hardBreak = hardBreakFactory({
|
|
11
12
|
toDOM: function toDOM() {
|
12
13
|
return ['br'];
|
13
14
|
}
|
15
|
+
});
|
16
|
+
export var hardBreakWithLocalId = hardBreakFactory({
|
17
|
+
parseDOM: [{
|
18
|
+
tag: 'br',
|
19
|
+
getAttrs: function getAttrs() {
|
20
|
+
return {
|
21
|
+
localId: uuid.generate()
|
22
|
+
};
|
23
|
+
}
|
24
|
+
}],
|
25
|
+
toDOM: function toDOM(node) {
|
26
|
+
var _node$attrs;
|
27
|
+
return ['br', {
|
28
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
29
|
+
}];
|
30
|
+
}
|
14
31
|
});
|
@@ -1,44 +1,44 @@
|
|
1
|
-
export { expandWithNestedExpand, toJSON as expandToJSON } from './expand';
|
1
|
+
export { expandWithNestedExpand, expandWithNestedExpandLocalId, toJSON as expandToJSON } from './expand';
|
2
2
|
export { confluenceJiraIssue } from './confluence-jira-issue';
|
3
3
|
export { confluenceUnsupportedBlock } from './confluence-unsupported-block';
|
4
4
|
export { confluenceUnsupportedInline } from './confluence-unsupported-inline';
|
5
5
|
export { doc } from './doc';
|
6
|
-
export { blockquote, extendedBlockquote } from './blockquote';
|
7
|
-
export { bulletList, bulletListSelector } from './bullet-list';
|
8
|
-
export { codeBlock, toJSON as codeBlockToJSON } from './code-block';
|
9
|
-
export { hardBreak } from './hard-break';
|
6
|
+
export { blockquote, extendedBlockquote, extendedBlockquoteWithLocalId } from './blockquote';
|
7
|
+
export { bulletList, bulletListSelector, bulletListWithLocalId } from './bullet-list';
|
8
|
+
export { codeBlock, codeBlockWithLocalId, toJSON as codeBlockToJSON } from './code-block';
|
9
|
+
export { hardBreak, hardBreakWithLocalId } from './hard-break';
|
10
10
|
export { heading } from './heading';
|
11
|
-
export { rule } from './rule';
|
12
|
-
export { orderedList, orderedListSelector, orderedListWithOrder } from './ordered-list';
|
11
|
+
export { rule, ruleWithLocalId } from './rule';
|
12
|
+
export { orderedList, orderedListSelector, orderedListWithLocalId, orderedListWithOrder, orderedListWithOrderAndLocalId } from './ordered-list';
|
13
13
|
export { paragraph } from './paragraph';
|
14
|
-
export { emoji } from './emoji';
|
14
|
+
export { emoji, emojiWithLocalId } from './emoji';
|
15
15
|
export { image } from './image';
|
16
16
|
export { mention, toJSON as mentionToJSON } from './mention';
|
17
17
|
export { listItem, listItemWithDecisionStage0 } from './list-item';
|
18
|
-
export { extendedPanel, PanelType } from './panel';
|
18
|
+
export { extendedPanel, extendedPanelWithLocalId, PanelType } from './panel';
|
19
19
|
export { text } from './text';
|
20
20
|
export { default as unknownBlock } from './unknown-block';
|
21
|
-
export { caption } from './caption';
|
21
|
+
export { caption, captionWithLocalId } 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, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, toJSON as mediaSingleToJSON } from './media-single';
|
25
|
+
export { mediaSingle, mediaSingleSpec, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleFullWithLocalId, toJSON as mediaSingleToJSON } from './media-single';
|
26
26
|
export { table, tableWithNestedTable, tableRowWithNestedTable, tableCellWithNestedTable, tableHeaderWithNestedTable, tableStage0, 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';
|
29
29
|
export { taskList, taskListSelector } from './task-list';
|
30
30
|
export { taskItem } from './task-item';
|
31
|
-
export { date } from './date';
|
32
|
-
export { placeholder } from './placeholder';
|
33
|
-
export { layoutSection, layoutSectionWithSingleColumn } from './layout-section';
|
34
|
-
export { layoutColumn } from './layout-column';
|
35
|
-
export { inlineCard } from './inline-card';
|
36
|
-
export { blockCard } from './block-card';
|
31
|
+
export { date, dateWithLocalId } from './date';
|
32
|
+
export { placeholder, placeholderWithLocalId } from './placeholder';
|
33
|
+
export { layoutSection, layoutSectionWithSingleColumn, layoutSectionWithSingleColumnLocalId } from './layout-section';
|
34
|
+
export { layoutColumn, layoutColumnWithLocalId } from './layout-column';
|
35
|
+
export { inlineCard, inlineCardWithLocalId } from './inline-card';
|
36
|
+
export { blockCard, blockCardWithLocalId } from './block-card';
|
37
37
|
export { unsupportedBlock } from './unsupported-block';
|
38
38
|
export { unsupportedInline } from './unsupported-inline';
|
39
39
|
export { status } from './status';
|
40
|
-
export { nestedExpand } from './nested-expand';
|
41
|
-
export { embedCard } from './embed-card';
|
40
|
+
export { nestedExpand, nestedExpandWithLocalId } from './nested-expand';
|
41
|
+
export { embedCard, embedCardWithLocalId } from './embed-card';
|
42
42
|
// Extensions
|
43
43
|
export { extension } from './extension';
|
44
44
|
export { inlineExtension } from './inline-extension';
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { inlineCard as inlineCardFactory } from '../../next-schema/generated/nodeTypes';
|
2
|
+
import { uuid } from '../../utils/uuid';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @name inlineCard_node
|
@@ -44,4 +45,48 @@ export var inlineCard = inlineCardFactory({
|
|
44
45
|
return ['a', attrs];
|
45
46
|
}
|
46
47
|
}
|
48
|
+
});
|
49
|
+
export var inlineCardWithLocalId = inlineCardFactory({
|
50
|
+
parseDOM: [{
|
51
|
+
tag: 'a[data-inline-card], span[data-inline-card]',
|
52
|
+
// bump priority higher than hyperlink
|
53
|
+
priority: 100,
|
54
|
+
getAttrs: function getAttrs(dom) {
|
55
|
+
var anchor = dom;
|
56
|
+
var data = anchor.getAttribute('data-card-data');
|
57
|
+
|
58
|
+
/* Support attrs from Editor and Renderer */
|
59
|
+
return {
|
60
|
+
url: anchor.getAttribute('href') || anchor.getAttribute('data-card-url') || null,
|
61
|
+
data: data ? JSON.parse(data) : null
|
62
|
+
};
|
63
|
+
}
|
64
|
+
},
|
65
|
+
// for renderer
|
66
|
+
{
|
67
|
+
tag: 'div[data-inline-card]',
|
68
|
+
getAttrs: function getAttrs(dom) {
|
69
|
+
var anchor = dom;
|
70
|
+
var data = anchor.getAttribute('data-card-data');
|
71
|
+
return {
|
72
|
+
url: anchor.getAttribute('data-card-url'),
|
73
|
+
data: data ? JSON.parse(data) : null,
|
74
|
+
localId: uuid.generate()
|
75
|
+
};
|
76
|
+
}
|
77
|
+
}],
|
78
|
+
toDOM: function toDOM(node) {
|
79
|
+
var _node$attrs;
|
80
|
+
var attrs = {
|
81
|
+
'data-inline-card': '',
|
82
|
+
href: node.attrs.url || '',
|
83
|
+
'data-card-data': node.attrs.data ? JSON.stringify(node.attrs.data) : '',
|
84
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
85
|
+
};
|
86
|
+
if (node.attrs.url) {
|
87
|
+
return ['a', attrs, node.attrs.url];
|
88
|
+
} else {
|
89
|
+
return ['a', attrs];
|
90
|
+
}
|
91
|
+
}
|
47
92
|
});
|
@@ -1,4 +1,5 @@
|
|
1
1
|
import { layoutColumn as layoutColumnFactory } from '../../next-schema/generated/nodeTypes';
|
2
|
+
import { uuid } from '../../utils/uuid';
|
2
3
|
|
3
4
|
/**
|
4
5
|
* @name layoutColumn_node
|
@@ -28,6 +29,41 @@ export var layoutColumn = layoutColumnFactory({
|
|
28
29
|
attrs['data-column-width'] = "".concat(width);
|
29
30
|
}
|
30
31
|
|
32
|
+
// We need to apply a attribute to the inner most child to help
|
33
|
+
// ProseMirror identify its boundaries better.
|
34
|
+
var contentAttrs = {
|
35
|
+
'data-layout-content': 'true'
|
36
|
+
};
|
37
|
+
return ['div', attrs, ['div', contentAttrs, 0]];
|
38
|
+
}
|
39
|
+
});
|
40
|
+
export var layoutColumnWithLocalId = layoutColumnFactory({
|
41
|
+
parseDOM: [{
|
42
|
+
context: 'layoutColumn//',
|
43
|
+
tag: 'div[data-layout-column]',
|
44
|
+
skip: true
|
45
|
+
}, {
|
46
|
+
tag: 'div[data-layout-column]',
|
47
|
+
getAttrs: function getAttrs(domNode) {
|
48
|
+
var dom = domNode;
|
49
|
+
return {
|
50
|
+
width: Number(dom.getAttribute('data-column-width')) || undefined,
|
51
|
+
localId: uuid.generate()
|
52
|
+
};
|
53
|
+
}
|
54
|
+
}],
|
55
|
+
toDOM: function toDOM(node) {
|
56
|
+
var _node$attrs;
|
57
|
+
var attrs = {
|
58
|
+
'data-layout-column': 'true',
|
59
|
+
'data-local-id': (node === null || node === void 0 ? void 0 : (_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.localId) || undefined
|
60
|
+
};
|
61
|
+
var width = node.attrs.width;
|
62
|
+
if (width) {
|
63
|
+
attrs['style'] = "flex-basis: ".concat(width, "%");
|
64
|
+
attrs['data-column-width'] = "".concat(width);
|
65
|
+
}
|
66
|
+
|
31
67
|
// We need to apply a attribute to the inner most child to help
|
32
68
|
// ProseMirror identify its boundaries better.
|
33
69
|
var contentAttrs = {
|