@atlaskit/editor-common 74.2.0 → 74.3.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 +39 -0
- package/dist/cjs/i18n/en_ZZ.js +35 -2
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/styles/shared/table.js +4 -4
- package/dist/cjs/ui/DropList/index.js +3 -5
- package/dist/cjs/ui/Expand/index.js +1 -3
- package/dist/cjs/ui-menu/ToolbarButton/index.js +3 -1
- package/dist/cjs/ui-menu/ToolbarButton/styles.js +3 -0
- package/dist/cjs/utils/compareNodes.js +66 -51
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/i18n/en_ZZ.js +35 -2
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/styles/shared/table.js +4 -4
- package/dist/es2019/ui/DropList/index.js +3 -6
- package/dist/es2019/ui/Expand/index.js +1 -3
- package/dist/es2019/ui-menu/ToolbarButton/index.js +3 -0
- package/dist/es2019/ui-menu/ToolbarButton/styles.js +3 -0
- package/dist/es2019/utils/compareNodes.js +61 -47
- package/dist/es2019/version.json +1 -1
- package/dist/esm/i18n/en_ZZ.js +35 -2
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/styles/shared/table.js +4 -4
- package/dist/esm/ui/DropList/index.js +3 -6
- package/dist/esm/ui/Expand/index.js +1 -3
- package/dist/esm/ui-menu/ToolbarButton/index.js +3 -0
- package/dist/esm/ui-menu/ToolbarButton/styles.js +3 -0
- package/dist/esm/utils/compareNodes.js +65 -51
- package/dist/esm/version.json +1 -1
- package/dist/types/i18n/en_ZZ.d.ts +35 -2
- package/dist/types/types/feature-flags.d.ts +0 -11
- package/dist/types/utils/compareNodes.d.ts +3 -1
- package/dist/types-ts4.5/i18n/en_ZZ.d.ts +35 -2
- package/dist/types-ts4.5/types/feature-flags.d.ts +0 -11
- package/dist/types-ts4.5/utils/compareNodes.d.ts +3 -1
- package/package.json +7 -6
|
@@ -94,9 +94,7 @@ const containerStyles = styleProps => {
|
|
|
94
94
|
expanded,
|
|
95
95
|
focused
|
|
96
96
|
} = styleProps;
|
|
97
|
-
|
|
98
|
-
// Recommendation: Verify if this is intentional: 8 / 4 / 14 rem = 4.57px?
|
|
99
|
-
const marginTop = `${gridSize() / 2 / fontSize()}rem`;
|
|
97
|
+
const marginTop = "var(--ds-space-050, 0.25rem)";
|
|
100
98
|
const marginBottom = 0;
|
|
101
99
|
// Only only these margins if the expand isn't editable
|
|
102
100
|
// and is the root level expand.
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
// This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/index.tsx`
|
|
2
|
+
// If you make any change here, copy it to above file as well
|
|
3
|
+
// and notify about the change in #team-fc-editor-ai-dev channel.
|
|
1
4
|
/** @jsx jsx */
|
|
2
5
|
import React, { useCallback } from 'react';
|
|
3
6
|
import { css, jsx } from '@emotion/react';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
// This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/styles.tsx`
|
|
3
|
+
// If you make any change here, copy it to above file as well
|
|
4
|
+
// and notify about the change in #team-fc-editor-ai-dev channel.
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import Button from '@atlaskit/button/standard-button';
|
|
4
7
|
export default /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
@@ -12,46 +12,59 @@ function getLinkMark(node) {
|
|
|
12
12
|
const [linkMark] = node.marks.filter(mark => mark.type.name === 'link');
|
|
13
13
|
return linkMark || null;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
function parseLocaleNumber(stringNumber) {
|
|
18
|
-
if (stringNumber.trim() === '') {
|
|
15
|
+
function parseLocaleNumber(stringNumber, groupPattern, fractionPattern) {
|
|
16
|
+
if (!stringNumber.trim().length) {
|
|
19
17
|
return null;
|
|
20
18
|
}
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
const decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, '');
|
|
24
|
-
const maybeANumber = Number(stringNumber.replace(new RegExp('\\' + thousandSeparator, 'g'), '').replace(new RegExp('\\' + decimalSeparator), '.'));
|
|
25
|
-
const isANumber = !Number.isNaN(maybeANumber);
|
|
26
|
-
if (!isANumber) {
|
|
19
|
+
const maybeANumber = Number.parseFloat(stringNumber.replace(groupPattern, '').replace(fractionPattern, '.'));
|
|
20
|
+
if (Number.isNaN(maybeANumber)) {
|
|
27
21
|
return null;
|
|
28
22
|
}
|
|
29
23
|
return maybeANumber;
|
|
30
24
|
}
|
|
31
|
-
function
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
export function createNormalizeTextParser() {
|
|
26
|
+
// Source: https://stackoverflow.com/questions/12004808/does-javascript-take-local-decimal-separators-into-account
|
|
27
|
+
const locale = window.navigator.language;
|
|
28
|
+
const thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/\p{Number}/gu, '');
|
|
29
|
+
const decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/\p{Number}/gu, '');
|
|
30
|
+
const numericPattern = new RegExp(`(\\d+(?:[${thousandSeparator}${decimalSeparator}]?\\d+)*)`, 'g');
|
|
31
|
+
const thousandSeparatorPattern = new RegExp('\\' + thousandSeparator, 'g');
|
|
32
|
+
const decimalSeparatorPattern = new RegExp('\\' + decimalSeparator);
|
|
33
|
+
return text => {
|
|
34
|
+
if (!text.trim().length) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// This will break the text apart at the locations of the formatted numbers
|
|
39
|
+
const result = text.split(numericPattern);
|
|
40
|
+
|
|
41
|
+
// We then put the text back together but with all the formatted numbers converted back to plain numerals,
|
|
42
|
+
// for example a sentence like "What is 1,000.01% of 10,000.01" would be normalized and sorted as
|
|
43
|
+
// if it's saying "What is 1000.01% of 10000.01". This way the Intl.Collator can use the numeric setting to sort
|
|
44
|
+
// numeral values within string correctly.
|
|
45
|
+
const tokens = result.reduce((acc, stringNumber) => {
|
|
46
|
+
if (!(stringNumber !== null && stringNumber !== void 0 && stringNumber.length)) {
|
|
47
|
+
return acc;
|
|
48
|
+
}
|
|
49
|
+
const maybeANumber = parseLocaleNumber(stringNumber, thousandSeparatorPattern, decimalSeparatorPattern);
|
|
50
|
+
|
|
51
|
+
// NOTE: We know there can only be a single decimal separator. So we can assume that if the first found separator
|
|
52
|
+
// is not at the same position as the last found one, then we can assume the locale used to format the number
|
|
53
|
+
// is different to our locale. This will result in the value being treated as a string.
|
|
54
|
+
if (maybeANumber !== null && stringNumber.indexOf(decimalSeparator) === stringNumber.lastIndexOf(decimalSeparator)) {
|
|
55
|
+
acc.push(maybeANumber);
|
|
56
|
+
} else {
|
|
57
|
+
acc.push(stringNumber);
|
|
58
|
+
}
|
|
59
|
+
return acc;
|
|
60
|
+
}, []);
|
|
61
|
+
if (tokens.length === 1) {
|
|
62
|
+
return tokens[0];
|
|
63
|
+
}
|
|
64
|
+
return tokens.join('');
|
|
65
|
+
};
|
|
53
66
|
}
|
|
54
|
-
export function extractMetaFromTextNode(textNode) {
|
|
67
|
+
export function extractMetaFromTextNode(textNode, normalizeTextParser) {
|
|
55
68
|
// treat as a link if contain a link
|
|
56
69
|
const linkMark = getLinkMark(textNode);
|
|
57
70
|
if (linkMark) {
|
|
@@ -62,20 +75,19 @@ export function extractMetaFromTextNode(textNode) {
|
|
|
62
75
|
};
|
|
63
76
|
}
|
|
64
77
|
const text = textNode.text || '';
|
|
65
|
-
const
|
|
66
|
-
|
|
67
|
-
if (maybeANumber !== null) {
|
|
78
|
+
const normalizedText = normalizeTextParser(text);
|
|
79
|
+
if (typeof normalizedText === 'number') {
|
|
68
80
|
return {
|
|
69
81
|
type: ContentType.NUMBER,
|
|
70
|
-
value:
|
|
82
|
+
value: normalizedText
|
|
71
83
|
};
|
|
72
84
|
}
|
|
73
85
|
return {
|
|
74
86
|
type: ContentType.TEXT,
|
|
75
|
-
value:
|
|
87
|
+
value: normalizedText !== null && normalizedText !== void 0 ? normalizedText : text
|
|
76
88
|
};
|
|
77
89
|
}
|
|
78
|
-
function getMetaFromNode(node, options) {
|
|
90
|
+
function getMetaFromNode(node, options, normalizeTextParser) {
|
|
79
91
|
if (!node) {
|
|
80
92
|
return null;
|
|
81
93
|
}
|
|
@@ -88,12 +100,12 @@ function getMetaFromNode(node, options) {
|
|
|
88
100
|
/*
|
|
89
101
|
Get Meta value from the first child if the cell is of type
|
|
90
102
|
* Heading (Any cell where the text is set to a heading type)
|
|
91
|
-
* Paragraph (Normal text)
|
|
103
|
+
* Paragraph (Normal text)
|
|
92
104
|
*/
|
|
93
105
|
case 'heading':
|
|
94
106
|
case 'paragraph':
|
|
95
107
|
{
|
|
96
|
-
return getMetaFromNode(firstChild, options);
|
|
108
|
+
return getMetaFromNode(firstChild, options, normalizeTextParser);
|
|
97
109
|
}
|
|
98
110
|
case 'inlineCard':
|
|
99
111
|
{
|
|
@@ -113,7 +125,7 @@ function getMetaFromNode(node, options) {
|
|
|
113
125
|
}
|
|
114
126
|
case 'text':
|
|
115
127
|
{
|
|
116
|
-
return extractMetaFromTextNode(firstChild);
|
|
128
|
+
return extractMetaFromTextNode(firstChild, normalizeTextParser);
|
|
117
129
|
}
|
|
118
130
|
case 'status':
|
|
119
131
|
{
|
|
@@ -150,7 +162,8 @@ function compareValue(valueA, valueB) {
|
|
|
150
162
|
}
|
|
151
163
|
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
152
164
|
return valueA.localeCompare(valueB, window.navigator.language, {
|
|
153
|
-
caseFirst: 'upper'
|
|
165
|
+
caseFirst: 'upper',
|
|
166
|
+
numeric: true
|
|
154
167
|
});
|
|
155
168
|
}
|
|
156
169
|
return valueA > valueB ? 1 : -1;
|
|
@@ -181,11 +194,12 @@ function compareValue(valueA, valueB) {
|
|
|
181
194
|
* like a regular JS sort method.
|
|
182
195
|
*/
|
|
183
196
|
export const createCompareNodes = (options, order = SortOrder.ASC) => {
|
|
197
|
+
const normalizeTextParser = createNormalizeTextParser();
|
|
184
198
|
return (nodeA, nodeB) => {
|
|
185
|
-
const metaNodeA = getMetaFromNode(nodeA, options);
|
|
186
|
-
const metaNodeB = getMetaFromNode(nodeB, options);
|
|
187
|
-
/*
|
|
188
|
-
Donot switch the order (Asec or Desc) if either node is null.
|
|
199
|
+
const metaNodeA = getMetaFromNode(nodeA, options, normalizeTextParser);
|
|
200
|
+
const metaNodeB = getMetaFromNode(nodeB, options, normalizeTextParser);
|
|
201
|
+
/*
|
|
202
|
+
Donot switch the order (Asec or Desc) if either node is null.
|
|
189
203
|
This will ensure that empty cells are always at the bottom during sorting.
|
|
190
204
|
*/
|
|
191
205
|
if (metaNodeA === null || metaNodeB === null) {
|
package/dist/es2019/version.json
CHANGED
package/dist/esm/i18n/en_ZZ.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
export default {
|
|
10
10
|
'fabric.editor.action': 'Action item',
|
|
11
11
|
'fabric.editor.action.description': 'Create and assign action items',
|
|
12
|
+
'fabric.editor.addMediaFiles': 'Add image, video, or file',
|
|
12
13
|
'fabric.editor.alignImageCenter': 'Align center',
|
|
13
14
|
'fabric.editor.alignImageLeft': 'Align left',
|
|
14
15
|
'fabric.editor.alignImageRight': 'Align right',
|
|
@@ -18,6 +19,8 @@ export default {
|
|
|
18
19
|
'fabric.editor.codeBidiWarningLabel': 'Bidirectional characters change the order that text is rendered. This could be used to obscure malicious code.',
|
|
19
20
|
'fabric.editor.codeBlockCopyButton.copiedToClipboard': 'Copied!',
|
|
20
21
|
'fabric.editor.codeBlockCopyButton.copyToClipboard': 'Copy as text',
|
|
22
|
+
'fabric.editor.codeBlockWrapButton.unwrapCodeBlock': 'Turn off wrap',
|
|
23
|
+
'fabric.editor.codeBlockWrapButton.wrapCodeBlock': 'Turn on wrap',
|
|
21
24
|
'fabric.editor.collapseNode': 'Collapse content',
|
|
22
25
|
'fabric.editor.columns': 'Layouts',
|
|
23
26
|
'fabric.editor.columns.description': 'Structure your page using sections',
|
|
@@ -37,8 +40,6 @@ export default {
|
|
|
37
40
|
'fabric.editor.expandPlaceholder': 'Give this expand a title...',
|
|
38
41
|
'fabric.editor.feedbackDialog': 'Give feedback',
|
|
39
42
|
'fabric.editor.feedbackDialog.description': 'Tell us about your experience using the new editor',
|
|
40
|
-
'fabric.editor.filesAndImages': 'Files & images',
|
|
41
|
-
'fabric.editor.filesAndImages.description': 'Add images and other files to your page',
|
|
42
43
|
'fabric.editor.help': 'Help',
|
|
43
44
|
'fabric.editor.help.description': 'Browse all the keyboard shortcuts and markdown options',
|
|
44
45
|
'fabric.editor.horizontalRule': 'Divider',
|
|
@@ -50,6 +51,8 @@ export default {
|
|
|
50
51
|
'fabric.editor.layoutWide': 'Go wide',
|
|
51
52
|
'fabric.editor.link': 'Link',
|
|
52
53
|
'fabric.editor.link.description': 'Insert a link',
|
|
54
|
+
'fabric.editor.mediaFiles': 'Image, video, or file',
|
|
55
|
+
'fabric.editor.mediaFiles.description': 'Add images and other files to your page',
|
|
53
56
|
'fabric.editor.mention': 'Mention',
|
|
54
57
|
'fabric.editor.mention.description': 'Mention someone to send them a notification',
|
|
55
58
|
'fabric.editor.openLink': 'Open link in a new tab',
|
|
@@ -77,12 +80,32 @@ export default {
|
|
|
77
80
|
'fabric.editor.viewMore': 'View more',
|
|
78
81
|
'fabric.editor.visit': 'Open link in a new window',
|
|
79
82
|
'fabric.theme.blue': 'Blue',
|
|
83
|
+
'fabric.theme.bold-blue': 'Bold blue',
|
|
84
|
+
'fabric.theme.bold-gray': 'Bold gray',
|
|
85
|
+
'fabric.theme.bold-green': 'Bold green',
|
|
86
|
+
'fabric.theme.bold-magenta': 'Bold magenta',
|
|
87
|
+
'fabric.theme.bold-orange': 'Bold orange',
|
|
88
|
+
'fabric.theme.bold-purple': 'Bold purple',
|
|
89
|
+
'fabric.theme.bold-red': 'Bold red',
|
|
90
|
+
'fabric.theme.bold-teal': 'Bold teal',
|
|
91
|
+
'fabric.theme.bold-yellow': 'Bold yellow',
|
|
92
|
+
'fabric.theme.bolder-blue': 'Bolder blue',
|
|
93
|
+
'fabric.theme.bolder-gray': 'Bolder gray',
|
|
94
|
+
'fabric.theme.bolder-green': 'Bolder green',
|
|
95
|
+
'fabric.theme.bolder-magenta': 'Bolder magenta',
|
|
96
|
+
'fabric.theme.bolder-orange': 'Bolder orange',
|
|
97
|
+
'fabric.theme.bolder-purple': 'Bolder purple',
|
|
98
|
+
'fabric.theme.bolder-red': 'Bolder red',
|
|
99
|
+
'fabric.theme.bolder-teal': 'Bolder teal',
|
|
100
|
+
'fabric.theme.bolder-yellow': 'Bolder yellow',
|
|
80
101
|
'fabric.theme.dark-blue': 'Dark blue',
|
|
102
|
+
'fabric.theme.dark-gray': 'Dark gray',
|
|
81
103
|
'fabric.theme.dark-green': 'Dark green',
|
|
82
104
|
'fabric.theme.dark-purple': 'Dark purple',
|
|
83
105
|
'fabric.theme.dark-red': 'Dark red',
|
|
84
106
|
'fabric.theme.dark-teal': 'Dark teal',
|
|
85
107
|
'fabric.theme.dark-yellow': 'Dark yellow',
|
|
108
|
+
'fabric.theme.default': 'Default',
|
|
86
109
|
'fabric.theme.gray': 'Gray',
|
|
87
110
|
'fabric.theme.green': 'Green',
|
|
88
111
|
'fabric.theme.light-blue': 'Light blue',
|
|
@@ -92,9 +115,19 @@ export default {
|
|
|
92
115
|
'fabric.theme.light-red': 'Light red',
|
|
93
116
|
'fabric.theme.light-teal': 'Light teal',
|
|
94
117
|
'fabric.theme.light-yellow': 'Light yellow',
|
|
118
|
+
'fabric.theme.magenta': 'Magenta',
|
|
95
119
|
'fabric.theme.orange': 'Orange',
|
|
96
120
|
'fabric.theme.purple': 'Purple',
|
|
97
121
|
'fabric.theme.red': 'Red',
|
|
122
|
+
'fabric.theme.subtle-blue': 'Subtle blue',
|
|
123
|
+
'fabric.theme.subtle-gray': 'Subtle gray',
|
|
124
|
+
'fabric.theme.subtle-green': 'Subtle green',
|
|
125
|
+
'fabric.theme.subtle-magenta': 'Subtle magenta',
|
|
126
|
+
'fabric.theme.subtle-orange': 'Subtle orange',
|
|
127
|
+
'fabric.theme.subtle-purple': 'Subtle purple',
|
|
128
|
+
'fabric.theme.subtle-red': 'Subtle red',
|
|
129
|
+
'fabric.theme.subtle-teal': 'Subtle teal',
|
|
130
|
+
'fabric.theme.subtle-yellow': 'Subtle yellow',
|
|
98
131
|
'fabric.theme.teal': 'Teal',
|
|
99
132
|
'fabric.theme.white': 'White',
|
|
100
133
|
'fabric.theme.yellow': 'Yellow'
|
|
@@ -6,7 +6,7 @@ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (O
|
|
|
6
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
7
7
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
8
8
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
9
|
-
var packageVersion = "74.
|
|
9
|
+
var packageVersion = "74.3.0";
|
|
10
10
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
11
11
|
// Remove URL as it has UGC
|
|
12
12
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -38,11 +38,11 @@ export var TableSharedCssClassName = {
|
|
|
38
38
|
};
|
|
39
39
|
var tableSharedStyle = function tableSharedStyle(props) {
|
|
40
40
|
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n ", "\n .", " {\n position: relative;\n margin: 0 auto ", "px;\n box-sizing: border-box;\n\n /**\n * Fix block top alignment inside table cells.\n */\n .decisionItemView-content-wrap:first-of-type > div {\n margin-top: 0;\n }\n }\n .", "[data-number-column='true'] {\n padding-left: ", "px;\n clear: both;\n }\n .", " > table {\n margin: ", "px 0 0 0;\n }\n\n .", " > table,\n .", " > table {\n margin: ", "px ", "px 0 0;\n }\n\n /* avoid applying styles to nested tables (possible via extensions) */\n .", " > table,\n .", " > table,\n .", " > table {\n border-collapse: collapse;\n border: ", "px solid\n ", ";\n table-layout: fixed;\n font-size: 1em;\n width: 100%;\n\n &[data-autosize='true'] {\n table-layout: auto;\n }\n\n & {\n * {\n box-sizing: border-box;\n }\n hr {\n box-sizing: content-box;\n }\n\n tbody {\n border-bottom: none;\n }\n th td {\n background-color: ", ";\n }\n th,\n td {\n min-width: ", "px;\n font-weight: normal;\n vertical-align: top;\n border: 1px solid\n ", ";\n border-right-width: 0;\n border-bottom-width: 0;\n padding: ", "px;\n /* https://stackoverflow.com/questions/7517127/borders-not-shown-in-firefox-with-border-collapse-on-table-position-relative-o */\n ", "\n\n ", ";\n\n > :first-child:not(style),\n > style:first-child + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + *,\n > style:first-child + .ProseMirror-gapcursor + * {\n margin-top: 0;\n }\n\n > .ProseMirror-gapcursor:first-child + span + *,\n > style:first-child + .ProseMirror-gapcursor + span + * {\n margin-top: 0;\n }\n\n th p:not(:first-of-type),\n td p:not(:first-of-type) {\n margin-top: 12px;\n }\n }\n th {\n background-color: ", ";\n text-align: left;\n\n /* only apply this styling to codeblocks in default background headercells */\n /* TODO this needs to be overhauled as it relies on unsafe selectors */\n &:not([style]):not(.danger) {\n .", ":not(.danger) {\n background-color: ", ";\n\n :not(.", ") {\n box-shadow: 0px 0px 0px 1px\n ", ";\n }\n\n .", " {\n background-image: ", ";\n\n background-color: ", ";\n }\n\n .", " {\n background-color: ", ";\n }\n\n /* this is only relevant to the element taken care of by renderer */\n > [data-ds--code--code-block] {\n background-image: ", "!important;\n\n background-color: ", "!important;\n\n // selector lives inside @atlaskit/code\n --ds--code--line-number-bg-color: ", ";\n }\n }\n }\n }\n }\n }\n"])), tableCellBackgroundStyleOverride(), TableSharedCssClassName.TABLE_CONTAINER, tableMarginBottom, TableSharedCssClassName.TABLE_CONTAINER, akEditorTableNumberColumnWidth - 1, TableSharedCssClassName.TABLE_NODE_WRAPPER, tableMarginTop, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableMarginTop, tableMarginSides, TableSharedCssClassName.TABLE_CONTAINER, TableSharedCssClassName.TABLE_NODE_WRAPPER, TableSharedCssClassName.TABLE_STICKY_WRAPPER, tableCellBorderWidth, themed({
|
|
41
|
-
light: "var(--ds-
|
|
42
|
-
dark: "var(--ds-
|
|
41
|
+
light: "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"),
|
|
42
|
+
dark: "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorderDark, ")")
|
|
43
43
|
})(props), "var(--ds-background-neutral-subtle, white)", tableCellMinWidth, themed({
|
|
44
|
-
light: "var(--ds-
|
|
45
|
-
dark: "var(--ds-
|
|
44
|
+
light: "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorder, ")"),
|
|
45
|
+
dark: "var(--ds-background-accent-gray-subtler, ".concat(akEditorTableBorderDark, ")")
|
|
46
46
|
})(props), tableCellPadding, browser.gecko || browser.ie || browser.mac && browser.chrome ? 'background-clip: padding-box;' : '', themed({
|
|
47
47
|
dark: getTableCellBackgroundDarkModeColors
|
|
48
48
|
})(props), themed({
|
|
@@ -15,15 +15,12 @@ import { css, jsx } from '@emotion/react';
|
|
|
15
15
|
import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@atlaskit/analytics-next';
|
|
16
16
|
import { DN50, DN600, N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
17
17
|
import { themed } from '@atlaskit/theme/components';
|
|
18
|
-
|
|
19
|
-
import { borderRadius, gridSize } from '@atlaskit/theme/constants';
|
|
18
|
+
import { borderRadius } from '@atlaskit/theme/constants';
|
|
20
19
|
import Layer from '../Layer';
|
|
21
20
|
var packageName = "@atlaskit/editor-common";
|
|
22
|
-
var packageVersion = "74.
|
|
21
|
+
var packageVersion = "74.3.0";
|
|
23
22
|
var halfFocusRing = 1;
|
|
24
|
-
|
|
25
|
-
// Recommendation: Replace gridSize with token('space.100', '8px') after verfiying Popper can accept this
|
|
26
|
-
var dropOffset = "0, ".concat(gridSize(), "px");
|
|
23
|
+
var dropOffset = '0, 8';
|
|
27
24
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
28
25
|
_inherits(DropList, _Component);
|
|
29
26
|
var _super = _createSuper(DropList);
|
|
@@ -75,9 +75,7 @@ export var ExpandLayoutWrapperWithRef = /*#__PURE__*/forwardRef(function (props,
|
|
|
75
75
|
var containerStyles = function containerStyles(styleProps) {
|
|
76
76
|
var expanded = styleProps.expanded,
|
|
77
77
|
focused = styleProps.focused;
|
|
78
|
-
|
|
79
|
-
// Recommendation: Verify if this is intentional: 8 / 4 / 14 rem = 4.57px?
|
|
80
|
-
var marginTop = "".concat(gridSize() / 2 / fontSize(), "rem");
|
|
78
|
+
var marginTop = "var(--ds-space-050, 0.25rem)";
|
|
81
79
|
var marginBottom = 0;
|
|
82
80
|
// Only only these margins if the expand isn't editable
|
|
83
81
|
// and is the root level expand.
|
|
@@ -3,6 +3,9 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral
|
|
|
3
3
|
var _templateObject;
|
|
4
4
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
5
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
+
// This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/index.tsx`
|
|
7
|
+
// If you make any change here, copy it to above file as well
|
|
8
|
+
// and notify about the change in #team-fc-editor-ai-dev channel.
|
|
6
9
|
/** @jsx jsx */
|
|
7
10
|
import React, { useCallback } from 'react';
|
|
8
11
|
import { css, jsx } from '@emotion/react';
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/extends";
|
|
2
|
+
// This file is copied to `packages/editor/editor-plugin-ai/src/ui/components/AtlassianIntelligenceToolbarButton/ToolbarButton/styles.tsx`
|
|
3
|
+
// If you make any change here, copy it to above file as well
|
|
4
|
+
// and notify about the change in #team-fc-editor-ai-dev channel.
|
|
2
5
|
import React from 'react';
|
|
3
6
|
import Button from '@atlaskit/button/standard-button';
|
|
4
7
|
export default /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
@@ -17,46 +17,59 @@ function getLinkMark(node) {
|
|
|
17
17
|
linkMark = _node$marks$filter2[0];
|
|
18
18
|
return linkMark || null;
|
|
19
19
|
}
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
function parseLocaleNumber(stringNumber) {
|
|
23
|
-
if (stringNumber.trim() === '') {
|
|
20
|
+
function parseLocaleNumber(stringNumber, groupPattern, fractionPattern) {
|
|
21
|
+
if (!stringNumber.trim().length) {
|
|
24
22
|
return null;
|
|
25
23
|
}
|
|
26
|
-
var
|
|
27
|
-
|
|
28
|
-
var decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
29
|
-
var maybeANumber = Number(stringNumber.replace(new RegExp('\\' + thousandSeparator, 'g'), '').replace(new RegExp('\\' + decimalSeparator), '.'));
|
|
30
|
-
var isANumber = !Number.isNaN(maybeANumber);
|
|
31
|
-
if (!isANumber) {
|
|
24
|
+
var maybeANumber = Number.parseFloat(stringNumber.replace(groupPattern, '').replace(fractionPattern, '.'));
|
|
25
|
+
if (Number.isNaN(maybeANumber)) {
|
|
32
26
|
return null;
|
|
33
27
|
}
|
|
34
28
|
return maybeANumber;
|
|
35
29
|
}
|
|
36
|
-
function
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
30
|
+
export function createNormalizeTextParser() {
|
|
31
|
+
// Source: https://stackoverflow.com/questions/12004808/does-javascript-take-local-decimal-separators-into-account
|
|
32
|
+
var locale = window.navigator.language;
|
|
33
|
+
var thousandSeparator = Intl.NumberFormat(locale).format(11111).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
34
|
+
var decimalSeparator = Intl.NumberFormat(locale).format(1.1).replace(/(?:[0-9\xB2\xB3\xB9\xBC-\xBE\u0660-\u0669\u06F0-\u06F9\u07C0-\u07C9\u0966-\u096F\u09E6-\u09EF\u09F4-\u09F9\u0A66-\u0A6F\u0AE6-\u0AEF\u0B66-\u0B6F\u0B72-\u0B77\u0BE6-\u0BF2\u0C66-\u0C6F\u0C78-\u0C7E\u0CE6-\u0CEF\u0D58-\u0D5E\u0D66-\u0D78\u0DE6-\u0DEF\u0E50-\u0E59\u0ED0-\u0ED9\u0F20-\u0F33\u1040-\u1049\u1090-\u1099\u1369-\u137C\u16EE-\u16F0\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1946-\u194F\u19D0-\u19DA\u1A80-\u1A89\u1A90-\u1A99\u1B50-\u1B59\u1BB0-\u1BB9\u1C40-\u1C49\u1C50-\u1C59\u2070\u2074-\u2079\u2080-\u2089\u2150-\u2182\u2185-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2CFD\u3007\u3021-\u3029\u3038-\u303A\u3192-\u3195\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\uA620-\uA629\uA6E6-\uA6EF\uA830-\uA835\uA8D0-\uA8D9\uA900-\uA909\uA9D0-\uA9D9\uA9F0-\uA9F9\uAA50-\uAA59\uABF0-\uABF9\uFF10-\uFF19]|\uD800[\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDEE1-\uDEFB\uDF20-\uDF23\uDF41\uDF4A\uDFD1-\uDFD5]|\uD801[\uDCA0-\uDCA9]|\uD802[\uDC58-\uDC5F\uDC79-\uDC7F\uDCA7-\uDCAF\uDCFB-\uDCFF\uDD16-\uDD1B\uDDBC\uDDBD\uDDC0-\uDDCF\uDDD2-\uDDFF\uDE40-\uDE48\uDE7D\uDE7E\uDE9D-\uDE9F\uDEEB-\uDEEF\uDF58-\uDF5F\uDF78-\uDF7F\uDFA9-\uDFAF]|\uD803[\uDCFA-\uDCFF\uDD30-\uDD39\uDE60-\uDE7E\uDF1D-\uDF26\uDF51-\uDF54\uDFC5-\uDFCB]|\uD804[\uDC52-\uDC6F\uDCF0-\uDCF9\uDD36-\uDD3F\uDDD0-\uDDD9\uDDE1-\uDDF4\uDEF0-\uDEF9]|\uD805[\uDC50-\uDC59\uDCD0-\uDCD9\uDE50-\uDE59\uDEC0-\uDEC9\uDF30-\uDF3B]|\uD806[\uDCE0-\uDCF2\uDD50-\uDD59]|\uD807[\uDC50-\uDC6C\uDD50-\uDD59\uDDA0-\uDDA9\uDF50-\uDF59\uDFC0-\uDFD4]|\uD809[\uDC00-\uDC6E]|\uD81A[\uDE60-\uDE69\uDEC0-\uDEC9\uDF50-\uDF59\uDF5B-\uDF61]|\uD81B[\uDE80-\uDE96]|\uD834[\uDEC0-\uDED3\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDFCE-\uDFFF]|\uD838[\uDD40-\uDD49\uDEF0-\uDEF9]|\uD839[\uDCF0-\uDCF9]|\uD83A[\uDCC7-\uDCCF\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9])/g, '');
|
|
35
|
+
var numericPattern = new RegExp("(\\d+(?:[".concat(thousandSeparator).concat(decimalSeparator, "]?\\d+)*)"), 'g');
|
|
36
|
+
var thousandSeparatorPattern = new RegExp('\\' + thousandSeparator, 'g');
|
|
37
|
+
var decimalSeparatorPattern = new RegExp('\\' + decimalSeparator);
|
|
38
|
+
return function (text) {
|
|
39
|
+
if (!text.trim().length) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// This will break the text apart at the locations of the formatted numbers
|
|
44
|
+
var result = text.split(numericPattern);
|
|
45
|
+
|
|
46
|
+
// We then put the text back together but with all the formatted numbers converted back to plain numerals,
|
|
47
|
+
// for example a sentence like "What is 1,000.01% of 10,000.01" would be normalized and sorted as
|
|
48
|
+
// if it's saying "What is 1000.01% of 10000.01". This way the Intl.Collator can use the numeric setting to sort
|
|
49
|
+
// numeral values within string correctly.
|
|
50
|
+
var tokens = result.reduce(function (acc, stringNumber) {
|
|
51
|
+
if (!(stringNumber !== null && stringNumber !== void 0 && stringNumber.length)) {
|
|
52
|
+
return acc;
|
|
53
|
+
}
|
|
54
|
+
var maybeANumber = parseLocaleNumber(stringNumber, thousandSeparatorPattern, decimalSeparatorPattern);
|
|
55
|
+
|
|
56
|
+
// NOTE: We know there can only be a single decimal separator. So we can assume that if the first found separator
|
|
57
|
+
// is not at the same position as the last found one, then we can assume the locale used to format the number
|
|
58
|
+
// is different to our locale. This will result in the value being treated as a string.
|
|
59
|
+
if (maybeANumber !== null && stringNumber.indexOf(decimalSeparator) === stringNumber.lastIndexOf(decimalSeparator)) {
|
|
60
|
+
acc.push(maybeANumber);
|
|
61
|
+
} else {
|
|
62
|
+
acc.push(stringNumber);
|
|
63
|
+
}
|
|
64
|
+
return acc;
|
|
65
|
+
}, []);
|
|
66
|
+
if (tokens.length === 1) {
|
|
67
|
+
return tokens[0];
|
|
68
|
+
}
|
|
69
|
+
return tokens.join('');
|
|
70
|
+
};
|
|
58
71
|
}
|
|
59
|
-
export function extractMetaFromTextNode(textNode) {
|
|
72
|
+
export function extractMetaFromTextNode(textNode, normalizeTextParser) {
|
|
60
73
|
// treat as a link if contain a link
|
|
61
74
|
var linkMark = getLinkMark(textNode);
|
|
62
75
|
if (linkMark) {
|
|
@@ -67,20 +80,19 @@ export function extractMetaFromTextNode(textNode) {
|
|
|
67
80
|
};
|
|
68
81
|
}
|
|
69
82
|
var text = textNode.text || '';
|
|
70
|
-
var
|
|
71
|
-
|
|
72
|
-
if (maybeANumber !== null) {
|
|
83
|
+
var normalizedText = normalizeTextParser(text);
|
|
84
|
+
if (typeof normalizedText === 'number') {
|
|
73
85
|
return {
|
|
74
86
|
type: ContentType.NUMBER,
|
|
75
|
-
value:
|
|
87
|
+
value: normalizedText
|
|
76
88
|
};
|
|
77
89
|
}
|
|
78
90
|
return {
|
|
79
91
|
type: ContentType.TEXT,
|
|
80
|
-
value:
|
|
92
|
+
value: normalizedText !== null && normalizedText !== void 0 ? normalizedText : text
|
|
81
93
|
};
|
|
82
94
|
}
|
|
83
|
-
function getMetaFromNode(node, options) {
|
|
95
|
+
function getMetaFromNode(node, options, normalizeTextParser) {
|
|
84
96
|
if (!node) {
|
|
85
97
|
return null;
|
|
86
98
|
}
|
|
@@ -93,12 +105,12 @@ function getMetaFromNode(node, options) {
|
|
|
93
105
|
/*
|
|
94
106
|
Get Meta value from the first child if the cell is of type
|
|
95
107
|
* Heading (Any cell where the text is set to a heading type)
|
|
96
|
-
* Paragraph (Normal text)
|
|
108
|
+
* Paragraph (Normal text)
|
|
97
109
|
*/
|
|
98
110
|
case 'heading':
|
|
99
111
|
case 'paragraph':
|
|
100
112
|
{
|
|
101
|
-
return getMetaFromNode(firstChild, options);
|
|
113
|
+
return getMetaFromNode(firstChild, options, normalizeTextParser);
|
|
102
114
|
}
|
|
103
115
|
case 'inlineCard':
|
|
104
116
|
{
|
|
@@ -118,14 +130,14 @@ function getMetaFromNode(node, options) {
|
|
|
118
130
|
}
|
|
119
131
|
case 'text':
|
|
120
132
|
{
|
|
121
|
-
return extractMetaFromTextNode(firstChild);
|
|
133
|
+
return extractMetaFromTextNode(firstChild, normalizeTextParser);
|
|
122
134
|
}
|
|
123
135
|
case 'status':
|
|
124
136
|
{
|
|
125
|
-
var
|
|
137
|
+
var _text = firstChild.attrs.text;
|
|
126
138
|
return {
|
|
127
139
|
type: ContentType.STATUS,
|
|
128
|
-
value:
|
|
140
|
+
value: _text
|
|
129
141
|
};
|
|
130
142
|
}
|
|
131
143
|
case 'date':
|
|
@@ -139,10 +151,10 @@ function getMetaFromNode(node, options) {
|
|
|
139
151
|
case 'mention':
|
|
140
152
|
{
|
|
141
153
|
// TODO: Check what should be the fallback when mention does not have a text
|
|
142
|
-
var
|
|
154
|
+
var _text2 = firstChild.attrs.text || '';
|
|
143
155
|
return {
|
|
144
156
|
type: ContentType.MENTION,
|
|
145
|
-
value:
|
|
157
|
+
value: _text2.toLowerCase()
|
|
146
158
|
};
|
|
147
159
|
}
|
|
148
160
|
default:
|
|
@@ -155,7 +167,8 @@ function compareValue(valueA, valueB) {
|
|
|
155
167
|
}
|
|
156
168
|
if (typeof valueA === 'string' && typeof valueB === 'string') {
|
|
157
169
|
return valueA.localeCompare(valueB, window.navigator.language, {
|
|
158
|
-
caseFirst: 'upper'
|
|
170
|
+
caseFirst: 'upper',
|
|
171
|
+
numeric: true
|
|
159
172
|
});
|
|
160
173
|
}
|
|
161
174
|
return valueA > valueB ? 1 : -1;
|
|
@@ -187,11 +200,12 @@ function compareValue(valueA, valueB) {
|
|
|
187
200
|
*/
|
|
188
201
|
export var createCompareNodes = function createCompareNodes(options) {
|
|
189
202
|
var order = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : SortOrder.ASC;
|
|
203
|
+
var normalizeTextParser = createNormalizeTextParser();
|
|
190
204
|
return function (nodeA, nodeB) {
|
|
191
|
-
var metaNodeA = getMetaFromNode(nodeA, options);
|
|
192
|
-
var metaNodeB = getMetaFromNode(nodeB, options);
|
|
193
|
-
/*
|
|
194
|
-
Donot switch the order (Asec or Desc) if either node is null.
|
|
205
|
+
var metaNodeA = getMetaFromNode(nodeA, options, normalizeTextParser);
|
|
206
|
+
var metaNodeB = getMetaFromNode(nodeB, options, normalizeTextParser);
|
|
207
|
+
/*
|
|
208
|
+
Donot switch the order (Asec or Desc) if either node is null.
|
|
195
209
|
This will ensure that empty cells are always at the bottom during sorting.
|
|
196
210
|
*/
|
|
197
211
|
if (metaNodeA === null || metaNodeB === null) {
|
package/dist/esm/version.json
CHANGED