@atlaskit/editor-plugin-annotation 19.0.3 → 19.2.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 +20 -0
- package/dist/cjs/annotationPlugin.js +23 -14
- package/dist/cjs/editor-commands/index.js +22 -14
- package/dist/cjs/editor-commands/transform.js +4 -4
- package/dist/cjs/pm-plugins/annotation-manager-hooks.js +5 -5
- package/dist/cjs/pm-plugins/inline-comment.js +2 -3
- package/dist/cjs/pm-plugins/reducer.js +3 -3
- package/dist/cjs/pm-plugins/utils.js +10 -5
- package/dist/cjs/ui/InlineCommentView.js +3 -3
- package/dist/es2019/annotationPlugin.js +19 -10
- package/dist/es2019/editor-commands/index.js +20 -18
- package/dist/es2019/editor-commands/transform.js +4 -4
- package/dist/es2019/pm-plugins/annotation-manager-hooks.js +5 -5
- package/dist/es2019/pm-plugins/inline-comment.js +3 -4
- package/dist/es2019/pm-plugins/reducer.js +3 -3
- package/dist/es2019/pm-plugins/utils.js +9 -7
- package/dist/es2019/ui/InlineCommentView.js +3 -3
- package/dist/esm/annotationPlugin.js +24 -15
- package/dist/esm/editor-commands/index.js +22 -14
- package/dist/esm/editor-commands/transform.js +4 -4
- package/dist/esm/pm-plugins/annotation-manager-hooks.js +5 -5
- package/dist/esm/pm-plugins/inline-comment.js +3 -4
- package/dist/esm/pm-plugins/reducer.js +3 -3
- package/dist/esm/pm-plugins/utils.js +10 -5
- package/dist/esm/ui/InlineCommentView.js +3 -3
- package/dist/types/annotationPluginType.d.ts +12 -0
- package/dist/types/editor-commands/index.d.ts +7 -7
- package/dist/types/editor-commands/transform.d.ts +3 -3
- package/dist/types/pm-plugins/annotation-manager-hooks.d.ts +1 -1
- package/dist/types/pm-plugins/types.d.ts +1 -0
- package/dist/types/pm-plugins/utils.d.ts +4 -4
- package/dist/types/types/index.d.ts +9 -0
- package/package.json +6 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 19.2.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`c408ac489d43a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c408ac489d43a) -
|
|
8
|
+
Add an optional node-aware predicate for block annotation eligibility behind
|
|
9
|
+
`cc_maui_annotations_on_extensions`, while preserving the existing node-name configuration.
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 19.1.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`e1e5846272124`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e1e5846272124) -
|
|
20
|
+
Expose `applyInlineCommentDraft` and `removeInlineCommentAnnotation` so consumers can apply and
|
|
21
|
+
roll back inline-comment drafts without the annotation manager.
|
|
22
|
+
|
|
3
23
|
## 19.0.3
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
|
@@ -9,6 +9,7 @@ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"))
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
11
|
var _react = _interopRequireDefault(require("react"));
|
|
12
|
+
var _annotation = require("@atlaskit/adf-schema/annotation");
|
|
12
13
|
var _coreUtils = require("@atlaskit/editor-common/core-utils");
|
|
13
14
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
14
15
|
var _editorExperiment = require("@atlaskit/tmp-editor-statsig/editor-experiment");
|
|
@@ -24,7 +25,7 @@ var _toolbarComponents = require("./ui/toolbar-components");
|
|
|
24
25
|
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; }
|
|
25
26
|
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; }
|
|
26
27
|
var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref) {
|
|
27
|
-
var _api$featureFlags, _api$
|
|
28
|
+
var _api$featureFlags, _api$analytics3;
|
|
28
29
|
var annotationProviders = _ref.config,
|
|
29
30
|
api = _ref.api;
|
|
30
31
|
var featureFlags = api === null || api === void 0 || (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState();
|
|
@@ -94,8 +95,16 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
94
95
|
hasAnyUnResolvedAnnotationInPage: _utils.hasAnyUnResolvedAnnotationInPage,
|
|
95
96
|
requestCloseInlineComment: requestCloseInlineComment,
|
|
96
97
|
stripNonExistingAnnotations: _utils.stripNonExistingAnnotations,
|
|
97
|
-
|
|
98
|
-
|
|
98
|
+
applyInlineCommentDraft: function applyInlineCommentDraft(annotationId) {
|
|
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);
|
|
101
|
+
},
|
|
102
|
+
removeInlineCommentAnnotation: function removeInlineCommentAnnotation(annotationId) {
|
|
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$ : []);
|
|
105
|
+
},
|
|
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
|
+
showCommentForBlockNode: (0, _editorCommands.showInlineCommentForBlockNode)(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
99
108
|
setSelectedAnnotation: _editorCommands.setSelectedAnnotation,
|
|
100
109
|
setPendingSelectedAnnotation: _editorCommands.setPendingSelectedAnnotation
|
|
101
110
|
},
|
|
@@ -114,11 +123,11 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
114
123
|
plugin: function plugin(_ref4) {
|
|
115
124
|
var dispatch = _ref4.dispatch;
|
|
116
125
|
if (annotationProviders) {
|
|
117
|
-
var _api$
|
|
126
|
+
var _api$analytics4;
|
|
118
127
|
return (0, _inlineComment.inlineCommentPlugin)({
|
|
119
128
|
dispatch: dispatch,
|
|
120
129
|
provider: annotationProviders.inlineComment,
|
|
121
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$
|
|
130
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
122
131
|
featureFlagsPluginState: featureFlags,
|
|
123
132
|
selectCommentExperience: annotationProviders.selectCommentExperience,
|
|
124
133
|
viewInlineCommentTraceUFOPress: annotationProviders.viewInlineCommentTraceUFOPress,
|
|
@@ -158,13 +167,13 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
158
167
|
}
|
|
159
168
|
var pluginState = (0, _utils.getPluginState)(state);
|
|
160
169
|
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
161
|
-
var _api$
|
|
162
|
-
var _annotationProviders$ = annotationProviders.inlineComment,
|
|
163
|
-
isToolbarAbove = _annotationProviders
|
|
164
|
-
onCommentButtonMount = _annotationProviders
|
|
165
|
-
getCanAddComments = _annotationProviders
|
|
166
|
-
contentType = _annotationProviders
|
|
167
|
-
var toolbarConfig = (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$
|
|
170
|
+
var _api$analytics5;
|
|
171
|
+
var _annotationProviders$2 = annotationProviders.inlineComment,
|
|
172
|
+
isToolbarAbove = _annotationProviders$2.isToolbarAbove,
|
|
173
|
+
onCommentButtonMount = _annotationProviders$2.onCommentButtonMount,
|
|
174
|
+
getCanAddComments = _annotationProviders$2.getCanAddComments,
|
|
175
|
+
contentType = _annotationProviders$2.contentType;
|
|
176
|
+
var toolbarConfig = (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)({
|
|
168
177
|
state: state,
|
|
169
178
|
intl: intl,
|
|
170
179
|
isToolbarAbove: isToolbarAbove,
|
|
@@ -209,7 +218,7 @@ var selector = function selector(states) {
|
|
|
209
218
|
};
|
|
210
219
|
};
|
|
211
220
|
function AnnotationContentComponent(_ref6) {
|
|
212
|
-
var _api$
|
|
221
|
+
var _api$analytics6;
|
|
213
222
|
var api = _ref6.api,
|
|
214
223
|
editorView = _ref6.editorView,
|
|
215
224
|
annotationProviders = _ref6.annotationProviders,
|
|
@@ -226,7 +235,7 @@ function AnnotationContentComponent(_ref6) {
|
|
|
226
235
|
providers: annotationProviders,
|
|
227
236
|
editorView: editorView,
|
|
228
237
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
229
|
-
editorAnalyticsAPI: api === null || api === void 0 || (_api$
|
|
238
|
+
editorAnalyticsAPI: api === null || api === void 0 || (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions,
|
|
230
239
|
editorAPI: api
|
|
231
240
|
}));
|
|
232
241
|
}
|
|
@@ -88,11 +88,13 @@ var setPendingSelectedAnnotation = exports.setPendingSelectedAnnotation = functi
|
|
|
88
88
|
};
|
|
89
89
|
var removeInlineCommentFromNode = function removeInlineCommentFromNode(id) {
|
|
90
90
|
var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
91
|
-
var
|
|
92
|
-
var
|
|
91
|
+
var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
92
|
+
var state = arguments.length > 3 ? arguments[3] : undefined;
|
|
93
|
+
var dispatch = arguments.length > 4 ? arguments[4] : undefined;
|
|
93
94
|
var tr = state.tr,
|
|
94
95
|
selection = state.selection;
|
|
95
|
-
|
|
96
|
+
var selectedNodeIsSupported = selection instanceof _state.NodeSelection && ((0, _utils.isSupportedBlockNode)(selection.node, supportedBlockNodes, isBlockNodeSupported) || selection.node.type === state.schema.nodes.mediaSingle && !!selection.node.firstChild && (0, _utils.isSupportedBlockNode)(selection.node.firstChild, supportedBlockNodes, isBlockNodeSupported));
|
|
97
|
+
if (selectedNodeIsSupported) {
|
|
96
98
|
var $from = selection.$from;
|
|
97
99
|
var currNode = selection.node;
|
|
98
100
|
var from = $from.start();
|
|
@@ -122,10 +124,11 @@ var removeInlineCommentFromNode = function removeInlineCommentFromNode(id) {
|
|
|
122
124
|
};
|
|
123
125
|
var removeInlineCommentNearSelection = exports.removeInlineCommentNearSelection = function removeInlineCommentNearSelection(id) {
|
|
124
126
|
var supportedNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
127
|
+
var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
125
128
|
return function (state, dispatch) {
|
|
126
129
|
var tr = state.tr,
|
|
127
130
|
$from = state.selection.$from;
|
|
128
|
-
if (removeInlineCommentFromNode(id, supportedNodes, state, dispatch)) {
|
|
131
|
+
if (removeInlineCommentFromNode(id, supportedNodes, isBlockNodeSupported, state, dispatch)) {
|
|
129
132
|
return true;
|
|
130
133
|
}
|
|
131
134
|
var annotationMarkType = state.schema.marks.annotation;
|
|
@@ -150,6 +153,7 @@ var removeInlineCommentNearSelection = exports.removeInlineCommentNearSelection
|
|
|
150
153
|
var removeInlineCommentFromDoc = exports.removeInlineCommentFromDoc = function removeInlineCommentFromDoc(editorAnalyticsAPI) {
|
|
151
154
|
return function (id) {
|
|
152
155
|
var supportedNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
156
|
+
var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
153
157
|
return function (state, dispatch) {
|
|
154
158
|
var tr = state.tr;
|
|
155
159
|
state.doc.descendants(function (node, pos) {
|
|
@@ -158,11 +162,11 @@ var removeInlineCommentFromDoc = exports.removeInlineCommentFromDoc = function r
|
|
|
158
162
|
if (node.type.name === 'mediaInline') {
|
|
159
163
|
return false;
|
|
160
164
|
}
|
|
161
|
-
var
|
|
165
|
+
var isSupportedBlock = node.isBlock && (0, _utils.isSupportedBlockNode)(node, supportedNodes, isBlockNodeSupported);
|
|
162
166
|
node.marks.filter(function (mark) {
|
|
163
167
|
return mark.type === state.schema.marks.annotation && mark.attrs.id === id;
|
|
164
168
|
}).forEach(function (mark) {
|
|
165
|
-
if (
|
|
169
|
+
if (isSupportedBlock) {
|
|
166
170
|
tr.removeNodeMark(pos, mark);
|
|
167
171
|
} else {
|
|
168
172
|
tr.removeMark(pos, pos + node.nodeSize, mark);
|
|
@@ -177,10 +181,10 @@ var removeInlineCommentFromDoc = exports.removeInlineCommentFromDoc = function r
|
|
|
177
181
|
};
|
|
178
182
|
};
|
|
179
183
|
};
|
|
180
|
-
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, targetNodeId, supportedBlockNodes, isOpeningMediaCommentFromToolbar) {
|
|
184
|
+
var getDraftCommandAction = function getDraftCommandAction(drafting, targetType, targetNodeId, supportedBlockNodes, isBlockNodeSupported, isOpeningMediaCommentFromToolbar) {
|
|
181
185
|
return function (editorState) {
|
|
182
186
|
// validate selection only when entering draft mode
|
|
183
|
-
if (drafting && (0, _utils.isSelectionValid)(editorState) !== _types2.AnnotationSelectionType.VALID) {
|
|
187
|
+
if (drafting && (0, _utils.isSelectionValid)(editorState, supportedBlockNodes, isBlockNodeSupported) !== _types2.AnnotationSelectionType.VALID) {
|
|
184
188
|
return false;
|
|
185
189
|
}
|
|
186
190
|
return {
|
|
@@ -190,6 +194,7 @@ var getDraftCommandAction = function getDraftCommandAction(drafting, targetType,
|
|
|
190
194
|
editorState: editorState,
|
|
191
195
|
targetType: targetType,
|
|
192
196
|
supportedBlockNodes: supportedBlockNodes,
|
|
197
|
+
isBlockNodeSupported: isBlockNodeSupported,
|
|
193
198
|
targetNodeId: targetNodeId,
|
|
194
199
|
isOpeningMediaCommentFromToolbar: isOpeningMediaCommentFromToolbar
|
|
195
200
|
}
|
|
@@ -205,11 +210,12 @@ var getDraftCommandAction = function getDraftCommandAction(drafting, targetType,
|
|
|
205
210
|
*/
|
|
206
211
|
var showInlineCommentForBlockNode = exports.showInlineCommentForBlockNode = function showInlineCommentForBlockNode() {
|
|
207
212
|
var supportedBlockNodes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
213
|
+
var isBlockNodeSupported = arguments.length > 1 ? arguments[1] : undefined;
|
|
208
214
|
return function (node, viewMethod, isOpeningMediaCommentFromToolbar) {
|
|
209
215
|
return function (state, dispatch) {
|
|
210
216
|
var pluginState = (0, _utils.getPluginState)(state);
|
|
211
217
|
var annotation = state.schema.marks.annotation;
|
|
212
|
-
if (node && node.isBlock &&
|
|
218
|
+
if (node && node.isBlock && (0, _utils.isSupportedBlockNode)(node, supportedBlockNodes, isBlockNodeSupported)) {
|
|
213
219
|
var unresolvedAnnotationMarks = ((node === null || node === void 0 ? void 0 : node.marks) || []).filter(function (mark) {
|
|
214
220
|
return mark.type === annotation && !(pluginState !== null && pluginState !== void 0 && pluginState.annotations[mark.attrs.id]);
|
|
215
221
|
}).map(function (mark) {
|
|
@@ -242,12 +248,13 @@ var showInlineCommentForBlockNode = exports.showInlineCommentForBlockNode = func
|
|
|
242
248
|
var setInlineCommentDraftState = exports.setInlineCommentDraftState = function setInlineCommentDraftState(editorAnalyticsAPI) {
|
|
243
249
|
var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
244
250
|
var api = arguments.length > 2 ? arguments[2] : undefined;
|
|
251
|
+
var isBlockNodeSupported = arguments.length > 3 ? arguments[3] : undefined;
|
|
245
252
|
return function (drafting) {
|
|
246
253
|
var inputMethod = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _analytics.INPUT_METHOD.TOOLBAR;
|
|
247
254
|
var targetType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'inline';
|
|
248
255
|
var targetNodeId = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
|
|
249
256
|
var isOpeningMediaCommentFromToolbar = arguments.length > 4 ? arguments[4] : undefined;
|
|
250
|
-
var commandAction = getDraftCommandAction(drafting, targetType, targetNodeId, supportedBlockNodes, isOpeningMediaCommentFromToolbar);
|
|
257
|
+
var commandAction = getDraftCommandAction(drafting, targetType, targetNodeId, supportedBlockNodes, isBlockNodeSupported, isOpeningMediaCommentFromToolbar);
|
|
251
258
|
if (Boolean(api === null || api === void 0 ? void 0 : api.toolbar)) {
|
|
252
259
|
return function (state, dispatch) {
|
|
253
260
|
var tr = _transform.default.handleDraftState(editorAnalyticsAPI)(drafting, inputMethod)(state.tr, state);
|
|
@@ -273,7 +280,7 @@ var setInlineCommentDraftState = exports.setInlineCommentDraftState = function s
|
|
|
273
280
|
};
|
|
274
281
|
};
|
|
275
282
|
var addInlineComment = exports.addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI) {
|
|
276
|
-
return function (id, supportedBlockNodes) {
|
|
283
|
+
return function (id, supportedBlockNodes, isBlockNodeSupported) {
|
|
277
284
|
var commandAction = function commandAction(editorState) {
|
|
278
285
|
return {
|
|
279
286
|
type: _types.ACTIONS.ADD_INLINE_COMMENT,
|
|
@@ -292,7 +299,7 @@ var addInlineComment = exports.addInlineComment = function addInlineComment(edit
|
|
|
292
299
|
};
|
|
293
300
|
if (Boolean(editorAPI === null || editorAPI === void 0 ? void 0 : editorAPI.toolbar)) {
|
|
294
301
|
return function (state, dispatch) {
|
|
295
|
-
var tr = _transform.default.addInlineComment(editorAnalyticsAPI, editorAPI)(id, supportedBlockNodes)(state.tr, state);
|
|
302
|
+
var tr = _transform.default.addInlineComment(editorAnalyticsAPI, editorAPI)(id, supportedBlockNodes, isBlockNodeSupported)(state.tr, state);
|
|
296
303
|
tr.setMeta(_utils.inlineCommentPluginKey, commandAction(state));
|
|
297
304
|
(0, _utils2.resetUserIntent)(editorAPI, tr);
|
|
298
305
|
if (dispatch) {
|
|
@@ -302,7 +309,7 @@ var addInlineComment = exports.addInlineComment = function addInlineComment(edit
|
|
|
302
309
|
return false;
|
|
303
310
|
};
|
|
304
311
|
} else {
|
|
305
|
-
return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(editorAnalyticsAPI, editorAPI)(id, supportedBlockNodes));
|
|
312
|
+
return (0, _pluginFactory.createCommand)(commandAction, _transform.default.addInlineComment(editorAnalyticsAPI, editorAPI)(id, supportedBlockNodes, isBlockNodeSupported));
|
|
306
313
|
}
|
|
307
314
|
};
|
|
308
315
|
};
|
|
@@ -340,6 +347,7 @@ var createAnnotation = exports.createAnnotation = function createAnnotation(edit
|
|
|
340
347
|
return function (id) {
|
|
341
348
|
var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _annotation.AnnotationTypes.INLINE_COMMENT;
|
|
342
349
|
var supportedBlockNodes = arguments.length > 2 ? arguments[2] : undefined;
|
|
350
|
+
var isBlockNodeSupported = arguments.length > 3 ? arguments[3] : undefined;
|
|
343
351
|
return function (state, dispatch) {
|
|
344
352
|
// don't try to add if there are is no temp highlight bookmarked
|
|
345
353
|
var _ref = (0, _utils.getPluginState)(state) || {},
|
|
@@ -348,7 +356,7 @@ var createAnnotation = exports.createAnnotation = function createAnnotation(edit
|
|
|
348
356
|
return false;
|
|
349
357
|
}
|
|
350
358
|
if (annotationType === _annotation.AnnotationTypes.INLINE_COMMENT) {
|
|
351
|
-
return addInlineComment(editorAnalyticsAPI, editorAPI)(id, supportedBlockNodes)(state, dispatch);
|
|
359
|
+
return addInlineComment(editorAnalyticsAPI, editorAPI)(id, supportedBlockNodes, isBlockNodeSupported)(state, dispatch);
|
|
352
360
|
}
|
|
353
361
|
return false;
|
|
354
362
|
};
|
|
@@ -15,7 +15,7 @@ var _utils2 = require("../pm-plugins/utils");
|
|
|
15
15
|
var isAnnotationStep = function isAnnotationStep(step) {
|
|
16
16
|
return step instanceof _transform.AddMarkStep && step.mark.type.name === 'annotation';
|
|
17
17
|
};
|
|
18
|
-
var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes) {
|
|
18
|
+
var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes, isBlockNodeSupported) {
|
|
19
19
|
return function (transaction, state) {
|
|
20
20
|
var inlineCommentState = (0, _utils2.getPluginState)(state);
|
|
21
21
|
var _ref = inlineCommentState || {},
|
|
@@ -24,7 +24,7 @@ var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes) {
|
|
|
24
24
|
id: id,
|
|
25
25
|
type: _annotation.AnnotationTypes.INLINE_COMMENT
|
|
26
26
|
});
|
|
27
|
-
var _resolveDraftBookmark = (0, _utils2.resolveDraftBookmark)(state, bookmark, supportedBlockNodes),
|
|
27
|
+
var _resolveDraftBookmark = (0, _utils2.resolveDraftBookmark)(state, bookmark, supportedBlockNodes, isBlockNodeSupported),
|
|
28
28
|
from = _resolveDraftBookmark.from,
|
|
29
29
|
to = _resolveDraftBookmark.to,
|
|
30
30
|
head = _resolveDraftBookmark.head,
|
|
@@ -48,10 +48,10 @@ var addAnnotationMark = function addAnnotationMark(id, supportedBlockNodes) {
|
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
50
|
var addInlineComment = function addInlineComment(editorAnalyticsAPI, editorAPI) {
|
|
51
|
-
return function (id, supportedBlockNodes) {
|
|
51
|
+
return function (id, supportedBlockNodes, isBlockNodeSupported) {
|
|
52
52
|
return function (transaction, state) {
|
|
53
53
|
var _editorAPI$editorView, _pluginState$featureF;
|
|
54
|
-
var tr = addAnnotationMark(id, supportedBlockNodes)(transaction, state);
|
|
54
|
+
var tr = addAnnotationMark(id, supportedBlockNodes, isBlockNodeSupported)(transaction, state);
|
|
55
55
|
editorAPI === null || editorAPI === void 0 || (_editorAPI$editorView = editorAPI.editorViewModeEffects) === null || _editorAPI$editorView === void 0 || _editorAPI$editorView.actions.applyViewModeStepAt(tr);
|
|
56
56
|
|
|
57
57
|
// add insert analytics step to transaction
|
|
@@ -28,7 +28,7 @@ var domRefFromPos = function domRefFromPos(view, position) {
|
|
|
28
28
|
}
|
|
29
29
|
return dom;
|
|
30
30
|
};
|
|
31
|
-
var allowAnnotation = exports.allowAnnotation = function allowAnnotation(editorView,
|
|
31
|
+
var allowAnnotation = exports.allowAnnotation = function allowAnnotation(editorView, options) {
|
|
32
32
|
return function () {
|
|
33
33
|
var _ref = _utils3.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
34
34
|
isDrafting = _ref.isDrafting,
|
|
@@ -42,7 +42,7 @@ var allowAnnotation = exports.allowAnnotation = function allowAnnotation(editorV
|
|
|
42
42
|
if (!!(decoration !== null && decoration !== void 0 && decoration.length)) {
|
|
43
43
|
return false;
|
|
44
44
|
}
|
|
45
|
-
return (0, _utils3.isSelectionValid)(editorView.state) === _types.AnnotationSelectionType.VALID;
|
|
45
|
+
return (0, _utils3.isSelectionValid)(editorView.state, options.provider.supportedBlockNodes, options.provider.isBlockNodeSupported) === _types.AnnotationSelectionType.VALID;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
48
|
var startDraft = exports.startDraft = function startDraft(editorView, options) {
|
|
@@ -75,7 +75,7 @@ var startDraft = exports.startDraft = function startDraft(editorView, options) {
|
|
|
75
75
|
});
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
(0, _editorCommands.setInlineCommentDraftState)(options.editorAnalyticsAPI,
|
|
78
|
+
(0, _editorCommands.setInlineCommentDraftState)(options.editorAnalyticsAPI, options.provider.supportedBlockNodes, options.api, options.provider.isBlockNodeSupported)(true)(editorView.state, editorView.dispatch);
|
|
79
79
|
var _ref3 = _utils3.inlineCommentPluginKey.getState(editorView.state) || {},
|
|
80
80
|
draftDecorationSet = _ref3.draftDecorationSet;
|
|
81
81
|
var decorations = draftDecorationSet === null || draftDecorationSet === void 0 ? void 0 : draftDecorationSet.find();
|
|
@@ -159,7 +159,7 @@ var applyDraft = exports.applyDraft = function applyDraft(editorView, options) {
|
|
|
159
159
|
};
|
|
160
160
|
}
|
|
161
161
|
var from = decorations[0].from;
|
|
162
|
-
(0, _editorCommands.createAnnotation)(options.editorAnalyticsAPI, options.api)(id, _annotation.AnnotationTypes.INLINE_COMMENT, options.provider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
|
162
|
+
(0, _editorCommands.createAnnotation)(options.editorAnalyticsAPI, options.api)(id, _annotation.AnnotationTypes.INLINE_COMMENT, options.provider.supportedBlockNodes, options.provider.isBlockNodeSupported)(editorView.state, editorView.dispatch);
|
|
163
163
|
!editorView.hasFocus() && editorView.focus();
|
|
164
164
|
|
|
165
165
|
// Using the original decoration from position we should be able to locate the new target element.
|
|
@@ -343,7 +343,7 @@ var clearAnnotation = exports.clearAnnotation = function clearAnnotation(editorV
|
|
|
343
343
|
reason: ERROR_REASON_ID_INVALID
|
|
344
344
|
};
|
|
345
345
|
}
|
|
346
|
-
(0, _editorCommands.removeInlineCommentFromDoc)(options.editorAnalyticsAPI)(id, options.provider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
|
346
|
+
(0, _editorCommands.removeInlineCommentFromDoc)(options.editorAnalyticsAPI)(id, options.provider.supportedBlockNodes, options.provider.isBlockNodeSupported)(editorView.state, editorView.dispatch);
|
|
347
347
|
return {
|
|
348
348
|
success: true,
|
|
349
349
|
actionResult: undefined
|
|
@@ -467,13 +467,12 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
467
467
|
// everytime we need to update the decorations. This handler will be called alot. We should be caching
|
|
468
468
|
// the decorations in plugin state and only updating them when required.
|
|
469
469
|
state.doc.descendants(function (node, pos) {
|
|
470
|
-
var _provider$supportedBl;
|
|
471
470
|
// Inline comment on mediaInline is not supported as part of comments on media project
|
|
472
471
|
// Thus, we skip the decoration for mediaInline node
|
|
473
472
|
if (node.type.name === 'mediaInline') {
|
|
474
473
|
return false;
|
|
475
474
|
}
|
|
476
|
-
var
|
|
475
|
+
var isSupportedBlock = node.isBlock && (0, _utils3.isSupportedBlockNode)(node, provider.supportedBlockNodes, provider.isBlockNodeSupported);
|
|
477
476
|
node.marks.filter(function (mark) {
|
|
478
477
|
return mark.type === state.schema.marks.annotation;
|
|
479
478
|
}).forEach(function (mark) {
|
|
@@ -485,7 +484,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
485
484
|
var isHovered = !isInlineCommentViewClosed && !!(hoveredAnnotations !== null && hoveredAnnotations !== void 0 && hoveredAnnotations.some(function (hoveredAnnotation) {
|
|
486
485
|
return hoveredAnnotation.id === mark.attrs.id;
|
|
487
486
|
}));
|
|
488
|
-
if (
|
|
487
|
+
if (isSupportedBlock) {
|
|
489
488
|
focusDecorations.push(_view.Decoration.node(pos, pos + node.nodeSize, {
|
|
490
489
|
class: "".concat((0, _nodeviews.getBlockAnnotationViewClassname)(isUnresolved, isSelected), " ").concat(isUnresolved)
|
|
491
490
|
}, {
|
|
@@ -29,7 +29,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
29
29
|
mouseData: mouseData
|
|
30
30
|
});
|
|
31
31
|
case _types.ACTIONS.SET_INLINE_COMMENT_DRAFT_STATE:
|
|
32
|
-
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType, action.data.supportedBlockNodes, action.data.targetNodeId, action.data.isOpeningMediaCommentFromToolbar);
|
|
32
|
+
return getNewDraftState(pluginState, action.data.drafting, action.data.editorState, action.data.targetType, action.data.supportedBlockNodes, action.data.isBlockNodeSupported, action.data.targetNodeId, action.data.isOpeningMediaCommentFromToolbar);
|
|
33
33
|
case _types.ACTIONS.INLINE_COMMENT_CLEAR_DIRTY_MARK:
|
|
34
34
|
return _objectSpread(_objectSpread({}, pluginState), {}, {
|
|
35
35
|
dirtyAnnotations: false,
|
|
@@ -91,7 +91,7 @@ var _default = exports.default = function _default(pluginState, action) {
|
|
|
91
91
|
return pluginState;
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
-
function getNewDraftState(pluginState, drafting, editorState, targetType, supportedBlockNodes, targetNodeId, isOpeningMediaCommentFromToolbar) {
|
|
94
|
+
function getNewDraftState(pluginState, drafting, editorState, targetType, supportedBlockNodes, isBlockNodeSupported, targetNodeId, isOpeningMediaCommentFromToolbar) {
|
|
95
95
|
var draftDecorationSet = pluginState.draftDecorationSet;
|
|
96
96
|
if (!draftDecorationSet || !drafting) {
|
|
97
97
|
draftDecorationSet = _view.DecorationSet.empty;
|
|
@@ -104,7 +104,7 @@ function getNewDraftState(pluginState, drafting, editorState, targetType, suppor
|
|
|
104
104
|
newState.bookmark = undefined;
|
|
105
105
|
if (drafting && editorState) {
|
|
106
106
|
newState.bookmark = editorState.selection.getBookmark();
|
|
107
|
-
var _resolveDraftBookmark = (0, _utils.resolveDraftBookmark)(editorState, newState.bookmark, supportedBlockNodes),
|
|
107
|
+
var _resolveDraftBookmark = (0, _utils.resolveDraftBookmark)(editorState, newState.bookmark, supportedBlockNodes, isBlockNodeSupported),
|
|
108
108
|
from = _resolveDraftBookmark.from,
|
|
109
109
|
to = _resolveDraftBookmark.to;
|
|
110
110
|
var draftDecoration = (0, _utils.addDraftDecoration)(from, to, targetType);
|
|
@@ -202,6 +202,7 @@ var findAnnotationsInSelection = exports.findAnnotationsInSelection = function f
|
|
|
202
202
|
};
|
|
203
203
|
var resolveDraftBookmark = exports.resolveDraftBookmark = function resolveDraftBookmark(editorState, bookmark) {
|
|
204
204
|
var supportedBlockNodes = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
|
205
|
+
var isBlockNodeSupported = arguments.length > 3 ? arguments[3] : undefined;
|
|
205
206
|
var doc = editorState.doc;
|
|
206
207
|
var resolvedBookmark = bookmark ? bookmark.resolve(doc) : editorState.selection;
|
|
207
208
|
var from = resolvedBookmark.from,
|
|
@@ -223,7 +224,8 @@ var resolveDraftBookmark = exports.resolveDraftBookmark = function resolveDraftB
|
|
|
223
224
|
return false;
|
|
224
225
|
}
|
|
225
226
|
var nodeEndsAt = pos + node.nodeSize;
|
|
226
|
-
|
|
227
|
+
var isLegacyMediaSingleWrapper = node.type.name === 'mediaSingle' && supportedBlockNodes.includes('media') && !supportedBlockNodes.includes('mediaSingle');
|
|
228
|
+
if (isSupportedBlockNode(node, supportedBlockNodes, isBlockNodeSupported) && !isLegacyMediaSingleWrapper) {
|
|
227
229
|
draftBookmark = {
|
|
228
230
|
from: pos,
|
|
229
231
|
to: nodeEndsAt,
|
|
@@ -300,14 +302,16 @@ var getDraftCommandAnalyticsPayload = exports.getDraftCommandAnalyticsPayload =
|
|
|
300
302
|
};
|
|
301
303
|
var isSelectionValid = exports.isSelectionValid = function isSelectionValid(state) {
|
|
302
304
|
var _currentMediaNodeWith;
|
|
303
|
-
var
|
|
305
|
+
var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
306
|
+
var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
304
307
|
var selection = state.selection;
|
|
305
308
|
var _ref3 = getPluginState(state) || {},
|
|
306
309
|
disallowOnWhitespace = _ref3.disallowOnWhitespace;
|
|
307
310
|
var allowedInlineNodes = ['emoji', 'status', 'date', 'mention', 'inlineCard'];
|
|
308
311
|
var isSelectionEmpty = selection.empty;
|
|
309
312
|
var isTextOrAllSelection = selection instanceof _state.TextSelection || selection instanceof _state.AllSelection;
|
|
310
|
-
var
|
|
313
|
+
var isSupportedBlockNodeSelection = selection instanceof _state.NodeSelection && isSupportedBlockNode(selection.node, supportedBlockNodes, isBlockNodeSupported);
|
|
314
|
+
var isValidNodeSelection = selection instanceof _state.NodeSelection && (allowedInlineNodes.includes(selection.node.type.name) || isSupportedBlockNodeSelection);
|
|
311
315
|
var isValidSelection = isTextOrAllSelection || isValidNodeSelection;
|
|
312
316
|
|
|
313
317
|
// Allow media so that it can enter draft mode
|
|
@@ -317,7 +321,7 @@ var isSelectionValid = exports.isSelectionValid = function isSelectionValid(stat
|
|
|
317
321
|
if (isSelectionEmpty || !isValidSelection) {
|
|
318
322
|
return _types.AnnotationSelectionType.INVALID;
|
|
319
323
|
}
|
|
320
|
-
var containsInvalidNodes = hasInvalidNodes(state);
|
|
324
|
+
var containsInvalidNodes = !isSupportedBlockNodeSelection && hasInvalidNodes(state);
|
|
321
325
|
|
|
322
326
|
// A selection that only covers 1 pos, and is an invalid node
|
|
323
327
|
// e.g. a text selection over a mention
|
|
@@ -346,7 +350,8 @@ var hasInvalidNodes = exports.hasInvalidNodes = function hasInvalidNodes(state)
|
|
|
346
350
|
};
|
|
347
351
|
var isSupportedBlockNode = exports.isSupportedBlockNode = function isSupportedBlockNode(node) {
|
|
348
352
|
var supportedBlockNodes = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
|
|
349
|
-
|
|
353
|
+
var isBlockNodeSupported = arguments.length > 2 ? arguments[2] : undefined;
|
|
354
|
+
return supportedBlockNodes.indexOf(node.type.name) >= 0 || node.type.name === 'mediaSingle' && supportedBlockNodes.indexOf('media') >= 0 || (0, _fg.fg)('cc_maui_annotations_on_extensions') && (isBlockNodeSupported === null || isBlockNodeSupported === void 0 ? void 0 : isBlockNodeSupported(node)) === true;
|
|
350
355
|
};
|
|
351
356
|
|
|
352
357
|
/**
|
|
@@ -122,7 +122,7 @@ function InlineCommentView(_ref) {
|
|
|
122
122
|
,
|
|
123
123
|
onCreate: function onCreate(id) {
|
|
124
124
|
if (!isAnnotationManagerEnabled) {
|
|
125
|
-
var createAnnotationResult = (0, _editorCommands.createAnnotation)(editorAnalyticsAPI, editorAPI)(id, _annotation.AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
|
125
|
+
var createAnnotationResult = (0, _editorCommands.createAnnotation)(editorAnalyticsAPI, editorAPI)(id, _annotation.AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes, inlineCommentProvider.isBlockNodeSupported)(editorView.state, editorView.dispatch);
|
|
126
126
|
!editorView.hasFocus() && editorView.focus();
|
|
127
127
|
if (!createAnnotationResult) {
|
|
128
128
|
throw new Error('Failed to create annotation');
|
|
@@ -135,7 +135,7 @@ function InlineCommentView(_ref) {
|
|
|
135
135
|
return (
|
|
136
136
|
// This is called when optimistic create inline comment encounters an error,
|
|
137
137
|
// in which case the optimistically added annotation must be removed.
|
|
138
|
-
(0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch)
|
|
138
|
+
(0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes, inlineCommentProvider.isBlockNodeSupported)(editorView.state, editorView.dispatch)
|
|
139
139
|
);
|
|
140
140
|
}
|
|
141
141
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
@@ -204,7 +204,7 @@ function InlineCommentView(_ref) {
|
|
|
204
204
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
205
205
|
,
|
|
206
206
|
onDelete: function onDelete(id) {
|
|
207
|
-
return (0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes)(editorView.state, dispatch);
|
|
207
|
+
return (0, _editorCommands.removeInlineCommentNearSelection)(id, inlineCommentProvider.supportedBlockNodes, inlineCommentProvider.isBlockNodeSupported)(editorView.state, dispatch);
|
|
208
208
|
}
|
|
209
209
|
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
|
|
210
210
|
,
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { AnnotationTypes } from '@atlaskit/adf-schema/annotation';
|
|
2
3
|
import { isSSR } from '@atlaskit/editor-common/core-utils';
|
|
3
4
|
import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
|
|
4
5
|
import { editorExperiment } from '@atlaskit/tmp-editor-statsig/editor-experiment';
|
|
5
|
-
import { setInlineCommentDraftState, setSelectedAnnotation, setPendingSelectedAnnotation, showInlineCommentForBlockNode } from './editor-commands';
|
|
6
|
+
import { createAnnotation, removeInlineCommentFromDoc, setInlineCommentDraftState, setSelectedAnnotation, setPendingSelectedAnnotation, showInlineCommentForBlockNode } from './editor-commands';
|
|
6
7
|
import { annotationWithToDOMFix } from './nodeviews/annotationMark';
|
|
7
8
|
import { inlineCommentPlugin } from './pm-plugins/inline-comment';
|
|
8
9
|
import { keymapPlugin } from './pm-plugins/keymap';
|
|
@@ -15,7 +16,7 @@ export const annotationPlugin = ({
|
|
|
15
16
|
config: annotationProviders,
|
|
16
17
|
api
|
|
17
18
|
}) => {
|
|
18
|
-
var _api$featureFlags, _api$
|
|
19
|
+
var _api$featureFlags, _api$analytics3;
|
|
19
20
|
const featureFlags = api === null || api === void 0 ? void 0 : (_api$featureFlags = api.featureFlags) === null || _api$featureFlags === void 0 ? void 0 : _api$featureFlags.sharedState.currentState();
|
|
20
21
|
const isToolbarAIFCEnabled = Boolean(api === null || api === void 0 ? void 0 : api.toolbar);
|
|
21
22
|
/**
|
|
@@ -62,8 +63,16 @@ export const annotationPlugin = ({
|
|
|
62
63
|
hasAnyUnResolvedAnnotationInPage,
|
|
63
64
|
requestCloseInlineComment,
|
|
64
65
|
stripNonExistingAnnotations,
|
|
65
|
-
|
|
66
|
-
|
|
66
|
+
applyInlineCommentDraft: annotationId => {
|
|
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);
|
|
69
|
+
},
|
|
70
|
+
removeInlineCommentAnnotation: annotationId => {
|
|
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$ : []);
|
|
73
|
+
},
|
|
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
|
+
showCommentForBlockNode: showInlineCommentForBlockNode(annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.supportedBlockNodes, annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment.isBlockNodeSupported),
|
|
67
76
|
setSelectedAnnotation,
|
|
68
77
|
setPendingSelectedAnnotation
|
|
69
78
|
},
|
|
@@ -82,11 +91,11 @@ export const annotationPlugin = ({
|
|
|
82
91
|
dispatch
|
|
83
92
|
}) => {
|
|
84
93
|
if (annotationProviders) {
|
|
85
|
-
var _api$
|
|
94
|
+
var _api$analytics4;
|
|
86
95
|
return inlineCommentPlugin({
|
|
87
96
|
dispatch,
|
|
88
97
|
provider: annotationProviders.inlineComment,
|
|
89
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
98
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions,
|
|
90
99
|
featureFlagsPluginState: featureFlags,
|
|
91
100
|
selectCommentExperience: annotationProviders.selectCommentExperience,
|
|
92
101
|
viewInlineCommentTraceUFOPress: annotationProviders.viewInlineCommentTraceUFOPress,
|
|
@@ -125,14 +134,14 @@ export const annotationPlugin = ({
|
|
|
125
134
|
}
|
|
126
135
|
const pluginState = getPluginState(state);
|
|
127
136
|
if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
|
|
128
|
-
var _api$
|
|
137
|
+
var _api$analytics5;
|
|
129
138
|
const {
|
|
130
139
|
isToolbarAbove,
|
|
131
140
|
onCommentButtonMount,
|
|
132
141
|
getCanAddComments,
|
|
133
142
|
contentType
|
|
134
143
|
} = annotationProviders.inlineComment;
|
|
135
|
-
const toolbarConfig = buildToolbar(api === null || api === void 0 ? void 0 : (_api$
|
|
144
|
+
const toolbarConfig = buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics5 = api.analytics) === null || _api$analytics5 === void 0 ? void 0 : _api$analytics5.actions)({
|
|
136
145
|
state,
|
|
137
146
|
intl,
|
|
138
147
|
isToolbarAbove,
|
|
@@ -184,7 +193,7 @@ function AnnotationContentComponent({
|
|
|
184
193
|
annotationProviders,
|
|
185
194
|
dispatchAnalyticsEvent
|
|
186
195
|
}) {
|
|
187
|
-
var _api$
|
|
196
|
+
var _api$analytics6;
|
|
188
197
|
const annotationState = useSharedPluginStateWithSelector(api, ['annotation'], selector);
|
|
189
198
|
|
|
190
199
|
// need to explicitly check for false as undefined is also a valid value to continue
|
|
@@ -197,7 +206,7 @@ function AnnotationContentComponent({
|
|
|
197
206
|
providers: annotationProviders,
|
|
198
207
|
editorView: editorView,
|
|
199
208
|
dispatchAnalyticsEvent: dispatchAnalyticsEvent,
|
|
200
|
-
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$
|
|
209
|
+
editorAnalyticsAPI: api === null || api === void 0 ? void 0 : (_api$analytics6 = api.analytics) === null || _api$analytics6 === void 0 ? void 0 : _api$analytics6.actions,
|
|
201
210
|
editorAPI: api
|
|
202
211
|
}));
|
|
203
212
|
}
|