@atlaskit/editor-common 88.8.1 → 88.8.3
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 +24 -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/lazy-node-view/index.js +3 -3
- package/dist/cjs/lazy-node-view/node-view.js +24 -10
- 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/lazy-node-view/index.js +3 -3
- package/dist/es2019/lazy-node-view/node-view.js +24 -10
- 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/lazy-node-view/index.js +3 -3
- package/dist/esm/lazy-node-view/node-view.js +24 -10
- 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/lazy-node-view/index.d.ts +1 -1
- package/dist/types/lazy-node-view/node-view.d.ts +4 -4
- 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/dist/types-ts4.5/lazy-node-view/index.d.ts +1 -1
- package/dist/types-ts4.5/lazy-node-view/node-view.d.ts +4 -4
- 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,29 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 88.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#136760](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136760)
|
|
8
|
+
[`39e4b9c90b284`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/39e4b9c90b284) -
|
|
9
|
+
LazyNodeView update method to compare decorations
|
|
10
|
+
|
|
11
|
+
## 88.8.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- [#137244](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/137244)
|
|
16
|
+
[`e6f32d1f22896`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e6f32d1f22896) -
|
|
17
|
+
Control show or hide editor toolbar in SSR environment
|
|
18
|
+
- [#136871](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/136871)
|
|
19
|
+
[`87a30d5cb3ffb`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/87a30d5cb3ffb) -
|
|
20
|
+
ED-24814 - Addressing a bug where changing the language on a wrapped code block caused the wrapped
|
|
21
|
+
decorator to disappear. Required changing the sequence in which we update the keys on the wrapped
|
|
22
|
+
states WeakMap. Due to the amount of changes, it has all be placed behind a bug fix feature gate
|
|
23
|
+
(editor_code_block_wrapping_language_change_bug) and the original feature gate
|
|
24
|
+
(editor_support_code_block_wrapping).
|
|
25
|
+
- Updated dependencies
|
|
26
|
+
|
|
3
27
|
## 88.8.1
|
|
4
28
|
|
|
5
29
|
### 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
|
+
}
|
|
@@ -70,7 +70,7 @@ var testOnlyIgnoreLazyNodeViewSet = new WeakSet();
|
|
|
70
70
|
*
|
|
71
71
|
* This needs to be replaced with proper implementation once LazyNodeView is converted to a plugin.
|
|
72
72
|
*
|
|
73
|
-
* @deprecated DO NOT USE THIS
|
|
73
|
+
* @deprecated DO NOT USE THIS OUTSIDE TESTS.
|
|
74
74
|
*/
|
|
75
75
|
function testOnlyIgnoreLazyNodeView(view) {
|
|
76
76
|
testOnlyIgnoreLazyNodeViewSet.add(view);
|
|
@@ -137,7 +137,7 @@ var withLazyLoading = exports.withLazyLoading = function withLazyLoading(_ref) {
|
|
|
137
137
|
if (resolvedNodeView && !testOnlyIgnoreLazyNodeViewSet.has(view)) {
|
|
138
138
|
return resolvedNodeView(node, view, getPos, decorations);
|
|
139
139
|
}
|
|
140
|
-
return new _nodeView.LazyNodeView(node, view, getPos,
|
|
140
|
+
return new _nodeView.LazyNodeView(node, view, getPos, decorations);
|
|
141
141
|
}
|
|
142
142
|
var loaderPromise = loader().then(function (nodeViewFuncModule) {
|
|
143
143
|
var _resolvedNodesPerEdit;
|
|
@@ -187,7 +187,7 @@ var withLazyLoading = exports.withLazyLoading = function withLazyLoading(_ref) {
|
|
|
187
187
|
// },
|
|
188
188
|
// });
|
|
189
189
|
}
|
|
190
|
-
return new _nodeView.LazyNodeView(node, view, getPos,
|
|
190
|
+
return new _nodeView.LazyNodeView(node, view, getPos, decorations);
|
|
191
191
|
};
|
|
192
192
|
return createLazyNodeView;
|
|
193
193
|
};
|
|
@@ -15,23 +15,40 @@ var getEditorLineWidth = (0, _memoize.default)(function (view) {
|
|
|
15
15
|
return (_view$dom = view.dom) === null || _view$dom === void 0 ? void 0 : _view$dom.clientWidth;
|
|
16
16
|
});
|
|
17
17
|
|
|
18
|
+
// Copied from ProseMirror NodeView
|
|
19
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/cfa73eb969777f63bcb39972594fd4a9110f5a93/src/viewdesc.ts#L1095-L1099
|
|
20
|
+
function sameOuterDeco(a, b) {
|
|
21
|
+
if (a.length !== b.length) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
for (var i = 0; i < a.length; i++) {
|
|
25
|
+
// @ts-expect-error type actually exist on decoration at runtime
|
|
26
|
+
if (!a[i].type) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// @ts-expect-error type actually exist on decoration at runtime
|
|
31
|
+
if (!a[i].type.eq(b[i].type)) {
|
|
32
|
+
return false;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
|
|
18
38
|
/**
|
|
19
39
|
* 🧱 Internal: Editor FE Platform
|
|
20
40
|
*
|
|
21
41
|
* A NodeView that serves as a placeholder until the actual NodeView is loaded.
|
|
22
42
|
*/
|
|
23
43
|
var LazyNodeView = exports.LazyNodeView = /*#__PURE__*/function () {
|
|
24
|
-
function LazyNodeView(_node, view, _getPos,
|
|
44
|
+
function LazyNodeView(_node, view, _getPos, _outerDeco) {
|
|
25
45
|
var _this = this,
|
|
26
46
|
_node$type;
|
|
27
47
|
(0, _classCallCheck2.default)(this, LazyNodeView);
|
|
28
|
-
(0, _defineProperty2.default)(this, "update", function (node) {
|
|
48
|
+
(0, _defineProperty2.default)(this, "update", function (node, outerDeco) {
|
|
29
49
|
var prevNode = _this.node;
|
|
30
50
|
_this.node = node;
|
|
31
|
-
|
|
32
|
-
// Forcing NodeView to be re-created
|
|
33
|
-
// so that ProseMirror can replace LazyNodeView with the real one.
|
|
34
|
-
if (_this.isNodeViewLoaded) {
|
|
51
|
+
if (!sameOuterDeco(outerDeco, _this.outerDeco)) {
|
|
35
52
|
return false;
|
|
36
53
|
}
|
|
37
54
|
|
|
@@ -40,7 +57,7 @@ var LazyNodeView = exports.LazyNodeView = /*#__PURE__*/function () {
|
|
|
40
57
|
return !_this.node.sameMarkup(prevNode);
|
|
41
58
|
});
|
|
42
59
|
this.node = _node;
|
|
43
|
-
this.
|
|
60
|
+
this.outerDeco = _outerDeco;
|
|
44
61
|
if (typeof ((_node$type = _node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.toDOM) !== 'function') {
|
|
45
62
|
this.dom = document.createElement('div');
|
|
46
63
|
return;
|
|
@@ -63,9 +80,6 @@ var LazyNodeView = exports.LazyNodeView = /*#__PURE__*/function () {
|
|
|
63
80
|
// before the test started
|
|
64
81
|
this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
|
|
65
82
|
}
|
|
66
|
-
nodeViewLoader.then(function () {
|
|
67
|
-
_this.isNodeViewLoaded = true;
|
|
68
|
-
});
|
|
69
83
|
}
|
|
70
84
|
(0, _createClass2.default)(LazyNodeView, [{
|
|
71
85
|
key: "ignoreMutation",
|
|
@@ -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.3";
|
|
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.3";
|
|
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
|
+
}
|
|
@@ -54,7 +54,7 @@ const testOnlyIgnoreLazyNodeViewSet = new WeakSet();
|
|
|
54
54
|
*
|
|
55
55
|
* This needs to be replaced with proper implementation once LazyNodeView is converted to a plugin.
|
|
56
56
|
*
|
|
57
|
-
* @deprecated DO NOT USE THIS
|
|
57
|
+
* @deprecated DO NOT USE THIS OUTSIDE TESTS.
|
|
58
58
|
*/
|
|
59
59
|
export function testOnlyIgnoreLazyNodeView(view) {
|
|
60
60
|
testOnlyIgnoreLazyNodeViewSet.add(view);
|
|
@@ -122,7 +122,7 @@ export const withLazyLoading = ({
|
|
|
122
122
|
if (resolvedNodeView && !testOnlyIgnoreLazyNodeViewSet.has(view)) {
|
|
123
123
|
return resolvedNodeView(node, view, getPos, decorations);
|
|
124
124
|
}
|
|
125
|
-
return new LazyNodeView(node, view, getPos,
|
|
125
|
+
return new LazyNodeView(node, view, getPos, decorations);
|
|
126
126
|
}
|
|
127
127
|
const loaderPromise = loader().then(nodeViewFuncModule => {
|
|
128
128
|
var _resolvedNodesPerEdit;
|
|
@@ -169,7 +169,7 @@ export const withLazyLoading = ({
|
|
|
169
169
|
// },
|
|
170
170
|
// });
|
|
171
171
|
}
|
|
172
|
-
return new LazyNodeView(node, view, getPos,
|
|
172
|
+
return new LazyNodeView(node, view, getPos, decorations);
|
|
173
173
|
};
|
|
174
174
|
return createLazyNodeView;
|
|
175
175
|
};
|
|
@@ -6,21 +6,38 @@ const getEditorLineWidth = memoize(view => {
|
|
|
6
6
|
return (_view$dom = view.dom) === null || _view$dom === void 0 ? void 0 : _view$dom.clientWidth;
|
|
7
7
|
});
|
|
8
8
|
|
|
9
|
+
// Copied from ProseMirror NodeView
|
|
10
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/cfa73eb969777f63bcb39972594fd4a9110f5a93/src/viewdesc.ts#L1095-L1099
|
|
11
|
+
function sameOuterDeco(a, b) {
|
|
12
|
+
if (a.length !== b.length) {
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
for (let i = 0; i < a.length; i++) {
|
|
16
|
+
// @ts-expect-error type actually exist on decoration at runtime
|
|
17
|
+
if (!a[i].type) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
// @ts-expect-error type actually exist on decoration at runtime
|
|
22
|
+
if (!a[i].type.eq(b[i].type)) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
|
|
9
29
|
/**
|
|
10
30
|
* 🧱 Internal: Editor FE Platform
|
|
11
31
|
*
|
|
12
32
|
* A NodeView that serves as a placeholder until the actual NodeView is loaded.
|
|
13
33
|
*/
|
|
14
34
|
export class LazyNodeView {
|
|
15
|
-
constructor(_node, view, _getPos,
|
|
35
|
+
constructor(_node, view, _getPos, _outerDeco) {
|
|
16
36
|
var _node$type, _node$type$spec;
|
|
17
|
-
_defineProperty(this, "update", node => {
|
|
37
|
+
_defineProperty(this, "update", (node, outerDeco) => {
|
|
18
38
|
const prevNode = this.node;
|
|
19
39
|
this.node = node;
|
|
20
|
-
|
|
21
|
-
// Forcing NodeView to be re-created
|
|
22
|
-
// so that ProseMirror can replace LazyNodeView with the real one.
|
|
23
|
-
if (this.isNodeViewLoaded) {
|
|
40
|
+
if (!sameOuterDeco(outerDeco, this.outerDeco)) {
|
|
24
41
|
return false;
|
|
25
42
|
}
|
|
26
43
|
|
|
@@ -29,7 +46,7 @@ export class LazyNodeView {
|
|
|
29
46
|
return !this.node.sameMarkup(prevNode);
|
|
30
47
|
});
|
|
31
48
|
this.node = _node;
|
|
32
|
-
this.
|
|
49
|
+
this.outerDeco = _outerDeco;
|
|
33
50
|
if (typeof ((_node$type = _node.type) === null || _node$type === void 0 ? void 0 : (_node$type$spec = _node$type.spec) === null || _node$type$spec === void 0 ? void 0 : _node$type$spec.toDOM) !== 'function') {
|
|
34
51
|
this.dom = document.createElement('div');
|
|
35
52
|
return;
|
|
@@ -52,9 +69,6 @@ export class LazyNodeView {
|
|
|
52
69
|
// before the test started
|
|
53
70
|
this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
|
|
54
71
|
}
|
|
55
|
-
nodeViewLoader.then(() => {
|
|
56
|
-
this.isNodeViewLoaded = true;
|
|
57
|
-
});
|
|
58
72
|
}
|
|
59
73
|
ignoreMutation() {
|
|
60
74
|
if (this.node.type.isTextblock) {
|
|
@@ -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.3";
|
|
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.3";
|
|
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
|
+
}
|
|
@@ -55,7 +55,7 @@ var testOnlyIgnoreLazyNodeViewSet = new WeakSet();
|
|
|
55
55
|
*
|
|
56
56
|
* This needs to be replaced with proper implementation once LazyNodeView is converted to a plugin.
|
|
57
57
|
*
|
|
58
|
-
* @deprecated DO NOT USE THIS
|
|
58
|
+
* @deprecated DO NOT USE THIS OUTSIDE TESTS.
|
|
59
59
|
*/
|
|
60
60
|
export function testOnlyIgnoreLazyNodeView(view) {
|
|
61
61
|
testOnlyIgnoreLazyNodeViewSet.add(view);
|
|
@@ -122,7 +122,7 @@ export var withLazyLoading = function withLazyLoading(_ref) {
|
|
|
122
122
|
if (resolvedNodeView && !testOnlyIgnoreLazyNodeViewSet.has(view)) {
|
|
123
123
|
return resolvedNodeView(node, view, getPos, decorations);
|
|
124
124
|
}
|
|
125
|
-
return new LazyNodeView(node, view, getPos,
|
|
125
|
+
return new LazyNodeView(node, view, getPos, decorations);
|
|
126
126
|
}
|
|
127
127
|
var loaderPromise = loader().then(function (nodeViewFuncModule) {
|
|
128
128
|
var _resolvedNodesPerEdit;
|
|
@@ -172,7 +172,7 @@ export var withLazyLoading = function withLazyLoading(_ref) {
|
|
|
172
172
|
// },
|
|
173
173
|
// });
|
|
174
174
|
}
|
|
175
|
-
return new LazyNodeView(node, view, getPos,
|
|
175
|
+
return new LazyNodeView(node, view, getPos, decorations);
|
|
176
176
|
};
|
|
177
177
|
return createLazyNodeView;
|
|
178
178
|
};
|
|
@@ -8,23 +8,40 @@ var getEditorLineWidth = memoize(function (view) {
|
|
|
8
8
|
return (_view$dom = view.dom) === null || _view$dom === void 0 ? void 0 : _view$dom.clientWidth;
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
+
// Copied from ProseMirror NodeView
|
|
12
|
+
// https://github.com/ProseMirror/prosemirror-view/blob/cfa73eb969777f63bcb39972594fd4a9110f5a93/src/viewdesc.ts#L1095-L1099
|
|
13
|
+
function sameOuterDeco(a, b) {
|
|
14
|
+
if (a.length !== b.length) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
for (var i = 0; i < a.length; i++) {
|
|
18
|
+
// @ts-expect-error type actually exist on decoration at runtime
|
|
19
|
+
if (!a[i].type) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// @ts-expect-error type actually exist on decoration at runtime
|
|
24
|
+
if (!a[i].type.eq(b[i].type)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return true;
|
|
29
|
+
}
|
|
30
|
+
|
|
11
31
|
/**
|
|
12
32
|
* 🧱 Internal: Editor FE Platform
|
|
13
33
|
*
|
|
14
34
|
* A NodeView that serves as a placeholder until the actual NodeView is loaded.
|
|
15
35
|
*/
|
|
16
36
|
export var LazyNodeView = /*#__PURE__*/function () {
|
|
17
|
-
function LazyNodeView(_node, view, _getPos,
|
|
37
|
+
function LazyNodeView(_node, view, _getPos, _outerDeco) {
|
|
18
38
|
var _this = this,
|
|
19
39
|
_node$type;
|
|
20
40
|
_classCallCheck(this, LazyNodeView);
|
|
21
|
-
_defineProperty(this, "update", function (node) {
|
|
41
|
+
_defineProperty(this, "update", function (node, outerDeco) {
|
|
22
42
|
var prevNode = _this.node;
|
|
23
43
|
_this.node = node;
|
|
24
|
-
|
|
25
|
-
// Forcing NodeView to be re-created
|
|
26
|
-
// so that ProseMirror can replace LazyNodeView with the real one.
|
|
27
|
-
if (_this.isNodeViewLoaded) {
|
|
44
|
+
if (!sameOuterDeco(outerDeco, _this.outerDeco)) {
|
|
28
45
|
return false;
|
|
29
46
|
}
|
|
30
47
|
|
|
@@ -33,7 +50,7 @@ export var LazyNodeView = /*#__PURE__*/function () {
|
|
|
33
50
|
return !_this.node.sameMarkup(prevNode);
|
|
34
51
|
});
|
|
35
52
|
this.node = _node;
|
|
36
|
-
this.
|
|
53
|
+
this.outerDeco = _outerDeco;
|
|
37
54
|
if (typeof ((_node$type = _node.type) === null || _node$type === void 0 || (_node$type = _node$type.spec) === null || _node$type === void 0 ? void 0 : _node$type.toDOM) !== 'function') {
|
|
38
55
|
this.dom = document.createElement('div');
|
|
39
56
|
return;
|
|
@@ -56,9 +73,6 @@ export var LazyNodeView = /*#__PURE__*/function () {
|
|
|
56
73
|
// before the test started
|
|
57
74
|
this.dom.setAttribute('data-lazy-node-view-fallback', 'true');
|
|
58
75
|
}
|
|
59
|
-
nodeViewLoader.then(function () {
|
|
60
|
-
_this.isNodeViewLoaded = true;
|
|
61
|
-
});
|
|
62
76
|
}
|
|
63
77
|
_createClass(LazyNodeView, [{
|
|
64
78
|
key: "ignoreMutation",
|
|
@@ -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.3";
|
|
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.3";
|
|
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;
|
|
@@ -35,7 +35,7 @@ export type LazyLoadingProps<NodeViewOptions> = {
|
|
|
35
35
|
*
|
|
36
36
|
* This needs to be replaced with proper implementation once LazyNodeView is converted to a plugin.
|
|
37
37
|
*
|
|
38
|
-
* @deprecated DO NOT USE THIS
|
|
38
|
+
* @deprecated DO NOT USE THIS OUTSIDE TESTS.
|
|
39
39
|
*/
|
|
40
40
|
export declare function testOnlyIgnoreLazyNodeView(view: EditorView): void;
|
|
41
41
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
/**
|
|
4
4
|
* 🧱 Internal: Editor FE Platform
|
|
5
5
|
*
|
|
@@ -9,8 +9,8 @@ export declare class LazyNodeView implements NodeView {
|
|
|
9
9
|
dom: Node;
|
|
10
10
|
contentDOM?: HTMLElement;
|
|
11
11
|
private node;
|
|
12
|
-
private
|
|
13
|
-
constructor(node: PMNode, view: EditorView, _getPos: () => number | undefined,
|
|
14
|
-
update: (node: PMNode) => boolean;
|
|
12
|
+
private outerDeco;
|
|
13
|
+
constructor(node: PMNode, view: EditorView, _getPos: () => number | undefined, outerDeco: readonly Decoration[]);
|
|
14
|
+
update: (node: PMNode, outerDeco: readonly Decoration[]) => boolean;
|
|
15
15
|
ignoreMutation(): boolean;
|
|
16
16
|
}
|
|
@@ -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;
|
|
@@ -35,7 +35,7 @@ export type LazyLoadingProps<NodeViewOptions> = {
|
|
|
35
35
|
*
|
|
36
36
|
* This needs to be replaced with proper implementation once LazyNodeView is converted to a plugin.
|
|
37
37
|
*
|
|
38
|
-
* @deprecated DO NOT USE THIS
|
|
38
|
+
* @deprecated DO NOT USE THIS OUTSIDE TESTS.
|
|
39
39
|
*/
|
|
40
40
|
export declare function testOnlyIgnoreLazyNodeView(view: EditorView): void;
|
|
41
41
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
-
import type { EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
+
import type { Decoration, EditorView, NodeView } from '@atlaskit/editor-prosemirror/view';
|
|
3
3
|
/**
|
|
4
4
|
* 🧱 Internal: Editor FE Platform
|
|
5
5
|
*
|
|
@@ -9,8 +9,8 @@ export declare class LazyNodeView implements NodeView {
|
|
|
9
9
|
dom: Node;
|
|
10
10
|
contentDOM?: HTMLElement;
|
|
11
11
|
private node;
|
|
12
|
-
private
|
|
13
|
-
constructor(node: PMNode, view: EditorView, _getPos: () => number | undefined,
|
|
14
|
-
update: (node: PMNode) => boolean;
|
|
12
|
+
private outerDeco;
|
|
13
|
+
constructor(node: PMNode, view: EditorView, _getPos: () => number | undefined, outerDeco: readonly Decoration[]);
|
|
14
|
+
update: (node: PMNode, outerDeco: readonly Decoration[]) => boolean;
|
|
15
15
|
ignoreMutation(): boolean;
|
|
16
16
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "88.8.
|
|
3
|
+
"version": "88.8.3",
|
|
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
|