@atlaskit/editor-plugin-annotation 5.3.0 → 5.4.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 +21 -0
- package/dist/cjs/pm-plugins/inline-comment.js +14 -36
- package/dist/cjs/ui/CommentButton/utils.js +7 -1
- package/dist/es2019/pm-plugins/inline-comment.js +9 -28
- package/dist/es2019/ui/CommentButton/utils.js +8 -2
- package/dist/esm/pm-plugins/inline-comment.js +14 -36
- package/dist/esm/ui/CommentButton/utils.js +8 -2
- package/package.json +5 -14
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 5.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`08569ab338048`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08569ab338048) -
|
|
8
|
+
Removed feature gates for cleanup
|
|
9
|
+
|
|
10
|
+
## 5.3.2
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- Updated dependencies
|
|
15
|
+
|
|
16
|
+
## 5.3.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- [`b85694a21dec9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b85694a21dec9) -
|
|
21
|
+
[ux] [ED-29271] don't show Comment button if a draft comment is in progress
|
|
22
|
+
- Updated dependencies
|
|
23
|
+
|
|
3
24
|
## 5.3.0
|
|
4
25
|
|
|
5
26
|
### Minor Changes
|
|
@@ -29,7 +29,7 @@ var fetchProviderStates = /*#__PURE__*/function () {
|
|
|
29
29
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
30
30
|
while (1) switch (_context.prev = _context.next) {
|
|
31
31
|
case 0:
|
|
32
|
-
if (!(
|
|
32
|
+
if (!(!provider || !provider.getState)) {
|
|
33
33
|
_context.next = 2;
|
|
34
34
|
break;
|
|
35
35
|
}
|
|
@@ -65,26 +65,20 @@ var fetchState = /*#__PURE__*/function () {
|
|
|
65
65
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
66
66
|
while (1) switch (_context2.prev = _context2.next) {
|
|
67
67
|
case 0:
|
|
68
|
-
|
|
69
|
-
_context2.next = 2;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
return _context2.abrupt("return");
|
|
73
|
-
case 2:
|
|
74
|
-
_context2.next = 4;
|
|
68
|
+
_context2.next = 2;
|
|
75
69
|
return fetchProviderStates(provider, annotationIds);
|
|
76
|
-
case
|
|
70
|
+
case 2:
|
|
77
71
|
inlineCommentStates = _context2.sent;
|
|
78
|
-
if (!(Object.keys(inlineCommentStates).length === 0
|
|
79
|
-
_context2.next =
|
|
72
|
+
if (!(Object.keys(inlineCommentStates).length === 0)) {
|
|
73
|
+
_context2.next = 5;
|
|
80
74
|
break;
|
|
81
75
|
}
|
|
82
76
|
return _context2.abrupt("return");
|
|
83
|
-
case
|
|
77
|
+
case 5:
|
|
84
78
|
if (editorView.dispatch) {
|
|
85
79
|
(0, _editorCommands.updateInlineCommentResolvedState)(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
|
|
86
80
|
}
|
|
87
|
-
case
|
|
81
|
+
case 6:
|
|
88
82
|
case "end":
|
|
89
83
|
return _context2.stop();
|
|
90
84
|
}
|
|
@@ -214,24 +208,10 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
214
208
|
return onSetVisibility(editorView)(isVisible);
|
|
215
209
|
};
|
|
216
210
|
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
// When feature flag is true, only close if no annotationId
|
|
220
|
-
if (!annotationId) {
|
|
221
|
-
(0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
222
|
-
} else {
|
|
223
|
-
(0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
224
|
-
}
|
|
211
|
+
if (!annotationId) {
|
|
212
|
+
(0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
225
213
|
} else {
|
|
226
|
-
|
|
227
|
-
// 1. No annotationId OR
|
|
228
|
-
// 2. View is closed and annotation clicks are enabled
|
|
229
|
-
var shouldClose = !annotationId || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.isInlineCommentViewClosed) && (0, _platformFeatureFlags.fg)('platform_editor_listen_for_annotation_clicks');
|
|
230
|
-
if (shouldClose) {
|
|
231
|
-
(0, _editorCommands.closeComponent)()(editorView.state, editorView.dispatch);
|
|
232
|
-
} else {
|
|
233
|
-
(0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
234
|
-
}
|
|
214
|
+
(0, _editorCommands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
|
|
235
215
|
}
|
|
236
216
|
};
|
|
237
217
|
var setHoveredAnnotationFn = function setHoveredAnnotationFn(annotationId) {
|
|
@@ -280,15 +260,13 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
280
260
|
selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 || (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
|
|
281
261
|
// This ensures that the selected annotation is unresolved
|
|
282
262
|
annotations && annotations[selectedAnnotationId] === false) {
|
|
283
|
-
var _options$selectCommen;
|
|
263
|
+
var _options$selectCommen, _options$viewInlineCo;
|
|
284
264
|
// ...we mark the select annotation experience as complete.
|
|
285
265
|
// The selectComponentExperience is using a simplified object, which is why it's type asserted.
|
|
286
266
|
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
(_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 || _options$viewInlineCo.call(options);
|
|
291
|
-
}
|
|
267
|
+
|
|
268
|
+
// ...and start a new UFO press trace since the selected comment is changing
|
|
269
|
+
(_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 || _options$viewInlineCo.call(options);
|
|
292
270
|
}
|
|
293
271
|
var api = options.api;
|
|
294
272
|
if (isDrafting && !view.state.selection.eq(_prevState.selection) && (0, _experiments.editorExperiment)('platform_editor_toolbar_aifc', true) && (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_2', 'isEnabled', true)) {
|
|
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
|
|
|
9
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
10
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
11
11
|
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
|
+
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
12
13
|
var _editorCommands = require("../../editor-commands");
|
|
13
14
|
var _utils = require("../../pm-plugins/utils");
|
|
14
15
|
var _types = require("../../types");
|
|
@@ -27,9 +28,14 @@ var shouldShowCommentButton = exports.shouldShowCommentButton = function shouldS
|
|
|
27
28
|
isVisible = _ref2.isVisible,
|
|
28
29
|
annotationSelectionType = _ref2.annotationSelectionType;
|
|
29
30
|
var isMediaSelected = state ? (0, _mediaSingle.currentMediaNodeWithPos)(state) : false;
|
|
31
|
+
var isDrafting = false;
|
|
32
|
+
if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) && state) {
|
|
33
|
+
var _inlineCommentPluginK;
|
|
34
|
+
isDrafting = ((_inlineCommentPluginK = _utils.inlineCommentPluginKey.getState(state)) === null || _inlineCommentPluginK === void 0 ? void 0 : _inlineCommentPluginK.isDrafting) || false;
|
|
35
|
+
}
|
|
30
36
|
|
|
31
37
|
// comments on media can only be added via media floating toolbar
|
|
32
|
-
if (isMediaSelected || annotationSelectionType === _types.AnnotationSelectionType.INVALID || !isVisible) {
|
|
38
|
+
if (isDrafting || isMediaSelected || annotationSelectionType === _types.AnnotationSelectionType.INVALID || !isVisible) {
|
|
33
39
|
return false;
|
|
34
40
|
}
|
|
35
41
|
return true;
|
|
@@ -14,7 +14,7 @@ import { createPluginState } from './plugin-factory';
|
|
|
14
14
|
import { shouldSuppressFloatingToolbar } from './toolbar';
|
|
15
15
|
import { decorationKey, getAllAnnotations, getPluginState, inlineCommentPluginKey } from './utils';
|
|
16
16
|
const fetchProviderStates = async (provider, annotationIds) => {
|
|
17
|
-
if (
|
|
17
|
+
if (!provider || !provider.getState) {
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
20
|
const data = await provider.getState(annotationIds);
|
|
@@ -30,11 +30,8 @@ const fetchProviderStates = async (provider, annotationIds) => {
|
|
|
30
30
|
// fetchState is unable to return a command as it's runs async and may dispatch at a later time
|
|
31
31
|
// Requires `editorView` instead of the decomposition as the async means state may end up stale
|
|
32
32
|
const fetchState = async (provider, annotationIds, editorView, editorAnalyticsAPI) => {
|
|
33
|
-
if ((!annotationIds || !annotationIds.length) && !fg('use_comments_data_annotation_updater')) {
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
33
|
const inlineCommentStates = await fetchProviderStates(provider, annotationIds);
|
|
37
|
-
if (Object.keys(inlineCommentStates).length === 0
|
|
34
|
+
if (Object.keys(inlineCommentStates).length === 0) {
|
|
38
35
|
return;
|
|
39
36
|
}
|
|
40
37
|
if (editorView.dispatch) {
|
|
@@ -145,24 +142,10 @@ export const inlineCommentPlugin = options => {
|
|
|
145
142
|
const mouseUp = event => onMouseUp(editorView.state, editorView.dispatch)(event);
|
|
146
143
|
const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
|
|
147
144
|
const setSelectedAnnotationFn = annotationId => {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
// When feature flag is true, only close if no annotationId
|
|
151
|
-
if (!annotationId) {
|
|
152
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
153
|
-
} else {
|
|
154
|
-
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
155
|
-
}
|
|
145
|
+
if (!annotationId) {
|
|
146
|
+
closeComponent()(editorView.state, editorView.dispatch);
|
|
156
147
|
} else {
|
|
157
|
-
|
|
158
|
-
// 1. No annotationId OR
|
|
159
|
-
// 2. View is closed and annotation clicks are enabled
|
|
160
|
-
const shouldClose = !annotationId || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.isInlineCommentViewClosed) && fg('platform_editor_listen_for_annotation_clicks');
|
|
161
|
-
if (shouldClose) {
|
|
162
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
163
|
-
} else {
|
|
164
|
-
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
165
|
-
}
|
|
148
|
+
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
166
149
|
}
|
|
167
150
|
};
|
|
168
151
|
const setHoveredAnnotationFn = annotationId => {
|
|
@@ -215,15 +198,13 @@ export const inlineCommentPlugin = options => {
|
|
|
215
198
|
selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 ? void 0 : (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
|
|
216
199
|
// This ensures that the selected annotation is unresolved
|
|
217
200
|
annotations && annotations[selectedAnnotationId] === false) {
|
|
218
|
-
var _options$selectCommen;
|
|
201
|
+
var _options$selectCommen, _options$viewInlineCo;
|
|
219
202
|
// ...we mark the select annotation experience as complete.
|
|
220
203
|
// The selectComponentExperience is using a simplified object, which is why it's type asserted.
|
|
221
204
|
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 ? void 0 : _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
(_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 ? void 0 : _options$viewInlineCo.call(options);
|
|
226
|
-
}
|
|
205
|
+
|
|
206
|
+
// ...and start a new UFO press trace since the selected comment is changing
|
|
207
|
+
(_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 ? void 0 : _options$viewInlineCo.call(options);
|
|
227
208
|
}
|
|
228
209
|
const {
|
|
229
210
|
api
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE } from '@atlaskit/editor-common/analytics';
|
|
2
2
|
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
3
3
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
4
5
|
import { setInlineCommentDraftState } from '../../editor-commands';
|
|
5
|
-
import { isSelectionValid } from '../../pm-plugins/utils';
|
|
6
|
+
import { inlineCommentPluginKey, isSelectionValid } from '../../pm-plugins/utils';
|
|
6
7
|
import { AnnotationSelectionType } from '../../types';
|
|
7
8
|
export const isButtonDisabled = ({
|
|
8
9
|
state,
|
|
@@ -19,9 +20,14 @@ export const shouldShowCommentButton = ({
|
|
|
19
20
|
annotationSelectionType
|
|
20
21
|
}) => {
|
|
21
22
|
const isMediaSelected = state ? currentMediaNodeWithPos(state) : false;
|
|
23
|
+
let isDrafting = false;
|
|
24
|
+
if (expValEquals('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) && state) {
|
|
25
|
+
var _inlineCommentPluginK;
|
|
26
|
+
isDrafting = ((_inlineCommentPluginK = inlineCommentPluginKey.getState(state)) === null || _inlineCommentPluginK === void 0 ? void 0 : _inlineCommentPluginK.isDrafting) || false;
|
|
27
|
+
}
|
|
22
28
|
|
|
23
29
|
// comments on media can only be added via media floating toolbar
|
|
24
|
-
if (isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
|
|
30
|
+
if (isDrafting || isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
|
|
25
31
|
return false;
|
|
26
32
|
}
|
|
27
33
|
return true;
|
|
@@ -22,7 +22,7 @@ var fetchProviderStates = /*#__PURE__*/function () {
|
|
|
22
22
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
23
|
while (1) switch (_context.prev = _context.next) {
|
|
24
24
|
case 0:
|
|
25
|
-
if (!(
|
|
25
|
+
if (!(!provider || !provider.getState)) {
|
|
26
26
|
_context.next = 2;
|
|
27
27
|
break;
|
|
28
28
|
}
|
|
@@ -58,26 +58,20 @@ var fetchState = /*#__PURE__*/function () {
|
|
|
58
58
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
59
59
|
while (1) switch (_context2.prev = _context2.next) {
|
|
60
60
|
case 0:
|
|
61
|
-
|
|
62
|
-
_context2.next = 2;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
return _context2.abrupt("return");
|
|
66
|
-
case 2:
|
|
67
|
-
_context2.next = 4;
|
|
61
|
+
_context2.next = 2;
|
|
68
62
|
return fetchProviderStates(provider, annotationIds);
|
|
69
|
-
case
|
|
63
|
+
case 2:
|
|
70
64
|
inlineCommentStates = _context2.sent;
|
|
71
|
-
if (!(Object.keys(inlineCommentStates).length === 0
|
|
72
|
-
_context2.next =
|
|
65
|
+
if (!(Object.keys(inlineCommentStates).length === 0)) {
|
|
66
|
+
_context2.next = 5;
|
|
73
67
|
break;
|
|
74
68
|
}
|
|
75
69
|
return _context2.abrupt("return");
|
|
76
|
-
case
|
|
70
|
+
case 5:
|
|
77
71
|
if (editorView.dispatch) {
|
|
78
72
|
updateInlineCommentResolvedState(editorAnalyticsAPI)(inlineCommentStates)(editorView.state, editorView.dispatch);
|
|
79
73
|
}
|
|
80
|
-
case
|
|
74
|
+
case 6:
|
|
81
75
|
case "end":
|
|
82
76
|
return _context2.stop();
|
|
83
77
|
}
|
|
@@ -207,24 +201,10 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
207
201
|
return onSetVisibility(editorView)(isVisible);
|
|
208
202
|
};
|
|
209
203
|
var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
// When feature flag is true, only close if no annotationId
|
|
213
|
-
if (!annotationId) {
|
|
214
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
215
|
-
} else {
|
|
216
|
-
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
217
|
-
}
|
|
204
|
+
if (!annotationId) {
|
|
205
|
+
closeComponent()(editorView.state, editorView.dispatch);
|
|
218
206
|
} else {
|
|
219
|
-
|
|
220
|
-
// 1. No annotationId OR
|
|
221
|
-
// 2. View is closed and annotation clicks are enabled
|
|
222
|
-
var shouldClose = !annotationId || (pluginState === null || pluginState === void 0 ? void 0 : pluginState.isInlineCommentViewClosed) && fg('platform_editor_listen_for_annotation_clicks');
|
|
223
|
-
if (shouldClose) {
|
|
224
|
-
closeComponent()(editorView.state, editorView.dispatch);
|
|
225
|
-
} else {
|
|
226
|
-
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
227
|
-
}
|
|
207
|
+
setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
|
|
228
208
|
}
|
|
229
209
|
};
|
|
230
210
|
var setHoveredAnnotationFn = function setHoveredAnnotationFn(annotationId) {
|
|
@@ -273,15 +253,13 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
273
253
|
selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 || (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
|
|
274
254
|
// This ensures that the selected annotation is unresolved
|
|
275
255
|
annotations && annotations[selectedAnnotationId] === false) {
|
|
276
|
-
var _options$selectCommen;
|
|
256
|
+
var _options$selectCommen, _options$viewInlineCo;
|
|
277
257
|
// ...we mark the select annotation experience as complete.
|
|
278
258
|
// The selectComponentExperience is using a simplified object, which is why it's type asserted.
|
|
279
259
|
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
(_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 || _options$viewInlineCo.call(options);
|
|
284
|
-
}
|
|
260
|
+
|
|
261
|
+
// ...and start a new UFO press trace since the selected comment is changing
|
|
262
|
+
(_options$viewInlineCo = options.viewInlineCommentTraceUFOPress) === null || _options$viewInlineCo === void 0 || _options$viewInlineCo.call(options);
|
|
285
263
|
}
|
|
286
264
|
var api = options.api;
|
|
287
265
|
if (isDrafting && !view.state.selection.eq(_prevState.selection) && editorExperiment('platform_editor_toolbar_aifc', true) && expValEquals('platform_editor_toolbar_aifc_patch_2', 'isEnabled', true)) {
|
|
@@ -4,8 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
|
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
6
6
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
|
+
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
7
8
|
import { setInlineCommentDraftState } from '../../editor-commands';
|
|
8
|
-
import { isSelectionValid } from '../../pm-plugins/utils';
|
|
9
|
+
import { inlineCommentPluginKey, isSelectionValid } from '../../pm-plugins/utils';
|
|
9
10
|
import { AnnotationSelectionType } from '../../types';
|
|
10
11
|
export var isButtonDisabled = function isButtonDisabled(_ref) {
|
|
11
12
|
var _api$connectivity;
|
|
@@ -20,9 +21,14 @@ export var shouldShowCommentButton = function shouldShowCommentButton(_ref2) {
|
|
|
20
21
|
isVisible = _ref2.isVisible,
|
|
21
22
|
annotationSelectionType = _ref2.annotationSelectionType;
|
|
22
23
|
var isMediaSelected = state ? currentMediaNodeWithPos(state) : false;
|
|
24
|
+
var isDrafting = false;
|
|
25
|
+
if (expValEquals('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) && state) {
|
|
26
|
+
var _inlineCommentPluginK;
|
|
27
|
+
isDrafting = ((_inlineCommentPluginK = inlineCommentPluginKey.getState(state)) === null || _inlineCommentPluginK === void 0 ? void 0 : _inlineCommentPluginK.isDrafting) || false;
|
|
28
|
+
}
|
|
23
29
|
|
|
24
30
|
// comments on media can only be added via media floating toolbar
|
|
25
|
-
if (isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
|
|
31
|
+
if (isDrafting || isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
|
|
26
32
|
return false;
|
|
27
33
|
}
|
|
28
34
|
return true;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.4.0",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"@atlaskit/editor-plugin-toolbar": "^2.1.0",
|
|
37
37
|
"@atlaskit/editor-plugin-user-intent": "^3.0.0",
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
|
-
"@atlaskit/editor-toolbar": "^0.
|
|
39
|
+
"@atlaskit/editor-toolbar": "^0.9.0",
|
|
40
40
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
41
|
-
"@atlaskit/icon": "^28.
|
|
41
|
+
"@atlaskit/icon": "^28.2.0",
|
|
42
42
|
"@atlaskit/onboarding": "^14.4.0",
|
|
43
43
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
44
|
-
"@atlaskit/tmp-editor-statsig": "^12.
|
|
44
|
+
"@atlaskit/tmp-editor-statsig": "^12.27.0",
|
|
45
45
|
"@babel/runtime": "^7.0.0",
|
|
46
46
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
49
|
-
"@atlaskit/editor-common": "^109.
|
|
49
|
+
"@atlaskit/editor-common": "^109.11.0",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-dom": "^18.2.0"
|
|
52
52
|
},
|
|
@@ -100,21 +100,12 @@
|
|
|
100
100
|
"editor_inline_comments_on_inline_nodes": {
|
|
101
101
|
"type": "boolean"
|
|
102
102
|
},
|
|
103
|
-
"use_comments_data_annotation_updater": {
|
|
104
|
-
"type": "boolean"
|
|
105
|
-
},
|
|
106
103
|
"platform_editor_listen_for_annotation_clicks": {
|
|
107
104
|
"type": "boolean"
|
|
108
105
|
},
|
|
109
106
|
"platform_editor_annotation_selected_annotation": {
|
|
110
107
|
"type": "boolean"
|
|
111
108
|
},
|
|
112
|
-
"platform_editor_listen_for_focussed_query_param": {
|
|
113
|
-
"type": "boolean"
|
|
114
|
-
},
|
|
115
|
-
"cc_comments_track_view_inline_comment_action": {
|
|
116
|
-
"type": "boolean"
|
|
117
|
-
},
|
|
118
109
|
"confluence_frontend_preload_inline_comment_editor": {
|
|
119
110
|
"type": "boolean"
|
|
120
111
|
},
|