@atlaskit/editor-common 111.9.1 → 111.9.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 +12 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/node-anchor/node-anchor-provider.js +50 -10
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui-color/ColorPalette/Palettes/highlightColorPalette.js +1 -18
- package/dist/cjs/ui-color/index.js +0 -6
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/node-anchor/node-anchor-provider.js +51 -10
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui-color/ColorPalette/Palettes/highlightColorPalette.js +1 -18
- package/dist/es2019/ui-color/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/node-anchor/node-anchor-provider.js +51 -10
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui-color/ColorPalette/Palettes/highlightColorPalette.js +1 -18
- package/dist/esm/ui-color/index.js +1 -1
- package/dist/types/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +0 -5
- package/dist/types/ui-color/index.d.ts +1 -1
- package/dist/types-ts4.5/ui-color/ColorPalette/Palettes/highlightColorPalette.d.ts +0 -5
- package/dist/types-ts4.5/ui-color/index.d.ts +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 111.9.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`256b4fc86bae0`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/256b4fc86bae0) -
|
|
8
|
+
[ux] EDITOR-4464 Limited Mode: Change threshold to activate limited mode to use the node count
|
|
9
|
+
rather than the raw document size.
|
|
10
|
+
- [`25c388e0f807a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/25c388e0f807a) -
|
|
11
|
+
EDITOR-4684 Clean up platform_editor_add_orange_highlight_color experiment - orange highlight
|
|
12
|
+
color is now permanently enabled
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 111.9.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
|
@@ -19,7 +19,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
19
19
|
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
|
|
20
20
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
21
21
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
22
|
-
var packageVersion = "111.9.
|
|
22
|
+
var packageVersion = "111.9.1";
|
|
23
23
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
24
24
|
// Remove URL as it has UGC
|
|
25
25
|
// Ignored via go/ees007
|
|
@@ -9,8 +9,41 @@ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/cl
|
|
|
9
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _expVal = require("@atlaskit/tmp-editor-statsig/expVal");
|
|
12
13
|
var _utils = require("../utils");
|
|
13
14
|
var _dynamicBitArray = require("./dynamic-bit-array");
|
|
15
|
+
/**
|
|
16
|
+
* Counts nodes in the document.
|
|
17
|
+
*
|
|
18
|
+
* Note: legacy-content macros add a damped contribution based on ADF length to avoid
|
|
19
|
+
* parsing nested ADF on every check, which is inefficient.
|
|
20
|
+
*/
|
|
21
|
+
var countNodesInDoc = function countNodesInDoc(doc, lcmDampingFactor) {
|
|
22
|
+
var nodeCount = 0;
|
|
23
|
+
doc.descendants(function (node) {
|
|
24
|
+
var _node$attrs;
|
|
25
|
+
nodeCount += 1;
|
|
26
|
+
if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
|
|
27
|
+
var _node$attrs2;
|
|
28
|
+
var adfLength = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.parameters) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.adf) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.length;
|
|
29
|
+
if (typeof adfLength === 'number' && lcmDampingFactor > 0) {
|
|
30
|
+
nodeCount += Math.ceil(adfLength / lcmDampingFactor);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return nodeCount;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Guard against test overrides returning booleans for numeric params.
|
|
39
|
+
*/
|
|
40
|
+
var getNumericExperimentParam = function getNumericExperimentParam(experimentName, paramName, fallbackValue) {
|
|
41
|
+
var rawValue = (0, _expVal.expVal)(experimentName, paramName, fallbackValue);
|
|
42
|
+
if (typeof rawValue === 'number') {
|
|
43
|
+
return rawValue;
|
|
44
|
+
}
|
|
45
|
+
return fallbackValue;
|
|
46
|
+
};
|
|
14
47
|
var NodeAnchorProvider = exports.NodeAnchorProvider = /*#__PURE__*/function () {
|
|
15
48
|
function NodeAnchorProvider() {
|
|
16
49
|
var limitedMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -89,15 +122,22 @@ var LIMITED_MODE_NODE_SIZE_THRESHOLD = 40000;
|
|
|
89
122
|
// This is duplicate from the limited mode plugin to avoid circular dependency
|
|
90
123
|
// We can refactor this later to have a shared util package
|
|
91
124
|
var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
var
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
125
|
+
if ((0, _expVal.expVal)('cc_editor_limited_mode_expanded', 'isEnabled', false)) {
|
|
126
|
+
var lcmNodeCountDampingFactor = getNumericExperimentParam('cc_editor_limited_mode_expanded', 'lcmNodeCountDampingFactor', 10);
|
|
127
|
+
var nodeCountThreshold = getNumericExperimentParam('cc_editor_limited_mode_expanded', 'nodeCountThreshold', 1000);
|
|
128
|
+
var nodeCount = countNodesInDoc(editorView.state.doc, lcmNodeCountDampingFactor);
|
|
129
|
+
return nodeCount > nodeCountThreshold;
|
|
130
|
+
} else {
|
|
131
|
+
var customDocSize = editorView.state.doc.nodeSize;
|
|
132
|
+
editorView.state.doc.descendants(function (node) {
|
|
133
|
+
var _node$attrs3;
|
|
134
|
+
if (((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey) === 'legacy-content') {
|
|
135
|
+
var _node$attrs$parameter, _node$attrs4;
|
|
136
|
+
customDocSize += (_node$attrs$parameter = (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.parameters) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.adf) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.length) !== null && _node$attrs$parameter !== void 0 ? _node$attrs$parameter : 0;
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
return customDocSize > LIMITED_MODE_NODE_SIZE_THRESHOLD;
|
|
140
|
+
}
|
|
101
141
|
};
|
|
102
142
|
|
|
103
143
|
// Get the NodeIdProvider for a specific EditorView instance.
|
|
@@ -105,7 +145,7 @@ var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
|
|
|
105
145
|
var getNodeIdProvider = exports.getNodeIdProvider = function getNodeIdProvider(editorView) {
|
|
106
146
|
if (!nodeIdProviderMap.has(editorView)) {
|
|
107
147
|
if ((0, _platformFeatureFlags.fg)('platform_editor_native_anchor_patch_2')) {
|
|
108
|
-
// if the limited mode flag is on, enable limited mode based on
|
|
148
|
+
// if the limited mode flag is on, enable limited mode based on the threshold
|
|
109
149
|
// only for the first time
|
|
110
150
|
var limitedMode = isLimitedModeEnabled(editorView);
|
|
111
151
|
var isEmptyDoc = (0, _utils.isEmptyDocument)(editorView.state.doc);
|
|
@@ -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 = "111.9.
|
|
27
|
+
var packageVersion = "111.9.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.
|
|
7
|
+
exports.highlightColorPalette = exports.REMOVE_HIGHLIGHT_COLOR = exports.EditorDiagonalLineIcon = void 0;
|
|
8
8
|
var _react = require("@emotion/react");
|
|
9
9
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
10
10
|
var _tokens = require("@atlaskit/tokens");
|
|
@@ -58,12 +58,6 @@ var EditorDiagonalLineIcon = exports.EditorDiagonalLineIcon = function EditorDia
|
|
|
58
58
|
})
|
|
59
59
|
);
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
|
|
63
|
-
/**
|
|
64
|
-
* @deprecated Use `highlightColorPaletteNext` instead, which supports both orange and yellow highlight color
|
|
65
|
-
* This will be removed when platform_editor_add_orange_highlight_color is cleaned up
|
|
66
|
-
*/
|
|
67
61
|
var highlightColorPalette = exports.highlightColorPalette = [{
|
|
68
62
|
value: REMOVE_HIGHLIGHT_COLOR,
|
|
69
63
|
label: 'No color',
|
|
@@ -74,15 +68,4 @@ var highlightColorPalette = exports.highlightColorPalette = [{
|
|
|
74
68
|
}];
|
|
75
69
|
_adfSchema.backgroundColorPalette.forEach(function (label, color) {
|
|
76
70
|
highlightColorPalette.push((0, _textColorPalette.mapPaletteColor)(label, color));
|
|
77
|
-
});
|
|
78
|
-
var highlightColorPaletteNext = exports.highlightColorPaletteNext = [{
|
|
79
|
-
value: REMOVE_HIGHLIGHT_COLOR,
|
|
80
|
-
label: 'No color',
|
|
81
|
-
// Mostly informative, only used for analytics
|
|
82
|
-
border: "var(--ds-border, #091E4224)",
|
|
83
|
-
message: (0, _getColorMessage.default)(_paletteMessages.default, 'no-color'),
|
|
84
|
-
decorator: (0, _react.jsx)(EditorDiagonalLineIcon, null)
|
|
85
|
-
}];
|
|
86
|
-
_adfSchema.backgroundColorPaletteNext.forEach(function (label, color) {
|
|
87
|
-
highlightColorPaletteNext.push((0, _textColorPalette.mapPaletteColor)(label, color));
|
|
88
71
|
});
|
|
@@ -94,12 +94,6 @@ Object.defineProperty(exports, "highlightColorPalette", {
|
|
|
94
94
|
return _highlightColorPalette.highlightColorPalette;
|
|
95
95
|
}
|
|
96
96
|
});
|
|
97
|
-
Object.defineProperty(exports, "highlightColorPaletteNext", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
get: function get() {
|
|
100
|
-
return _highlightColorPalette.highlightColorPaletteNext;
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
97
|
Object.defineProperty(exports, "panelBackgroundPalette", {
|
|
104
98
|
enumerable: true,
|
|
105
99
|
get: function get() {
|
|
@@ -4,7 +4,7 @@ import { isFedRamp } from './environment';
|
|
|
4
4
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
5
5
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
6
6
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
7
|
-
const packageVersion = "111.9.
|
|
7
|
+
const packageVersion = "111.9.1";
|
|
8
8
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
9
9
|
// Remove URL as it has UGC
|
|
10
10
|
// Ignored via go/ees007
|
|
@@ -1,7 +1,41 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
3
|
+
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
3
4
|
import { isEmptyDocument } from '../utils';
|
|
4
5
|
import { DynamicBitArray } from './dynamic-bit-array';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Counts nodes in the document.
|
|
9
|
+
*
|
|
10
|
+
* Note: legacy-content macros add a damped contribution based on ADF length to avoid
|
|
11
|
+
* parsing nested ADF on every check, which is inefficient.
|
|
12
|
+
*/
|
|
13
|
+
const countNodesInDoc = (doc, lcmDampingFactor) => {
|
|
14
|
+
let nodeCount = 0;
|
|
15
|
+
doc.descendants(node => {
|
|
16
|
+
var _node$attrs;
|
|
17
|
+
nodeCount += 1;
|
|
18
|
+
if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
|
|
19
|
+
var _node$attrs2, _node$attrs2$paramete, _node$attrs2$paramete2;
|
|
20
|
+
const adfLength = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 ? void 0 : (_node$attrs2$paramete = _node$attrs2.parameters) === null || _node$attrs2$paramete === void 0 ? void 0 : (_node$attrs2$paramete2 = _node$attrs2$paramete.adf) === null || _node$attrs2$paramete2 === void 0 ? void 0 : _node$attrs2$paramete2.length;
|
|
21
|
+
if (typeof adfLength === 'number' && lcmDampingFactor > 0) {
|
|
22
|
+
nodeCount += Math.ceil(adfLength / lcmDampingFactor);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
return nodeCount;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Guard against test overrides returning booleans for numeric params.
|
|
31
|
+
*/
|
|
32
|
+
const getNumericExperimentParam = (experimentName, paramName, fallbackValue) => {
|
|
33
|
+
const rawValue = expVal(experimentName, paramName, fallbackValue);
|
|
34
|
+
if (typeof rawValue === 'number') {
|
|
35
|
+
return rawValue;
|
|
36
|
+
}
|
|
37
|
+
return fallbackValue;
|
|
38
|
+
};
|
|
5
39
|
export class NodeAnchorProvider {
|
|
6
40
|
constructor(limitedMode = false, emptyDoc = false) {
|
|
7
41
|
_defineProperty(this, "cache", new WeakMap());
|
|
@@ -64,15 +98,22 @@ const LIMITED_MODE_NODE_SIZE_THRESHOLD = 40000;
|
|
|
64
98
|
// This is duplicate from the limited mode plugin to avoid circular dependency
|
|
65
99
|
// We can refactor this later to have a shared util package
|
|
66
100
|
const isLimitedModeEnabled = editorView => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
if (expVal('cc_editor_limited_mode_expanded', 'isEnabled', false)) {
|
|
102
|
+
const lcmNodeCountDampingFactor = getNumericExperimentParam('cc_editor_limited_mode_expanded', 'lcmNodeCountDampingFactor', 10);
|
|
103
|
+
const nodeCountThreshold = getNumericExperimentParam('cc_editor_limited_mode_expanded', 'nodeCountThreshold', 1000);
|
|
104
|
+
const nodeCount = countNodesInDoc(editorView.state.doc, lcmNodeCountDampingFactor);
|
|
105
|
+
return nodeCount > nodeCountThreshold;
|
|
106
|
+
} else {
|
|
107
|
+
let customDocSize = editorView.state.doc.nodeSize;
|
|
108
|
+
editorView.state.doc.descendants(node => {
|
|
109
|
+
var _node$attrs3;
|
|
110
|
+
if (((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey) === 'legacy-content') {
|
|
111
|
+
var _node$attrs$parameter, _node$attrs4, _node$attrs4$paramete, _node$attrs4$paramete2;
|
|
112
|
+
customDocSize += (_node$attrs$parameter = (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 ? void 0 : (_node$attrs4$paramete = _node$attrs4.parameters) === null || _node$attrs4$paramete === void 0 ? void 0 : (_node$attrs4$paramete2 = _node$attrs4$paramete.adf) === null || _node$attrs4$paramete2 === void 0 ? void 0 : _node$attrs4$paramete2.length) !== null && _node$attrs$parameter !== void 0 ? _node$attrs$parameter : 0;
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return customDocSize > LIMITED_MODE_NODE_SIZE_THRESHOLD;
|
|
116
|
+
}
|
|
76
117
|
};
|
|
77
118
|
|
|
78
119
|
// Get the NodeIdProvider for a specific EditorView instance.
|
|
@@ -80,7 +121,7 @@ const isLimitedModeEnabled = editorView => {
|
|
|
80
121
|
export const getNodeIdProvider = editorView => {
|
|
81
122
|
if (!nodeIdProviderMap.has(editorView)) {
|
|
82
123
|
if (fg('platform_editor_native_anchor_patch_2')) {
|
|
83
|
-
// if the limited mode flag is on, enable limited mode based on
|
|
124
|
+
// if the limited mode flag is on, enable limited mode based on the threshold
|
|
84
125
|
// only for the first time
|
|
85
126
|
const limitedMode = isLimitedModeEnabled(editorView);
|
|
86
127
|
const isEmptyDoc = isEmptyDocument(editorView.state.doc);
|
|
@@ -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 = "111.9.
|
|
17
|
+
const packageVersion = "111.9.1";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
-
import { backgroundColorPalette
|
|
8
|
+
import { backgroundColorPalette } from '@atlaskit/adf-schema';
|
|
9
9
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
10
10
|
import getColorMessage from './getColorMessage';
|
|
11
11
|
import paletteMessages from './paletteMessages';
|
|
@@ -49,12 +49,6 @@ export const EditorDiagonalLineIcon = () => {
|
|
|
49
49
|
})
|
|
50
50
|
);
|
|
51
51
|
};
|
|
52
|
-
|
|
53
|
-
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
|
|
54
|
-
/**
|
|
55
|
-
* @deprecated Use `highlightColorPaletteNext` instead, which supports both orange and yellow highlight color
|
|
56
|
-
* This will be removed when platform_editor_add_orange_highlight_color is cleaned up
|
|
57
|
-
*/
|
|
58
52
|
export const highlightColorPalette = [{
|
|
59
53
|
value: REMOVE_HIGHLIGHT_COLOR,
|
|
60
54
|
label: 'No color',
|
|
@@ -65,15 +59,4 @@ export const highlightColorPalette = [{
|
|
|
65
59
|
}];
|
|
66
60
|
backgroundColorPalette.forEach((label, color) => {
|
|
67
61
|
highlightColorPalette.push(mapPaletteColor(label, color));
|
|
68
|
-
});
|
|
69
|
-
export const highlightColorPaletteNext = [{
|
|
70
|
-
value: REMOVE_HIGHLIGHT_COLOR,
|
|
71
|
-
label: 'No color',
|
|
72
|
-
// Mostly informative, only used for analytics
|
|
73
|
-
border: "var(--ds-border, #091E4224)",
|
|
74
|
-
message: getColorMessage(paletteMessages, 'no-color'),
|
|
75
|
-
decorator: jsx(EditorDiagonalLineIcon, null)
|
|
76
|
-
}];
|
|
77
|
-
backgroundColorPaletteNext.forEach((label, color) => {
|
|
78
|
-
highlightColorPaletteNext.push(mapPaletteColor(label, color));
|
|
79
62
|
});
|
|
@@ -8,7 +8,7 @@ export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/c
|
|
|
8
8
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
9
9
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
10
10
|
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
11
|
-
export { highlightColorPalette,
|
|
11
|
+
export { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR } from './ColorPalette/Palettes/highlightColorPalette';
|
|
12
12
|
export { backgroundPaletteTooltipMessages, borderPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages } from './ColorPalette/Palettes/paletteMessagesTokenModeNames';
|
|
13
13
|
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
14
14
|
export { default as borderColorPalette } from './ColorPalette/Palettes/borderColorPalette';
|
|
@@ -10,7 +10,7 @@ import { isFedRamp } from './environment';
|
|
|
10
10
|
import { normaliseSentryBreadcrumbs, SERIALIZABLE_ATTRIBUTES } from './normalise-sentry-breadcrumbs';
|
|
11
11
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
12
12
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
13
|
-
var packageVersion = "111.9.
|
|
13
|
+
var packageVersion = "111.9.1";
|
|
14
14
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
15
15
|
// Remove URL as it has UGC
|
|
16
16
|
// Ignored via go/ees007
|
|
@@ -2,8 +2,42 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
4
4
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
5
|
+
import { expVal } from '@atlaskit/tmp-editor-statsig/expVal';
|
|
5
6
|
import { isEmptyDocument } from '../utils';
|
|
6
7
|
import { DynamicBitArray } from './dynamic-bit-array';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Counts nodes in the document.
|
|
11
|
+
*
|
|
12
|
+
* Note: legacy-content macros add a damped contribution based on ADF length to avoid
|
|
13
|
+
* parsing nested ADF on every check, which is inefficient.
|
|
14
|
+
*/
|
|
15
|
+
var countNodesInDoc = function countNodesInDoc(doc, lcmDampingFactor) {
|
|
16
|
+
var nodeCount = 0;
|
|
17
|
+
doc.descendants(function (node) {
|
|
18
|
+
var _node$attrs;
|
|
19
|
+
nodeCount += 1;
|
|
20
|
+
if (((_node$attrs = node.attrs) === null || _node$attrs === void 0 ? void 0 : _node$attrs.extensionKey) === 'legacy-content') {
|
|
21
|
+
var _node$attrs2;
|
|
22
|
+
var adfLength = (_node$attrs2 = node.attrs) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.parameters) === null || _node$attrs2 === void 0 || (_node$attrs2 = _node$attrs2.adf) === null || _node$attrs2 === void 0 ? void 0 : _node$attrs2.length;
|
|
23
|
+
if (typeof adfLength === 'number' && lcmDampingFactor > 0) {
|
|
24
|
+
nodeCount += Math.ceil(adfLength / lcmDampingFactor);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return nodeCount;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Guard against test overrides returning booleans for numeric params.
|
|
33
|
+
*/
|
|
34
|
+
var getNumericExperimentParam = function getNumericExperimentParam(experimentName, paramName, fallbackValue) {
|
|
35
|
+
var rawValue = expVal(experimentName, paramName, fallbackValue);
|
|
36
|
+
if (typeof rawValue === 'number') {
|
|
37
|
+
return rawValue;
|
|
38
|
+
}
|
|
39
|
+
return fallbackValue;
|
|
40
|
+
};
|
|
7
41
|
export var NodeAnchorProvider = /*#__PURE__*/function () {
|
|
8
42
|
function NodeAnchorProvider() {
|
|
9
43
|
var limitedMode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
@@ -82,15 +116,22 @@ var LIMITED_MODE_NODE_SIZE_THRESHOLD = 40000;
|
|
|
82
116
|
// This is duplicate from the limited mode plugin to avoid circular dependency
|
|
83
117
|
// We can refactor this later to have a shared util package
|
|
84
118
|
var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
var
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
119
|
+
if (expVal('cc_editor_limited_mode_expanded', 'isEnabled', false)) {
|
|
120
|
+
var lcmNodeCountDampingFactor = getNumericExperimentParam('cc_editor_limited_mode_expanded', 'lcmNodeCountDampingFactor', 10);
|
|
121
|
+
var nodeCountThreshold = getNumericExperimentParam('cc_editor_limited_mode_expanded', 'nodeCountThreshold', 1000);
|
|
122
|
+
var nodeCount = countNodesInDoc(editorView.state.doc, lcmNodeCountDampingFactor);
|
|
123
|
+
return nodeCount > nodeCountThreshold;
|
|
124
|
+
} else {
|
|
125
|
+
var customDocSize = editorView.state.doc.nodeSize;
|
|
126
|
+
editorView.state.doc.descendants(function (node) {
|
|
127
|
+
var _node$attrs3;
|
|
128
|
+
if (((_node$attrs3 = node.attrs) === null || _node$attrs3 === void 0 ? void 0 : _node$attrs3.extensionKey) === 'legacy-content') {
|
|
129
|
+
var _node$attrs$parameter, _node$attrs4;
|
|
130
|
+
customDocSize += (_node$attrs$parameter = (_node$attrs4 = node.attrs) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.parameters) === null || _node$attrs4 === void 0 || (_node$attrs4 = _node$attrs4.adf) === null || _node$attrs4 === void 0 ? void 0 : _node$attrs4.length) !== null && _node$attrs$parameter !== void 0 ? _node$attrs$parameter : 0;
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
return customDocSize > LIMITED_MODE_NODE_SIZE_THRESHOLD;
|
|
134
|
+
}
|
|
94
135
|
};
|
|
95
136
|
|
|
96
137
|
// Get the NodeIdProvider for a specific EditorView instance.
|
|
@@ -98,7 +139,7 @@ var isLimitedModeEnabled = function isLimitedModeEnabled(editorView) {
|
|
|
98
139
|
export var getNodeIdProvider = function getNodeIdProvider(editorView) {
|
|
99
140
|
if (!nodeIdProviderMap.has(editorView)) {
|
|
100
141
|
if (fg('platform_editor_native_anchor_patch_2')) {
|
|
101
|
-
// if the limited mode flag is on, enable limited mode based on
|
|
142
|
+
// if the limited mode flag is on, enable limited mode based on the threshold
|
|
102
143
|
// only for the first time
|
|
103
144
|
var limitedMode = isLimitedModeEnabled(editorView);
|
|
104
145
|
var isEmptyDoc = isEmptyDocument(editorView.state.doc);
|
|
@@ -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 = "111.9.
|
|
24
|
+
var packageVersion = "111.9.1";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
|
|
6
6
|
// eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
7
7
|
import { jsx } from '@emotion/react';
|
|
8
|
-
import { backgroundColorPalette
|
|
8
|
+
import { backgroundColorPalette } from '@atlaskit/adf-schema';
|
|
9
9
|
import { useThemeObserver } from '@atlaskit/tokens';
|
|
10
10
|
import getColorMessage from './getColorMessage';
|
|
11
11
|
import paletteMessages from './paletteMessages';
|
|
@@ -50,12 +50,6 @@ export var EditorDiagonalLineIcon = function EditorDiagonalLineIcon() {
|
|
|
50
50
|
})
|
|
51
51
|
);
|
|
52
52
|
};
|
|
53
|
-
|
|
54
|
-
// eslint-disable-next-line @repo/internal/deprecations/deprecation-ticket-required
|
|
55
|
-
/**
|
|
56
|
-
* @deprecated Use `highlightColorPaletteNext` instead, which supports both orange and yellow highlight color
|
|
57
|
-
* This will be removed when platform_editor_add_orange_highlight_color is cleaned up
|
|
58
|
-
*/
|
|
59
53
|
export var highlightColorPalette = [{
|
|
60
54
|
value: REMOVE_HIGHLIGHT_COLOR,
|
|
61
55
|
label: 'No color',
|
|
@@ -66,15 +60,4 @@ export var highlightColorPalette = [{
|
|
|
66
60
|
}];
|
|
67
61
|
backgroundColorPalette.forEach(function (label, color) {
|
|
68
62
|
highlightColorPalette.push(mapPaletteColor(label, color));
|
|
69
|
-
});
|
|
70
|
-
export var highlightColorPaletteNext = [{
|
|
71
|
-
value: REMOVE_HIGHLIGHT_COLOR,
|
|
72
|
-
label: 'No color',
|
|
73
|
-
// Mostly informative, only used for analytics
|
|
74
|
-
border: "var(--ds-border, #091E4224)",
|
|
75
|
-
message: getColorMessage(paletteMessages, 'no-color'),
|
|
76
|
-
decorator: jsx(EditorDiagonalLineIcon, null)
|
|
77
|
-
}];
|
|
78
|
-
backgroundColorPaletteNext.forEach(function (label, color) {
|
|
79
|
-
highlightColorPaletteNext.push(mapPaletteColor(label, color));
|
|
80
63
|
});
|
|
@@ -8,7 +8,7 @@ export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/c
|
|
|
8
8
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
9
9
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
10
10
|
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
11
|
-
export { highlightColorPalette,
|
|
11
|
+
export { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR } from './ColorPalette/Palettes/highlightColorPalette';
|
|
12
12
|
export { backgroundPaletteTooltipMessages, borderPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages } from './ColorPalette/Palettes/paletteMessagesTokenModeNames';
|
|
13
13
|
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
14
14
|
export { default as borderColorPalette } from './ColorPalette/Palettes/borderColorPalette';
|
|
@@ -6,9 +6,4 @@ import { jsx } from '@emotion/react';
|
|
|
6
6
|
import type { PaletteColor } from './type';
|
|
7
7
|
export declare const REMOVE_HIGHLIGHT_COLOR = "#00000000";
|
|
8
8
|
export declare const EditorDiagonalLineIcon: () => jsx.JSX.Element;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use `highlightColorPaletteNext` instead, which supports both orange and yellow highlight color
|
|
11
|
-
* This will be removed when platform_editor_add_orange_highlight_color is cleaned up
|
|
12
|
-
*/
|
|
13
9
|
export declare const highlightColorPalette: Array<PaletteColor>;
|
|
14
|
-
export declare const highlightColorPaletteNext: Array<PaletteColor>;
|
|
@@ -5,7 +5,7 @@ export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/c
|
|
|
5
5
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
6
6
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
7
7
|
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
8
|
-
export { highlightColorPalette,
|
|
8
|
+
export { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR, } from './ColorPalette/Palettes/highlightColorPalette';
|
|
9
9
|
export { backgroundPaletteTooltipMessages, borderPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages, } from './ColorPalette/Palettes/paletteMessagesTokenModeNames';
|
|
10
10
|
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
11
11
|
export type { PaletteColor, PaletteTooltipMessages } from './ColorPalette/Palettes/type';
|
|
@@ -6,9 +6,4 @@ import { jsx } from '@emotion/react';
|
|
|
6
6
|
import type { PaletteColor } from './type';
|
|
7
7
|
export declare const REMOVE_HIGHLIGHT_COLOR = "#00000000";
|
|
8
8
|
export declare const EditorDiagonalLineIcon: () => jsx.JSX.Element;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated Use `highlightColorPaletteNext` instead, which supports both orange and yellow highlight color
|
|
11
|
-
* This will be removed when platform_editor_add_orange_highlight_color is cleaned up
|
|
12
|
-
*/
|
|
13
9
|
export declare const highlightColorPalette: Array<PaletteColor>;
|
|
14
|
-
export declare const highlightColorPaletteNext: Array<PaletteColor>;
|
|
@@ -5,7 +5,7 @@ export { default as cellBackgroundColorPalette } from './ColorPalette/Palettes/c
|
|
|
5
5
|
export { default as colorPaletteMessages } from './ColorPalette/Palettes/paletteMessages';
|
|
6
6
|
export { panelBackgroundPalette } from './ColorPalette/Palettes/panelBackgroundPalette';
|
|
7
7
|
export { textColorPalette } from './ColorPalette/Palettes/textColorPalette';
|
|
8
|
-
export { highlightColorPalette,
|
|
8
|
+
export { highlightColorPalette, REMOVE_HIGHLIGHT_COLOR, } from './ColorPalette/Palettes/highlightColorPalette';
|
|
9
9
|
export { backgroundPaletteTooltipMessages, borderPaletteTooltipMessages, chartsColorPaletteTooltipMessages, textPaletteTooltipMessages, } from './ColorPalette/Palettes/paletteMessagesTokenModeNames';
|
|
10
10
|
export { DEFAULT_BORDER_COLOR } from './ColorPalette/Palettes/common';
|
|
11
11
|
export type { PaletteColor, PaletteTooltipMessages } from './ColorPalette/Palettes/type';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "111.9.
|
|
3
|
+
"version": "111.9.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/"
|
|
@@ -70,7 +70,7 @@
|
|
|
70
70
|
"@atlaskit/platform-feature-flags-react": "^0.4.0",
|
|
71
71
|
"@atlaskit/popper": "^7.1.0",
|
|
72
72
|
"@atlaskit/primitives": "^17.1.0",
|
|
73
|
-
"@atlaskit/profilecard": "^24.
|
|
73
|
+
"@atlaskit/profilecard": "^24.34.0",
|
|
74
74
|
"@atlaskit/prosemirror-history": "^0.2.0",
|
|
75
75
|
"@atlaskit/react-ufo": "^5.0.0",
|
|
76
76
|
"@atlaskit/section-message": "^8.12.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"@atlaskit/task-decision": "^19.2.0",
|
|
82
82
|
"@atlaskit/textfield": "^8.2.0",
|
|
83
83
|
"@atlaskit/theme": "^21.0.0",
|
|
84
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
84
|
+
"@atlaskit/tmp-editor-statsig": "^17.0.0",
|
|
85
85
|
"@atlaskit/tokens": "^10.1.0",
|
|
86
86
|
"@atlaskit/tooltip": "^20.14.0",
|
|
87
87
|
"@atlaskit/width-detector": "^5.0.0",
|