@atlaskit/editor-plugin-annotation 1.8.0 → 1.9.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 +23 -0
- package/dist/cjs/commands/index.js +3 -2
- package/dist/cjs/pm-plugins/inline-comment.js +8 -1
- package/dist/cjs/pm-plugins/plugin-factory.js +9 -5
- package/dist/cjs/pm-plugins/reducer.js +3 -1
- package/dist/cjs/ui/InlineCommentView.js +13 -2
- package/dist/cjs/utils.js +11 -3
- package/dist/es2019/commands/index.js +3 -2
- package/dist/es2019/pm-plugins/inline-comment.js +8 -1
- package/dist/es2019/pm-plugins/plugin-factory.js +7 -4
- package/dist/es2019/pm-plugins/reducer.js +3 -1
- package/dist/es2019/ui/InlineCommentView.js +12 -1
- package/dist/es2019/utils.js +9 -3
- package/dist/esm/commands/index.js +3 -2
- package/dist/esm/pm-plugins/inline-comment.js +8 -1
- package/dist/esm/pm-plugins/plugin-factory.js +9 -5
- package/dist/esm/pm-plugins/reducer.js +3 -1
- package/dist/esm/ui/InlineCommentView.js +13 -2
- package/dist/esm/utils.js +11 -3
- package/dist/types/commands/index.d.ts +2 -2
- package/dist/types/commands/transform.d.ts +1 -1
- package/dist/types/pm-plugins/types.d.ts +3 -1
- package/dist/types/utils.d.ts +1 -1
- package/dist/types-ts4.5/commands/index.d.ts +2 -2
- package/dist/types-ts4.5/commands/transform.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/types.d.ts +3 -1
- package/dist/types-ts4.5/utils.d.ts +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,28 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 1.9.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#97803](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/97803)
|
|
8
|
+
[`4c1023ffb3d8`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/4c1023ffb3d8) -
|
|
9
|
+
[ED-23094] Ignore annotations on mediaInline node, including highlight styling,
|
|
10
|
+
event(onMouseEnter, onClick) listeners, update active annotations when the node is selected or
|
|
11
|
+
the cursor is right after the node
|
|
12
|
+
|
|
13
|
+
## 1.9.0
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#100662](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/100662)
|
|
18
|
+
[`3d61cd8f2afe`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/3d61cd8f2afe) -
|
|
19
|
+
[ED-23355] Update annotation viewed event to with attributes nodeType and method to capture
|
|
20
|
+
usage for comments on media
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
|
|
3
26
|
## 1.8.0
|
|
4
27
|
|
|
5
28
|
### Minor Changes
|
|
@@ -138,7 +138,7 @@ var getDraftCommandAction = function getDraftCommandAction(drafting, targetType,
|
|
|
138
138
|
*/
|
|
139
139
|
var showInlineCommentForBlockNode = exports.showInlineCommentForBlockNode = function showInlineCommentForBlockNode() {
|
|
140
140
|
var supportedBlockNodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
141
|
-
return function (node) {
|
|
141
|
+
return function (node, viewMethod) {
|
|
142
142
|
return function (state, dispatch) {
|
|
143
143
|
var pluginState = (0, _utils.getPluginState)(state);
|
|
144
144
|
var annotation = state.schema.marks.annotation;
|
|
@@ -159,7 +159,8 @@ var showInlineCommentForBlockNode = exports.showInlineCommentForBlockNode = func
|
|
|
159
159
|
dispatch(state.tr.setMeta(_utils.inlineCommentPluginKey, {
|
|
160
160
|
type: _types.ACTIONS.SET_SELECTED_ANNOTATION,
|
|
161
161
|
data: {
|
|
162
|
-
selectedAnnotations: unresolvedAnnotationMarks
|
|
162
|
+
selectedAnnotations: unresolvedAnnotationMarks,
|
|
163
|
+
selectAnnotationMethod: viewMethod
|
|
163
164
|
}
|
|
164
165
|
}));
|
|
165
166
|
return true;
|
|
@@ -220,11 +220,18 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
220
220
|
annotations = _ref5.annotations,
|
|
221
221
|
selectedAnnotations = _ref5.selectedAnnotations,
|
|
222
222
|
isVisible = _ref5.isVisible,
|
|
223
|
-
isInlineCommentViewClosed = _ref5.isInlineCommentViewClosed
|
|
223
|
+
isInlineCommentViewClosed = _ref5.isInlineCommentViewClosed,
|
|
224
|
+
featureFlagsPluginState = _ref5.featureFlagsPluginState;
|
|
224
225
|
var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : _view.DecorationSet.empty;
|
|
225
226
|
var focusDecorations = [];
|
|
227
|
+
var isCommentsOnMediaMediaInlineBugFixEnabled = featureFlagsPluginState === null || featureFlagsPluginState === void 0 ? void 0 : featureFlagsPluginState.commentsOnMediaMediaInlineBugFix;
|
|
226
228
|
state.doc.descendants(function (node, pos) {
|
|
227
229
|
var _provider$supportedBl;
|
|
230
|
+
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
231
|
+
// Thus, we skip the decoration for mediaInline node
|
|
232
|
+
if (isCommentsOnMediaMediaInlineBugFixEnabled && node.type.name === 'mediaInline') {
|
|
233
|
+
return false;
|
|
234
|
+
}
|
|
228
235
|
var isSupportedBlockNode = node.isBlock && ((_provider$supportedBl = provider.supportedBlockNodes) === null || _provider$supportedBl === void 0 ? void 0 : _provider$supportedBl.includes(node.type.name));
|
|
229
236
|
node.marks.filter(function (mark) {
|
|
230
237
|
return mark.type === state.schema.marks.annotation;
|
|
@@ -22,7 +22,7 @@ var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
|
22
22
|
};
|
|
23
23
|
var getSelectionChangedHandler = function getSelectionChangedHandler(reopenCommentView) {
|
|
24
24
|
return function (tr, pluginState) {
|
|
25
|
-
var _pluginState$featureF;
|
|
25
|
+
var _pluginState$featureF, _pluginState$featureF2;
|
|
26
26
|
if (pluginState.skipSelectionHandling) {
|
|
27
27
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
28
28
|
skipSelectionHandling: false
|
|
@@ -38,22 +38,26 @@ var getSelectionChangedHandler = function getSelectionChangedHandler(reopenComme
|
|
|
38
38
|
isInlineCommentViewClosed: false
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
var selectedAnnotations = (0, _utils2.findAnnotationsInSelection)(tr.selection, tr.doc);
|
|
41
|
+
var selectedAnnotations = (0, _utils2.findAnnotationsInSelection)(tr.selection, tr.doc, (_pluginState$featureF2 = pluginState.featureFlagsPluginState) === null || _pluginState$featureF2 === void 0 ? void 0 : _pluginState$featureF2.commentsOnMediaMediaInlineBugFix);
|
|
42
42
|
if (selectedAnnotations.length === 0) {
|
|
43
43
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
44
44
|
selectedAnnotations: selectedAnnotations,
|
|
45
|
-
isInlineCommentViewClosed: true
|
|
45
|
+
isInlineCommentViewClosed: true,
|
|
46
|
+
selectAnnotationMethod: undefined
|
|
46
47
|
});
|
|
47
48
|
}
|
|
48
49
|
if ((0, _utils2.isSelectedAnnotationsChanged)(selectedAnnotations, pluginState.selectedAnnotations)) {
|
|
49
50
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
50
|
-
selectedAnnotations: selectedAnnotations
|
|
51
|
+
selectedAnnotations: selectedAnnotations,
|
|
52
|
+
selectAnnotationMethod: undefined
|
|
51
53
|
}, reopenCommentView && {
|
|
52
54
|
isInlineCommentViewClosed: false
|
|
53
55
|
});
|
|
54
56
|
}
|
|
55
|
-
return _objectSpread(_objectSpread({}, pluginState), reopenCommentView && {
|
|
57
|
+
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), reopenCommentView && {
|
|
56
58
|
isInlineCommentViewClosed: false
|
|
59
|
+
}), {}, {
|
|
60
|
+
selectAnnotationMethod: undefined
|
|
57
61
|
});
|
|
58
62
|
};
|
|
59
63
|
};
|
|
@@ -40,7 +40,8 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
40
40
|
return _objectSpread(_objectSpread({}, updatedPluginState), {}, {
|
|
41
41
|
selectedAnnotations: [].concat((0, _toConsumableArray2.default)(updatedPluginState.selectedAnnotations), (0, _toConsumableArray2.default)(action.data.selectedAnnotations)),
|
|
42
42
|
annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments),
|
|
43
|
-
isInlineCommentViewClosed: false
|
|
43
|
+
isInlineCommentViewClosed: false,
|
|
44
|
+
selectAnnotationMethod: undefined
|
|
44
45
|
});
|
|
45
46
|
case _types.ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
46
47
|
var isVisible = action.data.isVisible;
|
|
@@ -53,6 +54,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
53
54
|
case _types.ACTIONS.SET_SELECTED_ANNOTATION:
|
|
54
55
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
55
56
|
selectedAnnotations: (0, _toConsumableArray2.default)(action.data.selectedAnnotations),
|
|
57
|
+
selectAnnotationMethod: action.data.selectAnnotationMethod,
|
|
56
58
|
skipSelectionHandling: true,
|
|
57
59
|
isInlineCommentViewClosed: false
|
|
58
60
|
});
|
|
@@ -14,6 +14,8 @@ var _commands = require("../commands");
|
|
|
14
14
|
var _types = require("../types");
|
|
15
15
|
var _utils2 = require("../utils");
|
|
16
16
|
var _AnnotationViewWrapper = require("./AnnotationViewWrapper");
|
|
17
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
18
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2.default)(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
17
19
|
var findPosForDOM = function findPosForDOM(sel) {
|
|
18
20
|
var $from = sel.$from,
|
|
19
21
|
from = sel.from;
|
|
@@ -110,18 +112,27 @@ function InlineCommentView(_ref) {
|
|
|
110
112
|
return null;
|
|
111
113
|
}
|
|
112
114
|
var onAnnotationViewed = function onAnnotationViewed() {
|
|
115
|
+
var _editorView$state$doc;
|
|
113
116
|
if (!dispatchAnalyticsEvent) {
|
|
114
117
|
return;
|
|
115
118
|
}
|
|
119
|
+
var _ref3 = inlineCommentState || {},
|
|
120
|
+
selectAnnotationMethod = _ref3.selectAnnotationMethod,
|
|
121
|
+
featureFlagsPluginState = _ref3.featureFlagsPluginState;
|
|
122
|
+
var isCommentsOnMediaAnalyticsEnabled = featureFlagsPluginState === null || featureFlagsPluginState === void 0 ? void 0 : featureFlagsPluginState.commentsOnMediaAnalytics;
|
|
123
|
+
|
|
116
124
|
// fire analytics
|
|
117
125
|
var payload = {
|
|
118
126
|
action: _analytics.ACTION.VIEWED,
|
|
119
127
|
actionSubject: _analytics.ACTION_SUBJECT.ANNOTATION,
|
|
120
128
|
actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
121
129
|
eventType: _analytics.EVENT_TYPE.TRACK,
|
|
122
|
-
attributes: {
|
|
130
|
+
attributes: _objectSpread({
|
|
123
131
|
overlap: activeAnnotations.length ? activeAnnotations.length - 1 : 0
|
|
124
|
-
}
|
|
132
|
+
}, isCommentsOnMediaAnalyticsEnabled && {
|
|
133
|
+
targetNodeType: (_editorView$state$doc = editorView.state.doc.nodeAt(position)) === null || _editorView$state$doc === void 0 ? void 0 : _editorView$state$doc.type.name,
|
|
134
|
+
method: selectAnnotationMethod
|
|
135
|
+
})
|
|
125
136
|
};
|
|
126
137
|
dispatchAnalyticsEvent(payload);
|
|
127
138
|
};
|
package/dist/cjs/utils.js
CHANGED
|
@@ -167,7 +167,7 @@ var isCurrentBlockNodeSelected = exports.isCurrentBlockNodeSelected = function i
|
|
|
167
167
|
}
|
|
168
168
|
return false;
|
|
169
169
|
};
|
|
170
|
-
var findAnnotationsInSelection = exports.findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc) {
|
|
170
|
+
var findAnnotationsInSelection = exports.findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc, isCommentsOnMediaMediaInlineBugFixEnabled) {
|
|
171
171
|
var empty = selection.empty,
|
|
172
172
|
$anchor = selection.$anchor,
|
|
173
173
|
anchor = selection.anchor;
|
|
@@ -176,11 +176,19 @@ var findAnnotationsInSelection = exports.findAnnotationsInSelection = function f
|
|
|
176
176
|
return [];
|
|
177
177
|
}
|
|
178
178
|
var node = doc.nodeAt(anchor);
|
|
179
|
-
|
|
179
|
+
var nodeBefore = $anchor.nodeBefore;
|
|
180
|
+
if (!node && !nodeBefore) {
|
|
181
|
+
return [];
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
185
|
+
// Hence, we ignore annotations associated with the node when the cursor is right after/before the node
|
|
186
|
+
if (isCommentsOnMediaMediaInlineBugFixEnabled && [nodeBefore, node].some(function (node) {
|
|
187
|
+
return (node === null || node === void 0 ? void 0 : node.type.name) === 'mediaInline';
|
|
188
|
+
})) {
|
|
180
189
|
return [];
|
|
181
190
|
}
|
|
182
191
|
var annotationMark = doc.type.schema.marks.annotation;
|
|
183
|
-
var nodeBefore = $anchor.nodeBefore;
|
|
184
192
|
var anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
|
|
185
193
|
var marks = [];
|
|
186
194
|
if (annotationMark.isInSet(anchorAnnotationMarks)) {
|
|
@@ -118,7 +118,7 @@ const getDraftCommandAction = (drafting, targetType, targetNodeId, isCommentOnMe
|
|
|
118
118
|
* Show active inline comments for a given block node, otherwise,
|
|
119
119
|
* return false if the node has no comments or no unresolved comments.
|
|
120
120
|
*/
|
|
121
|
-
export const showInlineCommentForBlockNode = (supportedBlockNodes = []) => node => (state, dispatch) => {
|
|
121
|
+
export const showInlineCommentForBlockNode = (supportedBlockNodes = []) => (node, viewMethod) => (state, dispatch) => {
|
|
122
122
|
const pluginState = getPluginState(state);
|
|
123
123
|
const {
|
|
124
124
|
annotation
|
|
@@ -136,7 +136,8 @@ export const showInlineCommentForBlockNode = (supportedBlockNodes = []) => node
|
|
|
136
136
|
dispatch(state.tr.setMeta(inlineCommentPluginKey, {
|
|
137
137
|
type: ACTIONS.SET_SELECTED_ANNOTATION,
|
|
138
138
|
data: {
|
|
139
|
-
selectedAnnotations: unresolvedAnnotationMarks
|
|
139
|
+
selectedAnnotations: unresolvedAnnotationMarks,
|
|
140
|
+
selectAnnotationMethod: viewMethod
|
|
140
141
|
}
|
|
141
142
|
}));
|
|
142
143
|
return true;
|
|
@@ -159,12 +159,19 @@ export const inlineCommentPlugin = options => {
|
|
|
159
159
|
annotations,
|
|
160
160
|
selectedAnnotations,
|
|
161
161
|
isVisible,
|
|
162
|
-
isInlineCommentViewClosed
|
|
162
|
+
isInlineCommentViewClosed,
|
|
163
|
+
featureFlagsPluginState
|
|
163
164
|
} = getPluginState(state) || {};
|
|
164
165
|
let decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
|
|
165
166
|
const focusDecorations = [];
|
|
167
|
+
const isCommentsOnMediaMediaInlineBugFixEnabled = featureFlagsPluginState === null || featureFlagsPluginState === void 0 ? void 0 : featureFlagsPluginState.commentsOnMediaMediaInlineBugFix;
|
|
166
168
|
state.doc.descendants((node, pos) => {
|
|
167
169
|
var _provider$supportedBl;
|
|
170
|
+
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
171
|
+
// Thus, we skip the decoration for mediaInline node
|
|
172
|
+
if (isCommentsOnMediaMediaInlineBugFixEnabled && node.type.name === 'mediaInline') {
|
|
173
|
+
return false;
|
|
174
|
+
}
|
|
168
175
|
const isSupportedBlockNode = node.isBlock && ((_provider$supportedBl = provider.supportedBlockNodes) === null || _provider$supportedBl === void 0 ? void 0 : _provider$supportedBl.includes(node.type.name));
|
|
169
176
|
node.marks.filter(mark => mark.type === state.schema.marks.annotation).forEach(mark => {
|
|
170
177
|
if (isVisible) {
|
|
@@ -12,7 +12,7 @@ const handleDocChanged = (tr, prevPluginState) => {
|
|
|
12
12
|
};
|
|
13
13
|
};
|
|
14
14
|
const getSelectionChangedHandler = reopenCommentView => (tr, pluginState) => {
|
|
15
|
-
var _pluginState$featureF;
|
|
15
|
+
var _pluginState$featureF, _pluginState$featureF2;
|
|
16
16
|
if (pluginState.skipSelectionHandling) {
|
|
17
17
|
return {
|
|
18
18
|
...pluginState,
|
|
@@ -33,18 +33,20 @@ const getSelectionChangedHandler = reopenCommentView => (tr, pluginState) => {
|
|
|
33
33
|
})
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
-
const selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
36
|
+
const selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc, (_pluginState$featureF2 = pluginState.featureFlagsPluginState) === null || _pluginState$featureF2 === void 0 ? void 0 : _pluginState$featureF2.commentsOnMediaMediaInlineBugFix);
|
|
37
37
|
if (selectedAnnotations.length === 0) {
|
|
38
38
|
return {
|
|
39
39
|
...pluginState,
|
|
40
40
|
selectedAnnotations,
|
|
41
|
-
isInlineCommentViewClosed: true
|
|
41
|
+
isInlineCommentViewClosed: true,
|
|
42
|
+
selectAnnotationMethod: undefined
|
|
42
43
|
};
|
|
43
44
|
}
|
|
44
45
|
if (isSelectedAnnotationsChanged(selectedAnnotations, pluginState.selectedAnnotations)) {
|
|
45
46
|
return {
|
|
46
47
|
...pluginState,
|
|
47
48
|
selectedAnnotations,
|
|
49
|
+
selectAnnotationMethod: undefined,
|
|
48
50
|
...(reopenCommentView && {
|
|
49
51
|
isInlineCommentViewClosed: false
|
|
50
52
|
})
|
|
@@ -54,7 +56,8 @@ const getSelectionChangedHandler = reopenCommentView => (tr, pluginState) => {
|
|
|
54
56
|
...pluginState,
|
|
55
57
|
...(reopenCommentView && {
|
|
56
58
|
isInlineCommentViewClosed: false
|
|
57
|
-
})
|
|
59
|
+
}),
|
|
60
|
+
selectAnnotationMethod: undefined
|
|
58
61
|
};
|
|
59
62
|
};
|
|
60
63
|
export const {
|
|
@@ -40,7 +40,8 @@ export default ((pluginState, action) => {
|
|
|
40
40
|
...pluginState.annotations,
|
|
41
41
|
...action.data.inlineComments
|
|
42
42
|
},
|
|
43
|
-
isInlineCommentViewClosed: false
|
|
43
|
+
isInlineCommentViewClosed: false,
|
|
44
|
+
selectAnnotationMethod: undefined
|
|
44
45
|
};
|
|
45
46
|
case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
46
47
|
const {
|
|
@@ -57,6 +58,7 @@ export default ((pluginState, action) => {
|
|
|
57
58
|
return {
|
|
58
59
|
...pluginState,
|
|
59
60
|
selectedAnnotations: [...action.data.selectedAnnotations],
|
|
61
|
+
selectAnnotationMethod: action.data.selectAnnotationMethod,
|
|
60
62
|
skipSelectionHandling: true,
|
|
61
63
|
isInlineCommentViewClosed: false
|
|
62
64
|
};
|
|
@@ -108,9 +108,16 @@ export function InlineCommentView({
|
|
|
108
108
|
return null;
|
|
109
109
|
}
|
|
110
110
|
const onAnnotationViewed = () => {
|
|
111
|
+
var _editorView$state$doc;
|
|
111
112
|
if (!dispatchAnalyticsEvent) {
|
|
112
113
|
return;
|
|
113
114
|
}
|
|
115
|
+
const {
|
|
116
|
+
selectAnnotationMethod,
|
|
117
|
+
featureFlagsPluginState
|
|
118
|
+
} = inlineCommentState || {};
|
|
119
|
+
const isCommentsOnMediaAnalyticsEnabled = featureFlagsPluginState === null || featureFlagsPluginState === void 0 ? void 0 : featureFlagsPluginState.commentsOnMediaAnalytics;
|
|
120
|
+
|
|
114
121
|
// fire analytics
|
|
115
122
|
const payload = {
|
|
116
123
|
action: ACTION.VIEWED,
|
|
@@ -118,7 +125,11 @@ export function InlineCommentView({
|
|
|
118
125
|
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
119
126
|
eventType: EVENT_TYPE.TRACK,
|
|
120
127
|
attributes: {
|
|
121
|
-
overlap: activeAnnotations.length ? activeAnnotations.length - 1 : 0
|
|
128
|
+
overlap: activeAnnotations.length ? activeAnnotations.length - 1 : 0,
|
|
129
|
+
...(isCommentsOnMediaAnalyticsEnabled && {
|
|
130
|
+
targetNodeType: (_editorView$state$doc = editorView.state.doc.nodeAt(position)) === null || _editorView$state$doc === void 0 ? void 0 : _editorView$state$doc.type.name,
|
|
131
|
+
method: selectAnnotationMethod
|
|
132
|
+
})
|
|
122
133
|
}
|
|
123
134
|
};
|
|
124
135
|
dispatchAnalyticsEvent(payload);
|
package/dist/es2019/utils.js
CHANGED
|
@@ -128,7 +128,7 @@ export const isCurrentBlockNodeSelected = (state, node) => {
|
|
|
128
128
|
}
|
|
129
129
|
return false;
|
|
130
130
|
};
|
|
131
|
-
export const findAnnotationsInSelection = (selection, doc) => {
|
|
131
|
+
export const findAnnotationsInSelection = (selection, doc, isCommentsOnMediaMediaInlineBugFixEnabled) => {
|
|
132
132
|
const {
|
|
133
133
|
empty,
|
|
134
134
|
$anchor,
|
|
@@ -139,11 +139,17 @@ export const findAnnotationsInSelection = (selection, doc) => {
|
|
|
139
139
|
return [];
|
|
140
140
|
}
|
|
141
141
|
const node = doc.nodeAt(anchor);
|
|
142
|
-
|
|
142
|
+
const nodeBefore = $anchor.nodeBefore;
|
|
143
|
+
if (!node && !nodeBefore) {
|
|
144
|
+
return [];
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
148
|
+
// Hence, we ignore annotations associated with the node when the cursor is right after/before the node
|
|
149
|
+
if (isCommentsOnMediaMediaInlineBugFixEnabled && [nodeBefore, node].some(node => (node === null || node === void 0 ? void 0 : node.type.name) === 'mediaInline')) {
|
|
143
150
|
return [];
|
|
144
151
|
}
|
|
145
152
|
const annotationMark = doc.type.schema.marks.annotation;
|
|
146
|
-
const nodeBefore = $anchor.nodeBefore;
|
|
147
153
|
const anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
|
|
148
154
|
let marks = [];
|
|
149
155
|
if (annotationMark.isInSet(anchorAnnotationMarks)) {
|
|
@@ -131,7 +131,7 @@ var getDraftCommandAction = function getDraftCommandAction(drafting, targetType,
|
|
|
131
131
|
*/
|
|
132
132
|
export var showInlineCommentForBlockNode = function showInlineCommentForBlockNode() {
|
|
133
133
|
var supportedBlockNodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
134
|
-
return function (node) {
|
|
134
|
+
return function (node, viewMethod) {
|
|
135
135
|
return function (state, dispatch) {
|
|
136
136
|
var pluginState = getPluginState(state);
|
|
137
137
|
var annotation = state.schema.marks.annotation;
|
|
@@ -152,7 +152,8 @@ export var showInlineCommentForBlockNode = function showInlineCommentForBlockNod
|
|
|
152
152
|
dispatch(state.tr.setMeta(inlineCommentPluginKey, {
|
|
153
153
|
type: ACTIONS.SET_SELECTED_ANNOTATION,
|
|
154
154
|
data: {
|
|
155
|
-
selectedAnnotations: unresolvedAnnotationMarks
|
|
155
|
+
selectedAnnotations: unresolvedAnnotationMarks,
|
|
156
|
+
selectAnnotationMethod: viewMethod
|
|
156
157
|
}
|
|
157
158
|
}));
|
|
158
159
|
return true;
|
|
@@ -213,11 +213,18 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
213
213
|
annotations = _ref5.annotations,
|
|
214
214
|
selectedAnnotations = _ref5.selectedAnnotations,
|
|
215
215
|
isVisible = _ref5.isVisible,
|
|
216
|
-
isInlineCommentViewClosed = _ref5.isInlineCommentViewClosed
|
|
216
|
+
isInlineCommentViewClosed = _ref5.isInlineCommentViewClosed,
|
|
217
|
+
featureFlagsPluginState = _ref5.featureFlagsPluginState;
|
|
217
218
|
var decorations = draftDecorationSet !== null && draftDecorationSet !== void 0 ? draftDecorationSet : DecorationSet.empty;
|
|
218
219
|
var focusDecorations = [];
|
|
220
|
+
var isCommentsOnMediaMediaInlineBugFixEnabled = featureFlagsPluginState === null || featureFlagsPluginState === void 0 ? void 0 : featureFlagsPluginState.commentsOnMediaMediaInlineBugFix;
|
|
219
221
|
state.doc.descendants(function (node, pos) {
|
|
220
222
|
var _provider$supportedBl;
|
|
223
|
+
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
224
|
+
// Thus, we skip the decoration for mediaInline node
|
|
225
|
+
if (isCommentsOnMediaMediaInlineBugFixEnabled && node.type.name === 'mediaInline') {
|
|
226
|
+
return false;
|
|
227
|
+
}
|
|
221
228
|
var isSupportedBlockNode = node.isBlock && ((_provider$supportedBl = provider.supportedBlockNodes) === null || _provider$supportedBl === void 0 ? void 0 : _provider$supportedBl.includes(node.type.name));
|
|
222
229
|
node.marks.filter(function (mark) {
|
|
223
230
|
return mark.type === state.schema.marks.annotation;
|
|
@@ -15,7 +15,7 @@ var handleDocChanged = function handleDocChanged(tr, prevPluginState) {
|
|
|
15
15
|
};
|
|
16
16
|
var getSelectionChangedHandler = function getSelectionChangedHandler(reopenCommentView) {
|
|
17
17
|
return function (tr, pluginState) {
|
|
18
|
-
var _pluginState$featureF;
|
|
18
|
+
var _pluginState$featureF, _pluginState$featureF2;
|
|
19
19
|
if (pluginState.skipSelectionHandling) {
|
|
20
20
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
21
21
|
skipSelectionHandling: false
|
|
@@ -31,22 +31,26 @@ var getSelectionChangedHandler = function getSelectionChangedHandler(reopenComme
|
|
|
31
31
|
isInlineCommentViewClosed: false
|
|
32
32
|
});
|
|
33
33
|
}
|
|
34
|
-
var selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc);
|
|
34
|
+
var selectedAnnotations = findAnnotationsInSelection(tr.selection, tr.doc, (_pluginState$featureF2 = pluginState.featureFlagsPluginState) === null || _pluginState$featureF2 === void 0 ? void 0 : _pluginState$featureF2.commentsOnMediaMediaInlineBugFix);
|
|
35
35
|
if (selectedAnnotations.length === 0) {
|
|
36
36
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
37
37
|
selectedAnnotations: selectedAnnotations,
|
|
38
|
-
isInlineCommentViewClosed: true
|
|
38
|
+
isInlineCommentViewClosed: true,
|
|
39
|
+
selectAnnotationMethod: undefined
|
|
39
40
|
});
|
|
40
41
|
}
|
|
41
42
|
if (isSelectedAnnotationsChanged(selectedAnnotations, pluginState.selectedAnnotations)) {
|
|
42
43
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
43
|
-
selectedAnnotations: selectedAnnotations
|
|
44
|
+
selectedAnnotations: selectedAnnotations,
|
|
45
|
+
selectAnnotationMethod: undefined
|
|
44
46
|
}, reopenCommentView && {
|
|
45
47
|
isInlineCommentViewClosed: false
|
|
46
48
|
});
|
|
47
49
|
}
|
|
48
|
-
return _objectSpread(_objectSpread({}, pluginState), reopenCommentView && {
|
|
50
|
+
return _objectSpread(_objectSpread(_objectSpread({}, pluginState), reopenCommentView && {
|
|
49
51
|
isInlineCommentViewClosed: false
|
|
52
|
+
}), {}, {
|
|
53
|
+
selectAnnotationMethod: undefined
|
|
50
54
|
});
|
|
51
55
|
};
|
|
52
56
|
};
|
|
@@ -33,7 +33,8 @@ export default (function (pluginState, action) {
|
|
|
33
33
|
return _objectSpread(_objectSpread({}, updatedPluginState), {}, {
|
|
34
34
|
selectedAnnotations: [].concat(_toConsumableArray(updatedPluginState.selectedAnnotations), _toConsumableArray(action.data.selectedAnnotations)),
|
|
35
35
|
annotations: _objectSpread(_objectSpread({}, pluginState.annotations), action.data.inlineComments),
|
|
36
|
-
isInlineCommentViewClosed: false
|
|
36
|
+
isInlineCommentViewClosed: false,
|
|
37
|
+
selectAnnotationMethod: undefined
|
|
37
38
|
});
|
|
38
39
|
case ACTIONS.INLINE_COMMENT_SET_VISIBLE:
|
|
39
40
|
var isVisible = action.data.isVisible;
|
|
@@ -46,6 +47,7 @@ export default (function (pluginState, action) {
|
|
|
46
47
|
case ACTIONS.SET_SELECTED_ANNOTATION:
|
|
47
48
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
48
49
|
selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations),
|
|
50
|
+
selectAnnotationMethod: action.data.selectAnnotationMethod,
|
|
49
51
|
skipSelectionHandling: true,
|
|
50
52
|
isInlineCommentViewClosed: false
|
|
51
53
|
});
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
2
4
|
import React from 'react';
|
|
3
5
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
6
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
@@ -103,18 +105,27 @@ export function InlineCommentView(_ref) {
|
|
|
103
105
|
return null;
|
|
104
106
|
}
|
|
105
107
|
var onAnnotationViewed = function onAnnotationViewed() {
|
|
108
|
+
var _editorView$state$doc;
|
|
106
109
|
if (!dispatchAnalyticsEvent) {
|
|
107
110
|
return;
|
|
108
111
|
}
|
|
112
|
+
var _ref3 = inlineCommentState || {},
|
|
113
|
+
selectAnnotationMethod = _ref3.selectAnnotationMethod,
|
|
114
|
+
featureFlagsPluginState = _ref3.featureFlagsPluginState;
|
|
115
|
+
var isCommentsOnMediaAnalyticsEnabled = featureFlagsPluginState === null || featureFlagsPluginState === void 0 ? void 0 : featureFlagsPluginState.commentsOnMediaAnalytics;
|
|
116
|
+
|
|
109
117
|
// fire analytics
|
|
110
118
|
var payload = {
|
|
111
119
|
action: ACTION.VIEWED,
|
|
112
120
|
actionSubject: ACTION_SUBJECT.ANNOTATION,
|
|
113
121
|
actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
|
|
114
122
|
eventType: EVENT_TYPE.TRACK,
|
|
115
|
-
attributes: {
|
|
123
|
+
attributes: _objectSpread({
|
|
116
124
|
overlap: activeAnnotations.length ? activeAnnotations.length - 1 : 0
|
|
117
|
-
}
|
|
125
|
+
}, isCommentsOnMediaAnalyticsEnabled && {
|
|
126
|
+
targetNodeType: (_editorView$state$doc = editorView.state.doc.nodeAt(position)) === null || _editorView$state$doc === void 0 ? void 0 : _editorView$state$doc.type.name,
|
|
127
|
+
method: selectAnnotationMethod
|
|
128
|
+
})
|
|
118
129
|
};
|
|
119
130
|
dispatchAnalyticsEvent(payload);
|
|
120
131
|
};
|
package/dist/esm/utils.js
CHANGED
|
@@ -140,7 +140,7 @@ export var isCurrentBlockNodeSelected = function isCurrentBlockNodeSelected(stat
|
|
|
140
140
|
}
|
|
141
141
|
return false;
|
|
142
142
|
};
|
|
143
|
-
export var findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc) {
|
|
143
|
+
export var findAnnotationsInSelection = function findAnnotationsInSelection(selection, doc, isCommentsOnMediaMediaInlineBugFixEnabled) {
|
|
144
144
|
var empty = selection.empty,
|
|
145
145
|
$anchor = selection.$anchor,
|
|
146
146
|
anchor = selection.anchor;
|
|
@@ -149,11 +149,19 @@ export var findAnnotationsInSelection = function findAnnotationsInSelection(sele
|
|
|
149
149
|
return [];
|
|
150
150
|
}
|
|
151
151
|
var node = doc.nodeAt(anchor);
|
|
152
|
-
|
|
152
|
+
var nodeBefore = $anchor.nodeBefore;
|
|
153
|
+
if (!node && !nodeBefore) {
|
|
154
|
+
return [];
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
158
|
+
// Hence, we ignore annotations associated with the node when the cursor is right after/before the node
|
|
159
|
+
if (isCommentsOnMediaMediaInlineBugFixEnabled && [nodeBefore, node].some(function (node) {
|
|
160
|
+
return (node === null || node === void 0 ? void 0 : node.type.name) === 'mediaInline';
|
|
161
|
+
})) {
|
|
153
162
|
return [];
|
|
154
163
|
}
|
|
155
164
|
var annotationMark = doc.type.schema.marks.annotation;
|
|
156
|
-
var nodeBefore = $anchor.nodeBefore;
|
|
157
165
|
var anchorAnnotationMarks = (node === null || node === void 0 ? void 0 : node.marks) || [];
|
|
158
166
|
var marks = [];
|
|
159
167
|
if (annotationMark.isInSet(anchorAnnotationMarks)) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { RESOLVE_METHOD, type VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
@@ -13,7 +13,7 @@ export declare const removeInlineCommentNearSelection: (id: string, supportedNod
|
|
|
13
13
|
* Show active inline comments for a given block node, otherwise,
|
|
14
14
|
* return false if the node has no comments or no unresolved comments.
|
|
15
15
|
*/
|
|
16
|
-
export declare const showInlineCommentForBlockNode: (supportedBlockNodes?: string[]) => (node: PMNode | null) => Command;
|
|
16
|
+
export declare const showInlineCommentForBlockNode: (supportedBlockNodes?: string[]) => (node: PMNode | null, viewMethod?: VIEW_METHOD) => Command;
|
|
17
17
|
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, supportedBlockNodes?: string[]) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean, targetNodeId?: string | undefined) => Command;
|
|
18
18
|
export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, supportedBlockNodes?: string[]) => Command;
|
|
19
19
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
@@ -69,7 +69,7 @@ declare const _default: {
|
|
|
69
69
|
actions: {
|
|
70
70
|
stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
|
|
71
71
|
setInlineCommentDraftState: (drafting: boolean, inputMethod: InlineCommentInputMethod, targetType?: import("../types").TargetType | undefined, isCommentOnMediaOn?: boolean | undefined, targetNodeId?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
72
|
-
showCommentForBlockNode: (node: import("prosemirror-model").Node | null) => import("@atlaskit/editor-common/types").Command;
|
|
72
|
+
showCommentForBlockNode: (node: import("prosemirror-model").Node | null, viewMethod?: import("@atlaskit/editor-common/analytics").VIEW_METHOD | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
73
73
|
};
|
|
74
74
|
}, import("../types").AnnotationProviders | undefined>, import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
75
75
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/src/portal';
|
|
@@ -69,6 +69,7 @@ export type InlineCommentAction = {
|
|
|
69
69
|
type: ACTIONS.SET_SELECTED_ANNOTATION;
|
|
70
70
|
data: {
|
|
71
71
|
selectedAnnotations: AnnotationInfo[];
|
|
72
|
+
selectAnnotationMethod?: VIEW_METHOD;
|
|
72
73
|
};
|
|
73
74
|
};
|
|
74
75
|
export type InlineCommentPluginState = {
|
|
@@ -85,4 +86,5 @@ export type InlineCommentPluginState = {
|
|
|
85
86
|
featureFlagsPluginState?: FeatureFlags;
|
|
86
87
|
isDrafting: boolean;
|
|
87
88
|
targetNodeId?: string;
|
|
89
|
+
selectAnnotationMethod?: VIEW_METHOD;
|
|
88
90
|
};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -21,7 +21,7 @@ export declare const decorationKey: {
|
|
|
21
21
|
export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
|
|
22
22
|
export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
|
|
23
23
|
export declare const isCurrentBlockNodeSelected: (state: EditorState, node: Node) => boolean;
|
|
24
|
-
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
|
|
24
|
+
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node, isCommentsOnMediaMediaInlineBugFixEnabled?: boolean) => AnnotationInfo[];
|
|
25
25
|
export declare const resolveDraftBookmark: (editorState: EditorState, bookmark?: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
|
|
26
26
|
/**
|
|
27
27
|
* get selection from position to apply new comment for
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
3
|
-
import { RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import { RESOLVE_METHOD, type VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import type { Command, ExtractInjectionAPI } from '@atlaskit/editor-common/types';
|
|
5
5
|
import type { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
|
|
6
6
|
import type { InlineCommentMap, InlineCommentMouseData } from '../pm-plugins/types';
|
|
@@ -13,7 +13,7 @@ export declare const removeInlineCommentNearSelection: (id: string, supportedNod
|
|
|
13
13
|
* Show active inline comments for a given block node, otherwise,
|
|
14
14
|
* return false if the node has no comments or no unresolved comments.
|
|
15
15
|
*/
|
|
16
|
-
export declare const showInlineCommentForBlockNode: (supportedBlockNodes?: string[]) => (node: PMNode | null) => Command;
|
|
16
|
+
export declare const showInlineCommentForBlockNode: (supportedBlockNodes?: string[]) => (node: PMNode | null, viewMethod?: VIEW_METHOD) => Command;
|
|
17
17
|
export declare const setInlineCommentDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, supportedBlockNodes?: string[]) => (drafting: boolean, inputMethod?: InlineCommentInputMethod, targetType?: TargetType, isCommentOnMediaOn?: boolean, targetNodeId?: string | undefined) => Command;
|
|
18
18
|
export declare const addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI?: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, supportedBlockNodes?: string[]) => Command;
|
|
19
19
|
export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
|
|
@@ -83,7 +83,7 @@ declare const _default: {
|
|
|
83
83
|
actions: {
|
|
84
84
|
stripNonExistingAnnotations: (slice: import("prosemirror-model").Slice, state: EditorState) => boolean | undefined;
|
|
85
85
|
setInlineCommentDraftState: (drafting: boolean, inputMethod: InlineCommentInputMethod, targetType?: import("../types").TargetType | undefined, isCommentOnMediaOn?: boolean | undefined, targetNodeId?: string | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
86
|
-
showCommentForBlockNode: (node: import("prosemirror-model").Node | null) => import("@atlaskit/editor-common/types").Command;
|
|
86
|
+
showCommentForBlockNode: (node: import("prosemirror-model").Node | null, viewMethod?: import("@atlaskit/editor-common/analytics").VIEW_METHOD | undefined) => import("@atlaskit/editor-common/types").Command;
|
|
87
87
|
};
|
|
88
88
|
}, import("../types").AnnotationProviders | undefined>,
|
|
89
89
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
1
|
+
import type { EditorAnalyticsAPI, VIEW_METHOD } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import type { Dispatch, EventDispatcher } from '@atlaskit/editor-common/event-dispatcher';
|
|
3
3
|
import type { LegacyPortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
4
4
|
import { type PortalProviderAPI } from '@atlaskit/editor-common/src/portal';
|
|
@@ -69,6 +69,7 @@ export type InlineCommentAction = {
|
|
|
69
69
|
type: ACTIONS.SET_SELECTED_ANNOTATION;
|
|
70
70
|
data: {
|
|
71
71
|
selectedAnnotations: AnnotationInfo[];
|
|
72
|
+
selectAnnotationMethod?: VIEW_METHOD;
|
|
72
73
|
};
|
|
73
74
|
};
|
|
74
75
|
export type InlineCommentPluginState = {
|
|
@@ -85,4 +86,5 @@ export type InlineCommentPluginState = {
|
|
|
85
86
|
featureFlagsPluginState?: FeatureFlags;
|
|
86
87
|
isDrafting: boolean;
|
|
87
88
|
targetNodeId?: string;
|
|
89
|
+
selectAnnotationMethod?: VIEW_METHOD;
|
|
88
90
|
};
|
|
@@ -21,7 +21,7 @@ export declare const decorationKey: {
|
|
|
21
21
|
export declare const addDraftDecoration: (start: number, end: number, targetType?: TargetType) => Decoration;
|
|
22
22
|
export declare const getAnnotationViewKey: (annotations: AnnotationInfo[]) => string;
|
|
23
23
|
export declare const isCurrentBlockNodeSelected: (state: EditorState, node: Node) => boolean;
|
|
24
|
-
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node) => AnnotationInfo[];
|
|
24
|
+
export declare const findAnnotationsInSelection: (selection: Selection, doc: Node, isCommentsOnMediaMediaInlineBugFixEnabled?: boolean) => AnnotationInfo[];
|
|
25
25
|
export declare const resolveDraftBookmark: (editorState: EditorState, bookmark?: SelectionBookmark, supportedBlockNodes?: string[]) => DraftBookmark;
|
|
26
26
|
/**
|
|
27
27
|
* get selection from position to apply new comment for
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.9.1",
|
|
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.3.0",
|
|
36
|
-
"@atlaskit/editor-common": "^80.
|
|
36
|
+
"@atlaskit/editor-common": "^80.4.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",
|