@atlaskit/editor-common 88.8.1 → 88.8.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/code-block/index.js +34 -4
- package/dist/cjs/core-utils/index.js +8 -1
- package/dist/cjs/core-utils/is-ssr.js +20 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/ui/WidthProvider/index.js +2 -2
- package/dist/cjs/ui/WidthProvider/isSsrButNoBreakoutScriptObserved.js +2 -2
- package/dist/es2019/code-block/index.js +33 -3
- package/dist/es2019/core-utils/index.js +2 -1
- package/dist/es2019/core-utils/is-ssr.js +14 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/ui/WidthProvider/index.js +1 -1
- package/dist/es2019/ui/WidthProvider/isSsrButNoBreakoutScriptObserved.js +1 -1
- package/dist/esm/code-block/index.js +33 -3
- package/dist/esm/core-utils/index.js +2 -1
- package/dist/esm/core-utils/is-ssr.js +14 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/ui/WidthProvider/index.js +1 -1
- package/dist/esm/ui/WidthProvider/isSsrButNoBreakoutScriptObserved.js +1 -1
- package/dist/types/code-block/index.d.ts +10 -2
- package/dist/types/core-utils/index.d.ts +1 -0
- package/dist/types-ts4.5/code-block/index.d.ts +10 -2
- package/dist/types-ts4.5/core-utils/index.d.ts +1 -0
- package/package.json +7 -4
- package/dist/cjs/ui/WidthProvider/isSSR.js +0 -15
- package/dist/es2019/ui/WidthProvider/isSSR.js +0 -9
- package/dist/esm/ui/WidthProvider/isSSR.js +0 -9
- /package/dist/types/{ui/WidthProvider/isSSR.d.ts → core-utils/is-ssr.d.ts} +0 -0
- /package/dist/types-ts4.5/{ui/WidthProvider/isSSR.d.ts → core-utils/is-ssr.d.ts} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 88.8.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#137244](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137244)
|
|
8
|
+
[`e6f32d1f22896`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e6f32d1f22896) -
|
|
9
|
+
Control show or hide editor toolbar in SSR environment
|
|
10
|
+
- [#136871](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136871)
|
|
11
|
+
[`87a30d5cb3ffb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/87a30d5cb3ffb) -
|
|
12
|
+
ED-24814 - Addressing a bug where changing the language on a wrapped code block caused the wrapped
|
|
13
|
+
decorator to disappear. Required changing the sequence in which we update the keys on the wrapped
|
|
14
|
+
states WeakMap. Due to the amount of changes, it has all be placed behind a bug fix feature gate
|
|
15
|
+
(editor_code_block_wrapping_language_change_bug) and the original feature gate
|
|
16
|
+
(editor_support_code_block_wrapping).
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
3
19
|
## 88.8.1
|
|
4
20
|
|
|
5
21
|
### Patch Changes
|
|
@@ -3,8 +3,10 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.transferCodeBlockWrappedValue = exports.isCodeBlockWordWrapEnabled = exports.defaultWordWrapState = exports.codeBlockWrappedStates = void 0;
|
|
6
|
+
exports.updateCodeBlockWrappedStateNodeKeys = exports.transferCodeBlockWrappedValue = exports.isCodeBlockWordWrapEnabled = exports.defaultWordWrapState = exports.codeBlockWrappedStates = void 0;
|
|
7
7
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
8
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
9
|
+
|
|
8
10
|
var defaultWordWrapState = exports.defaultWordWrapState = false;
|
|
9
11
|
var codeBlockWrappedStates = exports.codeBlockWrappedStates = new WeakMap();
|
|
10
12
|
var isCodeBlockWordWrapEnabled = exports.isCodeBlockWordWrapEnabled = function isCodeBlockWordWrapEnabled(codeBlockNode) {
|
|
@@ -16,14 +18,13 @@ var isCodeBlockWordWrapEnabled = exports.isCodeBlockWordWrapEnabled = function i
|
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
/**
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
+
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
22
|
+
* Replaced with updateCodeBlockWrappedStateNodeKeys() under 'editor_code_block_wrapping_language_change_bug' feature gate.
|
|
21
23
|
*/
|
|
22
24
|
var transferCodeBlockWrappedValue = exports.transferCodeBlockWrappedValue = function transferCodeBlockWrappedValue(oldCodeBlockNode, newCodeBlockNode) {
|
|
23
25
|
if (!(0, _platformFeatureFlags.fg)('editor_support_code_block_wrapping')) {
|
|
24
26
|
return;
|
|
25
27
|
}
|
|
26
|
-
|
|
27
28
|
// Don't overwrite the value for the new node if it already exists.
|
|
28
29
|
// This can happen when a drag&drop is swapping nodes.
|
|
29
30
|
if (codeBlockWrappedStates.has(newCodeBlockNode)) {
|
|
@@ -32,4 +33,33 @@ var transferCodeBlockWrappedValue = exports.transferCodeBlockWrappedValue = func
|
|
|
32
33
|
var previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
33
34
|
codeBlockWrappedStates.set(newCodeBlockNode, previousValue);
|
|
34
35
|
codeBlockWrappedStates.delete(oldCodeBlockNode);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 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.
|
|
40
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
41
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
42
|
+
*/
|
|
43
|
+
var updateCodeBlockWrappedStateNodeKeys = exports.updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrappedStateNodeKeys(newCodeBlockNodes, oldState) {
|
|
44
|
+
if (!(0, _platformFeatureFlags.fg)('editor_support_code_block_wrapping') || !(0, _platformFeatureFlags.fg)('editor_code_block_wrapping_language_change_bug')) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
newCodeBlockNodes.forEach(function (newCodeBlockNode) {
|
|
48
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
49
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
50
|
+
if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Do not go out of range on the oldState doc. Happens on initial load.
|
|
55
|
+
if (oldState.doc.nodeSize <= newCodeBlockNode.pos) {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
var oldCodeBlockNode = oldState.doc.nodeAt(newCodeBlockNode.pos);
|
|
59
|
+
if (!oldCodeBlockNode || oldCodeBlockNode.type !== oldState.schema.nodes.codeBlock) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
var previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
63
|
+
codeBlockWrappedStates.set(newCodeBlockNode.node, previousValue);
|
|
64
|
+
});
|
|
35
65
|
};
|
|
@@ -15,5 +15,12 @@ Object.defineProperty(exports, "insideTable", {
|
|
|
15
15
|
return _inside.insideTable;
|
|
16
16
|
}
|
|
17
17
|
});
|
|
18
|
+
Object.defineProperty(exports, "isSSR", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function get() {
|
|
21
|
+
return _isSsr.isSSR;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
18
24
|
var _inside = require("./inside");
|
|
19
|
-
var _documentLogger = require("./document-logger");
|
|
25
|
+
var _documentLogger = require("./document-logger");
|
|
26
|
+
var _isSsr = require("./is-ssr");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.isSSR = isSSR;
|
|
7
|
+
function isSSR() {
|
|
8
|
+
try {
|
|
9
|
+
var _process;
|
|
10
|
+
return Boolean(
|
|
11
|
+
// In most places there is no document when running on server-side
|
|
12
|
+
typeof document === 'undefined' ||
|
|
13
|
+
// When SSRing editor with full cycle mode we define the document
|
|
14
|
+
// Check Confluence specific environment variable
|
|
15
|
+
typeof process !== 'undefined' && ((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR));
|
|
16
|
+
} catch (e) {
|
|
17
|
+
// Catch possible error that might occur and just return false
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
|
|
|
17
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
18
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
19
19
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
20
|
-
var packageVersion = "88.8.
|
|
20
|
+
var packageVersion = "88.8.2";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -25,7 +25,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
25
25
|
* @jsx jsx
|
|
26
26
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
27
27
|
var packageName = "@atlaskit/editor-common";
|
|
28
|
-
var packageVersion = "88.8.
|
|
28
|
+
var packageVersion = "88.8.2";
|
|
29
29
|
var halfFocusRing = 1;
|
|
30
30
|
var dropOffset = '0, 8';
|
|
31
31
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -16,7 +16,7 @@ var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
|
16
16
|
var _rafSchd = _interopRequireDefault(require("raf-schd"));
|
|
17
17
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
18
18
|
var _widthDetector = require("@atlaskit/width-detector");
|
|
19
|
-
var
|
|
19
|
+
var _isSsr = require("../../core-utils/is-ssr");
|
|
20
20
|
var _isSsrButNoBreakoutScriptObserved = require("./isSsrButNoBreakoutScriptObserved");
|
|
21
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -67,7 +67,7 @@ var Provider = WidthContext.Provider,
|
|
|
67
67
|
*/
|
|
68
68
|
var getBodyWidth = exports.getBodyWidth = (0, _memoizeOne.default)(function () {
|
|
69
69
|
var _document$body$offset, _document$body;
|
|
70
|
-
return (0,
|
|
70
|
+
return (0, _isSsr.isSSR)() ? 0 : (_document$body$offset = (_document$body = document.body) === null || _document$body === void 0 ? void 0 : _document$body.offsetWidth) !== null && _document$body$offset !== void 0 ? _document$body$offset : 0;
|
|
71
71
|
});
|
|
72
72
|
var WidthProvider = exports.WidthProvider = function WidthProvider(_ref) {
|
|
73
73
|
var className = _ref.className,
|
|
@@ -4,8 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.isSsrButNoBreakoutScriptObserved = isSsrButNoBreakoutScriptObserved;
|
|
7
|
-
var
|
|
7
|
+
var _isSsr = require("../../core-utils/is-ssr");
|
|
8
8
|
// export for testing
|
|
9
9
|
function isSsrButNoBreakoutScriptObserved() {
|
|
10
|
-
return (0,
|
|
10
|
+
return (0, _isSsr.isSSR)() && !window.__SSR_BREAKOUT_OBSERVED;
|
|
11
11
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
2
|
+
|
|
1
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export const defaultWordWrapState = false;
|
|
3
5
|
export const codeBlockWrappedStates = new WeakMap();
|
|
@@ -10,14 +12,13 @@ export const isCodeBlockWordWrapEnabled = codeBlockNode => {
|
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
16
|
+
* Replaced with updateCodeBlockWrappedStateNodeKeys() under 'editor_code_block_wrapping_language_change_bug' feature gate.
|
|
15
17
|
*/
|
|
16
18
|
export const transferCodeBlockWrappedValue = (oldCodeBlockNode, newCodeBlockNode) => {
|
|
17
19
|
if (!fg('editor_support_code_block_wrapping')) {
|
|
18
20
|
return;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
22
|
// Don't overwrite the value for the new node if it already exists.
|
|
22
23
|
// This can happen when a drag&drop is swapping nodes.
|
|
23
24
|
if (codeBlockWrappedStates.has(newCodeBlockNode)) {
|
|
@@ -26,4 +27,33 @@ export const transferCodeBlockWrappedValue = (oldCodeBlockNode, newCodeBlockNode
|
|
|
26
27
|
const previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
27
28
|
codeBlockWrappedStates.set(newCodeBlockNode, previousValue);
|
|
28
29
|
codeBlockWrappedStates.delete(oldCodeBlockNode);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 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.
|
|
34
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
35
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
36
|
+
*/
|
|
37
|
+
export const updateCodeBlockWrappedStateNodeKeys = (newCodeBlockNodes, oldState) => {
|
|
38
|
+
if (!fg('editor_support_code_block_wrapping') || !fg('editor_code_block_wrapping_language_change_bug')) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
newCodeBlockNodes.forEach(newCodeBlockNode => {
|
|
42
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
43
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
44
|
+
if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Do not go out of range on the oldState doc. Happens on initial load.
|
|
49
|
+
if (oldState.doc.nodeSize <= newCodeBlockNode.pos) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
const oldCodeBlockNode = oldState.doc.nodeAt(newCodeBlockNode.pos);
|
|
53
|
+
if (!oldCodeBlockNode || oldCodeBlockNode.type !== oldState.schema.nodes.codeBlock) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
57
|
+
codeBlockWrappedStates.set(newCodeBlockNode.node, previousValue);
|
|
58
|
+
});
|
|
29
59
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function isSSR() {
|
|
2
|
+
try {
|
|
3
|
+
var _process, _process$env;
|
|
4
|
+
return Boolean(
|
|
5
|
+
// In most places there is no document when running on server-side
|
|
6
|
+
typeof document === 'undefined' ||
|
|
7
|
+
// When SSRing editor with full cycle mode we define the document
|
|
8
|
+
// Check Confluence specific environment variable
|
|
9
|
+
typeof process !== 'undefined' && ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.REACT_SSR));
|
|
10
|
+
} catch (e) {
|
|
11
|
+
// Catch possible error that might occur and just return false
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -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 = "88.8.
|
|
4
|
+
const packageVersion = "88.8.2";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "88.8.
|
|
17
|
+
const packageVersion = "88.8.2";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
class DropList extends Component {
|
|
@@ -10,7 +10,7 @@ import memoizeOne from 'memoize-one';
|
|
|
10
10
|
import rafSchedule from 'raf-schd';
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
12
12
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
13
|
-
import { isSSR } from '
|
|
13
|
+
import { isSSR } from '../../core-utils/is-ssr';
|
|
14
14
|
import { isSsrButNoBreakoutScriptObserved } from './isSsrButNoBreakoutScriptObserved';
|
|
15
15
|
const styles = css({
|
|
16
16
|
position: 'relative',
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/* eslint-disable @atlaskit/platform/ensure-feature-flag-prefix */
|
|
2
|
+
|
|
1
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
2
4
|
export var defaultWordWrapState = false;
|
|
3
5
|
export var codeBlockWrappedStates = new WeakMap();
|
|
@@ -10,14 +12,13 @@ export var isCodeBlockWordWrapEnabled = function isCodeBlockWordWrapEnabled(code
|
|
|
10
12
|
};
|
|
11
13
|
|
|
12
14
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
+
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
16
|
+
* Replaced with updateCodeBlockWrappedStateNodeKeys() under 'editor_code_block_wrapping_language_change_bug' feature gate.
|
|
15
17
|
*/
|
|
16
18
|
export var transferCodeBlockWrappedValue = function transferCodeBlockWrappedValue(oldCodeBlockNode, newCodeBlockNode) {
|
|
17
19
|
if (!fg('editor_support_code_block_wrapping')) {
|
|
18
20
|
return;
|
|
19
21
|
}
|
|
20
|
-
|
|
21
22
|
// Don't overwrite the value for the new node if it already exists.
|
|
22
23
|
// This can happen when a drag&drop is swapping nodes.
|
|
23
24
|
if (codeBlockWrappedStates.has(newCodeBlockNode)) {
|
|
@@ -26,4 +27,33 @@ export var transferCodeBlockWrappedValue = function transferCodeBlockWrappedValu
|
|
|
26
27
|
var previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
27
28
|
codeBlockWrappedStates.set(newCodeBlockNode, previousValue);
|
|
28
29
|
codeBlockWrappedStates.delete(oldCodeBlockNode);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 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.
|
|
34
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
35
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
36
|
+
*/
|
|
37
|
+
export var updateCodeBlockWrappedStateNodeKeys = function updateCodeBlockWrappedStateNodeKeys(newCodeBlockNodes, oldState) {
|
|
38
|
+
if (!fg('editor_support_code_block_wrapping') || !fg('editor_code_block_wrapping_language_change_bug')) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
newCodeBlockNodes.forEach(function (newCodeBlockNode) {
|
|
42
|
+
// Don't overwrite the value for the new node if it already exists.
|
|
43
|
+
// This can happen when a drag&drop is swapping nodes.
|
|
44
|
+
if (codeBlockWrappedStates.has(newCodeBlockNode.node)) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Do not go out of range on the oldState doc. Happens on initial load.
|
|
49
|
+
if (oldState.doc.nodeSize <= newCodeBlockNode.pos) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
var oldCodeBlockNode = oldState.doc.nodeAt(newCodeBlockNode.pos);
|
|
53
|
+
if (!oldCodeBlockNode || oldCodeBlockNode.type !== oldState.schema.nodes.codeBlock) {
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
var previousValue = isCodeBlockWordWrapEnabled(oldCodeBlockNode);
|
|
57
|
+
codeBlockWrappedStates.set(newCodeBlockNode.node, previousValue);
|
|
58
|
+
});
|
|
29
59
|
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export function isSSR() {
|
|
2
|
+
try {
|
|
3
|
+
var _process;
|
|
4
|
+
return Boolean(
|
|
5
|
+
// In most places there is no document when running on server-side
|
|
6
|
+
typeof document === 'undefined' ||
|
|
7
|
+
// When SSRing editor with full cycle mode we define the document
|
|
8
|
+
// Check Confluence specific environment variable
|
|
9
|
+
typeof process !== 'undefined' && ((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR));
|
|
10
|
+
} catch (e) {
|
|
11
|
+
// Catch possible error that might occur and just return false
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -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 = "88.8.
|
|
10
|
+
var packageVersion = "88.8.2";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -22,7 +22,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
22
22
|
import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
|
|
23
23
|
import Layer from '../Layer';
|
|
24
24
|
var packageName = "@atlaskit/editor-common";
|
|
25
|
-
var packageVersion = "88.8.
|
|
25
|
+
var packageVersion = "88.8.2";
|
|
26
26
|
var halfFocusRing = 1;
|
|
27
27
|
var dropOffset = '0, 8';
|
|
28
28
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -11,7 +11,7 @@ import memoizeOne from 'memoize-one';
|
|
|
11
11
|
import rafSchedule from 'raf-schd';
|
|
12
12
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
13
13
|
import { WidthObserver } from '@atlaskit/width-detector';
|
|
14
|
-
import { isSSR } from '
|
|
14
|
+
import { isSSR } from '../../core-utils/is-ssr';
|
|
15
15
|
import { isSsrButNoBreakoutScriptObserved } from './isSsrButNoBreakoutScriptObserved';
|
|
16
16
|
var styles = css({
|
|
17
17
|
position: 'relative',
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
4
|
export declare const defaultWordWrapState = false;
|
|
3
5
|
export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>;
|
|
4
6
|
export declare const isCodeBlockWordWrapEnabled: (codeBlockNode: PmNode) => boolean;
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
9
|
+
* Replaced with updateCodeBlockWrappedStateNodeKeys() under 'editor_code_block_wrapping_language_change_bug' feature gate.
|
|
8
10
|
*/
|
|
9
11
|
export declare const transferCodeBlockWrappedValue: (oldCodeBlockNode: PmNode, newCodeBlockNode: PmNode) => void;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
15
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
16
|
+
*/
|
|
17
|
+
export declare const updateCodeBlockWrappedStateNodeKeys: (newCodeBlockNodes: NodeWithPos[], oldState: EditorState) => void;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import type { Node as PmNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
import { type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
|
+
import { type NodeWithPos } from '@atlaskit/editor-prosemirror/utils';
|
|
2
4
|
export declare const defaultWordWrapState = false;
|
|
3
5
|
export declare const codeBlockWrappedStates: WeakMap<PmNode, boolean | undefined>;
|
|
4
6
|
export declare const isCodeBlockWordWrapEnabled: (codeBlockNode: PmNode) => boolean;
|
|
5
7
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
+
* Swap the old node key with the new node key in the wrapped states WeakMap.
|
|
9
|
+
* Replaced with updateCodeBlockWrappedStateNodeKeys() under 'editor_code_block_wrapping_language_change_bug' feature gate.
|
|
8
10
|
*/
|
|
9
11
|
export declare const transferCodeBlockWrappedValue: (oldCodeBlockNode: PmNode, newCodeBlockNode: PmNode) => void;
|
|
12
|
+
/**
|
|
13
|
+
* 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.
|
|
14
|
+
* In these instances, we must get the value from that old node and set it to the value of the new node.
|
|
15
|
+
* This function takes all the given nodes, finds their old nodes from the old state and updates these old node keys.
|
|
16
|
+
*/
|
|
17
|
+
export declare const updateCodeBlockWrappedStateNodeKeys: (newCodeBlockNodes: NodeWithPos[], oldState: EditorState) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "88.8.
|
|
3
|
+
"version": "88.8.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/"
|
|
@@ -119,7 +119,7 @@
|
|
|
119
119
|
"@atlaskit/emoji": "^67.7.0",
|
|
120
120
|
"@atlaskit/icon": "^22.15.0",
|
|
121
121
|
"@atlaskit/icon-object": "^6.5.0",
|
|
122
|
-
"@atlaskit/link-datasource": "^2.
|
|
122
|
+
"@atlaskit/link-datasource": "^2.12.0",
|
|
123
123
|
"@atlaskit/link-picker": "^1.45.0",
|
|
124
124
|
"@atlaskit/media-card": "^78.2.0",
|
|
125
125
|
"@atlaskit/media-client": "^27.6.0",
|
|
@@ -133,9 +133,9 @@
|
|
|
133
133
|
"@atlaskit/menu": "^2.12.0",
|
|
134
134
|
"@atlaskit/platform-feature-flags": "^0.3.0",
|
|
135
135
|
"@atlaskit/primitives": "^12.1.0",
|
|
136
|
-
"@atlaskit/profilecard": "^19.
|
|
136
|
+
"@atlaskit/profilecard": "^19.26.0",
|
|
137
137
|
"@atlaskit/section-message": "^6.6.0",
|
|
138
|
-
"@atlaskit/smart-card": "^27.
|
|
138
|
+
"@atlaskit/smart-card": "^27.20.0",
|
|
139
139
|
"@atlaskit/smart-user-picker": "^6.10.0",
|
|
140
140
|
"@atlaskit/spinner": "^16.3.0",
|
|
141
141
|
"@atlaskit/task-decision": "^17.10.0",
|
|
@@ -256,6 +256,9 @@
|
|
|
256
256
|
"editor_support_code_block_wrapping": {
|
|
257
257
|
"type": "boolean"
|
|
258
258
|
},
|
|
259
|
+
"editor_code_block_wrapping_language_change_bug": {
|
|
260
|
+
"type": "boolean"
|
|
261
|
+
},
|
|
259
262
|
"cc_page_experiences_live_search_wysiwyg": {
|
|
260
263
|
"type": "boolean"
|
|
261
264
|
},
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.isSSR = isSSR;
|
|
7
|
-
function isSSR() {
|
|
8
|
-
var _process;
|
|
9
|
-
return Boolean(
|
|
10
|
-
// In most places there is no document when running on server-side
|
|
11
|
-
typeof document === 'undefined' ||
|
|
12
|
-
// When SSRing editor with full cycle mode we define the document
|
|
13
|
-
// Check Confluence specific environment variable
|
|
14
|
-
typeof process !== 'undefined' && ((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR));
|
|
15
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export function isSSR() {
|
|
2
|
-
var _process, _process$env;
|
|
3
|
-
return Boolean(
|
|
4
|
-
// In most places there is no document when running on server-side
|
|
5
|
-
typeof document === 'undefined' ||
|
|
6
|
-
// When SSRing editor with full cycle mode we define the document
|
|
7
|
-
// Check Confluence specific environment variable
|
|
8
|
-
typeof process !== 'undefined' && ((_process = process) === null || _process === void 0 ? void 0 : (_process$env = _process.env) === null || _process$env === void 0 ? void 0 : _process$env.REACT_SSR));
|
|
9
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
export function isSSR() {
|
|
2
|
-
var _process;
|
|
3
|
-
return Boolean(
|
|
4
|
-
// In most places there is no document when running on server-side
|
|
5
|
-
typeof document === 'undefined' ||
|
|
6
|
-
// When SSRing editor with full cycle mode we define the document
|
|
7
|
-
// Check Confluence specific environment variable
|
|
8
|
-
typeof process !== 'undefined' && ((_process = process) === null || _process === void 0 || (_process = _process.env) === null || _process === void 0 ? void 0 : _process.REACT_SSR));
|
|
9
|
-
}
|
|
File without changes
|
|
File without changes
|