@atlaskit/editor-plugin-annotation 5.3.2 → 5.5.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 +15 -0
- package/dist/cjs/pm-plugins/inline-comment.js +14 -36
- package/dist/cjs/pm-plugins/toolbar.js +6 -11
- package/dist/cjs/ui/CommentButton/utils.js +6 -13
- package/dist/es2019/pm-plugins/inline-comment.js +9 -28
- package/dist/es2019/pm-plugins/toolbar.js +2 -6
- package/dist/es2019/ui/CommentButton/utils.js +2 -7
- package/dist/esm/pm-plugins/inline-comment.js +14 -36
- package/dist/esm/pm-plugins/toolbar.js +6 -11
- package/dist/esm/ui/CommentButton/utils.js +6 -12
- package/package.json +4 -16
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 5.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`1f2b3dfa14308`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/1f2b3dfa14308) -
|
|
8
|
+
Clean up fg cc_comments_create_inline_experience_entry_point as true so that create comment
|
|
9
|
+
experience tracking logs always include the entryPoint
|
|
10
|
+
|
|
11
|
+
## 5.4.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [`08569ab338048`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/08569ab338048) -
|
|
16
|
+
Removed feature gates for cleanup
|
|
17
|
+
|
|
3
18
|
## 5.3.2
|
|
4
19
|
|
|
5
20
|
### Patch 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)) {
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.shouldSuppressFloatingToolbar = exports.buildToolbar = exports.buildSuppressedToolbar = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
8
|
var _react = _interopRequireDefault(require("react"));
|
|
10
9
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
11
10
|
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
@@ -17,8 +16,6 @@ var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
|
17
16
|
var _editorCommands = require("../editor-commands");
|
|
18
17
|
var _types = require("../types");
|
|
19
18
|
var _utils2 = require("./utils");
|
|
20
|
-
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; }
|
|
21
|
-
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; }
|
|
22
19
|
var getValidNodes = function getValidNodes(state) {
|
|
23
20
|
var schema = state.schema;
|
|
24
21
|
var annotation = schema.marks.annotation;
|
|
@@ -149,12 +146,11 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
|
|
|
149
146
|
annotationManager.checkPreemptiveGate().then(function (canStartDraft) {
|
|
150
147
|
if (canStartDraft) {
|
|
151
148
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
|
|
152
|
-
attributes:
|
|
149
|
+
attributes: {
|
|
153
150
|
pageClass: 'editor',
|
|
154
|
-
commentType: 'inline'
|
|
155
|
-
}, (0, _platformFeatureFlags.fg)('cc_comments_create_inline_experience_entry_point') ? {
|
|
151
|
+
commentType: 'inline',
|
|
156
152
|
entryPoint: 'highlightActions'
|
|
157
|
-
}
|
|
153
|
+
}
|
|
158
154
|
});
|
|
159
155
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
|
|
160
156
|
var result = annotationManager.startDraft();
|
|
@@ -186,12 +182,11 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
|
|
|
186
182
|
return true;
|
|
187
183
|
} else {
|
|
188
184
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
|
|
189
|
-
attributes:
|
|
185
|
+
attributes: {
|
|
190
186
|
pageClass: 'editor',
|
|
191
|
-
commentType: 'inline'
|
|
192
|
-
}, (0, _platformFeatureFlags.fg)('cc_comments_create_inline_experience_entry_point') ? {
|
|
187
|
+
commentType: 'inline',
|
|
193
188
|
entryPoint: 'highlightActions'
|
|
194
|
-
}
|
|
189
|
+
}
|
|
195
190
|
});
|
|
196
191
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
|
|
197
192
|
return (0, _editorCommands.setInlineCommentDraftState)(editorAnalyticsAPI)(true)(state, dispatch);
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
3
|
Object.defineProperty(exports, "__esModule", {
|
|
5
4
|
value: true
|
|
6
5
|
});
|
|
7
6
|
exports.startCommentExperience = exports.shouldShowCommentButton = exports.isButtonDisabled = exports.fireOnClickAnalyticsEvent = exports.fireCommentButtonViewedAnalyticsEvent = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
7
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
10
8
|
var _mediaSingle = require("@atlaskit/editor-common/media-single");
|
|
11
|
-
var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
|
|
12
9
|
var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
|
|
13
10
|
var _editorCommands = require("../../editor-commands");
|
|
14
11
|
var _utils = require("../../pm-plugins/utils");
|
|
15
12
|
var _types = require("../../types");
|
|
16
|
-
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; }
|
|
17
|
-
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; }
|
|
18
13
|
var isButtonDisabled = exports.isButtonDisabled = function isButtonDisabled(_ref) {
|
|
19
14
|
var _api$connectivity;
|
|
20
15
|
var state = _ref.state,
|
|
@@ -97,12 +92,11 @@ var startCommentExperience = exports.startCommentExperience = function startComm
|
|
|
97
92
|
if (canStartDraft) {
|
|
98
93
|
var _annotationProviders$, _annotationProviders$2;
|
|
99
94
|
(_annotationProviders$ = annotationProviders.createCommentExperience) === null || _annotationProviders$ === void 0 || _annotationProviders$.start({
|
|
100
|
-
attributes:
|
|
95
|
+
attributes: {
|
|
101
96
|
pageClass: 'editor',
|
|
102
|
-
commentType: 'inline'
|
|
103
|
-
}, (0, _platformFeatureFlags.fg)('cc_comments_create_inline_experience_entry_point') ? {
|
|
97
|
+
commentType: 'inline',
|
|
104
98
|
entryPoint: 'highlightActions'
|
|
105
|
-
}
|
|
99
|
+
}
|
|
106
100
|
});
|
|
107
101
|
(_annotationProviders$2 = annotationProviders.createCommentExperience) === null || _annotationProviders$2 === void 0 || _annotationProviders$2.initExperience.start();
|
|
108
102
|
var result = annotationManager.startDraft();
|
|
@@ -125,12 +119,11 @@ var startCommentExperience = exports.startCommentExperience = function startComm
|
|
|
125
119
|
} else {
|
|
126
120
|
var _annotationProviders$3, _annotationProviders$4, _api$analytics4;
|
|
127
121
|
annotationProviders === null || annotationProviders === void 0 || (_annotationProviders$3 = annotationProviders.createCommentExperience) === null || _annotationProviders$3 === void 0 || _annotationProviders$3.start({
|
|
128
|
-
attributes:
|
|
122
|
+
attributes: {
|
|
129
123
|
pageClass: 'editor',
|
|
130
|
-
commentType: 'inline'
|
|
131
|
-
}, (0, _platformFeatureFlags.fg)('cc_comments_create_inline_experience_entry_point') ? {
|
|
124
|
+
commentType: 'inline',
|
|
132
125
|
entryPoint: 'highlightActions'
|
|
133
|
-
}
|
|
126
|
+
}
|
|
134
127
|
});
|
|
135
128
|
annotationProviders === null || annotationProviders === void 0 || (_annotationProviders$4 = annotationProviders.createCommentExperience) === null || _annotationProviders$4 === void 0 || _annotationProviders$4.initExperience.start();
|
|
136
129
|
return (0, _editorCommands.setInlineCommentDraftState)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, undefined, api)(true)(state, dispatch);
|
|
@@ -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
|
|
@@ -142,9 +142,7 @@ export const buildToolbar = editorAnalyticsAPI => ({
|
|
|
142
142
|
attributes: {
|
|
143
143
|
pageClass: 'editor',
|
|
144
144
|
commentType: 'inline',
|
|
145
|
-
|
|
146
|
-
entryPoint: 'highlightActions'
|
|
147
|
-
} : {})
|
|
145
|
+
entryPoint: 'highlightActions'
|
|
148
146
|
}
|
|
149
147
|
});
|
|
150
148
|
createCommentExperience === null || createCommentExperience === void 0 ? void 0 : createCommentExperience.initExperience.start();
|
|
@@ -180,9 +178,7 @@ export const buildToolbar = editorAnalyticsAPI => ({
|
|
|
180
178
|
attributes: {
|
|
181
179
|
pageClass: 'editor',
|
|
182
180
|
commentType: 'inline',
|
|
183
|
-
|
|
184
|
-
entryPoint: 'highlightActions'
|
|
185
|
-
} : {})
|
|
181
|
+
entryPoint: 'highlightActions'
|
|
186
182
|
}
|
|
187
183
|
});
|
|
188
184
|
createCommentExperience === null || createCommentExperience === void 0 ? void 0 : createCommentExperience.initExperience.start();
|
|
@@ -1,6 +1,5 @@
|
|
|
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
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
4
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
5
4
|
import { setInlineCommentDraftState } from '../../editor-commands';
|
|
6
5
|
import { inlineCommentPluginKey, isSelectionValid } from '../../pm-plugins/utils';
|
|
@@ -96,9 +95,7 @@ export const startCommentExperience = ({
|
|
|
96
95
|
attributes: {
|
|
97
96
|
pageClass: 'editor',
|
|
98
97
|
commentType: 'inline',
|
|
99
|
-
|
|
100
|
-
entryPoint: 'highlightActions'
|
|
101
|
-
} : {})
|
|
98
|
+
entryPoint: 'highlightActions'
|
|
102
99
|
}
|
|
103
100
|
});
|
|
104
101
|
(_annotationProviders$2 = annotationProviders.createCommentExperience) === null || _annotationProviders$2 === void 0 ? void 0 : _annotationProviders$2.initExperience.start();
|
|
@@ -125,9 +122,7 @@ export const startCommentExperience = ({
|
|
|
125
122
|
attributes: {
|
|
126
123
|
pageClass: 'editor',
|
|
127
124
|
commentType: 'inline',
|
|
128
|
-
|
|
129
|
-
entryPoint: 'highlightActions'
|
|
130
|
-
} : {})
|
|
125
|
+
entryPoint: 'highlightActions'
|
|
131
126
|
}
|
|
132
127
|
});
|
|
133
128
|
annotationProviders === null || annotationProviders === void 0 ? void 0 : (_annotationProviders$4 = annotationProviders.createCommentExperience) === null || _annotationProviders$4 === void 0 ? void 0 : _annotationProviders$4.initExperience.start();
|
|
@@ -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)) {
|
|
@@ -1,6 +1,3 @@
|
|
|
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; }
|
|
4
1
|
import React from 'react';
|
|
5
2
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE } from '@atlaskit/editor-common/analytics';
|
|
6
3
|
import { ToolTipContent, addInlineComment } from '@atlaskit/editor-common/keymaps';
|
|
@@ -142,12 +139,11 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
|
|
|
142
139
|
annotationManager.checkPreemptiveGate().then(function (canStartDraft) {
|
|
143
140
|
if (canStartDraft) {
|
|
144
141
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
|
|
145
|
-
attributes:
|
|
142
|
+
attributes: {
|
|
146
143
|
pageClass: 'editor',
|
|
147
|
-
commentType: 'inline'
|
|
148
|
-
}, fg('cc_comments_create_inline_experience_entry_point') ? {
|
|
144
|
+
commentType: 'inline',
|
|
149
145
|
entryPoint: 'highlightActions'
|
|
150
|
-
}
|
|
146
|
+
}
|
|
151
147
|
});
|
|
152
148
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
|
|
153
149
|
var result = annotationManager.startDraft();
|
|
@@ -179,12 +175,11 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
|
|
|
179
175
|
return true;
|
|
180
176
|
} else {
|
|
181
177
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.start({
|
|
182
|
-
attributes:
|
|
178
|
+
attributes: {
|
|
183
179
|
pageClass: 'editor',
|
|
184
|
-
commentType: 'inline'
|
|
185
|
-
}, fg('cc_comments_create_inline_experience_entry_point') ? {
|
|
180
|
+
commentType: 'inline',
|
|
186
181
|
entryPoint: 'highlightActions'
|
|
187
|
-
}
|
|
182
|
+
}
|
|
188
183
|
});
|
|
189
184
|
createCommentExperience === null || createCommentExperience === void 0 || createCommentExperience.initExperience.start();
|
|
190
185
|
return setInlineCommentDraftState(editorAnalyticsAPI)(true)(state, dispatch);
|
|
@@ -1,9 +1,5 @@
|
|
|
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; }
|
|
4
1
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE } from '@atlaskit/editor-common/analytics';
|
|
5
2
|
import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
|
|
6
|
-
import { fg } from '@atlaskit/platform-feature-flags';
|
|
7
3
|
import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
|
|
8
4
|
import { setInlineCommentDraftState } from '../../editor-commands';
|
|
9
5
|
import { inlineCommentPluginKey, isSelectionValid } from '../../pm-plugins/utils';
|
|
@@ -90,12 +86,11 @@ export var startCommentExperience = function startCommentExperience(_ref6) {
|
|
|
90
86
|
if (canStartDraft) {
|
|
91
87
|
var _annotationProviders$, _annotationProviders$2;
|
|
92
88
|
(_annotationProviders$ = annotationProviders.createCommentExperience) === null || _annotationProviders$ === void 0 || _annotationProviders$.start({
|
|
93
|
-
attributes:
|
|
89
|
+
attributes: {
|
|
94
90
|
pageClass: 'editor',
|
|
95
|
-
commentType: 'inline'
|
|
96
|
-
}, fg('cc_comments_create_inline_experience_entry_point') ? {
|
|
91
|
+
commentType: 'inline',
|
|
97
92
|
entryPoint: 'highlightActions'
|
|
98
|
-
}
|
|
93
|
+
}
|
|
99
94
|
});
|
|
100
95
|
(_annotationProviders$2 = annotationProviders.createCommentExperience) === null || _annotationProviders$2 === void 0 || _annotationProviders$2.initExperience.start();
|
|
101
96
|
var result = annotationManager.startDraft();
|
|
@@ -118,12 +113,11 @@ export var startCommentExperience = function startCommentExperience(_ref6) {
|
|
|
118
113
|
} else {
|
|
119
114
|
var _annotationProviders$3, _annotationProviders$4, _api$analytics4;
|
|
120
115
|
annotationProviders === null || annotationProviders === void 0 || (_annotationProviders$3 = annotationProviders.createCommentExperience) === null || _annotationProviders$3 === void 0 || _annotationProviders$3.start({
|
|
121
|
-
attributes:
|
|
116
|
+
attributes: {
|
|
122
117
|
pageClass: 'editor',
|
|
123
|
-
commentType: 'inline'
|
|
124
|
-
}, fg('cc_comments_create_inline_experience_entry_point') ? {
|
|
118
|
+
commentType: 'inline',
|
|
125
119
|
entryPoint: 'highlightActions'
|
|
126
|
-
}
|
|
120
|
+
}
|
|
127
121
|
});
|
|
128
122
|
annotationProviders === null || annotationProviders === void 0 || (_annotationProviders$4 = annotationProviders.createCommentExperience) === null || _annotationProviders$4 === void 0 || _annotationProviders$4.initExperience.start();
|
|
129
123
|
return setInlineCommentDraftState(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions, undefined, api)(true)(state, dispatch);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.5.0",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -38,15 +38,15 @@
|
|
|
38
38
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
39
39
|
"@atlaskit/editor-toolbar": "^0.9.0",
|
|
40
40
|
"@atlaskit/editor-toolbar-model": "^0.2.0",
|
|
41
|
-
"@atlaskit/icon": "^28.
|
|
41
|
+
"@atlaskit/icon": "^28.3.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.29.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.15.0",
|
|
50
50
|
"react": "^18.2.0",
|
|
51
51
|
"react-dom": "^18.2.0"
|
|
52
52
|
},
|
|
@@ -100,26 +100,14 @@
|
|
|
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
|
-
},
|
|
121
|
-
"cc_comments_create_inline_experience_entry_point": {
|
|
122
|
-
"type": "boolean"
|
|
123
111
|
}
|
|
124
112
|
}
|
|
125
113
|
}
|