@atlaskit/editor-plugin-annotation 22.0.9 → 23.0.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 +19 -0
- package/dist/cjs/annotationPlugin.js +2 -2
- package/dist/cjs/pm-plugins/utils.js +5 -1
- package/dist/cjs/ui/InlineCommentView.js +29 -5
- package/dist/es2019/annotationPlugin.js +2 -2
- package/dist/es2019/pm-plugins/utils.js +5 -1
- package/dist/es2019/ui/InlineCommentView.js +29 -5
- package/dist/esm/annotationPlugin.js +2 -2
- package/dist/esm/pm-plugins/utils.js +5 -1
- package/dist/esm/ui/InlineCommentView.js +29 -5
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 23.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`45cf8c5ab1b31`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/45cf8c5ab1b31) -
|
|
8
|
+
Enable gated comments on MAUI charts in the Confluence editor, including the editor draft flow for
|
|
9
|
+
native-embed extension nodes. With `cc_maui_annotations_on_extensions` enabled, eligible extension
|
|
10
|
+
block selections can start a draft even when whitespace-only text comments are disallowed. The
|
|
11
|
+
extension-only DOM anchor fallback also requires this gate; existing text/media and gate-off
|
|
12
|
+
anchor behavior is preserved. The native-embed toolbar uses the same gate for its block-comment
|
|
13
|
+
opening hint.
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 23.0.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- Updated dependencies
|
|
21
|
+
|
|
3
22
|
## 22.0.9
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -97,11 +97,11 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
97
97
|
stripNonExistingAnnotations: _utils.stripNonExistingAnnotations,
|
|
98
98
|
applyInlineCommentDraft: function applyInlineCommentDraft(annotationId) {
|
|
99
99
|
var _api$analytics;
|
|
100
|
-
return (0, _editorCommands.createAnnotation)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, _annotation.AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes);
|
|
100
|
+
return (0, _editorCommands.createAnnotation)(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, _annotation.AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
|
|
101
101
|
},
|
|
102
102
|
removeInlineCommentAnnotation: function removeInlineCommentAnnotation(annotationId) {
|
|
103
103
|
var _api$analytics2, _annotationProviders$;
|
|
104
|
-
return (0, _editorCommands.removeInlineCommentFromDoc)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : []);
|
|
104
|
+
return (0, _editorCommands.removeInlineCommentFromDoc)(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
|
|
105
105
|
},
|
|
106
106
|
setInlineCommentDraftState: (0, _editorCommands.setInlineCommentDraftState)(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, undefined, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
107
107
|
showCommentForBlockNode: (0, _editorCommands.showInlineCommentForBlockNode)(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
@@ -331,7 +331,11 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
|
|
|
331
331
|
if (containsInvalidNodes) {
|
|
332
332
|
return _types.AnnotationSelectionType.DISABLED;
|
|
333
333
|
}
|
|
334
|
-
|
|
334
|
+
|
|
335
|
+
// Extension content lives outside the editor document, so an eligible whole-block
|
|
336
|
+
// selection must not be rejected for having no commentable text descendants.
|
|
337
|
+
var isSupportedExtensionSelection = (0, _fg.fg)('cc_maui_annotations_on_extensions') && isSupportedBlockNodeSelection && selection instanceof _state.NodeSelection && selection.node.type.name === 'extension';
|
|
338
|
+
if (disallowOnWhitespace && !isSupportedExtensionSelection && hasInvalidWhitespaceNode(selection, state.schema)) {
|
|
335
339
|
return _types.AnnotationSelectionType.INVALID;
|
|
336
340
|
}
|
|
337
341
|
if (!(selection instanceof _state.NodeSelection) && (0, _utils.isEmptyTextSelection)(selection, state.schema)) {
|
|
@@ -13,7 +13,9 @@ var _hooks = require("@atlaskit/editor-common/hooks");
|
|
|
13
13
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
14
14
|
var _utils = require("@atlaskit/editor-common/utils");
|
|
15
15
|
var _editorPluginConnectivity = require("@atlaskit/editor-plugin-connectivity");
|
|
16
|
+
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
16
17
|
var _utils2 = require("@atlaskit/editor-prosemirror/utils");
|
|
18
|
+
var _fg = require("@atlaskit/platform-feature-flags/fg");
|
|
17
19
|
var _editorCommands = require("../editor-commands");
|
|
18
20
|
var _utils3 = require("../pm-plugins/utils");
|
|
19
21
|
var _types = require("../types");
|
|
@@ -69,14 +71,36 @@ function InlineCommentView(_ref) {
|
|
|
69
71
|
var annotationsList = (0, _utils3.getAllAnnotations)(editorView.state.doc);
|
|
70
72
|
var selection = (0, _utils3.getSelectionPositions)(state, bookmark);
|
|
71
73
|
var position = findPosForDOM(selection);
|
|
74
|
+
var isExtensionSelection = selection instanceof _state.NodeSelection && selection.node.type.name === 'extension';
|
|
72
75
|
var dom;
|
|
76
|
+
var domLookupError;
|
|
73
77
|
try {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
var domRef = (0, _utils2.findDomRefAtPos)(position, editorView.domAtPos.bind(editorView));
|
|
79
|
+
if ((0, _fg.fg)('cc_maui_annotations_on_extensions') && isExtensionSelection) {
|
|
80
|
+
if (domRef instanceof HTMLElement) {
|
|
81
|
+
dom = domRef;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
// Preserve the existing text/media and gate-off anchor lookup.
|
|
85
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
86
|
+
dom = domRef;
|
|
87
|
+
}
|
|
77
88
|
} catch (error) {
|
|
89
|
+
domLookupError = error;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Native embed extension nodes are rendered by a node view. Depending on
|
|
93
|
+
// the wrapper, domAtPos can return no element (or throw) even though
|
|
94
|
+
// EditorView.nodeDOM can. Use that direct lookup as a block-comment anchor.
|
|
95
|
+
if ((0, _fg.fg)('cc_maui_annotations_on_extensions') && !dom && isExtensionSelection) {
|
|
96
|
+
var nodeDom = editorView.nodeDOM(selection.from);
|
|
97
|
+
if (nodeDom instanceof HTMLElement) {
|
|
98
|
+
dom = nodeDom;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!dom && domLookupError) {
|
|
78
102
|
// eslint-disable-next-line no-console
|
|
79
|
-
console.warn(
|
|
103
|
+
console.warn(domLookupError);
|
|
80
104
|
if (dispatchAnalyticsEvent) {
|
|
81
105
|
var payload = {
|
|
82
106
|
action: _analytics.ACTION.ERRORED,
|
|
@@ -87,7 +111,7 @@ function InlineCommentView(_ref) {
|
|
|
87
111
|
selection: selection.toJSON(),
|
|
88
112
|
position: position,
|
|
89
113
|
docSize: editorView.state.doc.nodeSize,
|
|
90
|
-
error:
|
|
114
|
+
error: domLookupError.toString()
|
|
91
115
|
}
|
|
92
116
|
};
|
|
93
117
|
dispatchAnalyticsEvent(payload);
|
|
@@ -65,11 +65,11 @@ export const annotationPlugin = ({
|
|
|
65
65
|
stripNonExistingAnnotations,
|
|
66
66
|
applyInlineCommentDraft: annotationId => {
|
|
67
67
|
var _api$analytics;
|
|
68
|
-
return createAnnotation(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes);
|
|
68
|
+
return createAnnotation(api === null || api === void 0 ? void 0 : (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
|
|
69
69
|
},
|
|
70
70
|
removeInlineCommentAnnotation: annotationId => {
|
|
71
71
|
var _api$analytics2, _annotationProviders$;
|
|
72
|
-
return removeInlineCommentFromDoc(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : []);
|
|
72
|
+
return removeInlineCommentFromDoc(api === null || api === void 0 ? void 0 : (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
|
|
73
73
|
},
|
|
74
74
|
setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 ? void 0 : (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, undefined, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
75
75
|
showCommentForBlockNode: showInlineCommentForBlockNode(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
@@ -295,7 +295,11 @@ export const isSelectionValid = (state, supportedBlockNodes = [], isBlockNodeSup
|
|
|
295
295
|
if (containsInvalidNodes) {
|
|
296
296
|
return AnnotationSelectionType.DISABLED;
|
|
297
297
|
}
|
|
298
|
-
|
|
298
|
+
|
|
299
|
+
// Extension content lives outside the editor document, so an eligible whole-block
|
|
300
|
+
// selection must not be rejected for having no commentable text descendants.
|
|
301
|
+
const isSupportedExtensionSelection = fg('cc_maui_annotations_on_extensions') && isSupportedBlockNodeSelection && selection instanceof NodeSelection && selection.node.type.name === 'extension';
|
|
302
|
+
if (disallowOnWhitespace && !isSupportedExtensionSelection && hasInvalidWhitespaceNode(selection, state.schema)) {
|
|
299
303
|
return AnnotationSelectionType.INVALID;
|
|
300
304
|
}
|
|
301
305
|
if (!(selection instanceof NodeSelection) && isEmptyTextSelection(selection, state.schema)) {
|
|
@@ -5,7 +5,9 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
5
5
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
6
6
|
import { getAnnotationInlineNodeTypes, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
|
|
7
7
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
8
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
8
9
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
10
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
9
11
|
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../editor-commands';
|
|
10
12
|
import { getAllAnnotations, getAnnotationViewKey, getSelectionPositions } from '../pm-plugins/utils';
|
|
11
13
|
import { AnnotationTestIds } from '../types';
|
|
@@ -69,14 +71,36 @@ export function InlineCommentView({
|
|
|
69
71
|
const annotationsList = getAllAnnotations(editorView.state.doc);
|
|
70
72
|
const selection = getSelectionPositions(state, bookmark);
|
|
71
73
|
const position = findPosForDOM(selection);
|
|
74
|
+
const isExtensionSelection = selection instanceof NodeSelection && selection.node.type.name === 'extension';
|
|
72
75
|
let dom;
|
|
76
|
+
let domLookupError;
|
|
73
77
|
try {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
const domRef = findDomRefAtPos(position, editorView.domAtPos.bind(editorView));
|
|
79
|
+
if (fg('cc_maui_annotations_on_extensions') && isExtensionSelection) {
|
|
80
|
+
if (domRef instanceof HTMLElement) {
|
|
81
|
+
dom = domRef;
|
|
82
|
+
}
|
|
83
|
+
} else {
|
|
84
|
+
// Preserve the existing text/media and gate-off anchor lookup.
|
|
85
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
86
|
+
dom = domRef;
|
|
87
|
+
}
|
|
77
88
|
} catch (error) {
|
|
89
|
+
domLookupError = error;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// Native embed extension nodes are rendered by a node view. Depending on
|
|
93
|
+
// the wrapper, domAtPos can return no element (or throw) even though
|
|
94
|
+
// EditorView.nodeDOM can. Use that direct lookup as a block-comment anchor.
|
|
95
|
+
if (fg('cc_maui_annotations_on_extensions') && !dom && isExtensionSelection) {
|
|
96
|
+
const nodeDom = editorView.nodeDOM(selection.from);
|
|
97
|
+
if (nodeDom instanceof HTMLElement) {
|
|
98
|
+
dom = nodeDom;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!dom && domLookupError) {
|
|
78
102
|
// eslint-disable-next-line no-console
|
|
79
|
-
console.warn(
|
|
103
|
+
console.warn(domLookupError);
|
|
80
104
|
if (dispatchAnalyticsEvent) {
|
|
81
105
|
const payload = {
|
|
82
106
|
action: ACTION.ERRORED,
|
|
@@ -87,7 +111,7 @@ export function InlineCommentView({
|
|
|
87
111
|
selection: selection.toJSON(),
|
|
88
112
|
position,
|
|
89
113
|
docSize: editorView.state.doc.nodeSize,
|
|
90
|
-
error:
|
|
114
|
+
error: domLookupError.toString()
|
|
91
115
|
}
|
|
92
116
|
};
|
|
93
117
|
dispatchAnalyticsEvent(payload);
|
|
@@ -90,11 +90,11 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
90
90
|
stripNonExistingAnnotations: stripNonExistingAnnotations,
|
|
91
91
|
applyInlineCommentDraft: function applyInlineCommentDraft(annotationId) {
|
|
92
92
|
var _api$analytics;
|
|
93
|
-
return createAnnotation(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes);
|
|
93
|
+
return createAnnotation(api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.actions, api)(annotationId, AnnotationTypes.INLINE_COMMENT, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
|
|
94
94
|
},
|
|
95
95
|
removeInlineCommentAnnotation: function removeInlineCommentAnnotation(annotationId) {
|
|
96
96
|
var _api$analytics2, _annotationProviders$;
|
|
97
|
-
return removeInlineCommentFromDoc(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : []);
|
|
97
|
+
return removeInlineCommentFromDoc(api === null || api === void 0 || (_api$analytics2 = api.analytics) === null || _api$analytics2 === void 0 ? void 0 : _api$analytics2.actions)(annotationId, (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : [], annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported);
|
|
98
98
|
},
|
|
99
99
|
setInlineCommentDraftState: setInlineCommentDraftState(api === null || api === void 0 || (_api$analytics3 = api.analytics) === null || _api$analytics3 === void 0 ? void 0 : _api$analytics3.actions, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, undefined, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
100
100
|
showCommentForBlockNode: showInlineCommentForBlockNode(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
@@ -314,7 +314,11 @@ export var isSelectionValid = function isSelectionValid(state) {
|
|
|
314
314
|
if (containsInvalidNodes) {
|
|
315
315
|
return AnnotationSelectionType.DISABLED;
|
|
316
316
|
}
|
|
317
|
-
|
|
317
|
+
|
|
318
|
+
// Extension content lives outside the editor document, so an eligible whole-block
|
|
319
|
+
// selection must not be rejected for having no commentable text descendants.
|
|
320
|
+
var isSupportedExtensionSelection = fg('cc_maui_annotations_on_extensions') && isSupportedBlockNodeSelection && selection instanceof NodeSelection && selection.node.type.name === 'extension';
|
|
321
|
+
if (disallowOnWhitespace && !isSupportedExtensionSelection && hasInvalidWhitespaceNode(selection, state.schema)) {
|
|
318
322
|
return AnnotationSelectionType.INVALID;
|
|
319
323
|
}
|
|
320
324
|
if (!(selection instanceof NodeSelection) && isEmptyTextSelection(selection, state.schema)) {
|
|
@@ -6,7 +6,9 @@ import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks'
|
|
|
6
6
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
7
7
|
import { getAnnotationInlineNodeTypes, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
|
|
8
8
|
import { isOfflineMode } from '@atlaskit/editor-plugin-connectivity';
|
|
9
|
+
import { NodeSelection } from '@atlaskit/editor-prosemirror/state';
|
|
9
10
|
import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
|
|
11
|
+
import { fg } from '@atlaskit/platform-feature-flags/fg';
|
|
10
12
|
import { closeComponent, createAnnotation, removeInlineCommentNearSelection, setInlineCommentDraftState, updateInlineCommentResolvedState } from '../editor-commands';
|
|
11
13
|
import { getAllAnnotations, getAnnotationViewKey, getSelectionPositions } from '../pm-plugins/utils';
|
|
12
14
|
import { AnnotationTestIds } from '../types';
|
|
@@ -62,14 +64,36 @@ export function InlineCommentView(_ref) {
|
|
|
62
64
|
var annotationsList = getAllAnnotations(editorView.state.doc);
|
|
63
65
|
var selection = getSelectionPositions(state, bookmark);
|
|
64
66
|
var position = findPosForDOM(selection);
|
|
67
|
+
var isExtensionSelection = selection instanceof NodeSelection && selection.node.type.name === 'extension';
|
|
65
68
|
var dom;
|
|
69
|
+
var domLookupError;
|
|
66
70
|
try {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
71
|
+
var domRef = findDomRefAtPos(position, editorView.domAtPos.bind(editorView));
|
|
72
|
+
if (fg('cc_maui_annotations_on_extensions') && isExtensionSelection) {
|
|
73
|
+
if (domRef instanceof HTMLElement) {
|
|
74
|
+
dom = domRef;
|
|
75
|
+
}
|
|
76
|
+
} else {
|
|
77
|
+
// Preserve the existing text/media and gate-off anchor lookup.
|
|
78
|
+
// eslint-disable-next-line @atlaskit/editor/no-as-casting
|
|
79
|
+
dom = domRef;
|
|
80
|
+
}
|
|
70
81
|
} catch (error) {
|
|
82
|
+
domLookupError = error;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Native embed extension nodes are rendered by a node view. Depending on
|
|
86
|
+
// the wrapper, domAtPos can return no element (or throw) even though
|
|
87
|
+
// EditorView.nodeDOM can. Use that direct lookup as a block-comment anchor.
|
|
88
|
+
if (fg('cc_maui_annotations_on_extensions') && !dom && isExtensionSelection) {
|
|
89
|
+
var nodeDom = editorView.nodeDOM(selection.from);
|
|
90
|
+
if (nodeDom instanceof HTMLElement) {
|
|
91
|
+
dom = nodeDom;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (!dom && domLookupError) {
|
|
71
95
|
// eslint-disable-next-line no-console
|
|
72
|
-
console.warn(
|
|
96
|
+
console.warn(domLookupError);
|
|
73
97
|
if (dispatchAnalyticsEvent) {
|
|
74
98
|
var payload = {
|
|
75
99
|
action: ACTION.ERRORED,
|
|
@@ -80,7 +104,7 @@ export function InlineCommentView(_ref) {
|
|
|
80
104
|
selection: selection.toJSON(),
|
|
81
105
|
position: position,
|
|
82
106
|
docSize: editorView.state.doc.nodeSize,
|
|
83
|
-
error:
|
|
107
|
+
error: domLookupError.toString()
|
|
84
108
|
}
|
|
85
109
|
};
|
|
86
110
|
dispatchAnalyticsEvent(payload);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "23.0.1",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,22 +20,22 @@
|
|
|
20
20
|
"atlaskit:src": "src/index.ts",
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@atlaskit/adf-schema": "^57.6.0",
|
|
23
|
-
"@atlaskit/editor-plugin-analytics": "^
|
|
24
|
-
"@atlaskit/editor-plugin-connectivity": "^
|
|
25
|
-
"@atlaskit/editor-plugin-editor-viewmode-effects": "^
|
|
26
|
-
"@atlaskit/editor-plugin-feature-flags": "^
|
|
27
|
-
"@atlaskit/editor-plugin-toolbar": "^
|
|
28
|
-
"@atlaskit/editor-plugin-user-intent": "^
|
|
23
|
+
"@atlaskit/editor-plugin-analytics": "^23.0.0",
|
|
24
|
+
"@atlaskit/editor-plugin-connectivity": "^23.0.0",
|
|
25
|
+
"@atlaskit/editor-plugin-editor-viewmode-effects": "^23.0.0",
|
|
26
|
+
"@atlaskit/editor-plugin-feature-flags": "^22.0.0",
|
|
27
|
+
"@atlaskit/editor-plugin-toolbar": "^20.0.0",
|
|
28
|
+
"@atlaskit/editor-plugin-user-intent": "^21.0.0",
|
|
29
29
|
"@atlaskit/editor-prosemirror": "^9.0.0",
|
|
30
30
|
"@atlaskit/editor-toolbar": "^2.8.0",
|
|
31
31
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
32
32
|
"@atlaskit/icon": "^38.0.0",
|
|
33
33
|
"@atlaskit/platform-feature-flags": "^2.2.0",
|
|
34
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
34
|
+
"@atlaskit/tmp-editor-statsig": "^219.0.0",
|
|
35
35
|
"@babel/runtime": "^7.0.0"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
|
-
"@atlaskit/editor-common": "^
|
|
38
|
+
"@atlaskit/editor-common": "^127.1.0",
|
|
39
39
|
"react": "^18.2.0 || ^19.2.0",
|
|
40
40
|
"react-dom": "^18.2.0 || ^19.2.0",
|
|
41
41
|
"react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"
|