@atlaskit/renderer 152.1.1 → 152.2.1
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 +20 -0
- package/dist/cjs/actions/get-annotation-marks-with-legacy-content.js +88 -0
- package/dist/cjs/actions/index.js +43 -0
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/actions/get-annotation-marks-with-legacy-content.js +65 -0
- package/dist/es2019/actions/index.js +36 -0
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/actions/get-annotation-marks-with-legacy-content.js +81 -0
- package/dist/esm/actions/index.js +43 -0
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/actions/get-annotation-marks-with-legacy-content.d.ts +7 -0
- package/package.json +10 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 152.2.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`0e4b0764b8618`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/0e4b0764b8618) -
|
|
8
|
+
Discover annotations in legacy content macros when platform_editor_fix_lcm_renderer_annotations is
|
|
9
|
+
enabled
|
|
10
|
+
|
|
11
|
+
## 152.2.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`5157e2c52cfcd`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5157e2c52cfcd) -
|
|
16
|
+
Update i18n NPM package versions for editor,editor-extensions,activity-platform,media,elements
|
|
17
|
+
(Group 3)
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 152.1.1
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.isLegacyContentExtension = exports.getAnnotationMarksWithLegacyContent = void 0;
|
|
8
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
9
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
12
|
+
var isObject = function isObject(value) {
|
|
13
|
+
return (0, _typeof2.default)(value) === 'object' && value !== null;
|
|
14
|
+
};
|
|
15
|
+
var isLegacyContentExtension = exports.isLegacyContentExtension = function isLegacyContentExtension(node) {
|
|
16
|
+
return (node.type.name === 'extension' || node.type.name === 'inlineExtension' || node.type.name === 'bodiedExtension') && node.attrs.extensionType === 'com.atlassian.confluence.migration' && node.attrs.extensionKey === 'legacy-content';
|
|
17
|
+
};
|
|
18
|
+
var getNestedContent = function getNestedContent(node) {
|
|
19
|
+
var parameters = node.attrs.parameters;
|
|
20
|
+
if (!isObject(parameters)) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
var nestedContent = parameters.nestedContent;
|
|
24
|
+
return isObject(nestedContent) && nestedContent.type === 'doc' && Array.isArray(nestedContent.content) ? nestedContent : undefined;
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Finds inline-comment marks stored in migration legacy-content ADF. These marks are not part of
|
|
29
|
+
* the root ProseMirror tree, so create them with the root schema's mark type for renderer consumers.
|
|
30
|
+
*/
|
|
31
|
+
var getAnnotationMarksWithLegacyContent = exports.getAnnotationMarksWithLegacyContent = function getAnnotationMarksWithLegacyContent(node, annotationMarkType) {
|
|
32
|
+
if (!isLegacyContentExtension(node)) {
|
|
33
|
+
return [];
|
|
34
|
+
}
|
|
35
|
+
var nestedContent = getNestedContent(node);
|
|
36
|
+
if (!nestedContent) {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
var marks = [];
|
|
40
|
+
var visited = new WeakSet();
|
|
41
|
+
var pending = [nestedContent];
|
|
42
|
+
while (pending.length) {
|
|
43
|
+
var value = pending.pop();
|
|
44
|
+
if (!isObject(value) || visited.has(value)) {
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
visited.add(value);
|
|
48
|
+
if (Array.isArray(value.marks)) {
|
|
49
|
+
var _iterator = _createForOfIteratorHelper(value.marks),
|
|
50
|
+
_step;
|
|
51
|
+
try {
|
|
52
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
53
|
+
var mark = _step.value;
|
|
54
|
+
if (!isObject(mark) || mark.type !== 'annotation' || !isObject(mark.attrs)) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
var _mark$attrs = mark.attrs,
|
|
58
|
+
id = _mark$attrs.id,
|
|
59
|
+
annotationType = _mark$attrs.annotationType;
|
|
60
|
+
if (annotationType === 'inlineComment' && typeof id === 'string' && id.trim().length > 0) {
|
|
61
|
+
marks.push(annotationMarkType.create({
|
|
62
|
+
id: id,
|
|
63
|
+
annotationType: annotationType
|
|
64
|
+
}));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
} catch (err) {
|
|
68
|
+
_iterator.e(err);
|
|
69
|
+
} finally {
|
|
70
|
+
_iterator.f();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (Array.isArray(value.content)) {
|
|
74
|
+
for (var index = value.content.length - 1; index >= 0; index--) {
|
|
75
|
+
pending.push(value.content[index]);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
var attrs = value.attrs;
|
|
79
|
+
if (isObject(attrs) && (value.type === 'extension' || value.type === 'inlineExtension' || value.type === 'bodiedExtension') && attrs.extensionType === 'com.atlassian.confluence.migration' && attrs.extensionKey === 'legacy-content') {
|
|
80
|
+
var parameters = attrs.parameters;
|
|
81
|
+
var childNestedContent = isObject(parameters) ? parameters.nestedContent : undefined;
|
|
82
|
+
if (isObject(childNestedContent) && childNestedContent.type === 'doc' && Array.isArray(childNestedContent.content)) {
|
|
83
|
+
pending.push(childNestedContent);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return marks;
|
|
88
|
+
};
|
|
@@ -15,8 +15,10 @@ var _annotation2 = require("@atlaskit/editor-common/utils/annotation");
|
|
|
15
15
|
var _JSONTransformer = require("@atlaskit/editor-json-transformer/JSONTransformer-2");
|
|
16
16
|
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
17
17
|
var _transform = require("@atlaskit/editor-prosemirror/transform");
|
|
18
|
+
var _isExperimentEnabled = require("@atlaskit/platform-feature-experiments/is-experiment-enabled");
|
|
18
19
|
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
19
20
|
var _steps = require("../steps");
|
|
21
|
+
var _getAnnotationMarksWithLegacyContent = require("./get-annotation-marks-with-legacy-content");
|
|
20
22
|
var _getRendererRangeInlineNodeNames = require("./get-renderer-range-inline-node-names");
|
|
21
23
|
var _matchesUtils = require("./matches-utils");
|
|
22
24
|
var _selection = require("./selection");
|
|
@@ -301,6 +303,47 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
301
303
|
if (!annotationMarkType) {
|
|
302
304
|
return [];
|
|
303
305
|
}
|
|
306
|
+
if ((0, _isExperimentEnabled.isExperimentEnabled)('platform_editor_fix_lcm_renderer_annotations')) {
|
|
307
|
+
var _marks = [];
|
|
308
|
+
doc.descendants(function (node) {
|
|
309
|
+
var annotationsMark = node.marks.filter(function (m) {
|
|
310
|
+
return m.type === annotationMarkType;
|
|
311
|
+
});
|
|
312
|
+
_marks.push.apply(_marks, (0, _toConsumableArray2.default)(annotationsMark.map(function (mark) {
|
|
313
|
+
return {
|
|
314
|
+
fromLegacyContent: false,
|
|
315
|
+
mark: mark
|
|
316
|
+
};
|
|
317
|
+
})));
|
|
318
|
+
if ((0, _getAnnotationMarksWithLegacyContent.isLegacyContentExtension)(node)) {
|
|
319
|
+
_marks.push.apply(_marks, (0, _toConsumableArray2.default)((0, _getAnnotationMarksWithLegacyContent.getAnnotationMarksWithLegacyContent)(node, annotationMarkType).map(function (mark) {
|
|
320
|
+
return {
|
|
321
|
+
fromLegacyContent: true,
|
|
322
|
+
mark: mark
|
|
323
|
+
};
|
|
324
|
+
})));
|
|
325
|
+
}
|
|
326
|
+
return annotationsMark.length === 0;
|
|
327
|
+
});
|
|
328
|
+
var rootAnnotationIds = new Set(_marks.filter(function (_ref) {
|
|
329
|
+
var fromLegacyContent = _ref.fromLegacyContent;
|
|
330
|
+
return !fromLegacyContent;
|
|
331
|
+
}).map(function (_ref2) {
|
|
332
|
+
var mark = _ref2.mark;
|
|
333
|
+
return mark.attrs.id;
|
|
334
|
+
}));
|
|
335
|
+
var _uniqueMarks = new Map();
|
|
336
|
+
_marks.forEach(function (_ref3) {
|
|
337
|
+
var mark = _ref3.mark,
|
|
338
|
+
fromLegacyContent = _ref3.fromLegacyContent;
|
|
339
|
+
var id = mark.attrs.id;
|
|
340
|
+
if (fromLegacyContent && (rootAnnotationIds.has(id) || _uniqueMarks.has(id))) {
|
|
341
|
+
return;
|
|
342
|
+
}
|
|
343
|
+
_uniqueMarks.set(id, mark);
|
|
344
|
+
});
|
|
345
|
+
return Array.from(_uniqueMarks.values());
|
|
346
|
+
}
|
|
304
347
|
var marks = [];
|
|
305
348
|
doc.descendants(function (node) {
|
|
306
349
|
var annotationsMark = node.marks.filter(function (m) {
|
|
@@ -79,7 +79,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
79
79
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
80
80
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
81
81
|
var packageName = "@atlaskit/renderer";
|
|
82
|
-
var packageVersion = "152.
|
|
82
|
+
var packageVersion = "152.2.0";
|
|
83
83
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
84
84
|
containerName: 'ak-renderer-wrapper',
|
|
85
85
|
containerType: 'inline-size'
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const isObject = value => typeof value === 'object' && value !== null;
|
|
2
|
+
export const isLegacyContentExtension = node => (node.type.name === 'extension' || node.type.name === 'inlineExtension' || node.type.name === 'bodiedExtension') && node.attrs.extensionType === 'com.atlassian.confluence.migration' && node.attrs.extensionKey === 'legacy-content';
|
|
3
|
+
const getNestedContent = node => {
|
|
4
|
+
const parameters = node.attrs.parameters;
|
|
5
|
+
if (!isObject(parameters)) {
|
|
6
|
+
return undefined;
|
|
7
|
+
}
|
|
8
|
+
const nestedContent = parameters.nestedContent;
|
|
9
|
+
return isObject(nestedContent) && nestedContent.type === 'doc' && Array.isArray(nestedContent.content) ? nestedContent : undefined;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Finds inline-comment marks stored in migration legacy-content ADF. These marks are not part of
|
|
14
|
+
* the root ProseMirror tree, so create them with the root schema's mark type for renderer consumers.
|
|
15
|
+
*/
|
|
16
|
+
export const getAnnotationMarksWithLegacyContent = (node, annotationMarkType) => {
|
|
17
|
+
if (!isLegacyContentExtension(node)) {
|
|
18
|
+
return [];
|
|
19
|
+
}
|
|
20
|
+
const nestedContent = getNestedContent(node);
|
|
21
|
+
if (!nestedContent) {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
const marks = [];
|
|
25
|
+
const visited = new WeakSet();
|
|
26
|
+
const pending = [nestedContent];
|
|
27
|
+
while (pending.length) {
|
|
28
|
+
const value = pending.pop();
|
|
29
|
+
if (!isObject(value) || visited.has(value)) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
visited.add(value);
|
|
33
|
+
if (Array.isArray(value.marks)) {
|
|
34
|
+
for (const mark of value.marks) {
|
|
35
|
+
if (!isObject(mark) || mark.type !== 'annotation' || !isObject(mark.attrs)) {
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
const {
|
|
39
|
+
id,
|
|
40
|
+
annotationType
|
|
41
|
+
} = mark.attrs;
|
|
42
|
+
if (annotationType === 'inlineComment' && typeof id === 'string' && id.trim().length > 0) {
|
|
43
|
+
marks.push(annotationMarkType.create({
|
|
44
|
+
id,
|
|
45
|
+
annotationType
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
if (Array.isArray(value.content)) {
|
|
51
|
+
for (let index = value.content.length - 1; index >= 0; index--) {
|
|
52
|
+
pending.push(value.content[index]);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
const attrs = value.attrs;
|
|
56
|
+
if (isObject(attrs) && (value.type === 'extension' || value.type === 'inlineExtension' || value.type === 'bodiedExtension') && attrs.extensionType === 'com.atlassian.confluence.migration' && attrs.extensionKey === 'legacy-content') {
|
|
57
|
+
const parameters = attrs.parameters;
|
|
58
|
+
const childNestedContent = isObject(parameters) ? parameters.nestedContent : undefined;
|
|
59
|
+
if (isObject(childNestedContent) && childNestedContent.type === 'doc' && Array.isArray(childNestedContent.content)) {
|
|
60
|
+
pending.push(childNestedContent);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return marks;
|
|
65
|
+
};
|
|
@@ -5,8 +5,10 @@ import { canApplyAnnotationOnRange, getAnnotationIdsFromRange, getAnnotationInli
|
|
|
5
5
|
import { JSONTransformer } from '@atlaskit/editor-json-transformer/JSONTransformer-2';
|
|
6
6
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import { AddNodeMarkStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
8
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
8
9
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
10
|
import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
11
|
+
import { getAnnotationMarksWithLegacyContent, isLegacyContentExtension } from './get-annotation-marks-with-legacy-content';
|
|
10
12
|
import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-node-names';
|
|
11
13
|
import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
|
|
12
14
|
import { getSelectionContext } from './selection';
|
|
@@ -277,6 +279,40 @@ export default class RendererActions {
|
|
|
277
279
|
if (!annotationMarkType) {
|
|
278
280
|
return [];
|
|
279
281
|
}
|
|
282
|
+
if (isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
|
|
283
|
+
const marks = [];
|
|
284
|
+
doc.descendants(node => {
|
|
285
|
+
const annotationsMark = node.marks.filter(m => m.type === annotationMarkType);
|
|
286
|
+
marks.push(...annotationsMark.map(mark => ({
|
|
287
|
+
fromLegacyContent: false,
|
|
288
|
+
mark
|
|
289
|
+
})));
|
|
290
|
+
if (isLegacyContentExtension(node)) {
|
|
291
|
+
marks.push(...getAnnotationMarksWithLegacyContent(node, annotationMarkType).map(mark => ({
|
|
292
|
+
fromLegacyContent: true,
|
|
293
|
+
mark
|
|
294
|
+
})));
|
|
295
|
+
}
|
|
296
|
+
return annotationsMark.length === 0;
|
|
297
|
+
});
|
|
298
|
+
const rootAnnotationIds = new Set(marks.filter(({
|
|
299
|
+
fromLegacyContent
|
|
300
|
+
}) => !fromLegacyContent).map(({
|
|
301
|
+
mark
|
|
302
|
+
}) => mark.attrs.id));
|
|
303
|
+
const uniqueMarks = new Map();
|
|
304
|
+
marks.forEach(({
|
|
305
|
+
mark,
|
|
306
|
+
fromLegacyContent
|
|
307
|
+
}) => {
|
|
308
|
+
const id = mark.attrs.id;
|
|
309
|
+
if (fromLegacyContent && (rootAnnotationIds.has(id) || uniqueMarks.has(id))) {
|
|
310
|
+
return;
|
|
311
|
+
}
|
|
312
|
+
uniqueMarks.set(id, mark);
|
|
313
|
+
});
|
|
314
|
+
return Array.from(uniqueMarks.values());
|
|
315
|
+
}
|
|
280
316
|
const marks = [];
|
|
281
317
|
doc.descendants(node => {
|
|
282
318
|
const annotationsMark = node.marks.filter(m => m.type === annotationMarkType);
|
|
@@ -64,7 +64,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
64
64
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
65
65
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
66
66
|
const packageName = "@atlaskit/renderer";
|
|
67
|
-
const packageVersion = "152.
|
|
67
|
+
const packageVersion = "152.2.0";
|
|
68
68
|
const setAsQueryContainerStyles = css({
|
|
69
69
|
containerName: 'ak-renderer-wrapper',
|
|
70
70
|
containerType: 'inline-size'
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import _typeof from "@babel/runtime/helpers/typeof";
|
|
2
|
+
function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
|
|
3
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
4
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
5
|
+
var isObject = function isObject(value) {
|
|
6
|
+
return _typeof(value) === 'object' && value !== null;
|
|
7
|
+
};
|
|
8
|
+
export var isLegacyContentExtension = function isLegacyContentExtension(node) {
|
|
9
|
+
return (node.type.name === 'extension' || node.type.name === 'inlineExtension' || node.type.name === 'bodiedExtension') && node.attrs.extensionType === 'com.atlassian.confluence.migration' && node.attrs.extensionKey === 'legacy-content';
|
|
10
|
+
};
|
|
11
|
+
var getNestedContent = function getNestedContent(node) {
|
|
12
|
+
var parameters = node.attrs.parameters;
|
|
13
|
+
if (!isObject(parameters)) {
|
|
14
|
+
return undefined;
|
|
15
|
+
}
|
|
16
|
+
var nestedContent = parameters.nestedContent;
|
|
17
|
+
return isObject(nestedContent) && nestedContent.type === 'doc' && Array.isArray(nestedContent.content) ? nestedContent : undefined;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Finds inline-comment marks stored in migration legacy-content ADF. These marks are not part of
|
|
22
|
+
* the root ProseMirror tree, so create them with the root schema's mark type for renderer consumers.
|
|
23
|
+
*/
|
|
24
|
+
export var getAnnotationMarksWithLegacyContent = function getAnnotationMarksWithLegacyContent(node, annotationMarkType) {
|
|
25
|
+
if (!isLegacyContentExtension(node)) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
var nestedContent = getNestedContent(node);
|
|
29
|
+
if (!nestedContent) {
|
|
30
|
+
return [];
|
|
31
|
+
}
|
|
32
|
+
var marks = [];
|
|
33
|
+
var visited = new WeakSet();
|
|
34
|
+
var pending = [nestedContent];
|
|
35
|
+
while (pending.length) {
|
|
36
|
+
var value = pending.pop();
|
|
37
|
+
if (!isObject(value) || visited.has(value)) {
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
visited.add(value);
|
|
41
|
+
if (Array.isArray(value.marks)) {
|
|
42
|
+
var _iterator = _createForOfIteratorHelper(value.marks),
|
|
43
|
+
_step;
|
|
44
|
+
try {
|
|
45
|
+
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
46
|
+
var mark = _step.value;
|
|
47
|
+
if (!isObject(mark) || mark.type !== 'annotation' || !isObject(mark.attrs)) {
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
var _mark$attrs = mark.attrs,
|
|
51
|
+
id = _mark$attrs.id,
|
|
52
|
+
annotationType = _mark$attrs.annotationType;
|
|
53
|
+
if (annotationType === 'inlineComment' && typeof id === 'string' && id.trim().length > 0) {
|
|
54
|
+
marks.push(annotationMarkType.create({
|
|
55
|
+
id: id,
|
|
56
|
+
annotationType: annotationType
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
_iterator.e(err);
|
|
62
|
+
} finally {
|
|
63
|
+
_iterator.f();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (Array.isArray(value.content)) {
|
|
67
|
+
for (var index = value.content.length - 1; index >= 0; index--) {
|
|
68
|
+
pending.push(value.content[index]);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
var attrs = value.attrs;
|
|
72
|
+
if (isObject(attrs) && (value.type === 'extension' || value.type === 'inlineExtension' || value.type === 'bodiedExtension') && attrs.extensionType === 'com.atlassian.confluence.migration' && attrs.extensionKey === 'legacy-content') {
|
|
73
|
+
var parameters = attrs.parameters;
|
|
74
|
+
var childNestedContent = isObject(parameters) ? parameters.nestedContent : undefined;
|
|
75
|
+
if (isObject(childNestedContent) && childNestedContent.type === 'doc' && Array.isArray(childNestedContent.content)) {
|
|
76
|
+
pending.push(childNestedContent);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return marks;
|
|
81
|
+
};
|
|
@@ -8,8 +8,10 @@ import { canApplyAnnotationOnRange, getAnnotationIdsFromRange, getAnnotationInli
|
|
|
8
8
|
import { JSONTransformer } from '@atlaskit/editor-json-transformer/JSONTransformer-2';
|
|
9
9
|
import { TextSelection } from '@atlaskit/editor-prosemirror/state';
|
|
10
10
|
import { AddNodeMarkStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/editor-prosemirror/transform';
|
|
11
|
+
import { isExperimentEnabled } from '@atlaskit/platform-feature-experiments/is-experiment-enabled';
|
|
11
12
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
13
|
import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
14
|
+
import { getAnnotationMarksWithLegacyContent, isLegacyContentExtension } from './get-annotation-marks-with-legacy-content';
|
|
13
15
|
import { getRendererRangeInlineNodeNames } from './get-renderer-range-inline-node-names';
|
|
14
16
|
import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
|
|
15
17
|
import { getSelectionContext as _getSelectionContext } from './selection';
|
|
@@ -294,6 +296,47 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
294
296
|
if (!annotationMarkType) {
|
|
295
297
|
return [];
|
|
296
298
|
}
|
|
299
|
+
if (isExperimentEnabled('platform_editor_fix_lcm_renderer_annotations')) {
|
|
300
|
+
var _marks = [];
|
|
301
|
+
doc.descendants(function (node) {
|
|
302
|
+
var annotationsMark = node.marks.filter(function (m) {
|
|
303
|
+
return m.type === annotationMarkType;
|
|
304
|
+
});
|
|
305
|
+
_marks.push.apply(_marks, _toConsumableArray(annotationsMark.map(function (mark) {
|
|
306
|
+
return {
|
|
307
|
+
fromLegacyContent: false,
|
|
308
|
+
mark: mark
|
|
309
|
+
};
|
|
310
|
+
})));
|
|
311
|
+
if (isLegacyContentExtension(node)) {
|
|
312
|
+
_marks.push.apply(_marks, _toConsumableArray(getAnnotationMarksWithLegacyContent(node, annotationMarkType).map(function (mark) {
|
|
313
|
+
return {
|
|
314
|
+
fromLegacyContent: true,
|
|
315
|
+
mark: mark
|
|
316
|
+
};
|
|
317
|
+
})));
|
|
318
|
+
}
|
|
319
|
+
return annotationsMark.length === 0;
|
|
320
|
+
});
|
|
321
|
+
var rootAnnotationIds = new Set(_marks.filter(function (_ref) {
|
|
322
|
+
var fromLegacyContent = _ref.fromLegacyContent;
|
|
323
|
+
return !fromLegacyContent;
|
|
324
|
+
}).map(function (_ref2) {
|
|
325
|
+
var mark = _ref2.mark;
|
|
326
|
+
return mark.attrs.id;
|
|
327
|
+
}));
|
|
328
|
+
var _uniqueMarks = new Map();
|
|
329
|
+
_marks.forEach(function (_ref3) {
|
|
330
|
+
var mark = _ref3.mark,
|
|
331
|
+
fromLegacyContent = _ref3.fromLegacyContent;
|
|
332
|
+
var id = mark.attrs.id;
|
|
333
|
+
if (fromLegacyContent && (rootAnnotationIds.has(id) || _uniqueMarks.has(id))) {
|
|
334
|
+
return;
|
|
335
|
+
}
|
|
336
|
+
_uniqueMarks.set(id, mark);
|
|
337
|
+
});
|
|
338
|
+
return Array.from(_uniqueMarks.values());
|
|
339
|
+
}
|
|
297
340
|
var marks = [];
|
|
298
341
|
doc.descendants(function (node) {
|
|
299
342
|
var annotationsMark = node.marks.filter(function (m) {
|
|
@@ -69,7 +69,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
69
69
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
70
70
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
71
71
|
var packageName = "@atlaskit/renderer";
|
|
72
|
-
var packageVersion = "152.
|
|
72
|
+
var packageVersion = "152.2.0";
|
|
73
73
|
var setAsQueryContainerStyles = css({
|
|
74
74
|
containerName: 'ak-renderer-wrapper',
|
|
75
75
|
containerType: 'inline-size'
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { MarkType, Node } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
export declare const isLegacyContentExtension: (node: Node) => boolean;
|
|
3
|
+
/**
|
|
4
|
+
* Finds inline-comment marks stored in migration legacy-content ADF. These marks are not part of
|
|
5
|
+
* the root ProseMirror tree, so create them with the root schema's mark type for renderer consumers.
|
|
6
|
+
*/
|
|
7
|
+
export declare const getAnnotationMarksWithLegacyContent: (node: Node, annotationMarkType: MarkType) => ReturnType<MarkType['create']>[];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "152.
|
|
3
|
+
"version": "152.2.1",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@atlaskit/adf-schema": "^57.7.0",
|
|
37
37
|
"@atlaskit/adf-utils": "^20.9.0",
|
|
38
|
-
"@atlaskit/afm-i18n-platform-editor-renderer": "2.
|
|
38
|
+
"@atlaskit/afm-i18n-platform-editor-renderer": "2.287.0",
|
|
39
39
|
"@atlaskit/analytics-listeners": "^11.4.0",
|
|
40
40
|
"@atlaskit/analytics-namespaced-context": "^8.2.0",
|
|
41
41
|
"@atlaskit/analytics-next": "^12.6.0",
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
50
50
|
"@atlaskit/editor-shared-styles": "^4.6.0",
|
|
51
51
|
"@atlaskit/editor-smart-link-draggable": "^1.2.0",
|
|
52
|
-
"@atlaskit/emoji": "^73.
|
|
52
|
+
"@atlaskit/emoji": "^73.1.0",
|
|
53
53
|
"@atlaskit/feature-gate-js-client": "^7.0.0",
|
|
54
54
|
"@atlaskit/icon": "^38.0.0",
|
|
55
55
|
"@atlaskit/link": "^5.1.0",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"@atlaskit/media-client-react": "^7.0.0",
|
|
62
62
|
"@atlaskit/media-common": "^14.7.0",
|
|
63
63
|
"@atlaskit/media-filmstrip": "^53.0.0",
|
|
64
|
-
"@atlaskit/media-ui": "^31.
|
|
64
|
+
"@atlaskit/media-ui": "^31.5.0",
|
|
65
65
|
"@atlaskit/media-viewer": "^54.11.0",
|
|
66
66
|
"@atlaskit/platform-feature-experiments": "^0.3.0",
|
|
67
67
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
"@atlaskit/react-compiler-gating": "^0.2.0",
|
|
71
71
|
"@atlaskit/react-ufo": "^8.1.0",
|
|
72
72
|
"@atlaskit/smart-card": "^46.7.0",
|
|
73
|
-
"@atlaskit/status": "^5.
|
|
74
|
-
"@atlaskit/task-decision": "^21.
|
|
73
|
+
"@atlaskit/status": "^5.14.0",
|
|
74
|
+
"@atlaskit/task-decision": "^21.13.0",
|
|
75
75
|
"@atlaskit/theme": "^28.2.0",
|
|
76
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
77
|
-
"@atlaskit/tokens": "^20.
|
|
76
|
+
"@atlaskit/tmp-editor-statsig": "^245.0.0",
|
|
77
|
+
"@atlaskit/tokens": "^20.7.0",
|
|
78
78
|
"@atlaskit/tooltip": "^24.4.0",
|
|
79
79
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
80
80
|
"@babel/runtime": "^7.0.0",
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
"uuid": "^11.1.1"
|
|
89
89
|
},
|
|
90
90
|
"peerDependencies": {
|
|
91
|
-
"@atlaskit/editor-common": "^133.
|
|
91
|
+
"@atlaskit/editor-common": "^133.6.0",
|
|
92
92
|
"@atlaskit/link-provider": "^6.0.0",
|
|
93
93
|
"@atlaskit/media-core": "^39.0.0",
|
|
94
94
|
"react": "^18.2.0 || ^19.2.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"@atlaskit/media-integration-test-helpers": "workspace:^",
|
|
112
112
|
"@atlaskit/media-state": "^4.0.0",
|
|
113
113
|
"@atlaskit/media-test-helpers": "^43.0.0",
|
|
114
|
-
"@atlaskit/mention": "^30.
|
|
114
|
+
"@atlaskit/mention": "^30.4.0",
|
|
115
115
|
"@atlaskit/modal-dialog": "^17.1.0",
|
|
116
116
|
"@atlaskit/navigation-system": "^11.3.0",
|
|
117
117
|
"@atlaskit/primitives": "^22.6.0",
|