@atlaskit/editor-common 107.29.0 → 107.30.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 +11 -0
- package/dist/cjs/code-block/index.js +58 -1
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/code-block/index.js +57 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/code-block/index.js +57 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/code-block/index.d.ts +6 -0
- package/dist/types-ts4.5/code-block/index.d.ts +6 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 107.30.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`0ff4a6c7a39ef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0ff4a6c7a39ef) -
|
|
8
|
+
Creates global fold state to retain folds after breakouts and page resizing
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies
|
|
13
|
+
|
|
3
14
|
## 107.29.0
|
|
4
15
|
|
|
5
16
|
### Minor Changes
|
|
@@ -3,20 +3,36 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.updateCodeBlockWrappedStateNodeKeys = exports.transferCodeBlockWrappedValue = exports.isCodeBlockWordWrapEnabled = exports.defaultWordWrapState = exports.codeBlockWrappedStates = void 0;
|
|
6
|
+
exports.updateCodeBlockWrappedStateNodeKeys = exports.transferCodeBlockWrappedValue = exports.setCodeBlockFoldState = exports.isCodeBlockWordWrapEnabled = exports.getCodeBlockFoldState = exports.defaultWordWrapState = exports.codeBlockWrappedStates = void 0;
|
|
7
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
7
8
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
8
9
|
|
|
9
10
|
var defaultWordWrapState = exports.defaultWordWrapState = false;
|
|
10
11
|
var codeBlockWrappedStates = exports.codeBlockWrappedStates = new WeakMap();
|
|
12
|
+
|
|
13
|
+
// Code folding state management - similar to word wrapping
|
|
14
|
+
|
|
15
|
+
var codeBlockFoldStates = new WeakMap();
|
|
11
16
|
var isCodeBlockWordWrapEnabled = exports.isCodeBlockWordWrapEnabled = function isCodeBlockWordWrapEnabled(codeBlockNode) {
|
|
12
17
|
var currentNodeWordWrapState = codeBlockWrappedStates.get(codeBlockNode);
|
|
13
18
|
return currentNodeWordWrapState !== undefined ? currentNodeWordWrapState : defaultWordWrapState;
|
|
14
19
|
};
|
|
20
|
+
var getCodeBlockFoldState = exports.getCodeBlockFoldState = function getCodeBlockFoldState(codeBlockNode) {
|
|
21
|
+
var currentNodeFoldState = codeBlockFoldStates.get(codeBlockNode);
|
|
22
|
+
return currentNodeFoldState || [];
|
|
23
|
+
};
|
|
24
|
+
var setCodeBlockFoldState = exports.setCodeBlockFoldState = function setCodeBlockFoldState(codeBlockNode, foldRanges) {
|
|
25
|
+
codeBlockFoldStates.set(codeBlockNode, foldRanges);
|
|
26
|
+
};
|
|
15
27
|
|
|
16
28
|
/**
|
|
17
29
|
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
18
30
|
*/
|
|
19
31
|
var transferCodeBlockWrappedValue = exports.transferCodeBlockWrappedValue = function transferCodeBlockWrappedValue(oldCodeBlockNode, newCodeBlockNode) {
|
|
32
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
|
|
33
|
+
transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
|
|
34
|
+
}
|
|
35
|
+
|
|
20
36
|
// Don't overwrite the value for the new node if it already exists.
|
|
21
37
|
// This can happen when a drag&drop is swapping nodes.
|
|
22
38
|
if (codeBlockWrappedStates.has(newCodeBlockNode)) {
|
|
@@ -27,6 +43,20 @@ var transferCodeBlockWrappedValue = exports.transferCodeBlockWrappedValue = func
|
|
|
27
43
|
codeBlockWrappedStates.delete(oldCodeBlockNode);
|
|
28
44
|
};
|
|
29
45
|
|
|
46
|
+
/**
|
|
47
|
+
* Swap the old node key with the new node key in the fold states WeakMap.
|
|
48
|
+
*/
|
|
49
|
+
var transferCodeBlockFoldValue = function transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode) {
|
|
50
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
51
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
52
|
+
if (codeBlockFoldStates.has(newCodeBlockNode)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
var previousValue = getCodeBlockFoldState(oldCodeBlockNode);
|
|
56
|
+
codeBlockFoldStates.set(newCodeBlockNode, previousValue);
|
|
57
|
+
codeBlockFoldStates.delete(oldCodeBlockNode);
|
|
58
|
+
};
|
|
59
|
+
|
|
30
60
|
/**
|
|
31
61
|
* As the code block node is used as the wrapped state key, there is instances where the node will be destroyed & recreated and is no longer a valid key.
|
|
32
62
|
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
@@ -34,6 +64,9 @@ var transferCodeBlockWrappedValue = exports.transferCodeBlockWrappedValue = func
|
|
|
34
64
|
*/
|
|
35
65
|
var updateCodeBlockWrappedStateNodeKeys = exports.updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrappedStateNodeKeys(newCodeBlockNodes, oldState) {
|
|
36
66
|
newCodeBlockNodes.forEach(function (newCodeBlockNode) {
|
|
67
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
|
|
68
|
+
updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
|
|
69
|
+
}
|
|
37
70
|
// Don't overwrite the value for the new node if it already exists.
|
|
38
71
|
// This can happen when a drag&drop is swapping nodes.
|
|
39
72
|
if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
|
|
@@ -51,4 +84,28 @@ var updateCodeBlockWrappedStateNodeKeys = exports.updateCodeBlockWrappedStateNod
|
|
|
51
84
|
var previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
52
85
|
codeBlockWrappedStates.set(newCodeBlockNode.node, previousValue);
|
|
53
86
|
});
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* As the code block node is used as the fold state key, there is instances where the node will be destroyed & recreated and is no longer a valid key.
|
|
91
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
92
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
93
|
+
*/
|
|
94
|
+
var updateCodeBlockFoldStateNodeKeys = function updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState) {
|
|
95
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
96
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
97
|
+
if (codeBlockFoldStates.has(newCodeBlockNode.node)) {
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Do not go out of range on the oldState doc. Happens on initial load.
|
|
102
|
+
if (oldState.doc.content.size <= newCodeBlockNode.pos) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
var oldCodeBlockNode = oldState.doc.nodeAt(newCodeBlockNode.pos);
|
|
106
|
+
if (!oldCodeBlockNode || oldCodeBlockNode.type !== oldState.schema.nodes.codeBlock) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
var previousValue = getCodeBlockFoldState(oldCodeBlockNode);
|
|
110
|
+
codeBlockFoldStates.set(newCodeBlockNode.node, previousValue);
|
|
54
111
|
};
|
|
@@ -16,7 +16,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
16
16
|
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); }
|
|
17
17
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
18
18
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
19
|
-
var packageVersion = "107.
|
|
19
|
+
var packageVersion = "107.29.0";
|
|
20
20
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
21
21
|
// Remove URL as it has UGC
|
|
22
22
|
// Ignored via go/ees007
|
|
@@ -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 = "107.
|
|
27
|
+
var packageVersion = "107.29.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
2
2
|
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
export const defaultWordWrapState = false;
|
|
4
5
|
export const codeBlockWrappedStates = new WeakMap();
|
|
6
|
+
|
|
7
|
+
// Code folding state management - similar to word wrapping
|
|
8
|
+
|
|
9
|
+
const codeBlockFoldStates = new WeakMap();
|
|
5
10
|
export const isCodeBlockWordWrapEnabled = codeBlockNode => {
|
|
6
11
|
const currentNodeWordWrapState = codeBlockWrappedStates.get(codeBlockNode);
|
|
7
12
|
return currentNodeWordWrapState !== undefined ? currentNodeWordWrapState : defaultWordWrapState;
|
|
8
13
|
};
|
|
14
|
+
export const getCodeBlockFoldState = codeBlockNode => {
|
|
15
|
+
const currentNodeFoldState = codeBlockFoldStates.get(codeBlockNode);
|
|
16
|
+
return currentNodeFoldState || [];
|
|
17
|
+
};
|
|
18
|
+
export const setCodeBlockFoldState = (codeBlockNode, foldRanges) => {
|
|
19
|
+
codeBlockFoldStates.set(codeBlockNode, foldRanges);
|
|
20
|
+
};
|
|
9
21
|
|
|
10
22
|
/**
|
|
11
23
|
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
12
24
|
*/
|
|
13
25
|
export const transferCodeBlockWrappedValue = (oldCodeBlockNode, newCodeBlockNode) => {
|
|
26
|
+
if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
|
|
27
|
+
transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
// Don't overwrite the value for the new node if it already exists.
|
|
15
31
|
// This can happen when a drag&drop is swapping nodes.
|
|
16
32
|
if (codeBlockWrappedStates.has(newCodeBlockNode)) {
|
|
@@ -21,6 +37,20 @@ export const transferCodeBlockWrappedValue = (oldCodeBlockNode, newCodeBlockNode
|
|
|
21
37
|
codeBlockWrappedStates.delete(oldCodeBlockNode);
|
|
22
38
|
};
|
|
23
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Swap the old node key with the new node key in the fold states WeakMap.
|
|
42
|
+
*/
|
|
43
|
+
const transferCodeBlockFoldValue = (oldCodeBlockNode, newCodeBlockNode) => {
|
|
44
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
45
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
46
|
+
if (codeBlockFoldStates.has(newCodeBlockNode)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const previousValue = getCodeBlockFoldState(oldCodeBlockNode);
|
|
50
|
+
codeBlockFoldStates.set(newCodeBlockNode, previousValue);
|
|
51
|
+
codeBlockFoldStates.delete(oldCodeBlockNode);
|
|
52
|
+
};
|
|
53
|
+
|
|
24
54
|
/**
|
|
25
55
|
* As the code block node is used as the wrapped state key, there is instances where the node will be destroyed & recreated and is no longer a valid key.
|
|
26
56
|
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
@@ -28,6 +58,9 @@ export const transferCodeBlockWrappedValue = (oldCodeBlockNode, newCodeBlockNode
|
|
|
28
58
|
*/
|
|
29
59
|
export const updateCodeBlockWrappedStateNodeKeys = (newCodeBlockNodes, oldState) => {
|
|
30
60
|
newCodeBlockNodes.forEach(newCodeBlockNode => {
|
|
61
|
+
if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
|
|
62
|
+
updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
|
|
63
|
+
}
|
|
31
64
|
// Don't overwrite the value for the new node if it already exists.
|
|
32
65
|
// This can happen when a drag&drop is swapping nodes.
|
|
33
66
|
if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
|
|
@@ -45,4 +78,28 @@ export const updateCodeBlockWrappedStateNodeKeys = (newCodeBlockNodes, oldState)
|
|
|
45
78
|
const previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
46
79
|
codeBlockWrappedStates.set(newCodeBlockNode.node, previousValue);
|
|
47
80
|
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* As the code block node is used as the fold state key, there is instances where the node will be destroyed & recreated and is no longer a valid key.
|
|
85
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
86
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
87
|
+
*/
|
|
88
|
+
const updateCodeBlockFoldStateNodeKeys = (newCodeBlockNode, oldState) => {
|
|
89
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
90
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
91
|
+
if (codeBlockFoldStates.has(newCodeBlockNode.node)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Do not go out of range on the oldState doc. Happens on initial load.
|
|
96
|
+
if (oldState.doc.content.size <= newCodeBlockNode.pos) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const oldCodeBlockNode = oldState.doc.nodeAt(newCodeBlockNode.pos);
|
|
100
|
+
if (!oldCodeBlockNode || oldCodeBlockNode.type !== oldState.schema.nodes.codeBlock) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
const previousValue = getCodeBlockFoldState(oldCodeBlockNode);
|
|
104
|
+
codeBlockFoldStates.set(newCodeBlockNode.node, previousValue);
|
|
48
105
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isFedRamp } from './environment';
|
|
2
2
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
3
3
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
4
|
-
const packageVersion = "107.
|
|
4
|
+
const packageVersion = "107.29.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// Ignored via go/ees007
|
|
@@ -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 = "107.
|
|
17
|
+
const packageVersion = "107.29.0";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
2
2
|
|
|
3
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
3
4
|
export var defaultWordWrapState = false;
|
|
4
5
|
export var codeBlockWrappedStates = new WeakMap();
|
|
6
|
+
|
|
7
|
+
// Code folding state management - similar to word wrapping
|
|
8
|
+
|
|
9
|
+
var codeBlockFoldStates = new WeakMap();
|
|
5
10
|
export var isCodeBlockWordWrapEnabled = function isCodeBlockWordWrapEnabled(codeBlockNode) {
|
|
6
11
|
var currentNodeWordWrapState = codeBlockWrappedStates.get(codeBlockNode);
|
|
7
12
|
return currentNodeWordWrapState !== undefined ? currentNodeWordWrapState : defaultWordWrapState;
|
|
8
13
|
};
|
|
14
|
+
export var getCodeBlockFoldState = function getCodeBlockFoldState(codeBlockNode) {
|
|
15
|
+
var currentNodeFoldState = codeBlockFoldStates.get(codeBlockNode);
|
|
16
|
+
return currentNodeFoldState || [];
|
|
17
|
+
};
|
|
18
|
+
export var setCodeBlockFoldState = function setCodeBlockFoldState(codeBlockNode, foldRanges) {
|
|
19
|
+
codeBlockFoldStates.set(codeBlockNode, foldRanges);
|
|
20
|
+
};
|
|
9
21
|
|
|
10
22
|
/**
|
|
11
23
|
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
12
24
|
*/
|
|
13
25
|
export var transferCodeBlockWrappedValue = function transferCodeBlockWrappedValue(oldCodeBlockNode, newCodeBlockNode) {
|
|
26
|
+
if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
|
|
27
|
+
transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode);
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
// Don't overwrite the value for the new node if it already exists.
|
|
15
31
|
// This can happen when a drag&drop is swapping nodes.
|
|
16
32
|
if (codeBlockWrappedStates.has(newCodeBlockNode)) {
|
|
@@ -21,6 +37,20 @@ export var transferCodeBlockWrappedValue = function transferCodeBlockWrappedValu
|
|
|
21
37
|
codeBlockWrappedStates.delete(oldCodeBlockNode);
|
|
22
38
|
};
|
|
23
39
|
|
|
40
|
+
/**
|
|
41
|
+
* Swap the old node key with the new node key in the fold states WeakMap.
|
|
42
|
+
*/
|
|
43
|
+
var transferCodeBlockFoldValue = function transferCodeBlockFoldValue(oldCodeBlockNode, newCodeBlockNode) {
|
|
44
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
45
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
46
|
+
if (codeBlockFoldStates.has(newCodeBlockNode)) {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
var previousValue = getCodeBlockFoldState(oldCodeBlockNode);
|
|
50
|
+
codeBlockFoldStates.set(newCodeBlockNode, previousValue);
|
|
51
|
+
codeBlockFoldStates.delete(oldCodeBlockNode);
|
|
52
|
+
};
|
|
53
|
+
|
|
24
54
|
/**
|
|
25
55
|
* As the code block node is used as the wrapped state key, there is instances where the node will be destroyed & recreated and is no longer a valid key.
|
|
26
56
|
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
@@ -28,6 +58,9 @@ export var transferCodeBlockWrappedValue = function transferCodeBlockWrappedValu
|
|
|
28
58
|
*/
|
|
29
59
|
export var updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrappedStateNodeKeys(newCodeBlockNodes, oldState) {
|
|
30
60
|
newCodeBlockNodes.forEach(function (newCodeBlockNode) {
|
|
61
|
+
if (expValEquals('platform_editor_code_block_fold_gutter', 'isEnabled', true)) {
|
|
62
|
+
updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState);
|
|
63
|
+
}
|
|
31
64
|
// Don't overwrite the value for the new node if it already exists.
|
|
32
65
|
// This can happen when a drag&drop is swapping nodes.
|
|
33
66
|
if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
|
|
@@ -45,4 +78,28 @@ export var updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrapped
|
|
|
45
78
|
var previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
46
79
|
codeBlockWrappedStates.set(newCodeBlockNode.node, previousValue);
|
|
47
80
|
});
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* As the code block node is used as the fold state key, there is instances where the node will be destroyed & recreated and is no longer a valid key.
|
|
85
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
86
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
87
|
+
*/
|
|
88
|
+
var updateCodeBlockFoldStateNodeKeys = function updateCodeBlockFoldStateNodeKeys(newCodeBlockNode, oldState) {
|
|
89
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
90
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
91
|
+
if (codeBlockFoldStates.has(newCodeBlockNode.node)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Do not go out of range on the oldState doc. Happens on initial load.
|
|
96
|
+
if (oldState.doc.content.size <= newCodeBlockNode.pos) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
var oldCodeBlockNode = oldState.doc.nodeAt(newCodeBlockNode.pos);
|
|
100
|
+
if (!oldCodeBlockNode || oldCodeBlockNode.type !== oldState.schema.nodes.codeBlock) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
var previousValue = getCodeBlockFoldState(oldCodeBlockNode);
|
|
104
|
+
codeBlockFoldStates.set(newCodeBlockNode.node, previousValue);
|
|
48
105
|
};
|
|
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
7
7
|
import { isFedRamp } from './environment';
|
|
8
8
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
9
9
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
10
|
-
var packageVersion = "107.
|
|
10
|
+
var packageVersion = "107.29.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// Ignored via go/ees007
|
|
@@ -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 = "107.
|
|
24
|
+
var packageVersion = "107.29.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -3,7 +3,13 @@ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
export declare const defaultWordWrapState = false;
|
|
5
5
|
export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>;
|
|
6
|
+
export interface FoldRange {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
}
|
|
6
10
|
export declare const isCodeBlockWordWrapEnabled: (codeBlockNode: PmNode) => boolean;
|
|
11
|
+
export declare const getCodeBlockFoldState: (codeBlockNode: PmNode) => FoldRange[];
|
|
12
|
+
export declare const setCodeBlockFoldState: (codeBlockNode: PmNode, foldRanges: FoldRange[]) => void;
|
|
7
13
|
/**
|
|
8
14
|
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
9
15
|
*/
|
|
@@ -3,7 +3,13 @@ import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
|
3
3
|
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
4
4
|
export declare const defaultWordWrapState = false;
|
|
5
5
|
export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>;
|
|
6
|
+
export interface FoldRange {
|
|
7
|
+
from: number;
|
|
8
|
+
to: number;
|
|
9
|
+
}
|
|
6
10
|
export declare const isCodeBlockWordWrapEnabled: (codeBlockNode: PmNode) => boolean;
|
|
11
|
+
export declare const getCodeBlockFoldState: (codeBlockNode: PmNode) => FoldRange[];
|
|
12
|
+
export declare const setCodeBlockFoldState: (codeBlockNode: PmNode, foldRanges: FoldRange[]) => void;
|
|
7
13
|
/**
|
|
8
14
|
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
9
15
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "107.
|
|
3
|
+
"version": "107.30.0",
|
|
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/"
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
},
|
|
127
127
|
"dependencies": {
|
|
128
128
|
"@atlaskit/activity-provider": "^2.5.0",
|
|
129
|
-
"@atlaskit/adf-schema": "^50.2.
|
|
129
|
+
"@atlaskit/adf-schema": "^50.2.2",
|
|
130
130
|
"@atlaskit/adf-utils": "^19.21.0",
|
|
131
131
|
"@atlaskit/analytics-listeners": "^9.0.0",
|
|
132
132
|
"@atlaskit/analytics-namespaced-context": "^7.0.0",
|