@atlaskit/adf-schema 25.1.0 → 25.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/dist/cjs/index.js +0 -2
- package/dist/cjs/json-schema/index.js +0 -3
- package/dist/cjs/schema/bitbucket-schema.js +0 -2
- package/dist/cjs/schema/confluence-schema.js +1 -4
- package/dist/cjs/schema/create-schema.js +12 -38
- package/dist/cjs/schema/default-schema.js +3 -16
- package/dist/cjs/schema/groups.js +13 -6
- package/dist/cjs/schema/index.js +0 -5
- package/dist/cjs/schema/inline-nodes.js +0 -5
- package/dist/cjs/schema/jira-schema.js +0 -36
- package/dist/cjs/schema/marks/alignment.js +0 -2
- package/dist/cjs/schema/marks/annotation.js +2 -14
- package/dist/cjs/schema/marks/code.js +0 -5
- package/dist/cjs/schema/marks/confluence-inline-comment.js +1 -1
- package/dist/cjs/schema/marks/data-consumer.js +2 -7
- package/dist/cjs/schema/marks/em.js +0 -2
- package/dist/cjs/schema/marks/fragment.js +0 -13
- package/dist/cjs/schema/marks/indentation.js +0 -2
- package/dist/cjs/schema/marks/index.js +0 -18
- package/dist/cjs/schema/marks/link.js +0 -17
- package/dist/cjs/schema/marks/strike.js +0 -2
- package/dist/cjs/schema/marks/strong.js +2 -3
- package/dist/cjs/schema/marks/subsup.js +0 -5
- package/dist/cjs/schema/marks/text-color.js +46 -37
- package/dist/cjs/schema/marks/type-ahead-query.js +0 -3
- package/dist/cjs/schema/marks/underline.js +0 -2
- package/dist/cjs/schema/nodes/block-card.js +1 -2
- package/dist/cjs/schema/nodes/blockquote.js +1 -1
- package/dist/cjs/schema/nodes/bodied-extension.js +0 -3
- package/dist/cjs/schema/nodes/caption.js +1 -1
- package/dist/cjs/schema/nodes/code-block.js +11 -29
- package/dist/cjs/schema/nodes/date.js +1 -1
- package/dist/cjs/schema/nodes/decision-item.js +2 -4
- package/dist/cjs/schema/nodes/decision-list.js +0 -2
- package/dist/cjs/schema/nodes/doc.js +1 -1
- package/dist/cjs/schema/nodes/embed-card.js +6 -6
- package/dist/cjs/schema/nodes/emoji.js +11 -9
- package/dist/cjs/schema/nodes/expand.js +1 -4
- package/dist/cjs/schema/nodes/extension.js +0 -3
- package/dist/cjs/schema/nodes/hard-break.js +1 -1
- package/dist/cjs/schema/nodes/heading.js +2 -2
- package/dist/cjs/schema/nodes/index.js +0 -45
- package/dist/cjs/schema/nodes/inline-card.js +4 -4
- package/dist/cjs/schema/nodes/inline-extension.js +0 -3
- package/dist/cjs/schema/nodes/layout-column.js +4 -5
- package/dist/cjs/schema/nodes/layout-section.js +1 -1
- package/dist/cjs/schema/nodes/media-group.js +1 -1
- package/dist/cjs/schema/nodes/media-inline.js +0 -2
- package/dist/cjs/schema/nodes/media-single.js +3 -14
- package/dist/cjs/schema/nodes/media.js +10 -28
- package/dist/cjs/schema/nodes/mention.js +4 -14
- package/dist/cjs/schema/nodes/nested-expand.js +1 -1
- package/dist/cjs/schema/nodes/ordered-list.js +3 -17
- package/dist/cjs/schema/nodes/panel.js +1 -13
- package/dist/cjs/schema/nodes/paragraph.js +1 -6
- package/dist/cjs/schema/nodes/placeholder.js +1 -1
- package/dist/cjs/schema/nodes/rule.js +1 -1
- package/dist/cjs/schema/nodes/status.js +4 -6
- package/dist/cjs/schema/nodes/tableNodes.js +12 -39
- package/dist/cjs/schema/nodes/task-item.js +2 -4
- package/dist/cjs/schema/nodes/task-list.js +0 -2
- package/dist/cjs/schema/nodes/text.js +1 -1
- package/dist/cjs/steps/analytics.js +4 -38
- package/dist/cjs/steps/set-attrs.js +0 -26
- package/dist/cjs/steps/table/add-column.js +33 -105
- package/dist/cjs/steps/table/constants.js +0 -1
- package/dist/cjs/steps/table/sort-column.js +0 -19
- package/dist/cjs/steps/table/utils/cell-step.js +18 -49
- package/dist/cjs/steps/table/utils/cells-at-column.js +2 -21
- package/dist/cjs/steps/table/utils/find-column.js +13 -17
- package/dist/cjs/steps/table/utils/get-table-rect-from-doc.js +6 -8
- package/dist/cjs/steps/table/utils/side-effects/rows.js +23 -78
- package/dist/cjs/steps/table/utils/side-effects/side-effects.js +0 -23
- package/dist/cjs/steps/table/utils/side-effects/table.js +2 -18
- package/dist/cjs/steps/table/utils/table-map.js +0 -6
- package/dist/cjs/steps/type-ahead.js +5 -25
- package/dist/cjs/steps.js +0 -6
- package/dist/cjs/utils/colors.js +13 -36
- package/dist/cjs/utils/confluence/emoji.js +6 -13
- package/dist/cjs/utils/extensions.js +0 -8
- package/dist/cjs/utils/index.js +0 -4
- package/dist/cjs/utils/parseDOM.js +0 -2
- package/dist/cjs/utils/url.js +3 -20
- package/dist/cjs/utils/uuid.js +0 -3
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/index.js +1 -2
- package/dist/es2019/schema/bitbucket-schema.js +1 -1
- package/dist/es2019/schema/confluence-schema.js +1 -2
- package/dist/es2019/schema/create-schema.js +12 -25
- package/dist/es2019/schema/default-schema.js +3 -11
- package/dist/es2019/schema/groups.js +13 -6
- package/dist/es2019/schema/index.js +1 -2
- package/dist/es2019/schema/jira-schema.js +0 -24
- package/dist/es2019/schema/marks/alignment.js +1 -3
- package/dist/es2019/schema/marks/annotation.js +3 -9
- package/dist/es2019/schema/marks/breakout.js +0 -4
- package/dist/es2019/schema/marks/code.js +1 -5
- package/dist/es2019/schema/marks/confluence-inline-comment.js +1 -2
- package/dist/es2019/schema/marks/data-consumer.js +3 -5
- package/dist/es2019/schema/marks/em.js +1 -2
- package/dist/es2019/schema/marks/fragment.js +0 -8
- package/dist/es2019/schema/marks/indentation.js +0 -4
- package/dist/es2019/schema/marks/link.js +2 -11
- package/dist/es2019/schema/marks/strike.js +1 -2
- package/dist/es2019/schema/marks/strong.js +3 -7
- package/dist/es2019/schema/marks/subsup.js +0 -6
- package/dist/es2019/schema/marks/text-color.js +44 -29
- package/dist/es2019/schema/marks/type-ahead-query.js +0 -2
- package/dist/es2019/schema/marks/underline.js +1 -2
- package/dist/es2019/schema/marks/unsupported-mark.js +0 -1
- package/dist/es2019/schema/marks/unsupported-node-attributes.js +0 -1
- package/dist/es2019/schema/nodes/block-card.js +1 -3
- package/dist/es2019/schema/nodes/blockquote.js +1 -2
- package/dist/es2019/schema/nodes/bodied-extension.js +0 -4
- package/dist/es2019/schema/nodes/bullet-list.js +0 -2
- package/dist/es2019/schema/nodes/caption.js +1 -2
- package/dist/es2019/schema/nodes/code-block.js +11 -28
- package/dist/es2019/schema/nodes/confluence-jira-issue.js +0 -2
- package/dist/es2019/schema/nodes/confluence-unsupported-block.js +0 -4
- package/dist/es2019/schema/nodes/confluence-unsupported-inline.js +0 -4
- package/dist/es2019/schema/nodes/date.js +1 -2
- package/dist/es2019/schema/nodes/decision-item.js +0 -2
- package/dist/es2019/schema/nodes/decision-list.js +1 -2
- package/dist/es2019/schema/nodes/doc.js +1 -0
- package/dist/es2019/schema/nodes/embed-card.js +1 -2
- package/dist/es2019/schema/nodes/emoji.js +9 -6
- package/dist/es2019/schema/nodes/expand.js +1 -3
- package/dist/es2019/schema/nodes/extension.js +0 -4
- package/dist/es2019/schema/nodes/hard-break.js +1 -2
- package/dist/es2019/schema/nodes/heading.js +2 -3
- package/dist/es2019/schema/nodes/image.js +0 -4
- package/dist/es2019/schema/nodes/inline-card.js +4 -5
- package/dist/es2019/schema/nodes/inline-extension.js +0 -4
- package/dist/es2019/schema/nodes/layout-column.js +4 -6
- package/dist/es2019/schema/nodes/layout-section.js +1 -4
- package/dist/es2019/schema/nodes/list-item.js +0 -2
- package/dist/es2019/schema/nodes/media-group.js +1 -2
- package/dist/es2019/schema/nodes/media-single.js +3 -6
- package/dist/es2019/schema/nodes/media.js +10 -20
- package/dist/es2019/schema/nodes/mention.js +0 -11
- package/dist/es2019/schema/nodes/nested-expand.js +1 -2
- package/dist/es2019/schema/nodes/ordered-list.js +4 -14
- package/dist/es2019/schema/nodes/panel.js +3 -10
- package/dist/es2019/schema/nodes/paragraph.js +1 -7
- package/dist/es2019/schema/nodes/placeholder.js +1 -2
- package/dist/es2019/schema/nodes/rule.js +1 -2
- package/dist/es2019/schema/nodes/status.js +1 -2
- package/dist/es2019/schema/nodes/tableNodes.js +10 -26
- package/dist/es2019/schema/nodes/task-item.js +0 -2
- package/dist/es2019/schema/nodes/task-list.js +0 -2
- package/dist/es2019/schema/nodes/text.js +1 -0
- package/dist/es2019/schema/nodes/unknown-block.js +0 -2
- package/dist/es2019/schema/nodes/unsupported-block.js +0 -2
- package/dist/es2019/schema/nodes/unsupported-inline.js +0 -2
- package/dist/es2019/steps/analytics.js +13 -30
- package/dist/es2019/steps/set-attrs.js +3 -12
- package/dist/es2019/steps/table/add-column.js +33 -76
- package/dist/es2019/steps/table/constants.js +0 -1
- package/dist/es2019/steps/table/sort-column.js +1 -8
- package/dist/es2019/steps/table/utils/cell-step.js +15 -32
- package/dist/es2019/steps/table/utils/cells-at-column.js +6 -11
- package/dist/es2019/steps/table/utils/find-column.js +12 -15
- package/dist/es2019/steps/table/utils/get-table-rect-from-doc.js +7 -6
- package/dist/es2019/steps/table/utils/side-effects/rows.js +19 -59
- package/dist/es2019/steps/table/utils/side-effects/side-effects.js +0 -21
- package/dist/es2019/steps/table/utils/side-effects/table.js +0 -17
- package/dist/es2019/steps/type-ahead.js +3 -15
- package/dist/es2019/utils/colors.js +8 -18
- package/dist/es2019/utils/confluence/emoji.js +5 -8
- package/dist/es2019/utils/extensions.js +0 -4
- package/dist/es2019/utils/url.js +2 -12
- package/dist/es2019/utils/uuid.js +0 -2
- package/dist/es2019/version.json +1 -1
- package/dist/esm/index.js +1 -2
- package/dist/esm/schema/bitbucket-schema.js +1 -1
- package/dist/esm/schema/confluence-schema.js +1 -2
- package/dist/esm/schema/create-schema.js +12 -31
- package/dist/esm/schema/default-schema.js +3 -11
- package/dist/esm/schema/groups.js +13 -6
- package/dist/esm/schema/index.js +1 -2
- package/dist/esm/schema/jira-schema.js +0 -24
- package/dist/esm/schema/marks/alignment.js +1 -1
- package/dist/esm/schema/marks/annotation.js +3 -11
- package/dist/esm/schema/marks/code.js +1 -3
- package/dist/esm/schema/marks/confluence-inline-comment.js +1 -0
- package/dist/esm/schema/marks/data-consumer.js +3 -3
- package/dist/esm/schema/marks/em.js +1 -0
- package/dist/esm/schema/marks/fragment.js +0 -9
- package/dist/esm/schema/marks/link.js +0 -12
- package/dist/esm/schema/marks/strike.js +1 -0
- package/dist/esm/schema/marks/strong.js +3 -1
- package/dist/esm/schema/marks/subsup.js +0 -4
- package/dist/esm/schema/marks/text-color.js +46 -30
- package/dist/esm/schema/marks/underline.js +1 -0
- package/dist/esm/schema/nodes/block-card.js +1 -1
- package/dist/esm/schema/nodes/blockquote.js +1 -0
- package/dist/esm/schema/nodes/bodied-extension.js +0 -2
- package/dist/esm/schema/nodes/caption.js +1 -0
- package/dist/esm/schema/nodes/code-block.js +11 -26
- package/dist/esm/schema/nodes/date.js +1 -0
- package/dist/esm/schema/nodes/decision-item.js +2 -2
- package/dist/esm/schema/nodes/decision-list.js +1 -0
- package/dist/esm/schema/nodes/doc.js +1 -0
- package/dist/esm/schema/nodes/embed-card.js +6 -5
- package/dist/esm/schema/nodes/emoji.js +12 -7
- package/dist/esm/schema/nodes/expand.js +1 -1
- package/dist/esm/schema/nodes/extension.js +0 -2
- package/dist/esm/schema/nodes/hard-break.js +1 -0
- package/dist/esm/schema/nodes/heading.js +2 -1
- package/dist/esm/schema/nodes/inline-card.js +4 -3
- package/dist/esm/schema/nodes/inline-extension.js +0 -2
- package/dist/esm/schema/nodes/layout-column.js +4 -4
- package/dist/esm/schema/nodes/layout-section.js +1 -0
- package/dist/esm/schema/nodes/media-group.js +1 -0
- package/dist/esm/schema/nodes/media-single.js +3 -8
- package/dist/esm/schema/nodes/media.js +10 -18
- package/dist/esm/schema/nodes/mention.js +4 -13
- package/dist/esm/schema/nodes/nested-expand.js +1 -0
- package/dist/esm/schema/nodes/ordered-list.js +3 -13
- package/dist/esm/schema/nodes/panel.js +1 -10
- package/dist/esm/schema/nodes/paragraph.js +1 -5
- package/dist/esm/schema/nodes/placeholder.js +1 -0
- package/dist/esm/schema/nodes/rule.js +1 -0
- package/dist/esm/schema/nodes/status.js +5 -4
- package/dist/esm/schema/nodes/tableNodes.js +12 -25
- package/dist/esm/schema/nodes/task-item.js +2 -2
- package/dist/esm/schema/nodes/text.js +1 -0
- package/dist/esm/steps/analytics.js +5 -31
- package/dist/esm/steps/set-attrs.js +1 -17
- package/dist/esm/steps/table/add-column.js +33 -91
- package/dist/esm/steps/table/constants.js +0 -1
- package/dist/esm/steps/table/sort-column.js +1 -10
- package/dist/esm/steps/table/utils/cell-step.js +18 -42
- package/dist/esm/steps/table/utils/cells-at-column.js +2 -18
- package/dist/esm/steps/table/utils/find-column.js +13 -16
- package/dist/esm/steps/table/utils/get-table-rect-from-doc.js +7 -6
- package/dist/esm/steps/table/utils/side-effects/rows.js +23 -76
- package/dist/esm/steps/table/utils/side-effects/side-effects.js +0 -18
- package/dist/esm/steps/table/utils/side-effects/table.js +2 -13
- package/dist/esm/steps/type-ahead.js +6 -18
- package/dist/esm/utils/colors.js +12 -23
- package/dist/esm/utils/confluence/emoji.js +6 -10
- package/dist/esm/utils/extensions.js +0 -4
- package/dist/esm/utils/url.js +2 -12
- package/dist/esm/version.json +1 -1
- package/dist/types/schema/default-schema.d.ts +1 -1
- package/dist/types/utils/colors.d.ts +1 -1
- package/package.json +2 -2
package/dist/cjs/utils/colors.js
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
var _typeof = require("@babel/runtime/helpers/typeof");
|
6
|
-
|
7
5
|
Object.defineProperty(exports, "__esModule", {
|
8
6
|
value: true
|
9
7
|
});
|
@@ -14,15 +12,10 @@ exports.isHex = isHex;
|
|
14
12
|
exports.isRgb = isRgb;
|
15
13
|
exports.normalizeHexColor = normalizeHexColor;
|
16
14
|
exports.rgbToHex = rgbToHex;
|
17
|
-
|
18
15
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
19
|
-
|
20
16
|
var namedColors = _interopRequireWildcard(require("css-color-names"));
|
21
|
-
|
22
17
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
23
|
-
|
24
18
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
25
|
-
|
26
19
|
// eslint-disable-line import/extensions
|
27
20
|
|
28
21
|
/**
|
@@ -31,6 +24,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
31
24
|
* TODO: Refactor this once tokenization by Core team is ready
|
32
25
|
* https://product-fabric.atlassian.net/browse/CS-908
|
33
26
|
*/
|
27
|
+
|
34
28
|
var R50 = '#FFEBE6';
|
35
29
|
exports.R50 = R50;
|
36
30
|
var R75 = '#FFBDAD';
|
@@ -120,20 +114,18 @@ exports.T100 = T100;
|
|
120
114
|
var T300 = '#00B8D9';
|
121
115
|
exports.T300 = T300;
|
122
116
|
var T500 = '#008DA6';
|
117
|
+
|
123
118
|
/**
|
124
|
-
* @return String with HEX-coded color
|
119
|
+
* @return String with HEX-coded color.
|
125
120
|
*/
|
126
|
-
|
127
121
|
exports.T500 = T500;
|
128
|
-
|
129
122
|
function normalizeHexColor(color, defaultColor) {
|
130
123
|
if (!color) {
|
131
124
|
return null;
|
132
|
-
}
|
133
|
-
|
125
|
+
}
|
134
126
|
|
127
|
+
// Normalize to hex
|
135
128
|
color = color.trim().toLowerCase();
|
136
|
-
|
137
129
|
if (isHex(color)) {
|
138
130
|
// Normalize 3-hex to 6-hex colours
|
139
131
|
if (color.length === 4) {
|
@@ -155,80 +147,65 @@ function normalizeHexColor(color, defaultColor) {
|
|
155
147
|
return null;
|
156
148
|
}
|
157
149
|
}
|
158
|
-
|
159
150
|
if (color === defaultColor) {
|
160
151
|
return null;
|
161
152
|
}
|
162
|
-
|
163
153
|
return color;
|
164
154
|
}
|
155
|
+
|
165
156
|
/**
|
166
157
|
* Converts hex color format to rgb.
|
167
158
|
* Works well with full hex color format and shortcut as well.
|
168
159
|
*
|
169
160
|
* @param hex - hex color string (#xxx, or #xxxxxx)
|
170
161
|
*/
|
171
|
-
|
172
|
-
|
173
162
|
function hexToRgb(color) {
|
174
163
|
if (!isHex(color)) {
|
175
164
|
return null;
|
176
165
|
}
|
177
|
-
|
178
166
|
var colorBits = color.substring(1).split('');
|
179
|
-
|
180
167
|
if (colorBits.length === 3) {
|
181
168
|
colorBits = [colorBits[0], colorBits[0], colorBits[1], colorBits[1], colorBits[2], colorBits[2]];
|
182
169
|
}
|
183
|
-
|
184
|
-
|
185
|
-
|
170
|
+
var rgb = Number("0x".concat(colorBits.join('')));
|
171
|
+
// eslint-disable-next-line no-bitwise
|
186
172
|
return "rgb(".concat(rgb >> 16 & 255, ",").concat(rgb >> 8 & 255, ",").concat(rgb & 255, ")");
|
187
173
|
}
|
174
|
+
|
188
175
|
/**
|
189
176
|
* Converts hex color format to rgba.
|
190
177
|
*
|
191
178
|
* @param hex - hex color string (#xxx, or #xxxxxx)
|
192
179
|
*/
|
193
|
-
|
194
|
-
|
195
180
|
function hexToRgba(rawColor, alpha) {
|
196
181
|
var color = normalizeHexColor(rawColor);
|
197
|
-
|
198
182
|
if (!color) {
|
199
183
|
return null;
|
200
184
|
}
|
201
|
-
|
202
185
|
var hex2rgb = function hex2rgb(color) {
|
203
186
|
return color.match(/[a-z0-9]{2}/gi).map(function (hex) {
|
204
187
|
return parseInt(hex, 16);
|
205
188
|
});
|
206
189
|
};
|
207
|
-
|
208
190
|
return "rgba(".concat(hex2rgb(color).concat(alpha).join(','), ")");
|
209
191
|
}
|
210
|
-
|
211
192
|
function rgbToHex(value) {
|
212
193
|
var matches = value.match(/(0?\.?\d{1,3})%?\b/g);
|
213
|
-
|
214
194
|
if (matches && matches.length >= 3) {
|
215
195
|
var _matches$map = matches.map(Number),
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
196
|
+
_matches$map2 = (0, _slicedToArray2.default)(_matches$map, 3),
|
197
|
+
red = _matches$map2[0],
|
198
|
+
green = _matches$map2[1],
|
199
|
+
blue = _matches$map2[2];
|
221
200
|
return '#' + (blue | green << 8 | red << 16 | 1 << 24).toString(16).slice(1) // eslint-disable-line no-bitwise
|
222
201
|
;
|
223
202
|
}
|
224
203
|
|
225
204
|
return null;
|
226
205
|
}
|
227
|
-
|
228
206
|
function isRgb(color) {
|
229
207
|
return /rgba?\(/.test(color);
|
230
208
|
}
|
231
|
-
|
232
209
|
function isHex(color) {
|
233
210
|
return /^#([A-Fa-f0-9]{3}){1,2}$/.test(color);
|
234
211
|
}
|
@@ -8,11 +8,14 @@ exports.acShortcutToEmoji = acShortcutToEmoji;
|
|
8
8
|
exports.emojiIdToAcName = emojiIdToAcName;
|
9
9
|
exports.getEmojiAcName = getEmojiAcName;
|
10
10
|
// Default emoji id for Confluence glyphs that has no match to Fabric Emoji
|
11
|
-
var DEFAULT_EMOJI_ID = '2b50';
|
11
|
+
var DEFAULT_EMOJI_ID = '2b50';
|
12
12
|
|
13
|
-
|
13
|
+
// Default ac:name for emoticons as a fallback is `blue-star`
|
14
|
+
var DEFAULT_EMOJI_ACNAME = 'blue-star';
|
14
15
|
|
16
|
+
// ac:hipchat-emoticon prefix when converting to Emoji ID
|
15
17
|
var HC_EMOTICON_PREFIX = 'atlassian-';
|
18
|
+
|
16
19
|
/**
|
17
20
|
* Confluence glyphs ac:name of <ac:emoticon /> map to new emojis
|
18
21
|
* {
|
@@ -22,7 +25,6 @@ var HC_EMOTICON_PREFIX = 'atlassian-';
|
|
22
25
|
* Glyphs that do not map to Fabric Emoji
|
23
26
|
* will be mapped to Emoji Id '2b50' (:star:) with preserving ac:name as shortName attribute;
|
24
27
|
*/
|
25
|
-
|
26
28
|
var acNameToEmojiMap = {
|
27
29
|
smile: ['1f642', ':slight_smile:', "\uD83D\uDE42"],
|
28
30
|
sad: ['1f641', ':slight_frown:', "\uD83D\uDE41"],
|
@@ -47,7 +49,6 @@ var acNameToEmojiMap = {
|
|
47
49
|
heart: ['2764', ':heart:', "\u2764\uFE0F"],
|
48
50
|
'broken-heart': ['1f494', ':broken_heart:', "\uD83D\uDC94"]
|
49
51
|
};
|
50
|
-
|
51
52
|
function acNameToEmoji(acName) {
|
52
53
|
var emojiData = acNameToEmojiMap[acName];
|
53
54
|
return emojiData ? {
|
@@ -60,15 +61,12 @@ function acNameToEmoji(acName) {
|
|
60
61
|
text: ''
|
61
62
|
};
|
62
63
|
}
|
63
|
-
|
64
64
|
function emojiIdToAcName(emojiId) {
|
65
65
|
var filterEmojis = function filterEmojis(acName) {
|
66
66
|
return acNameToEmojiMap[acName] ? acNameToEmojiMap[acName][0] === emojiId : false;
|
67
67
|
};
|
68
|
-
|
69
68
|
return Object.keys(acNameToEmojiMap).filter(filterEmojis)[0];
|
70
69
|
}
|
71
|
-
|
72
70
|
function acShortcutToEmoji(hipchatEmoticonShortName) {
|
73
71
|
return {
|
74
72
|
id: "".concat(HC_EMOTICON_PREFIX).concat(hipchatEmoticonShortName),
|
@@ -76,22 +74,17 @@ function acShortcutToEmoji(hipchatEmoticonShortName) {
|
|
76
74
|
text: ''
|
77
75
|
};
|
78
76
|
}
|
79
|
-
|
80
77
|
function getAcNameFromShortName(shortName) {
|
81
78
|
return shortName.slice(shortName[0] === ':' ? 1 : 0, shortName[shortName.length - 1] === ':' ? -1 : shortName.length);
|
82
79
|
}
|
83
|
-
|
84
80
|
function getEmojiAcName(_ref) {
|
85
81
|
var id = _ref.id,
|
86
|
-
|
87
|
-
|
82
|
+
shortName = _ref.shortName;
|
88
83
|
if (DEFAULT_EMOJI_ID === id) {
|
89
84
|
var possibleName = getAcNameFromShortName(shortName);
|
90
|
-
|
91
85
|
if (possibleName in acNameToEmojiMap) {
|
92
86
|
return possibleName;
|
93
87
|
}
|
94
88
|
}
|
95
|
-
|
96
89
|
return emojiIdToAcName(id) || DEFAULT_EMOJI_ACNAME;
|
97
90
|
}
|
@@ -4,22 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.isValidLayout = exports.getExtensionAttrs = void 0;
|
7
|
-
|
8
7
|
var isValidLayout = function isValidLayout(name) {
|
9
8
|
return !!name && ['default', 'wide', 'full-width'].includes(name);
|
10
9
|
};
|
11
|
-
|
12
10
|
exports.isValidLayout = isValidLayout;
|
13
|
-
|
14
11
|
var getExtensionAttrs = function getExtensionAttrs(dom) {
|
15
12
|
var isInline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
16
13
|
var extensionType = dom.getAttribute('data-extension-type');
|
17
14
|
var extensionKey = dom.getAttribute('data-extension-key');
|
18
|
-
|
19
15
|
if (!extensionType || !extensionKey) {
|
20
16
|
return false;
|
21
17
|
}
|
22
|
-
|
23
18
|
var attrs = {
|
24
19
|
extensionType: extensionType,
|
25
20
|
extensionKey: extensionKey,
|
@@ -27,13 +22,10 @@ var getExtensionAttrs = function getExtensionAttrs(dom) {
|
|
27
22
|
parameters: JSON.parse(dom.getAttribute('data-parameters') || '{}'),
|
28
23
|
localId: dom.getAttribute('data-local-id') || undefined
|
29
24
|
};
|
30
|
-
|
31
25
|
if (!isInline) {
|
32
26
|
var rawLayout = dom.getAttribute('data-layout');
|
33
27
|
attrs.layout = isValidLayout(rawLayout) ? rawLayout : 'default';
|
34
28
|
}
|
35
|
-
|
36
29
|
return attrs;
|
37
30
|
};
|
38
|
-
|
39
31
|
exports.getExtensionAttrs = getExtensionAttrs;
|
package/dist/cjs/utils/index.js
CHANGED
@@ -375,11 +375,7 @@ Object.defineProperty(exports, "uuid", {
|
|
375
375
|
return _uuid.uuid;
|
376
376
|
}
|
377
377
|
});
|
378
|
-
|
379
378
|
var _emoji = require("./confluence/emoji");
|
380
|
-
|
381
379
|
var _uuid = require("./uuid");
|
382
|
-
|
383
380
|
var _colors = require("./colors");
|
384
|
-
|
385
381
|
var _url = require("./url");
|
@@ -4,9 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.isDOMElement = void 0;
|
7
|
-
|
8
7
|
var isDOMElement = function isDOMElement(maybeNode) {
|
9
8
|
return maybeNode instanceof Node && maybeNode.nodeType === Node.ELEMENT_NODE;
|
10
9
|
};
|
11
|
-
|
12
10
|
exports.isDOMElement = isDOMElement;
|
package/dist/cjs/utils/url.js
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
4
|
-
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
6
5
|
value: true
|
7
6
|
});
|
@@ -9,30 +8,26 @@ exports.LINK_REGEXP = void 0;
|
|
9
8
|
exports.getLinkMatch = getLinkMatch;
|
10
9
|
exports.linkifyMatch = exports.linkify = exports.isSafeUrl = void 0;
|
11
10
|
exports.normalizeUrl = normalizeUrl;
|
12
|
-
|
13
11
|
var _linkifyIt = _interopRequireDefault(require("linkify-it"));
|
14
|
-
|
15
12
|
/**
|
16
13
|
* This file has been duplicated in packages/linking-platform/link-picker/src/common/utils/url.ts
|
17
14
|
* Any changes made here should be mirrored there.
|
18
15
|
*/
|
16
|
+
|
19
17
|
var whitelistedURLPatterns = [/^https?:\/\//im, /^ftps?:\/\//im, /^jamfselfservice:\/\//im, /^\//im, /^mailto:/im, /^skype:/im, /^callto:/im, /^facetime:/im, /^git:/im, /^irc6?:/im, /^news:/im, /^nntp:/im, /^feed:/im, /^cvs:/im, /^svn:/im, /^mvn:/im, /^ssh:/im, /^scp:\/\//im, /^sftp:\/\//im, /^itms:/im, /^notes:/im, /^hipchat:\/\//im, /^sourcetree:/im, /^urn:/im, /^tel:/im, /^xmpp:/im, /^telnet:/im, /^vnc:/im, /^rdp:/im, /^whatsapp:/im, /^slack:/im, /^sips?:/im, /^magnet:/im, /^#/im];
|
18
|
+
|
20
19
|
/**
|
21
20
|
* Please notify the Editor Mobile team (Slack: #help-mobilekit) if the logic for this changes.
|
22
21
|
*/
|
23
|
-
|
24
22
|
var isSafeUrl = function isSafeUrl(url) {
|
25
23
|
var urlTrimmed = url.trim();
|
26
|
-
|
27
24
|
if (urlTrimmed.length === 0) {
|
28
25
|
return true;
|
29
26
|
}
|
30
|
-
|
31
27
|
return whitelistedURLPatterns.some(function (p) {
|
32
28
|
return p.test(urlTrimmed);
|
33
29
|
});
|
34
30
|
};
|
35
|
-
|
36
31
|
exports.isSafeUrl = isSafeUrl;
|
37
32
|
var linkify = (0, _linkifyIt.default)();
|
38
33
|
exports.linkify = linkify;
|
@@ -44,20 +39,15 @@ tlds.push(tlds2Char);
|
|
44
39
|
linkify.tlds(tlds, false);
|
45
40
|
var LINK_REGEXP = /(https?|ftp|jamfselfservice):\/\/[^\s]+/;
|
46
41
|
exports.LINK_REGEXP = LINK_REGEXP;
|
47
|
-
|
48
42
|
var linkifyMatch = function linkifyMatch(text) {
|
49
43
|
var matches = [];
|
50
|
-
|
51
44
|
if (!LINK_REGEXP.test(text)) {
|
52
45
|
return matches;
|
53
46
|
}
|
54
|
-
|
55
47
|
var startpos = 0;
|
56
48
|
var substr;
|
57
|
-
|
58
49
|
while (substr = text.substr(startpos)) {
|
59
50
|
var link = (substr.match(LINK_REGEXP) || [''])[0];
|
60
|
-
|
61
51
|
if (link) {
|
62
52
|
var index = substr.search(LINK_REGEXP);
|
63
53
|
var start = index >= 0 ? index + startpos : index;
|
@@ -75,30 +65,23 @@ var linkifyMatch = function linkifyMatch(text) {
|
|
75
65
|
break;
|
76
66
|
}
|
77
67
|
}
|
78
|
-
|
79
68
|
return matches;
|
80
69
|
};
|
81
|
-
|
82
70
|
exports.linkifyMatch = linkifyMatch;
|
83
|
-
|
84
71
|
function getLinkMatch(str) {
|
85
72
|
if (!str) {
|
86
73
|
return null;
|
87
74
|
}
|
88
|
-
|
89
75
|
var match = linkifyMatch(str);
|
90
|
-
|
91
76
|
if (!match.length) {
|
92
77
|
match = linkify.match(str);
|
93
78
|
}
|
94
|
-
|
95
79
|
return match && match[0];
|
96
80
|
}
|
81
|
+
|
97
82
|
/**
|
98
83
|
* Adds protocol to url if needed.
|
99
84
|
*/
|
100
|
-
|
101
|
-
|
102
85
|
function normalizeUrl(url) {
|
103
86
|
var match = getLinkMatch(url);
|
104
87
|
return match && match.url || '';
|
package/dist/cjs/utils/uuid.js
CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.uuid = exports.generateUuid = void 0;
|
7
|
-
|
8
7
|
/* eslint-disable no-bitwise */
|
9
8
|
var generateUuid = function generateUuid() {
|
10
9
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
@@ -13,8 +12,6 @@ var generateUuid = function generateUuid() {
|
|
13
12
|
});
|
14
13
|
};
|
15
14
|
/* eslint-enable no-bitwise */
|
16
|
-
|
17
|
-
|
18
15
|
exports.generateUuid = generateUuid;
|
19
16
|
var staticValue = false;
|
20
17
|
var uuid = {
|
package/dist/cjs/version.json
CHANGED
package/dist/es2019/index.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette,
|
2
|
-
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
1
|
+
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
2
|
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './schema';
|
4
3
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { createSchema } from './create-schema';
|
2
|
+
|
2
3
|
/**
|
3
4
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
4
5
|
**/
|
5
|
-
|
6
6
|
export const bitbucketSchema = createSchema({
|
7
7
|
nodes: ['doc', 'caption', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'hardBreak', 'rule', 'image', 'media', 'mediaSingle', 'mention', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'],
|
8
8
|
marks: ['em', 'strong', 'strike', 'link', 'code', 'unsupportedMark', 'unsupportedNodeAttribute']
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { createSchema } from './create-schema';
|
2
2
|
const nodes = ['doc', 'paragraph', 'blockquote', 'codeBlock', 'panel', 'hardBreak', 'orderedList', 'bulletList', 'heading', 'mediaInline', 'mediaGroup', 'mediaSingle', 'media', 'caption', 'confluenceUnsupportedBlock', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'listItem', 'mention', 'text', 'confluenceUnsupportedInline', 'media', 'rule', 'table', 'tableCell', 'tableHeader', 'tableRow', 'emoji', 'taskList', 'taskItem', 'date', 'placeholder', 'decisionList', 'decisionItem', 'layoutSection', 'layoutColumn', 'inlineCard', 'unsupportedBlock', 'unsupportedInline'];
|
3
3
|
const marks = ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'mentionQuery', 'code', 'textColor', 'confluenceInlineComment', 'annotation', 'unsupportedMark', 'unsupportedNodeAttribute'];
|
4
|
+
|
4
5
|
/**
|
5
6
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
6
7
|
**/
|
7
|
-
|
8
8
|
export const confluenceSchema = createSchema({
|
9
9
|
nodes,
|
10
10
|
marks
|
@@ -12,7 +12,6 @@ export const confluenceSchema = createSchema({
|
|
12
12
|
/**
|
13
13
|
* @deprecated [ED-15676] We have stopped supporting product specific schemas. Use `@atlaskit/adf-schema/schema-default` instead.
|
14
14
|
**/
|
15
|
-
|
16
15
|
export const confluenceSchemaWithMediaSingle = createSchema({
|
17
16
|
nodes: nodes.concat('mediaSingle'),
|
18
17
|
marks
|
@@ -2,16 +2,14 @@ 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 } from './marks';
|
4
4
|
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaGroup, mediaSingleWithCaption, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
5
|
-
|
6
5
|
function addItems(builtInItems, config, customSpecs = {}) {
|
7
6
|
if (!config) {
|
8
7
|
return {};
|
9
8
|
}
|
9
|
+
|
10
10
|
/**
|
11
11
|
* Add built-in Node / Mark specs
|
12
12
|
*/
|
13
|
-
|
14
|
-
|
15
13
|
const items = builtInItems.reduce((items, {
|
16
14
|
name,
|
17
15
|
spec
|
@@ -19,30 +17,28 @@ function addItems(builtInItems, config, customSpecs = {}) {
|
|
19
17
|
if (config.indexOf(name) !== -1) {
|
20
18
|
items[name] = customSpecs[name] || spec;
|
21
19
|
}
|
22
|
-
|
23
20
|
return items;
|
24
21
|
}, {});
|
22
|
+
|
25
23
|
/**
|
26
24
|
* Add Custom Node / Mark specs
|
27
25
|
*/
|
28
|
-
|
29
26
|
return Object.keys(customSpecs).reduce((items, name) => {
|
30
27
|
if (items[name]) {
|
31
28
|
return items;
|
32
29
|
}
|
33
|
-
|
34
30
|
items[name] = customSpecs[name];
|
35
31
|
return items;
|
36
32
|
}, items);
|
37
|
-
}
|
33
|
+
}
|
34
|
+
|
35
|
+
// We use groups to allow schemas to be constructed in different shapes without changing node/mark
|
38
36
|
// specs, but this means nodes/marks are defined with groups that might never be used in the schema.
|
39
37
|
// In this scenario ProseMirror will complain and prevent the schema from being constructed.
|
40
38
|
//
|
41
39
|
// To avoid the problem, we include items that serve to "declare" the groups in the schema. This
|
42
40
|
// approach unfortunately leaves unused items in the schema, but has the benefit of avoiding the
|
43
41
|
// need to manipulate `exclude` or content expression values for potentially every schema item.
|
44
|
-
|
45
|
-
|
46
42
|
function groupDeclaration(name) {
|
47
43
|
return {
|
48
44
|
name: `__${name}GroupDeclaration`,
|
@@ -51,7 +47,6 @@ function groupDeclaration(name) {
|
|
51
47
|
}
|
52
48
|
};
|
53
49
|
}
|
54
|
-
|
55
50
|
const markGroupDeclarations = [groupDeclaration(COLOR), groupDeclaration(FONT_STYLE), groupDeclaration(SEARCH_QUERY), groupDeclaration(LINK)];
|
56
51
|
const markGroupDeclarationsNames = markGroupDeclarations.map(groupMark => groupMark.name);
|
57
52
|
const nodesInOrder = [{
|
@@ -251,10 +246,10 @@ const marksInOrder = [{
|
|
251
246
|
name: 'unsupportedNodeAttribute',
|
252
247
|
spec: unsupportedNodeAttribute
|
253
248
|
}];
|
249
|
+
|
254
250
|
/**
|
255
251
|
* Creates a schema preserving order of marks and nodes.
|
256
252
|
*/
|
257
|
-
|
258
253
|
export function createSchema(config) {
|
259
254
|
const {
|
260
255
|
customNodeSpecs,
|
@@ -273,17 +268,15 @@ export function createSchema(config) {
|
|
273
268
|
export function sanitizeNodes(nodes, supportedMarks) {
|
274
269
|
const nodeNames = Object.keys(nodes);
|
275
270
|
nodeNames.forEach(nodeKey => {
|
276
|
-
const nodeSpec = {
|
271
|
+
const nodeSpec = {
|
272
|
+
...nodes[nodeKey]
|
277
273
|
};
|
278
|
-
|
279
274
|
if (nodeSpec.marks && nodeSpec.marks !== '_') {
|
280
275
|
nodeSpec.marks = nodeSpec.marks.split(' ').filter(mark => !!supportedMarks[mark]).join(' ');
|
281
276
|
}
|
282
|
-
|
283
277
|
if (nodeSpec.content) {
|
284
278
|
nodeSpec.content = sanitizeNodeSpecContent(nodes, nodeSpec.content);
|
285
279
|
}
|
286
|
-
|
287
280
|
nodes[nodeKey] = nodeSpec;
|
288
281
|
});
|
289
282
|
return nodes;
|
@@ -294,37 +287,31 @@ export function sanitizeNodeSpecContent(nodes, rawContent) {
|
|
294
287
|
const unsupportedContentKeys = contentKeys.filter(contentKey => !isContentSupported(nodes, contentKey));
|
295
288
|
return unsupportedContentKeys.reduce((newContent, nodeName) => sanitizedContent(newContent, nodeName), rawContent);
|
296
289
|
}
|
297
|
-
|
298
290
|
function sanitizedContent(content, invalidContent) {
|
299
291
|
if (!invalidContent.length) {
|
300
292
|
return content || '';
|
301
293
|
}
|
302
|
-
|
303
294
|
if (!content || !content.match(/\w/)) {
|
304
295
|
return '';
|
305
296
|
}
|
306
|
-
|
307
297
|
const pattern = `(${invalidContent}((\\s)*\\|)+)|((\\|(\\s)*)+${invalidContent})|(${invalidContent}$)|(${invalidContent}(\\+|\\*))`;
|
308
298
|
return content.replace(new RegExp(pattern, 'g'), '').replace(' ', ' ').trim();
|
309
299
|
}
|
310
|
-
|
311
300
|
function isContentSupported(nodes, contentKey) {
|
312
|
-
const nodeKeys = Object.keys(nodes);
|
301
|
+
const nodeKeys = Object.keys(nodes);
|
313
302
|
|
303
|
+
// content is with valid node
|
314
304
|
if (nodeKeys.indexOf(contentKey) > -1) {
|
315
305
|
return true;
|
316
|
-
}
|
317
|
-
|
306
|
+
}
|
318
307
|
|
308
|
+
// content is with valid group
|
319
309
|
for (const supportedKey in nodes) {
|
320
310
|
const nodeSpec = nodes[supportedKey];
|
321
|
-
|
322
311
|
if (nodeSpec && nodeSpec.group === contentKey) {
|
323
312
|
return true;
|
324
313
|
}
|
325
314
|
}
|
326
|
-
|
327
315
|
return false;
|
328
316
|
}
|
329
|
-
|
330
317
|
export const allowCustomPanel = true;
|
@@ -1,30 +1,22 @@
|
|
1
1
|
import { layoutSectionWithSingleColumn } from './nodes';
|
2
|
-
import { fragment } from './marks';
|
3
2
|
import { createSchema } from './create-schema';
|
4
|
-
|
5
3
|
const getDefaultSchemaConfig = () => {
|
6
4
|
let defaultSchemaConfig = {
|
7
5
|
nodes: ['doc', 'paragraph', 'text', 'bulletList', 'orderedList', 'listItem', 'heading', 'blockquote', 'codeBlock', 'panel', 'rule', 'image', 'caption', 'mention', 'media', 'mediaGroup', 'mediaSingle', 'mediaInline', 'confluenceUnsupportedBlock', 'confluenceUnsupportedInline', 'confluenceJiraIssue', 'expand', 'nestedExpand', 'extension', 'inlineExtension', 'bodiedExtension', 'hardBreak', 'emoji', 'table', 'tableCell', 'tableHeader', 'tableRow', 'decisionList', 'decisionItem', 'taskList', 'taskItem', 'unknownBlock', 'date', 'status', 'placeholder', 'layoutSection', 'layoutColumn', 'inlineCard', 'blockCard', 'embedCard', 'unsupportedBlock', 'unsupportedInline'],
|
8
|
-
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery'
|
9
|
-
|
6
|
+
marks: ['link', 'em', 'strong', 'strike', 'subsup', 'underline', 'code', 'textColor', 'confluenceInlineComment', 'breakout', 'alignment', 'indentation', 'annotation', 'dataConsumer', 'unsupportedMark', 'unsupportedNodeAttribute', 'typeAheadQuery',
|
7
|
+
// https://product-fabric.atlassian.net/browse/ED-10214,
|
8
|
+
'fragment']
|
10
9
|
};
|
11
10
|
return defaultSchemaConfig;
|
12
11
|
};
|
13
|
-
|
14
12
|
export const defaultSchemaConfig = getDefaultSchemaConfig();
|
15
13
|
export const getSchemaBasedOnStage = (stage = 'final') => {
|
16
14
|
const defaultSchemaConfig = getDefaultSchemaConfig();
|
17
|
-
|
18
15
|
if (stage === 'stage0') {
|
19
16
|
defaultSchemaConfig.customNodeSpecs = {
|
20
17
|
layoutSection: layoutSectionWithSingleColumn
|
21
18
|
};
|
22
|
-
defaultSchemaConfig.customMarkSpecs = {
|
23
|
-
fragment
|
24
|
-
};
|
25
|
-
defaultSchemaConfig.nodes.push('mediaInline');
|
26
19
|
}
|
27
|
-
|
28
20
|
return createSchema(defaultSchemaConfig);
|
29
21
|
};
|
30
22
|
export const defaultSchema = getSchemaBasedOnStage();
|
@@ -7,17 +7,24 @@
|
|
7
7
|
//
|
8
8
|
// Groups provide a level of indirection, and solve this problem. For the immediate use-case, one
|
9
9
|
// group called "not_code" would have sufficed, but this an ultra-specialised to code.
|
10
|
+
|
10
11
|
// Mark group for font styling (e.g. bold, italic, underline, superscript).
|
11
|
-
export const FONT_STYLE = 'fontStyle';
|
12
|
+
export const FONT_STYLE = 'fontStyle';
|
13
|
+
|
14
|
+
// Marks group for search queries.
|
15
|
+
export const SEARCH_QUERY = 'searchQuery';
|
12
16
|
|
13
|
-
|
17
|
+
// Marks group for links.
|
18
|
+
export const LINK = 'link';
|
14
19
|
|
15
|
-
|
20
|
+
// Marks group for colors (text-color, background-color, etc).
|
21
|
+
export const COLOR = 'color';
|
16
22
|
|
17
|
-
|
23
|
+
// They need to be on their own group so that they can exclude each other
|
18
24
|
// and also work when one of them is disabled.
|
19
|
-
// Marks group for alignment.
|
20
25
|
|
21
|
-
|
26
|
+
// Marks group for alignment.
|
27
|
+
export const ALIGNMENT = 'alignment';
|
22
28
|
|
29
|
+
// Marks group for indentation.
|
23
30
|
export const INDENTATION = 'indentation';
|
@@ -1,6 +1,5 @@
|
|
1
1
|
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaInline, mediaSingleWithCaption, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
2
|
-
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette,
|
3
|
-
/** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
2
|
+
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
4
3
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute } from './marks';
|
5
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
6
5
|
export { inlineNodes } from './inline-nodes';
|