@atlaskit/renderer 145.0.2 → 145.0.4
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/index.js +3 -2
- package/dist/cjs/actions/matches-utils.js +13 -4
- package/dist/cjs/ui/Renderer/index.js +1 -1
- package/dist/es2019/actions/index.js +4 -3
- package/dist/es2019/actions/matches-utils.js +14 -6
- package/dist/es2019/ui/Renderer/index.js +1 -1
- package/dist/esm/actions/index.js +4 -3
- package/dist/esm/actions/matches-utils.js +13 -4
- package/dist/esm/ui/Renderer/index.js +1 -1
- package/dist/types/actions/matches-utils.d.ts +2 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/renderer
|
|
2
2
|
|
|
3
|
+
## 145.0.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 145.0.3
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`df04549a2c45c`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/df04549a2c45c) -
|
|
14
|
+
Update renderer annotation actions to produce `AddNodeMarkStep` results for eligible extension
|
|
15
|
+
nodes behind the `cc_maui_annotations_on_extensions` feature gate, while preserving existing text
|
|
16
|
+
and media annotation behavior.
|
|
17
|
+
- [`a13383c3c99b2`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/a13383c3c99b2) -
|
|
18
|
+
[FFCLEANUP-192944] clean up code references to patch gates
|
|
19
|
+
`platform_editor_lovability_text_bg_color_patch_1` and
|
|
20
|
+
`platform_editor_lovability_text_bg_color_patch_2`.
|
|
21
|
+
- Updated dependencies
|
|
22
|
+
|
|
3
23
|
## 145.0.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -362,8 +362,9 @@ var RendererActions = exports.default = /*#__PURE__*/function () {
|
|
|
362
362
|
// hence, -1 is not needed
|
|
363
363
|
var beforeNodePos = from;
|
|
364
364
|
var possibleNode = this.doc.nodeAt(beforeNodePos);
|
|
365
|
-
|
|
366
|
-
|
|
365
|
+
var isBlockTarget = possibleNode ? (0, _matchesUtils.isBlockAnnotationTarget)(possibleNode, this.schema) : false;
|
|
366
|
+
if (possibleNode && isBlockTarget) {
|
|
367
|
+
targetNodeType = possibleNode.type.name;
|
|
367
368
|
step = new _transform.AddNodeMarkStep(beforeNodePos, this.schema.marks.annotation.create({
|
|
368
369
|
id: annotationId,
|
|
369
370
|
type: annotationType
|
|
@@ -5,6 +5,16 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.countMatches = countMatches;
|
|
7
7
|
exports.getIndexMatch = getIndexMatch;
|
|
8
|
+
exports.isBlockAnnotationTarget = isBlockAnnotationTarget;
|
|
9
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
10
|
+
/** Returns whether renderer annotations should use node-mark steps for this node. */
|
|
11
|
+
function isBlockAnnotationTarget(node, schema) {
|
|
12
|
+
var _schema$nodes = schema.nodes,
|
|
13
|
+
extension = _schema$nodes.extension,
|
|
14
|
+
media = _schema$nodes.media;
|
|
15
|
+
return node.type === media || node.type === extension && (0, _fg.fg)('cc_maui_annotations_on_extensions') && node.type.allowsMarkType(schema.marks.annotation);
|
|
16
|
+
}
|
|
17
|
+
|
|
8
18
|
// Finds a string position using the Confluence annotation backend's serialisation rules.
|
|
9
19
|
function getIndexMatch(doc, schema, selectedText, startIndex) {
|
|
10
20
|
var textContent = '';
|
|
@@ -13,18 +23,17 @@ function getIndexMatch(doc, schema, selectedText, startIndex) {
|
|
|
13
23
|
var blockNodePos;
|
|
14
24
|
doc.descendants(function (node, pos) {
|
|
15
25
|
var nodeType = node.type;
|
|
16
|
-
var
|
|
26
|
+
var isBlockTarget = isBlockAnnotationTarget(node, schema);
|
|
17
27
|
var isBlockContainer = nodeType.isBlock && !nodeType.isLeaf && !nodeType.inlineContent;
|
|
18
28
|
|
|
19
29
|
// Containers may allow annotations for their children; skip their own text to avoid double-counting.
|
|
20
|
-
if ((node.isText || !nodeType.allowsMarkType(schema.marks.annotation) || isBlockContainer) &&
|
|
30
|
+
if ((node.isText || !nodeType.allowsMarkType(schema.marks.annotation) || isBlockContainer) && !isBlockTarget) {
|
|
21
31
|
return true;
|
|
22
32
|
}
|
|
23
33
|
var nodeStart = pos;
|
|
24
34
|
var nodeEnd = nodeStart + node.nodeSize;
|
|
25
35
|
if (startIndex >= nodeStart && startIndex <= nodeEnd) {
|
|
26
|
-
|
|
27
|
-
if (nodeType === media) {
|
|
36
|
+
if (isBlockTarget) {
|
|
28
37
|
blockNodePos = pos;
|
|
29
38
|
}
|
|
30
39
|
// If the start of the annotation selection is within the current node, we scan the document for previous occurrences
|
|
@@ -71,7 +71,7 @@ var DEGRADED_SEVERITY_THRESHOLD = exports.DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
71
71
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
72
72
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
73
73
|
var packageName = "@atlaskit/renderer";
|
|
74
|
-
var packageVersion = "145.0.
|
|
74
|
+
var packageVersion = "145.0.4";
|
|
75
75
|
var setAsQueryContainerStyles = (0, _react2.css)({
|
|
76
76
|
containerName: 'ak-renderer-wrapper',
|
|
77
77
|
containerType: 'inline-size'
|
|
@@ -8,7 +8,7 @@ import { AddNodeMarkStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/e
|
|
|
8
8
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
9
|
import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
10
10
|
import { getRendererRangeInlineNodeNames, getRendererRangeAncestorNodeNames } from './get-renderer-range-inline-node-names';
|
|
11
|
-
import { getIndexMatch } from './matches-utils';
|
|
11
|
+
import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
|
|
12
12
|
import { getSelectionContext } from './selection';
|
|
13
13
|
export default class RendererActions {
|
|
14
14
|
// Any kind of refence is allowed
|
|
@@ -328,8 +328,9 @@ export default class RendererActions {
|
|
|
328
328
|
// hence, -1 is not needed
|
|
329
329
|
const beforeNodePos = from;
|
|
330
330
|
const possibleNode = this.doc.nodeAt(beforeNodePos);
|
|
331
|
-
|
|
332
|
-
|
|
331
|
+
const isBlockTarget = possibleNode ? isBlockAnnotationTarget(possibleNode, this.schema) : false;
|
|
332
|
+
if (possibleNode && isBlockTarget) {
|
|
333
|
+
targetNodeType = possibleNode.type.name;
|
|
333
334
|
step = new AddNodeMarkStep(beforeNodePos, this.schema.marks.annotation.create({
|
|
334
335
|
id: annotationId,
|
|
335
336
|
type: annotationType
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
+
|
|
3
|
+
/** Returns whether renderer annotations should use node-mark steps for this node. */
|
|
4
|
+
export function isBlockAnnotationTarget(node, schema) {
|
|
5
|
+
const {
|
|
6
|
+
extension,
|
|
7
|
+
media
|
|
8
|
+
} = schema.nodes;
|
|
9
|
+
return node.type === media || node.type === extension && fg('cc_maui_annotations_on_extensions') && node.type.allowsMarkType(schema.marks.annotation);
|
|
10
|
+
}
|
|
11
|
+
|
|
1
12
|
// Finds a string position using the Confluence annotation backend's serialisation rules.
|
|
2
13
|
export function getIndexMatch(doc, schema, selectedText, startIndex) {
|
|
3
14
|
let textContent = '';
|
|
@@ -6,20 +17,17 @@ export function getIndexMatch(doc, schema, selectedText, startIndex) {
|
|
|
6
17
|
let blockNodePos;
|
|
7
18
|
doc.descendants((node, pos) => {
|
|
8
19
|
const nodeType = node.type;
|
|
9
|
-
const
|
|
10
|
-
media
|
|
11
|
-
} = schema.nodes;
|
|
20
|
+
const isBlockTarget = isBlockAnnotationTarget(node, schema);
|
|
12
21
|
const isBlockContainer = nodeType.isBlock && !nodeType.isLeaf && !nodeType.inlineContent;
|
|
13
22
|
|
|
14
23
|
// Containers may allow annotations for their children; skip their own text to avoid double-counting.
|
|
15
|
-
if ((node.isText || !nodeType.allowsMarkType(schema.marks.annotation) || isBlockContainer) &&
|
|
24
|
+
if ((node.isText || !nodeType.allowsMarkType(schema.marks.annotation) || isBlockContainer) && !isBlockTarget) {
|
|
16
25
|
return true;
|
|
17
26
|
}
|
|
18
27
|
const nodeStart = pos;
|
|
19
28
|
const nodeEnd = nodeStart + node.nodeSize;
|
|
20
29
|
if (startIndex >= nodeStart && startIndex <= nodeEnd) {
|
|
21
|
-
|
|
22
|
-
if (nodeType === media) {
|
|
30
|
+
if (isBlockTarget) {
|
|
23
31
|
blockNodePos = pos;
|
|
24
32
|
}
|
|
25
33
|
// If the start of the annotation selection is within the current node, we scan the document for previous occurrences
|
|
@@ -56,7 +56,7 @@ export const DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
56
56
|
const TABLE_INFO_TIMEOUT = 10000;
|
|
57
57
|
const RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
58
58
|
const packageName = "@atlaskit/renderer";
|
|
59
|
-
const packageVersion = "145.0.
|
|
59
|
+
const packageVersion = "145.0.4";
|
|
60
60
|
const setAsQueryContainerStyles = css({
|
|
61
61
|
containerName: 'ak-renderer-wrapper',
|
|
62
62
|
containerType: 'inline-size'
|
|
@@ -11,7 +11,7 @@ import { AddNodeMarkStep, RemoveMarkStep, RemoveNodeMarkStep } from '@atlaskit/e
|
|
|
11
11
|
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
12
12
|
import { createAnnotationStep, getPosFromRange } from '../steps';
|
|
13
13
|
import { getRendererRangeInlineNodeNames, getRendererRangeAncestorNodeNames } from './get-renderer-range-inline-node-names';
|
|
14
|
-
import { getIndexMatch } from './matches-utils';
|
|
14
|
+
import { getIndexMatch, isBlockAnnotationTarget } from './matches-utils';
|
|
15
15
|
import { getSelectionContext as _getSelectionContext } from './selection';
|
|
16
16
|
var RendererActions = /*#__PURE__*/function () {
|
|
17
17
|
// Any kind of refence is allowed
|
|
@@ -355,8 +355,9 @@ var RendererActions = /*#__PURE__*/function () {
|
|
|
355
355
|
// hence, -1 is not needed
|
|
356
356
|
var beforeNodePos = from;
|
|
357
357
|
var possibleNode = this.doc.nodeAt(beforeNodePos);
|
|
358
|
-
|
|
359
|
-
|
|
358
|
+
var isBlockTarget = possibleNode ? isBlockAnnotationTarget(possibleNode, this.schema) : false;
|
|
359
|
+
if (possibleNode && isBlockTarget) {
|
|
360
|
+
targetNodeType = possibleNode.type.name;
|
|
360
361
|
step = new AddNodeMarkStep(beforeNodePos, this.schema.marks.annotation.create({
|
|
361
362
|
id: annotationId,
|
|
362
363
|
type: annotationType
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
2
|
+
|
|
3
|
+
/** Returns whether renderer annotations should use node-mark steps for this node. */
|
|
4
|
+
export function isBlockAnnotationTarget(node, schema) {
|
|
5
|
+
var _schema$nodes = schema.nodes,
|
|
6
|
+
extension = _schema$nodes.extension,
|
|
7
|
+
media = _schema$nodes.media;
|
|
8
|
+
return node.type === media || node.type === extension && fg('cc_maui_annotations_on_extensions') && node.type.allowsMarkType(schema.marks.annotation);
|
|
9
|
+
}
|
|
10
|
+
|
|
1
11
|
// Finds a string position using the Confluence annotation backend's serialisation rules.
|
|
2
12
|
export function getIndexMatch(doc, schema, selectedText, startIndex) {
|
|
3
13
|
var textContent = '';
|
|
@@ -6,18 +16,17 @@ export function getIndexMatch(doc, schema, selectedText, startIndex) {
|
|
|
6
16
|
var blockNodePos;
|
|
7
17
|
doc.descendants(function (node, pos) {
|
|
8
18
|
var nodeType = node.type;
|
|
9
|
-
var
|
|
19
|
+
var isBlockTarget = isBlockAnnotationTarget(node, schema);
|
|
10
20
|
var isBlockContainer = nodeType.isBlock && !nodeType.isLeaf && !nodeType.inlineContent;
|
|
11
21
|
|
|
12
22
|
// Containers may allow annotations for their children; skip their own text to avoid double-counting.
|
|
13
|
-
if ((node.isText || !nodeType.allowsMarkType(schema.marks.annotation) || isBlockContainer) &&
|
|
23
|
+
if ((node.isText || !nodeType.allowsMarkType(schema.marks.annotation) || isBlockContainer) && !isBlockTarget) {
|
|
14
24
|
return true;
|
|
15
25
|
}
|
|
16
26
|
var nodeStart = pos;
|
|
17
27
|
var nodeEnd = nodeStart + node.nodeSize;
|
|
18
28
|
if (startIndex >= nodeStart && startIndex <= nodeEnd) {
|
|
19
|
-
|
|
20
|
-
if (nodeType === media) {
|
|
29
|
+
if (isBlockTarget) {
|
|
21
30
|
blockNodePos = pos;
|
|
22
31
|
}
|
|
23
32
|
// If the start of the annotation selection is within the current node, we scan the document for previous occurrences
|
|
@@ -61,7 +61,7 @@ export var DEGRADED_SEVERITY_THRESHOLD = 3000;
|
|
|
61
61
|
var TABLE_INFO_TIMEOUT = 10000;
|
|
62
62
|
var RENDER_EVENT_SAMPLE_RATE = 0.1;
|
|
63
63
|
var packageName = "@atlaskit/renderer";
|
|
64
|
-
var packageVersion = "145.0.
|
|
64
|
+
var packageVersion = "145.0.4";
|
|
65
65
|
var setAsQueryContainerStyles = css({
|
|
66
66
|
containerName: 'ak-renderer-wrapper',
|
|
67
67
|
containerType: 'inline-size'
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { Node, Schema } from '@atlaskit/editor-prosemirror/model';
|
|
2
|
+
/** Returns whether renderer annotations should use node-mark steps for this node. */
|
|
3
|
+
export declare function isBlockAnnotationTarget(node: Node, schema: Schema): boolean;
|
|
2
4
|
export declare function getIndexMatch(doc: Node, schema: Schema, selectedText: string, startIndex: number): {
|
|
3
5
|
blockNodePos?: number;
|
|
4
6
|
matchIndex: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/renderer",
|
|
3
|
-
"version": "145.0.
|
|
3
|
+
"version": "145.0.4",
|
|
4
4
|
"description": "Renderer component",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
"@atlaskit/status": "^5.12.0",
|
|
74
74
|
"@atlaskit/task-decision": "^21.11.0",
|
|
75
75
|
"@atlaskit/theme": "^28.2.0",
|
|
76
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
76
|
+
"@atlaskit/tmp-editor-statsig": "^212.0.0",
|
|
77
77
|
"@atlaskit/tokens": "^20.1.0",
|
|
78
78
|
"@atlaskit/tooltip": "^24.3.0",
|
|
79
79
|
"@atlaskit/visually-hidden": "^4.4.0",
|
|
@@ -162,6 +162,10 @@
|
|
|
162
162
|
"editor_inline_comments_on_inline_nodes": {
|
|
163
163
|
"type": "boolean"
|
|
164
164
|
},
|
|
165
|
+
"cc_maui_annotations_on_extensions": {
|
|
166
|
+
"type": "boolean",
|
|
167
|
+
"referenceOnly": true
|
|
168
|
+
},
|
|
165
169
|
"platform_editor_querySelector_fix_table_renderer": {
|
|
166
170
|
"type": "boolean"
|
|
167
171
|
},
|