@atlaskit/adf-schema 33.1.2 → 33.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 +12 -0
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/schema/create-schema.js +6 -0
- package/dist/cjs/schema/index.js +12 -0
- package/dist/cjs/schema/marks/text-color.js +33 -31
- package/dist/cjs/schema/nodes/index.js +17 -4
- package/dist/cjs/schema/nodes/multi-bodied-extension.js +102 -0
- package/dist/cjs/schema/nodes/tableNodes.js +34 -33
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/schema/create-schema.js +7 -1
- package/dist/es2019/schema/index.js +1 -1
- package/dist/es2019/schema/marks/text-color.js +33 -31
- package/dist/es2019/schema/nodes/index.js +6 -4
- package/dist/es2019/schema/nodes/multi-bodied-extension.js +94 -0
- package/dist/es2019/schema/nodes/tableNodes.js +34 -33
- package/dist/esm/index.js +1 -1
- package/dist/esm/schema/create-schema.js +7 -1
- package/dist/esm/schema/index.js +1 -1
- package/dist/esm/schema/marks/text-color.js +33 -31
- package/dist/esm/schema/nodes/index.js +6 -4
- package/dist/esm/schema/nodes/multi-bodied-extension.js +96 -0
- package/dist/esm/schema/nodes/tableNodes.js +34 -33
- package/dist/json-schema/v1/stage-0.json +138 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/schema/index.d.ts +2 -2
- package/dist/types/schema/nodes/doc.d.ts +2 -1
- package/dist/types/schema/nodes/index.d.ts +8 -6
- package/dist/types/schema/nodes/multi-bodied-extension.d.ts +50 -0
- package/json-schema/v1/stage-0.json +138 -0
- package/package.json +1 -12
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @atlaskit/adf-schema
|
2
2
|
|
3
|
+
## 33.2.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- e958e89: ED-20043: Adding Multi-bodied Extension to enable Nested Bodied Macros (NBM)
|
8
|
+
|
9
|
+
## 33.1.3
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 6ac028f: [ux] ED-20700 Clean up color inversion feature flag
|
14
|
+
|
3
15
|
## 33.1.2
|
4
16
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/index.js
CHANGED
@@ -531,6 +531,12 @@ Object.defineProperty(exports, "extension", {
|
|
531
531
|
return _schema.extension;
|
532
532
|
}
|
533
533
|
});
|
534
|
+
Object.defineProperty(exports, "extensionFrame", {
|
535
|
+
enumerable: true,
|
536
|
+
get: function get() {
|
537
|
+
return _schema.extensionFrame;
|
538
|
+
}
|
539
|
+
});
|
534
540
|
Object.defineProperty(exports, "fragment", {
|
535
541
|
enumerable: true,
|
536
542
|
get: function get() {
|
@@ -759,6 +765,12 @@ Object.defineProperty(exports, "mentionToJSON", {
|
|
759
765
|
return _schema.mentionToJSON;
|
760
766
|
}
|
761
767
|
});
|
768
|
+
Object.defineProperty(exports, "multiBodiedExtension", {
|
769
|
+
enumerable: true,
|
770
|
+
get: function get() {
|
771
|
+
return _schema.multiBodiedExtension;
|
772
|
+
}
|
773
|
+
});
|
762
774
|
Object.defineProperty(exports, "nestedExpand", {
|
763
775
|
enumerable: true,
|
764
776
|
get: function get() {
|
@@ -187,6 +187,12 @@ var nodesInOrder = [{
|
|
187
187
|
}, {
|
188
188
|
name: 'bodiedExtension',
|
189
189
|
spec: _nodes.bodiedExtension
|
190
|
+
}, {
|
191
|
+
name: 'multiBodiedExtension',
|
192
|
+
spec: _nodes.multiBodiedExtension
|
193
|
+
}, {
|
194
|
+
name: 'extensionFrame',
|
195
|
+
spec: _nodes.extensionFrame
|
190
196
|
}, {
|
191
197
|
name: 'inlineCard',
|
192
198
|
spec: _nodes.inlineCard
|
package/dist/cjs/schema/index.js
CHANGED
@@ -243,6 +243,12 @@ Object.defineProperty(exports, "extension", {
|
|
243
243
|
return _nodes.extension;
|
244
244
|
}
|
245
245
|
});
|
246
|
+
Object.defineProperty(exports, "extensionFrame", {
|
247
|
+
enumerable: true,
|
248
|
+
get: function get() {
|
249
|
+
return _nodes.extensionFrame;
|
250
|
+
}
|
251
|
+
});
|
246
252
|
Object.defineProperty(exports, "fragment", {
|
247
253
|
enumerable: true,
|
248
254
|
get: function get() {
|
@@ -417,6 +423,12 @@ Object.defineProperty(exports, "mentionToJSON", {
|
|
417
423
|
return _nodes.mentionToJSON;
|
418
424
|
}
|
419
425
|
});
|
426
|
+
Object.defineProperty(exports, "multiBodiedExtension", {
|
427
|
+
enumerable: true,
|
428
|
+
get: function get() {
|
429
|
+
return _nodes.multiBodiedExtension;
|
430
|
+
}
|
431
|
+
});
|
420
432
|
Object.defineProperty(exports, "nestedExpand", {
|
421
433
|
enumerable: true,
|
422
434
|
get: function get() {
|
@@ -10,7 +10,6 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
|
|
10
10
|
var _editorPalette = require("../../utils/editor-palette");
|
11
11
|
var _groups = require("../groups");
|
12
12
|
var _colors = require("../../utils/colors");
|
13
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
14
13
|
/**
|
15
14
|
* @name textColor_mark
|
16
15
|
*/
|
@@ -84,6 +83,12 @@ function invertCustomColor(customColor) {
|
|
84
83
|
hex = customColor;
|
85
84
|
} else if ((0, _colors.isRgb)(customColor)) {
|
86
85
|
hex = (0, _colors.rgbToHex)(customColor);
|
86
|
+
if (hex === null) {
|
87
|
+
// in some cases the rgb color is invalid, in this case we just return the color
|
88
|
+
// See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
|
89
|
+
// to align with the rgbToHex function
|
90
|
+
return customColor;
|
91
|
+
}
|
87
92
|
} else {
|
88
93
|
return customColor;
|
89
94
|
}
|
@@ -168,38 +173,35 @@ var textColor = {
|
|
168
173
|
// Note -- while there is no way to create custom colors using default tooling
|
169
174
|
// the editor does supported ad hoc color values -- and there may be content
|
170
175
|
// which has been migrated or created via apis which use such values.
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
176
|
+
|
177
|
+
/**
|
178
|
+
* The Editor persists custom text colors when content has been migrated from the old editor, or created via
|
179
|
+
* apis.
|
180
|
+
*
|
181
|
+
* This behaviour predates the introduction of dark mode.
|
182
|
+
*
|
183
|
+
* Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
|
184
|
+
*
|
185
|
+
* This introduces inversion of the presentation of the custom text colors when the user is in dark mode.
|
186
|
+
*
|
187
|
+
* This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
|
188
|
+
* how we detect text colors copied from external editor sources. Where we load the background color from a
|
189
|
+
* seperate attribute (data-text-custom-color), instead of the inline style.
|
190
|
+
*
|
191
|
+
* See the following document for more details on this behaviour
|
192
|
+
* https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
|
193
|
+
*/
|
194
|
+
var tokenColor = (0, _editorPalette.hexToEditorTextPaletteColor)(mark.attrs.color);
|
195
|
+
if (tokenColor) {
|
196
|
+
paletteColorValue = (0, _editorPalette.hexToEditorTextPaletteColor)(mark.attrs.color) || mark.attrs.color;
|
197
|
+
} else {
|
198
|
+
if (getGlobalTheme().colorMode === 'dark') {
|
199
|
+
// if we have a custom color, we need to check if we are in dark mode
|
200
|
+
paletteColorValue = invertCustomColor(mark.attrs.color);
|
192
201
|
} else {
|
193
|
-
if
|
194
|
-
|
195
|
-
paletteColorValue = invertCustomColor(mark.attrs.color);
|
196
|
-
} else {
|
197
|
-
// if we are in light mode, we can just set the color
|
198
|
-
paletteColorValue = mark.attrs.color;
|
199
|
-
}
|
202
|
+
// if we are in light mode, we can just set the color
|
203
|
+
paletteColorValue = mark.attrs.color;
|
200
204
|
}
|
201
|
-
} else {
|
202
|
-
paletteColorValue = (0, _editorPalette.hexToEditorTextPaletteColor)(mark.attrs.color) || mark.attrs.color;
|
203
205
|
}
|
204
206
|
return ['span', (0, _defineProperty2.default)({
|
205
207
|
class: 'fabric-text-color-mark',
|
@@ -142,6 +142,12 @@ Object.defineProperty(exports, "extension", {
|
|
142
142
|
return _extension.extension;
|
143
143
|
}
|
144
144
|
});
|
145
|
+
Object.defineProperty(exports, "extensionFrame", {
|
146
|
+
enumerable: true,
|
147
|
+
get: function get() {
|
148
|
+
return _multiBodiedExtension.extensionFrame;
|
149
|
+
}
|
150
|
+
});
|
145
151
|
Object.defineProperty(exports, "getCellAttrs", {
|
146
152
|
enumerable: true,
|
147
153
|
get: function get() {
|
@@ -280,6 +286,12 @@ Object.defineProperty(exports, "mentionToJSON", {
|
|
280
286
|
return _mention.toJSON;
|
281
287
|
}
|
282
288
|
});
|
289
|
+
Object.defineProperty(exports, "multiBodiedExtension", {
|
290
|
+
enumerable: true,
|
291
|
+
get: function get() {
|
292
|
+
return _multiBodiedExtension.multiBodiedExtension;
|
293
|
+
}
|
294
|
+
});
|
283
295
|
Object.defineProperty(exports, "nestedExpand", {
|
284
296
|
enumerable: true,
|
285
297
|
get: function get() {
|
@@ -502,9 +514,6 @@ var _decisionList = require("./decision-list");
|
|
502
514
|
var _decisionItem = require("./decision-item");
|
503
515
|
var _taskList = require("./task-list");
|
504
516
|
var _taskItem = require("./task-item");
|
505
|
-
var _extension = require("./extension");
|
506
|
-
var _inlineExtension = require("./inline-extension");
|
507
|
-
var _bodiedExtension = require("./bodied-extension");
|
508
517
|
var _date = require("./date");
|
509
518
|
var _placeholder = require("./placeholder");
|
510
519
|
var _layoutSection = require("./layout-section");
|
@@ -515,4 +524,8 @@ var _unsupportedBlock = require("./unsupported-block");
|
|
515
524
|
var _unsupportedInline = require("./unsupported-inline");
|
516
525
|
var _status = require("./status");
|
517
526
|
var _nestedExpand = require("./nested-expand");
|
518
|
-
var _embedCard = require("./embed-card");
|
527
|
+
var _embedCard = require("./embed-card");
|
528
|
+
var _extension = require("./extension");
|
529
|
+
var _inlineExtension = require("./inline-extension");
|
530
|
+
var _bodiedExtension = require("./bodied-extension");
|
531
|
+
var _multiBodiedExtension = require("./multi-bodied-extension");
|
@@ -0,0 +1,102 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.multiBodiedExtension = exports.extensionFrame = void 0;
|
7
|
+
var _extensions = require("../../utils/extensions");
|
8
|
+
/**
|
9
|
+
* @stage 0
|
10
|
+
* @name extensionFrame_node
|
11
|
+
* @description Wraps the block content
|
12
|
+
*/
|
13
|
+
|
14
|
+
/**
|
15
|
+
* @returns NodeSpec for ExtensionFrameDefinition
|
16
|
+
*/
|
17
|
+
var extensionFrame = {
|
18
|
+
type: 'extensionFrame',
|
19
|
+
content: '(panel | paragraph | blockquote | orderedList | bulletList | rule | heading | codeBlock | mediaGroup | mediaSingle | decisionList | taskList | table | extension | bodiedExtension | unsupportedBlock | blockCard | embedCard)+',
|
20
|
+
isolating: true,
|
21
|
+
marks: 'alignment indentation dataConsumer fragment unsupportedMark unsupportedNodeAttribute',
|
22
|
+
selectable: true,
|
23
|
+
attrs: {},
|
24
|
+
parseDOM: [{
|
25
|
+
context: 'extensionFrame//',
|
26
|
+
tag: 'div[data-extension-frame]',
|
27
|
+
skip: true
|
28
|
+
}, {
|
29
|
+
tag: 'div[data-extension-frame]'
|
30
|
+
}],
|
31
|
+
toDOM: function toDOM() {
|
32
|
+
var attrs = {
|
33
|
+
'data-extension-frame': 'true'
|
34
|
+
};
|
35
|
+
return ['div', attrs, 0];
|
36
|
+
}
|
37
|
+
};
|
38
|
+
|
39
|
+
/**
|
40
|
+
* @stage 0
|
41
|
+
* @name multiBodiedExtension_node
|
42
|
+
* @description Wraps multiple extensionFrame objects.
|
43
|
+
*/
|
44
|
+
exports.extensionFrame = extensionFrame;
|
45
|
+
/**
|
46
|
+
* @returns NodeSpec for MultiBodiedExtensionDefinition
|
47
|
+
*/
|
48
|
+
var createMultiBodiedExtensionNodeSpec = function createMultiBodiedExtensionNodeSpec() {
|
49
|
+
var nodeSpec = {
|
50
|
+
inline: false,
|
51
|
+
group: 'block',
|
52
|
+
marks: 'dataConsumer fragment',
|
53
|
+
content: 'extensionFrame+',
|
54
|
+
defining: true,
|
55
|
+
selectable: true,
|
56
|
+
attrs: {
|
57
|
+
extensionKey: {
|
58
|
+
default: ''
|
59
|
+
},
|
60
|
+
extensionType: {
|
61
|
+
default: ''
|
62
|
+
},
|
63
|
+
parameters: {
|
64
|
+
default: null
|
65
|
+
},
|
66
|
+
text: {
|
67
|
+
default: null
|
68
|
+
},
|
69
|
+
layout: {
|
70
|
+
default: 'default'
|
71
|
+
},
|
72
|
+
localId: {
|
73
|
+
default: null
|
74
|
+
}
|
75
|
+
},
|
76
|
+
parseDOM: [{
|
77
|
+
context: 'multiBodiedExtension//',
|
78
|
+
tag: '[data-node-type="multi-bodied-extension"]',
|
79
|
+
skip: true
|
80
|
+
}, {
|
81
|
+
tag: '[data-node-type="multi-bodied-extension"]',
|
82
|
+
getAttrs: function getAttrs(domNode) {
|
83
|
+
return (0, _extensions.getExtensionAttrs)(domNode);
|
84
|
+
}
|
85
|
+
}],
|
86
|
+
toDOM: function toDOM(node) {
|
87
|
+
var attrs = {
|
88
|
+
'data-node-type': 'multi-bodied-extension',
|
89
|
+
'data-extension-type': node.attrs.extensionType,
|
90
|
+
'data-extension-key': node.attrs.extensionKey,
|
91
|
+
'data-text': node.attrs.text,
|
92
|
+
'data-parameters': JSON.stringify(node.attrs.parameters),
|
93
|
+
'data-layout': node.attrs.layout,
|
94
|
+
'data-local-id:': node.attrs.localId
|
95
|
+
};
|
96
|
+
return ['div', attrs, 0];
|
97
|
+
}
|
98
|
+
};
|
99
|
+
return nodeSpec;
|
100
|
+
};
|
101
|
+
var multiBodiedExtension = createMultiBodiedExtensionNodeSpec();
|
102
|
+
exports.multiBodiedExtension = multiBodiedExtension;
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
exports.toJSONTableHeader = exports.toJSONTableCell = exports.tableWithCustomWidth = exports.tableToJSON = exports.tableRow = exports.tablePrefixSelector = exports.tableHeaderSelector = exports.tableHeader = exports.tableCellSelector = exports.tableCellContentWrapperSelector = exports.tableCellContentDomSelector = exports.tableCell = exports.tableBackgroundColorPalette = exports.tableBackgroundColorNames = exports.tableBackgroundBorderColor = exports.table = exports.setGlobalTheme = exports.getCellDomAttrs = exports.getCellAttrs = void 0;
|
8
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
9
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
10
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
11
10
|
var _editorPalette = require("../../utils/editor-palette");
|
12
11
|
var _colors = require("../../utils/colors");
|
13
12
|
var _uuid = require("../../utils/uuid");
|
@@ -74,6 +73,12 @@ function invertCustomColor(customColor) {
|
|
74
73
|
hex = customColor;
|
75
74
|
} else if ((0, _colors.isRgb)(customColor)) {
|
76
75
|
hex = (0, _colors.rgbToHex)(customColor);
|
76
|
+
if (hex === null) {
|
77
|
+
// in some cases the rgb color is invalid, in this case we just return the color
|
78
|
+
// See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
|
79
|
+
// to align with the rgbToHex function
|
80
|
+
return customColor;
|
81
|
+
}
|
77
82
|
} else {
|
78
83
|
return customColor;
|
79
84
|
}
|
@@ -140,40 +145,36 @@ var getCellDomAttrs = function getCellDomAttrs(node) {
|
|
140
145
|
attrs.style = '';
|
141
146
|
} else {
|
142
147
|
var color = (0, _colors.isRgb)(background) && (0, _colors.rgbToHex)(background) ? (0, _colors.rgbToHex)(background) : background;
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
148
|
+
|
149
|
+
/**
|
150
|
+
* The Editor supports users pasting content from external sources with custom table cell backgrounds and having those
|
151
|
+
* backgrounds persisted.
|
152
|
+
*
|
153
|
+
* This feature predates the introduction of dark mode.
|
154
|
+
*
|
155
|
+
* Without the inversion logic below, tokenised content (ie. text), can be hard to read when the user loads the page in dark mode.
|
156
|
+
*
|
157
|
+
* This introduces inversion of the presentation of the custom background color when the user is in dark mode.
|
158
|
+
*
|
159
|
+
* This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
|
160
|
+
* how we detect table cell background colors copied from external editor sources. Where we load the background color from a
|
161
|
+
* seperate attribute (data-cell-background), instead of the inline style.
|
162
|
+
*
|
163
|
+
* See the following document for more details on this behaviour
|
164
|
+
* https://hello.atlassian.net/wiki/spaces/CCECO/pages/2892247168/Unsupported+custom+table+cell+background+colors+in+dark+theme+Editor+Job+Story
|
165
|
+
*/
|
166
|
+
var tokenColor = (0, _editorPalette.hexToEditorBackgroundPaletteRawValue)(color);
|
167
|
+
if (tokenColor) {
|
168
|
+
attrs.style = "background-color: ".concat(tokenColor, ";");
|
169
|
+
} else {
|
170
|
+
// if we have a custom color, we need to check if we are in dark mode
|
171
|
+
if (getGlobalTheme().colorMode === 'dark') {
|
165
172
|
// if we have a custom color, we need to check if we are in dark mode
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
// if we are in light mode, we can just set the color
|
171
|
-
attrs.style = "background-color: ".concat(background, ";");
|
172
|
-
}
|
173
|
+
attrs.style = "background-color: ".concat(invertCustomColor(color), ";");
|
174
|
+
} else {
|
175
|
+
// if we are in light mode, we can just set the color
|
176
|
+
attrs.style = "background-color: ".concat(background, ";");
|
173
177
|
}
|
174
|
-
} else {
|
175
|
-
var _tokenColor = (0, _editorPalette.hexToEditorBackgroundPaletteRawValue)(color) || color;
|
176
|
-
attrs.style = "".concat(attrs.style || '', "background-color: ").concat(_tokenColor, ";");
|
177
178
|
}
|
178
179
|
|
179
180
|
/**
|
package/dist/es2019/index.js
CHANGED
@@ -1,3 +1,3 @@
|
|
1
1
|
export { PanelType, AnnotationTypes, alignment, alignmentPositionMap, annotation, blockCard, blockquote, bodiedExtension, breakout, bulletList, bulletListSelector, caption, code, codeBlock, codeBlockToJSON, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
2
|
-
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './schema';
|
2
|
+
colorPaletteExtended, confluenceInlineComment, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, createSchema, dataConsumer, dataConsumerToJSON, date, decisionItem, decisionList, decisionListSelector, doc, em, embedCard, emoji, expand, expandToJSON, extension, fragment, fragmentToJSON, hardBreak, heading, image, indentation, inlineCard, inlineExtension, inlineNodes, layoutColumn, layoutSection, link, linkToJSON, listItem, media, mediaGroup, mediaSingle, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleSpec, mediaInline, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, sanitizeNodes, getCellAttrs, getCellDomAttrs, status, strike, strong, subsup, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, textColor, toJSONTableCell, toJSONTableHeader, typeAheadQuery, underline, unknownBlock, unsupportedBlock, unsupportedInline, unsupportedNodeTypesForMediaCards, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette, extensionFrame, multiBodiedExtension } from './schema';
|
3
3
|
export { B100, B400, B50, B500, B75, G200, G300, G400, G50, G500, G75, N0, N20, N200, N30, N300, N40, N50, N500, N60, N80, N800, N90, P100, P300, P400, P50, P500, P75, R100, R300, R400, R50, R500, R75, T100, T300, T50, T500, T75, Y200, Y400, Y50, Y500, Y75, acNameToEmoji, acShortcutToEmoji, emojiIdToAcName, generateUuid, getEmojiAcName, getLinkMatch, hexToRgb, hexToRgba, isHex, isRgb, isSafeUrl, linkify, linkifyMatch, normalizeHexColor, normalizeUrl, rgbToHex, uuid } from './utils';
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { Schema } from '@atlaskit/editor-prosemirror/model';
|
2
2
|
import { COLOR, FONT_STYLE, SEARCH_QUERY, LINK } from './groups';
|
3
3
|
import { link, em, strong, textColor, strike, subsup, underline, code, typeAheadQuery, confluenceInlineComment, breakout, alignment, indentation, annotation, unsupportedMark, unsupportedNodeAttribute, dataConsumer, fragment, border } from './marks';
|
4
|
-
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaSingleFull, mediaGroup, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
4
|
+
import { confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, doc, paragraph, text, bulletList, orderedListWithOrder, listItem, heading, blockquote, codeBlock, panel, rule, image, mention, media, mediaInline, mediaSingleFull, mediaGroup, hardBreak, emoji, table, tableCell, tableHeader, tableRow, decisionList, decisionItem, taskList, taskItem, unknownBlock, extension, inlineExtension, bodiedExtension, multiBodiedExtension, extensionFrame, date, placeholder, layoutSection, layoutColumn, inlineCard, blockCard, unsupportedBlock, unsupportedInline, status, expand, nestedExpand, embedCard, caption } from './nodes';
|
5
5
|
function addItems(builtInItems, config, customSpecs = {}) {
|
6
6
|
if (!config) {
|
7
7
|
return {};
|
@@ -172,6 +172,12 @@ const nodesInOrder = [{
|
|
172
172
|
}, {
|
173
173
|
name: 'bodiedExtension',
|
174
174
|
spec: bodiedExtension
|
175
|
+
}, {
|
176
|
+
name: 'multiBodiedExtension',
|
177
|
+
spec: multiBodiedExtension
|
178
|
+
}, {
|
179
|
+
name: 'extensionFrame',
|
180
|
+
spec: extensionFrame
|
175
181
|
}, {
|
176
182
|
name: 'inlineCard',
|
177
183
|
spec: inlineCard
|
@@ -1,4 +1,4 @@
|
|
1
|
-
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline } from './nodes';
|
1
|
+
export { PanelType, blockCard, blockquote, bodiedExtension, bulletList, bulletListSelector, caption, codeBlock, codeBlockToJSON, confluenceJiraIssue, confluenceUnsupportedBlock, confluenceUnsupportedInline, copyPrivateMediaAttributes, date, decisionItem, decisionList, decisionListSelector, doc, embedCard, emoji, expand, expandToJSON, extension, hardBreak, heading, image, inlineCard, inlineExtension, layoutColumn, layoutSection, layoutSectionWithSingleColumn, listItem, media, mediaGroup, mediaSingle, mediaSingleSpec, mediaInline, mediaSingleWithCaption, mediaSingleWithWidthType, mediaSingleFull, mediaSingleToJSON, mediaToJSON, mention, mentionToJSON, nestedExpand, orderedList, orderedListSelector, orderedListWithOrder, panel, paragraph, placeholder, rule, getCellAttrs, getCellDomAttrs, status, table, tableWithCustomWidth, tableBackgroundBorderColor, tableBackgroundColorNames, tableBackgroundColorPalette, tableCell, tableCellContentDomSelector, tableCellContentWrapperSelector, tableCellSelector, tableHeader, tableHeaderSelector, tablePrefixSelector, tableRow, tableToJSON, taskItem, taskList, taskListSelector, text, toJSONTableCell, toJSONTableHeader, unknownBlock, unsupportedBlock, unsupportedInline, extensionFrame, multiBodiedExtension } from './nodes';
|
2
2
|
export { AnnotationTypes, alignment, alignmentPositionMap, annotation, breakout, code, colorPalette, /** @deprecated [ED-15849] The extended palette is now rolled into the main one. Use `colorPalette` instead. */
|
3
3
|
colorPaletteExtended, confluenceInlineComment, dataConsumer, dataConsumerToJSON, em, fragment, fragmentToJSON, indentation, link, linkToJSON, strike, strong, subsup, textColor, typeAheadQuery, underline, buildAnnotationMarkDataAttributes, AnnotationMarkStates, unsupportedMark, unsupportedNodeAttribute, border, borderColorPalette } from './marks';
|
4
4
|
export { unsupportedNodeTypesForMediaCards } from './unsupported';
|
@@ -1,7 +1,6 @@
|
|
1
1
|
import { hexToEditorTextPaletteColor } from '../../utils/editor-palette';
|
2
2
|
import { COLOR } from '../groups';
|
3
3
|
import { rgbToHex, N0, N80, P50, P300, P500, T75, T300, T500, G75, G300, G500, R75, R300, R500, Y75, Y200, Y400, B75, B100, B500, isHex, isRgb } from '../../utils/colors';
|
4
|
-
import { getBooleanFF } from '@atlaskit/platform-feature-flags';
|
5
4
|
|
6
5
|
/**
|
7
6
|
* @name textColor_mark
|
@@ -69,6 +68,12 @@ function invertCustomColor(customColor) {
|
|
69
68
|
hex = customColor;
|
70
69
|
} else if (isRgb(customColor)) {
|
71
70
|
hex = rgbToHex(customColor);
|
71
|
+
if (hex === null) {
|
72
|
+
// in some cases the rgb color is invalid, in this case we just return the color
|
73
|
+
// See https://product-fabric.atlassian.net/browse/DTR-2003 for a ticket to improve the isRgb function
|
74
|
+
// to align with the rgbToHex function
|
75
|
+
return customColor;
|
76
|
+
}
|
72
77
|
} else {
|
73
78
|
return customColor;
|
74
79
|
}
|
@@ -152,38 +157,35 @@ export const textColor = {
|
|
152
157
|
// Note -- while there is no way to create custom colors using default tooling
|
153
158
|
// the editor does supported ad hoc color values -- and there may be content
|
154
159
|
// which has been migrated or created via apis which use such values.
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
160
|
+
|
161
|
+
/**
|
162
|
+
* The Editor persists custom text colors when content has been migrated from the old editor, or created via
|
163
|
+
* apis.
|
164
|
+
*
|
165
|
+
* This behaviour predates the introduction of dark mode.
|
166
|
+
*
|
167
|
+
* Without the inversion logic below, text with custom colors, can be hard to read when the user loads the page in dark mode.
|
168
|
+
*
|
169
|
+
* This introduces inversion of the presentation of the custom text colors when the user is in dark mode.
|
170
|
+
*
|
171
|
+
* This can be done without additional changes to account for users copying and pasting content inside the Editor, because of
|
172
|
+
* how we detect text colors copied from external editor sources. Where we load the background color from a
|
173
|
+
* seperate attribute (data-text-custom-color), instead of the inline style.
|
174
|
+
*
|
175
|
+
* See the following document for more details on this behaviour
|
176
|
+
* https://hello.atlassian.net/wiki/spaces/CCECO/pages/2908658046/Unsupported+custom+text+colors+in+dark+theme+Editor+Job+Story
|
177
|
+
*/
|
178
|
+
const tokenColor = hexToEditorTextPaletteColor(mark.attrs.color);
|
179
|
+
if (tokenColor) {
|
180
|
+
paletteColorValue = hexToEditorTextPaletteColor(mark.attrs.color) || mark.attrs.color;
|
181
|
+
} else {
|
182
|
+
if (getGlobalTheme().colorMode === 'dark') {
|
183
|
+
// if we have a custom color, we need to check if we are in dark mode
|
184
|
+
paletteColorValue = invertCustomColor(mark.attrs.color);
|
176
185
|
} else {
|
177
|
-
if
|
178
|
-
|
179
|
-
paletteColorValue = invertCustomColor(mark.attrs.color);
|
180
|
-
} else {
|
181
|
-
// if we are in light mode, we can just set the color
|
182
|
-
paletteColorValue = mark.attrs.color;
|
183
|
-
}
|
186
|
+
// if we are in light mode, we can just set the color
|
187
|
+
paletteColorValue = mark.attrs.color;
|
184
188
|
}
|
185
|
-
} else {
|
186
|
-
paletteColorValue = hexToEditorTextPaletteColor(mark.attrs.color) || mark.attrs.color;
|
187
189
|
}
|
188
190
|
return ['span', {
|
189
191
|
class: 'fabric-text-color-mark',
|
@@ -28,9 +28,6 @@ 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 { extension } from './extension';
|
32
|
-
export { inlineExtension } from './inline-extension';
|
33
|
-
export { bodiedExtension } from './bodied-extension';
|
34
31
|
export { date } from './date';
|
35
32
|
export { placeholder } from './placeholder';
|
36
33
|
export { layoutSection, layoutSectionWithSingleColumn } from './layout-section';
|
@@ -41,4 +38,9 @@ export { unsupportedBlock } from './unsupported-block';
|
|
41
38
|
export { unsupportedInline } from './unsupported-inline';
|
42
39
|
export { status } from './status';
|
43
40
|
export { nestedExpand } from './nested-expand';
|
44
|
-
export { embedCard } from './embed-card';
|
41
|
+
export { embedCard } from './embed-card';
|
42
|
+
// Extensions
|
43
|
+
export { extension } from './extension';
|
44
|
+
export { inlineExtension } from './inline-extension';
|
45
|
+
export { bodiedExtension } from './bodied-extension';
|
46
|
+
export { extensionFrame, multiBodiedExtension } from './multi-bodied-extension';
|