@atlaskit/editor-common 116.23.0 → 116.23.2
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 +16 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/core-plugin/index.js +14 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/utils.js +60 -2
- package/dist/cjs/ui-color/index.js +6 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/core-plugin/index.js +14 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/utils.js +44 -1
- package/dist/es2019/ui-color/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/core-plugin/index.js +14 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/utils.js +58 -1
- package/dist/esm/ui-color/index.js +1 -1
- package/dist/types/ui-color/ColorPalette/utils.d.ts +1 -0
- package/dist/types/ui-color/index.d.ts +1 -1
- package/package.json +11 -17
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 116.23.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`d76b4661858ee`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/d76b4661858ee) -
|
|
8
|
+
Fix scrollToPos scrolling to scroll to the correct parent element instead of the editor root
|
|
9
|
+
- Updated dependencies
|
|
10
|
+
|
|
11
|
+
## 116.23.1
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [`74b3e15fed77e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/74b3e15fed77e) -
|
|
16
|
+
Check editor text and highlight color accessibility against both light and dark theme variants.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 116.23.0
|
|
4
20
|
|
|
5
21
|
### Minor Changes
|
|
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
28
28
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
29
29
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
30
30
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
31
|
-
var packageVersion = "116.23.
|
|
31
|
+
var packageVersion = "116.23.1";
|
|
32
32
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
33
33
|
// Remove URL as it has UGC
|
|
34
34
|
// Ignored via go/ees007
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.corePlugin = void 0;
|
|
7
7
|
var _model = require("@atlaskit/editor-prosemirror/model");
|
|
8
|
+
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
9
10
|
var _nodeAnchorProvider = require("../../node-anchor/node-anchor-provider");
|
|
10
11
|
var _processRawFragmentValue = require("../../utils/processRawFragmentValue");
|
|
@@ -86,6 +87,19 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
|
|
|
86
87
|
if (!isValidPos) {
|
|
87
88
|
return false;
|
|
88
89
|
}
|
|
90
|
+
if ((0, _platformFeatureFlags.fg)('platform_editor_fix_scroll_to_pos')) {
|
|
91
|
+
var _ref2, _editorView$domAtPos;
|
|
92
|
+
// nodeDOM can return a Text node for inline positions
|
|
93
|
+
var nodeDom = editorView.nodeDOM(pos);
|
|
94
|
+
var _dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
95
|
+
if (!(_dom instanceof Element)) {
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
_dom.scrollIntoView(scrollOptions);
|
|
99
|
+
return true;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Legacy path — domAtPos interprets block boundaries as the parent container
|
|
89
103
|
var dom = editorView.domAtPos(pos).node;
|
|
90
104
|
if (!(dom instanceof Element)) {
|
|
91
105
|
// If it's not an element (e.g. #text node), we'll try the parent.
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "116.23.
|
|
27
|
+
var packageVersion = "116.23.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
@@ -12,13 +13,57 @@ Object.defineProperty(exports, "getSelectedRowAndColumn", {
|
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
15
|
exports.getSelectedRowAndColumnFromPalette = getSelectedRowAndColumnFromPalette;
|
|
15
|
-
exports.getTokenCSSVariableValue = void 0;
|
|
16
|
+
exports.getTokenCSSVariableValueForNonActiveTheme = exports.getTokenCSSVariableValue = void 0;
|
|
17
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
18
|
+
var _palettesRaw = _interopRequireDefault(require("@atlaskit/tokens/palettes-raw"));
|
|
19
|
+
var _tokenNames = _interopRequireDefault(require("@atlaskit/tokens/token-names"));
|
|
20
|
+
var _tokensRaw = require("@atlaskit/tokens/tokens-raw");
|
|
16
21
|
var _getSelectedRowAndColumn = require("./getSelectedRowAndColumn");
|
|
17
22
|
var DEFAULT_COLOR_PICKER_COLUMNS = exports.DEFAULT_COLOR_PICKER_COLUMNS = 7;
|
|
18
|
-
|
|
19
23
|
// Ignored via go/ees005
|
|
20
24
|
// eslint-disable-next-line require-unicode-regexp
|
|
21
25
|
var CSS_VAR_EXPRESSION_REGEX = /var\(([^,\)]+)(,.*)?\)/;
|
|
26
|
+
var getCSSVariableParts = function getCSSVariableParts(variableExpression) {
|
|
27
|
+
var matcher = variableExpression.match(CSS_VAR_EXPRESSION_REGEX);
|
|
28
|
+
if (!matcher) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
fallback: matcher[2] ? matcher[2].replace(',', '').trim() : '',
|
|
33
|
+
variable: matcher[1].trim()
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// Build the reverse lookup (CSS variable -> token name) once at module load so that
|
|
38
|
+
// each lookup is O(1) instead of O(n) with an extra array allocation per call.
|
|
39
|
+
var cssVariableToTokenName = new Map(Object.entries(_tokenNames.default).map(function (_ref) {
|
|
40
|
+
var _ref2 = (0, _slicedToArray2.default)(_ref, 2),
|
|
41
|
+
tokenName = _ref2[0],
|
|
42
|
+
cssVariable = _ref2[1];
|
|
43
|
+
return [cssVariable, tokenName];
|
|
44
|
+
}));
|
|
45
|
+
var getTokenName = function getTokenName(cssVariable) {
|
|
46
|
+
return cssVariableToTokenName.get(cssVariable);
|
|
47
|
+
};
|
|
48
|
+
var resolveRawTokenValue = function resolveRawTokenValue(value) {
|
|
49
|
+
var _paletteRaw$find;
|
|
50
|
+
if (typeof value !== 'string') {
|
|
51
|
+
return undefined;
|
|
52
|
+
}
|
|
53
|
+
var paletteValue = (_paletteRaw$find = _palettesRaw.default.find(function (paletteToken) {
|
|
54
|
+
return paletteToken.path[paletteToken.path.length - 1] === value;
|
|
55
|
+
})) === null || _paletteRaw$find === void 0 ? void 0 : _paletteRaw$find.value;
|
|
56
|
+
return typeof paletteValue === 'string' ? paletteValue : value;
|
|
57
|
+
};
|
|
58
|
+
var getCurrentThemeMode = function getCurrentThemeMode() {
|
|
59
|
+
if (typeof document === 'undefined') {
|
|
60
|
+
return 'light';
|
|
61
|
+
}
|
|
62
|
+
return document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light';
|
|
63
|
+
};
|
|
64
|
+
var getNonActiveThemeMode = function getNonActiveThemeMode() {
|
|
65
|
+
return getCurrentThemeMode() === 'dark' ? 'light' : 'dark';
|
|
66
|
+
};
|
|
22
67
|
|
|
23
68
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
24
69
|
function getColorsPerRowFromPalette(palette) {
|
|
@@ -52,4 +97,17 @@ var getTokenCSSVariableValue = exports.getTokenCSSVariableValue = function getTo
|
|
|
52
97
|
}
|
|
53
98
|
return '';
|
|
54
99
|
};
|
|
100
|
+
|
|
101
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
102
|
+
var getTokenCSSVariableValueForNonActiveTheme = exports.getTokenCSSVariableValueForNonActiveTheme = function getTokenCSSVariableValueForNonActiveTheme(variableExpression, fallback) {
|
|
103
|
+
var cssVariableParts = getCSSVariableParts(variableExpression);
|
|
104
|
+
var tokenName = cssVariableParts ? getTokenName(cssVariableParts.variable) : undefined;
|
|
105
|
+
var rawToken = (getNonActiveThemeMode() === 'light' ? _tokensRaw.light : _tokensRaw.dark).find(function (token) {
|
|
106
|
+
return token.cleanName === tokenName;
|
|
107
|
+
});
|
|
108
|
+
if (rawToken) {
|
|
109
|
+
return resolveRawTokenValue(rawToken.value) || fallback;
|
|
110
|
+
}
|
|
111
|
+
return (cssVariableParts === null || cssVariableParts === void 0 ? void 0 : cssVariableParts.fallback) || fallback;
|
|
112
|
+
};
|
|
55
113
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
@@ -100,6 +100,12 @@ Object.defineProperty(exports, "getTokenCSSVariableValue", {
|
|
|
100
100
|
return _utils.getTokenCSSVariableValue;
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
+
Object.defineProperty(exports, "getTokenCSSVariableValueForNonActiveTheme", {
|
|
104
|
+
enumerable: true,
|
|
105
|
+
get: function get() {
|
|
106
|
+
return _utils.getTokenCSSVariableValueForNonActiveTheme;
|
|
107
|
+
}
|
|
108
|
+
});
|
|
103
109
|
Object.defineProperty(exports, "highlightColorPalette", {
|
|
104
110
|
enumerable: true,
|
|
105
111
|
get: function get() {
|
|
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
14
14
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
15
15
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
16
16
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
17
|
-
const packageVersion = "116.23.
|
|
17
|
+
const packageVersion = "116.23.1";
|
|
18
18
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
19
19
|
// Remove URL as it has UGC
|
|
20
20
|
// Ignored via go/ees007
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
|
|
4
5
|
import { processRawFragmentValue } from '../../utils/processRawFragmentValue';
|
|
@@ -82,6 +83,19 @@ export const corePlugin = ({
|
|
|
82
83
|
if (!isValidPos) {
|
|
83
84
|
return false;
|
|
84
85
|
}
|
|
86
|
+
if (fg('platform_editor_fix_scroll_to_pos')) {
|
|
87
|
+
var _ref, _editorView$domAtPos;
|
|
88
|
+
// nodeDOM can return a Text node for inline positions
|
|
89
|
+
const nodeDom = editorView.nodeDOM(pos);
|
|
90
|
+
const dom = (_ref = nodeDom instanceof Element ? nodeDom : null) !== null && _ref !== void 0 ? _ref : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
91
|
+
if (!(dom instanceof Element)) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
dom.scrollIntoView(scrollOptions);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Legacy path — domAtPos interprets block boundaries as the parent container
|
|
85
99
|
const dom = editorView.domAtPos(pos).node;
|
|
86
100
|
if (!(dom instanceof Element)) {
|
|
87
101
|
// If it's not an element (e.g. #text node), we'll try the parent.
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "116.23.
|
|
17
|
+
const packageVersion = "116.23.1";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -1,9 +1,41 @@
|
|
|
1
|
+
import paletteRaw from '@atlaskit/tokens/palettes-raw';
|
|
2
|
+
import tokenNames from '@atlaskit/tokens/token-names';
|
|
3
|
+
import { dark as darkTokensRaw, light as lightTokensRaw } from '@atlaskit/tokens/tokens-raw';
|
|
1
4
|
import { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
|
|
2
5
|
export const DEFAULT_COLOR_PICKER_COLUMNS = 7;
|
|
3
|
-
|
|
4
6
|
// Ignored via go/ees005
|
|
5
7
|
// eslint-disable-next-line require-unicode-regexp
|
|
6
8
|
const CSS_VAR_EXPRESSION_REGEX = /var\(([^,\)]+)(,.*)?\)/;
|
|
9
|
+
const getCSSVariableParts = variableExpression => {
|
|
10
|
+
const matcher = variableExpression.match(CSS_VAR_EXPRESSION_REGEX);
|
|
11
|
+
if (!matcher) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return {
|
|
15
|
+
fallback: matcher[2] ? matcher[2].replace(',', '').trim() : '',
|
|
16
|
+
variable: matcher[1].trim()
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
// Build the reverse lookup (CSS variable -> token name) once at module load so that
|
|
21
|
+
// each lookup is O(1) instead of O(n) with an extra array allocation per call.
|
|
22
|
+
const cssVariableToTokenName = new Map(Object.entries(tokenNames).map(([tokenName, cssVariable]) => [cssVariable, tokenName]));
|
|
23
|
+
const getTokenName = cssVariable => cssVariableToTokenName.get(cssVariable);
|
|
24
|
+
const resolveRawTokenValue = value => {
|
|
25
|
+
var _paletteRaw$find;
|
|
26
|
+
if (typeof value !== 'string') {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const paletteValue = (_paletteRaw$find = paletteRaw.find(paletteToken => paletteToken.path[paletteToken.path.length - 1] === value)) === null || _paletteRaw$find === void 0 ? void 0 : _paletteRaw$find.value;
|
|
30
|
+
return typeof paletteValue === 'string' ? paletteValue : value;
|
|
31
|
+
};
|
|
32
|
+
const getCurrentThemeMode = () => {
|
|
33
|
+
if (typeof document === 'undefined') {
|
|
34
|
+
return 'light';
|
|
35
|
+
}
|
|
36
|
+
return document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light';
|
|
37
|
+
};
|
|
38
|
+
const getNonActiveThemeMode = () => getCurrentThemeMode() === 'dark' ? 'light' : 'dark';
|
|
7
39
|
|
|
8
40
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
41
|
export function getColorsPerRowFromPalette(palette, cols = DEFAULT_COLOR_PICKER_COLUMNS) {
|
|
@@ -35,5 +67,16 @@ export const getTokenCSSVariableValue = variableExpression => {
|
|
|
35
67
|
}
|
|
36
68
|
return '';
|
|
37
69
|
};
|
|
70
|
+
|
|
71
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
72
|
+
export const getTokenCSSVariableValueForNonActiveTheme = (variableExpression, fallback) => {
|
|
73
|
+
const cssVariableParts = getCSSVariableParts(variableExpression);
|
|
74
|
+
const tokenName = cssVariableParts ? getTokenName(cssVariableParts.variable) : undefined;
|
|
75
|
+
const rawToken = (getNonActiveThemeMode() === 'light' ? lightTokensRaw : darkTokensRaw).find(token => token.cleanName === tokenName);
|
|
76
|
+
if (rawToken) {
|
|
77
|
+
return resolveRawTokenValue(rawToken.value) || fallback;
|
|
78
|
+
}
|
|
79
|
+
return (cssVariableParts === null || cssVariableParts === void 0 ? void 0 : cssVariableParts.fallback) || fallback;
|
|
80
|
+
};
|
|
38
81
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
39
82
|
export { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
|
|
@@ -6,7 +6,7 @@ export { default as Color } from './ColorPalette/Color';
|
|
|
6
6
|
export { SelectedTextColorProvider } from './ColorPalette/SelectedTextColorProvider';
|
|
7
7
|
export { useSelectedTextColor } from './ColorPalette/useSelectedTextColor';
|
|
8
8
|
export { getSelectedRowAndColumn } from './ColorPalette/getSelectedRowAndColumn';
|
|
9
|
-
export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue } from './ColorPalette/utils';
|
|
9
|
+
export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, getTokenCSSVariableValueForNonActiveTheme } from './ColorPalette/utils';
|
|
10
10
|
export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
|
|
11
11
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
12
12
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
20
20
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
21
21
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
22
22
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
23
|
-
var packageVersion = "116.23.
|
|
23
|
+
var packageVersion = "116.23.1";
|
|
24
24
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
25
25
|
// Remove URL as it has UGC
|
|
26
26
|
// Ignored via go/ees007
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
import { getNodeIdProvider } from '../../node-anchor/node-anchor-provider';
|
|
4
5
|
import { processRawFragmentValue } from '../../utils/processRawFragmentValue';
|
|
@@ -81,6 +82,19 @@ export var corePlugin = function corePlugin(_ref) {
|
|
|
81
82
|
if (!isValidPos) {
|
|
82
83
|
return false;
|
|
83
84
|
}
|
|
85
|
+
if (fg('platform_editor_fix_scroll_to_pos')) {
|
|
86
|
+
var _ref2, _editorView$domAtPos;
|
|
87
|
+
// nodeDOM can return a Text node for inline positions
|
|
88
|
+
var nodeDom = editorView.nodeDOM(pos);
|
|
89
|
+
var _dom = (_ref2 = nodeDom instanceof Element ? nodeDom : null) !== null && _ref2 !== void 0 ? _ref2 : (_editorView$domAtPos = editorView.domAtPos(pos)) === null || _editorView$domAtPos === void 0 ? void 0 : _editorView$domAtPos.node;
|
|
90
|
+
if (!(_dom instanceof Element)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
_dom.scrollIntoView(scrollOptions);
|
|
94
|
+
return true;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Legacy path — domAtPos interprets block boundaries as the parent container
|
|
84
98
|
var dom = editorView.domAtPos(pos).node;
|
|
85
99
|
if (!(dom instanceof Element)) {
|
|
86
100
|
// If it's not an element (e.g. #text node), we'll try the parent.
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "116.23.
|
|
24
|
+
var packageVersion = "116.23.1";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,9 +1,53 @@
|
|
|
1
|
+
import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
|
|
2
|
+
import paletteRaw from '@atlaskit/tokens/palettes-raw';
|
|
3
|
+
import tokenNames from '@atlaskit/tokens/token-names';
|
|
4
|
+
import { dark as darkTokensRaw, light as lightTokensRaw } from '@atlaskit/tokens/tokens-raw';
|
|
1
5
|
import { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
|
|
2
6
|
export var DEFAULT_COLOR_PICKER_COLUMNS = 7;
|
|
3
|
-
|
|
4
7
|
// Ignored via go/ees005
|
|
5
8
|
// eslint-disable-next-line require-unicode-regexp
|
|
6
9
|
var CSS_VAR_EXPRESSION_REGEX = /var\(([^,\)]+)(,.*)?\)/;
|
|
10
|
+
var getCSSVariableParts = function getCSSVariableParts(variableExpression) {
|
|
11
|
+
var matcher = variableExpression.match(CSS_VAR_EXPRESSION_REGEX);
|
|
12
|
+
if (!matcher) {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
fallback: matcher[2] ? matcher[2].replace(',', '').trim() : '',
|
|
17
|
+
variable: matcher[1].trim()
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
// Build the reverse lookup (CSS variable -> token name) once at module load so that
|
|
22
|
+
// each lookup is O(1) instead of O(n) with an extra array allocation per call.
|
|
23
|
+
var cssVariableToTokenName = new Map(Object.entries(tokenNames).map(function (_ref) {
|
|
24
|
+
var _ref2 = _slicedToArray(_ref, 2),
|
|
25
|
+
tokenName = _ref2[0],
|
|
26
|
+
cssVariable = _ref2[1];
|
|
27
|
+
return [cssVariable, tokenName];
|
|
28
|
+
}));
|
|
29
|
+
var getTokenName = function getTokenName(cssVariable) {
|
|
30
|
+
return cssVariableToTokenName.get(cssVariable);
|
|
31
|
+
};
|
|
32
|
+
var resolveRawTokenValue = function resolveRawTokenValue(value) {
|
|
33
|
+
var _paletteRaw$find;
|
|
34
|
+
if (typeof value !== 'string') {
|
|
35
|
+
return undefined;
|
|
36
|
+
}
|
|
37
|
+
var paletteValue = (_paletteRaw$find = paletteRaw.find(function (paletteToken) {
|
|
38
|
+
return paletteToken.path[paletteToken.path.length - 1] === value;
|
|
39
|
+
})) === null || _paletteRaw$find === void 0 ? void 0 : _paletteRaw$find.value;
|
|
40
|
+
return typeof paletteValue === 'string' ? paletteValue : value;
|
|
41
|
+
};
|
|
42
|
+
var getCurrentThemeMode = function getCurrentThemeMode() {
|
|
43
|
+
if (typeof document === 'undefined') {
|
|
44
|
+
return 'light';
|
|
45
|
+
}
|
|
46
|
+
return document.documentElement.getAttribute('data-color-mode') === 'dark' ? 'dark' : 'light';
|
|
47
|
+
};
|
|
48
|
+
var getNonActiveThemeMode = function getNonActiveThemeMode() {
|
|
49
|
+
return getCurrentThemeMode() === 'dark' ? 'light' : 'dark';
|
|
50
|
+
};
|
|
7
51
|
|
|
8
52
|
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
9
53
|
export function getColorsPerRowFromPalette(palette) {
|
|
@@ -37,5 +81,18 @@ export var getTokenCSSVariableValue = function getTokenCSSVariableValue(variable
|
|
|
37
81
|
}
|
|
38
82
|
return '';
|
|
39
83
|
};
|
|
84
|
+
|
|
85
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
86
|
+
export var getTokenCSSVariableValueForNonActiveTheme = function getTokenCSSVariableValueForNonActiveTheme(variableExpression, fallback) {
|
|
87
|
+
var cssVariableParts = getCSSVariableParts(variableExpression);
|
|
88
|
+
var tokenName = cssVariableParts ? getTokenName(cssVariableParts.variable) : undefined;
|
|
89
|
+
var rawToken = (getNonActiveThemeMode() === 'light' ? lightTokensRaw : darkTokensRaw).find(function (token) {
|
|
90
|
+
return token.cleanName === tokenName;
|
|
91
|
+
});
|
|
92
|
+
if (rawToken) {
|
|
93
|
+
return resolveRawTokenValue(rawToken.value) || fallback;
|
|
94
|
+
}
|
|
95
|
+
return (cssVariableParts === null || cssVariableParts === void 0 ? void 0 : cssVariableParts.fallback) || fallback;
|
|
96
|
+
};
|
|
40
97
|
// eslint-disable-next-line @atlaskit/editor/no-re-export
|
|
41
98
|
export { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
|
|
@@ -6,7 +6,7 @@ export { default as Color } from './ColorPalette/Color';
|
|
|
6
6
|
export { SelectedTextColorProvider } from './ColorPalette/SelectedTextColorProvider';
|
|
7
7
|
export { useSelectedTextColor } from './ColorPalette/useSelectedTextColor';
|
|
8
8
|
export { getSelectedRowAndColumn } from './ColorPalette/getSelectedRowAndColumn';
|
|
9
|
-
export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue } from './ColorPalette/utils';
|
|
9
|
+
export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, getTokenCSSVariableValueForNonActiveTheme } from './ColorPalette/utils';
|
|
10
10
|
export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
|
|
11
11
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
12
12
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
@@ -6,4 +6,5 @@ export declare function getSelectedRowAndColumnFromPalette(palette: PaletteColor
|
|
|
6
6
|
selectedRowIndex: number;
|
|
7
7
|
};
|
|
8
8
|
export declare const getTokenCSSVariableValue: (variableExpression: string) => string;
|
|
9
|
+
export declare const getTokenCSSVariableValueForNonActiveTheme: (variableExpression: string, fallback: string) => string;
|
|
9
10
|
export { getSelectedRowAndColumn } from './getSelectedRowAndColumn';
|
|
@@ -3,7 +3,7 @@ export { default as Color } from './ColorPalette/Color';
|
|
|
3
3
|
export { SelectedTextColorProvider } from './ColorPalette/SelectedTextColorProvider';
|
|
4
4
|
export { useSelectedTextColor } from './ColorPalette/useSelectedTextColor';
|
|
5
5
|
export { getSelectedRowAndColumn } from './ColorPalette/getSelectedRowAndColumn';
|
|
6
|
-
export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, } from './ColorPalette/utils';
|
|
6
|
+
export { DEFAULT_COLOR_PICKER_COLUMNS, getColorsPerRowFromPalette, getSelectedRowAndColumnFromPalette, getTokenCSSVariableValue, getTokenCSSVariableValueForNonActiveTheme, } from './ColorPalette/utils';
|
|
7
7
|
export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/cellBackgroundColorPalette';
|
|
8
8
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
9
9
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "116.23.
|
|
3
|
+
"version": "116.23.2",
|
|
4
4
|
"description": "A package that contains common classes and components for editor and renderer",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -12,9 +12,7 @@
|
|
|
12
12
|
"module": "dist/esm/index.js",
|
|
13
13
|
"module:es2019": "dist/es2019/index.js",
|
|
14
14
|
"types": "dist/types/index.d.ts",
|
|
15
|
-
"sideEffects": [
|
|
16
|
-
"**/*.compiled.css"
|
|
17
|
-
],
|
|
15
|
+
"sideEffects": ["**/*.compiled.css"],
|
|
18
16
|
"atlaskit:src": "src/index.ts",
|
|
19
17
|
"atlassian": {
|
|
20
18
|
"react-compiler": {
|
|
@@ -61,7 +59,7 @@
|
|
|
61
59
|
"@atlaskit/media-file-preview": "^1.1.0",
|
|
62
60
|
"@atlaskit/media-picker": "^72.1.0",
|
|
63
61
|
"@atlaskit/media-ui": "^30.6.0",
|
|
64
|
-
"@atlaskit/media-viewer": "^54.
|
|
62
|
+
"@atlaskit/media-viewer": "^54.4.0",
|
|
65
63
|
"@atlaskit/mention": "^27.5.0",
|
|
66
64
|
"@atlaskit/menu": "^9.1.0",
|
|
67
65
|
"@atlaskit/object": "^2.1.0",
|
|
@@ -80,10 +78,10 @@
|
|
|
80
78
|
"@atlaskit/task-decision": "^21.4.0",
|
|
81
79
|
"@atlaskit/teams-app-config": "^2.1.0",
|
|
82
80
|
"@atlaskit/textfield": "^9.1.0",
|
|
83
|
-
"@atlaskit/tmp-editor-statsig": "^121.
|
|
81
|
+
"@atlaskit/tmp-editor-statsig": "^121.3.0",
|
|
84
82
|
"@atlaskit/tokens": "^15.4.0",
|
|
85
83
|
"@atlaskit/tooltip": "^23.1.0",
|
|
86
|
-
"@atlaskit/width-detector": "^6.
|
|
84
|
+
"@atlaskit/width-detector": "^6.2.0",
|
|
87
85
|
"@babel/runtime": "^7.0.0",
|
|
88
86
|
"@compiled/react": "^0.20.0",
|
|
89
87
|
"@emotion/react": "^11.7.1",
|
|
@@ -142,20 +140,13 @@
|
|
|
142
140
|
},
|
|
143
141
|
"techstack": {
|
|
144
142
|
"@atlassian/frontend": {
|
|
145
|
-
"circular-dependencies": [
|
|
146
|
-
"file-level"
|
|
147
|
-
],
|
|
143
|
+
"circular-dependencies": ["file-level"],
|
|
148
144
|
"import-structure": "atlassian-conventions"
|
|
149
145
|
},
|
|
150
146
|
"@repo/internal": {
|
|
151
147
|
"deprecation": "no-deprecated-imports",
|
|
152
|
-
"design-tokens": [
|
|
153
|
-
|
|
154
|
-
],
|
|
155
|
-
"styling": [
|
|
156
|
-
"emotion",
|
|
157
|
-
"compiled"
|
|
158
|
-
]
|
|
148
|
+
"design-tokens": ["color"],
|
|
149
|
+
"styling": ["emotion", "compiled"]
|
|
159
150
|
}
|
|
160
151
|
},
|
|
161
152
|
"platform-feature-flags": {
|
|
@@ -264,6 +255,9 @@
|
|
|
264
255
|
},
|
|
265
256
|
"platform_editor_panel_c1_fallback_transform": {
|
|
266
257
|
"type": "boolean"
|
|
258
|
+
},
|
|
259
|
+
"platform_editor_fix_scroll_to_pos": {
|
|
260
|
+
"type": "boolean"
|
|
267
261
|
}
|
|
268
262
|
}
|
|
269
263
|
}
|