@atlaskit/editor-plugin-annotation 1.9.5 → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/cjs/utils.js +35 -13
- package/dist/es2019/utils.js +35 -13
- package/dist/esm/utils.js +35 -13
- package/package.json +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 1.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#108623](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/108623)
|
|
8
|
+
[`c01339668ebde`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/c01339668ebde) -
|
|
9
|
+
[ux] ED-23617 Add support in editor for comments on status, emoji, date and mention nodes
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
3
15
|
## 1.9.5
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/cjs/utils.js
CHANGED
|
@@ -375,30 +375,52 @@ var isSupportedBlockNode = exports.isSupportedBlockNode = function isSupportedBl
|
|
|
375
375
|
function hasInvalidWhitespaceNode(selection, schema) {
|
|
376
376
|
var foundInvalidWhitespace = false;
|
|
377
377
|
var content = selection.content().content;
|
|
378
|
+
var hasCommentableInlineNodeDescendants = false;
|
|
379
|
+
var hasCommentableTextNodeDescendants = false;
|
|
378
380
|
content.descendants(function (node) {
|
|
381
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
382
|
+
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
383
|
+
if (isAllowedInlineNode) {
|
|
384
|
+
hasCommentableInlineNodeDescendants = true;
|
|
385
|
+
return false;
|
|
386
|
+
}
|
|
387
|
+
}
|
|
379
388
|
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
|
|
380
389
|
return false;
|
|
381
390
|
}
|
|
382
391
|
if ((0, _utils.isText)(node, schema)) {
|
|
392
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
393
|
+
if (node.textContent.trim() !== '') {
|
|
394
|
+
hasCommentableTextNodeDescendants = true;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
383
397
|
return false;
|
|
384
398
|
}
|
|
385
|
-
if (
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
399
|
+
if (!(0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
400
|
+
if (node.textContent.trim() === '') {
|
|
401
|
+
// Trailing new lines do not result in the annotation spanning into
|
|
402
|
+
// the trailing new line so can be ignored when looking for invalid
|
|
403
|
+
// whitespace nodes.
|
|
404
|
+
var nodeIsTrailingNewLine =
|
|
405
|
+
// it is the final node
|
|
406
|
+
node.eq(content.lastChild) &&
|
|
407
|
+
// and there are multiple nodes
|
|
408
|
+
!node.eq(content.firstChild) &&
|
|
409
|
+
// and it is a paragraph node
|
|
410
|
+
(0, _utils.isParagraph)(node, schema);
|
|
411
|
+
if (!nodeIsTrailingNewLine) {
|
|
412
|
+
foundInvalidWhitespace = true;
|
|
413
|
+
}
|
|
398
414
|
}
|
|
399
415
|
}
|
|
400
416
|
return !foundInvalidWhitespace;
|
|
401
417
|
});
|
|
418
|
+
if ((0, _platformFeatureFlags.getBooleanFF)('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
419
|
+
if (hasCommentableInlineNodeDescendants) {
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
return !hasCommentableTextNodeDescendants;
|
|
423
|
+
}
|
|
402
424
|
return foundInvalidWhitespace;
|
|
403
425
|
}
|
|
404
426
|
|
package/dist/es2019/utils.js
CHANGED
|
@@ -341,30 +341,52 @@ export const isSupportedBlockNode = (node, supportedBlockNodes = []) => {
|
|
|
341
341
|
export function hasInvalidWhitespaceNode(selection, schema) {
|
|
342
342
|
let foundInvalidWhitespace = false;
|
|
343
343
|
const content = selection.content().content;
|
|
344
|
+
let hasCommentableInlineNodeDescendants = false;
|
|
345
|
+
let hasCommentableTextNodeDescendants = false;
|
|
344
346
|
content.descendants(node => {
|
|
347
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
348
|
+
const isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
349
|
+
if (isAllowedInlineNode) {
|
|
350
|
+
hasCommentableInlineNodeDescendants = true;
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
345
354
|
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
|
|
346
355
|
return false;
|
|
347
356
|
}
|
|
348
357
|
if (isText(node, schema)) {
|
|
358
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
359
|
+
if (node.textContent.trim() !== '') {
|
|
360
|
+
hasCommentableTextNodeDescendants = true;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
349
363
|
return false;
|
|
350
364
|
}
|
|
351
|
-
if (
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
365
|
+
if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
366
|
+
if (node.textContent.trim() === '') {
|
|
367
|
+
// Trailing new lines do not result in the annotation spanning into
|
|
368
|
+
// the trailing new line so can be ignored when looking for invalid
|
|
369
|
+
// whitespace nodes.
|
|
370
|
+
const nodeIsTrailingNewLine =
|
|
371
|
+
// it is the final node
|
|
372
|
+
node.eq(content.lastChild) &&
|
|
373
|
+
// and there are multiple nodes
|
|
374
|
+
!node.eq(content.firstChild) &&
|
|
375
|
+
// and it is a paragraph node
|
|
376
|
+
isParagraph(node, schema);
|
|
377
|
+
if (!nodeIsTrailingNewLine) {
|
|
378
|
+
foundInvalidWhitespace = true;
|
|
379
|
+
}
|
|
364
380
|
}
|
|
365
381
|
}
|
|
366
382
|
return !foundInvalidWhitespace;
|
|
367
383
|
});
|
|
384
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
385
|
+
if (hasCommentableInlineNodeDescendants) {
|
|
386
|
+
return false;
|
|
387
|
+
}
|
|
388
|
+
return !hasCommentableTextNodeDescendants;
|
|
389
|
+
}
|
|
368
390
|
return foundInvalidWhitespace;
|
|
369
391
|
}
|
|
370
392
|
|
package/dist/esm/utils.js
CHANGED
|
@@ -348,30 +348,52 @@ export var isSupportedBlockNode = function isSupportedBlockNode(node) {
|
|
|
348
348
|
export function hasInvalidWhitespaceNode(selection, schema) {
|
|
349
349
|
var foundInvalidWhitespace = false;
|
|
350
350
|
var content = selection.content().content;
|
|
351
|
+
var hasCommentableInlineNodeDescendants = false;
|
|
352
|
+
var hasCommentableTextNodeDescendants = false;
|
|
351
353
|
content.descendants(function (node) {
|
|
354
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
355
|
+
var isAllowedInlineNode = ['emoji', 'status', 'date', 'mention', 'inlineCard'].includes(node.type.name);
|
|
356
|
+
if (isAllowedInlineNode) {
|
|
357
|
+
hasCommentableInlineNodeDescendants = true;
|
|
358
|
+
return false;
|
|
359
|
+
}
|
|
360
|
+
}
|
|
352
361
|
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes') && node.type === schema.nodes.inlineCard) {
|
|
353
362
|
return false;
|
|
354
363
|
}
|
|
355
364
|
if (isText(node, schema)) {
|
|
365
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
366
|
+
if (node.textContent.trim() !== '') {
|
|
367
|
+
hasCommentableTextNodeDescendants = true;
|
|
368
|
+
}
|
|
369
|
+
}
|
|
356
370
|
return false;
|
|
357
371
|
}
|
|
358
|
-
if (
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
372
|
+
if (!getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
373
|
+
if (node.textContent.trim() === '') {
|
|
374
|
+
// Trailing new lines do not result in the annotation spanning into
|
|
375
|
+
// the trailing new line so can be ignored when looking for invalid
|
|
376
|
+
// whitespace nodes.
|
|
377
|
+
var nodeIsTrailingNewLine =
|
|
378
|
+
// it is the final node
|
|
379
|
+
node.eq(content.lastChild) &&
|
|
380
|
+
// and there are multiple nodes
|
|
381
|
+
!node.eq(content.firstChild) &&
|
|
382
|
+
// and it is a paragraph node
|
|
383
|
+
isParagraph(node, schema);
|
|
384
|
+
if (!nodeIsTrailingNewLine) {
|
|
385
|
+
foundInvalidWhitespace = true;
|
|
386
|
+
}
|
|
371
387
|
}
|
|
372
388
|
}
|
|
373
389
|
return !foundInvalidWhitespace;
|
|
374
390
|
});
|
|
391
|
+
if (getBooleanFF('platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz')) {
|
|
392
|
+
if (hasCommentableInlineNodeDescendants) {
|
|
393
|
+
return false;
|
|
394
|
+
}
|
|
395
|
+
return !hasCommentableTextNodeDescendants;
|
|
396
|
+
}
|
|
375
397
|
return foundInvalidWhitespace;
|
|
376
398
|
}
|
|
377
399
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.10.0",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
35
|
"@atlaskit/adf-schema": "^36.10.7",
|
|
36
|
-
"@atlaskit/editor-common": "^82.
|
|
36
|
+
"@atlaskit/editor-common": "^82.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-analytics": "^1.2.0",
|
|
38
38
|
"@atlaskit/editor-plugin-editor-viewmode": "^1.1.0",
|
|
39
39
|
"@atlaskit/editor-plugin-feature-flags": "^1.1.0",
|
|
@@ -96,6 +96,9 @@
|
|
|
96
96
|
"platform.editor.allow-inline-comments-for-inline-nodes": {
|
|
97
97
|
"type": "boolean"
|
|
98
98
|
},
|
|
99
|
+
"platform.editor.allow-inline-comments-for-inline-nodes-round-2_ctuxz": {
|
|
100
|
+
"type": "boolean"
|
|
101
|
+
},
|
|
99
102
|
"platform.editor.comments-on-media.bug.preserve-draft_i3vqb": {
|
|
100
103
|
"type": "boolean"
|
|
101
104
|
}
|