@atlaskit/editor-plugin-annotation 2.8.1 → 2.8.3
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 +17 -19
- package/dist/cjs/pm-plugins/toolbar.js +4 -0
- package/dist/cjs/ui/InlineCommentView.js +14 -1
- package/dist/es2019/pm-plugins/inline-comment.js +19 -21
- package/dist/es2019/pm-plugins/toolbar.js +4 -0
- package/dist/es2019/ui/InlineCommentView.js +11 -1
- package/dist/esm/pm-plugins/inline-comment.js +17 -19
- package/dist/esm/pm-plugins/toolbar.js +4 -0
- package/dist/esm/ui/InlineCommentView.js +11 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/pm-plugins/annotation-manager-hooks.d.ts +1 -1
- package/dist/types/pm-plugins/toolbar.d.ts +6 -2
- package/dist/types/types/index.d.ts +9 -7
- package/dist/types-ts4.5/index.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/annotation-manager-hooks.d.ts +1 -1
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +6 -2
- package/dist/types-ts4.5/types/index.d.ts +9 -7
- package/package.json +6 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 2.8.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies
|
|
8
|
+
|
|
9
|
+
## 2.8.2
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [#156246](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/156246)
|
|
14
|
+
[`66ad86018032f`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/66ad86018032f) -
|
|
15
|
+
Expand types for selectInlineCommentExperience tracking
|
|
16
|
+
- Updated dependencies
|
|
17
|
+
|
|
3
18
|
## 2.8.1
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -228,25 +228,23 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
|
|
|
228
228
|
editorView.root.addEventListener('mouseup', mouseUp);
|
|
229
229
|
return {
|
|
230
230
|
update: function update(view, _prevState) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
249
|
-
}
|
|
231
|
+
var _prevSelectedAnnotati;
|
|
232
|
+
var _ref4 = (0, _utils.getPluginState)(view.state) || {},
|
|
233
|
+
selectedAnnotations = _ref4.selectedAnnotations,
|
|
234
|
+
annotations = _ref4.annotations;
|
|
235
|
+
var _ref5 = (0, _utils.getPluginState)(_prevState) || {},
|
|
236
|
+
prevSelectedAnnotations = _ref5.selectedAnnotations;
|
|
237
|
+
var selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
|
|
238
|
+
// If the new state has an unresolved selected annotation, and it's different from
|
|
239
|
+
// the previous one then we mark the select annotation experience as complete.
|
|
240
|
+
if (
|
|
241
|
+
//This checks the selected annotation is different from the previous one
|
|
242
|
+
selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 || (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
|
|
243
|
+
// This ensures that the selected annotation is unresolved
|
|
244
|
+
annotations && annotations[selectedAnnotationId] === false) {
|
|
245
|
+
var _options$selectCommen;
|
|
246
|
+
// The selectComponentExperience is using a simplified object, which is why it's type asserted.
|
|
247
|
+
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
250
248
|
}
|
|
251
249
|
var _ref6 = (0, _utils.getPluginState)(view.state) || {},
|
|
252
250
|
dirtyAnnotations = _ref6.dirtyAnnotations;
|
|
@@ -32,6 +32,10 @@ var getValidNodes = exports.getValidNodes = function getValidNodes(state) {
|
|
|
32
32
|
* This only applies when the selection range exactly matches the bookmark range
|
|
33
33
|
* which should be the case immediately after the comment button is clicked
|
|
34
34
|
* if the user creates a different selection range, the floating toolbar should still be shown
|
|
35
|
+
* @param root0
|
|
36
|
+
* @param root0.state
|
|
37
|
+
* @param root0.bookmark
|
|
38
|
+
* @example
|
|
35
39
|
*/
|
|
36
40
|
var shouldSuppressFloatingToolbar = exports.shouldSuppressFloatingToolbar = function shouldSuppressFloatingToolbar(_ref) {
|
|
37
41
|
var state = _ref.state,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.InlineCommentView = InlineCommentView;
|
|
8
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _react =
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
10
11
|
var _adfSchema = require("@atlaskit/adf-schema");
|
|
11
12
|
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
12
13
|
var _hooks = require("@atlaskit/editor-common/hooks");
|
|
@@ -19,6 +20,8 @@ var _editorCommands = require("../editor-commands");
|
|
|
19
20
|
var _utils3 = require("../pm-plugins/utils");
|
|
20
21
|
var _types = require("../types");
|
|
21
22
|
var _AnnotationViewWrapper = require("./AnnotationViewWrapper");
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
25
|
var findPosForDOM = function findPosForDOM(sel) {
|
|
23
26
|
var $from = sel.$from,
|
|
24
27
|
from = sel.from;
|
|
@@ -79,6 +82,7 @@ function InlineCommentView(_ref3) {
|
|
|
79
82
|
var inlineCommentProvider = providers.inlineComment;
|
|
80
83
|
var state = editorView.state,
|
|
81
84
|
dispatch = editorView.dispatch;
|
|
85
|
+
var lastSelectedAnnotationId = (0, _react.useRef)();
|
|
82
86
|
var CreateComponent = inlineCommentProvider.createComponent,
|
|
83
87
|
ViewComponent = inlineCommentProvider.viewComponent;
|
|
84
88
|
var _useInlineCommentView = useInlineCommentViewPluginState({
|
|
@@ -131,9 +135,17 @@ function InlineCommentView(_ref3) {
|
|
|
131
135
|
|
|
132
136
|
// Create Component
|
|
133
137
|
if (bookmark) {
|
|
138
|
+
var _selectedAnnotations$;
|
|
134
139
|
if (!CreateComponent) {
|
|
135
140
|
return null;
|
|
136
141
|
}
|
|
142
|
+
var currentlySelectedAnnotation = selectedAnnotations === null || selectedAnnotations === void 0 || (_selectedAnnotations$ = selectedAnnotations[0]) === null || _selectedAnnotations$ === void 0 ? void 0 : _selectedAnnotations$.id;
|
|
143
|
+
var isAnnotationSelectionChanged = currentlySelectedAnnotation !== lastSelectedAnnotationId.current;
|
|
144
|
+
|
|
145
|
+
// Update the last selected annotation ID if the selection was updated
|
|
146
|
+
if (isAnnotationSelectionChanged) {
|
|
147
|
+
lastSelectedAnnotationId.current = currentlySelectedAnnotation;
|
|
148
|
+
}
|
|
137
149
|
var inlineNodeTypes = (0, _utils.getRangeInlineNodeNames)({
|
|
138
150
|
doc: state.doc,
|
|
139
151
|
pos: selection
|
|
@@ -147,6 +159,7 @@ function InlineCommentView(_ref3) {
|
|
|
147
159
|
}, /*#__PURE__*/_react.default.createElement(CreateComponent, {
|
|
148
160
|
dom: dom,
|
|
149
161
|
textSelection: textSelection,
|
|
162
|
+
wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged,
|
|
150
163
|
onCreate: function onCreate(id) {
|
|
151
164
|
if (!(0, _platformFeatureFlags.fg)('platform_editor_comments_api_manager')) {
|
|
152
165
|
var createAnnotationResult = (0, _editorCommands.createAnnotation)(editorAnalyticsAPI, editorAPI)(id, _adfSchema.AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
|
@@ -162,27 +162,25 @@ export const inlineCommentPlugin = options => {
|
|
|
162
162
|
editorView.root.addEventListener('mouseup', mouseUp);
|
|
163
163
|
return {
|
|
164
164
|
update(view, _prevState) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 ? void 0 : _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
185
|
-
}
|
|
165
|
+
var _prevSelectedAnnotati;
|
|
166
|
+
const {
|
|
167
|
+
selectedAnnotations,
|
|
168
|
+
annotations
|
|
169
|
+
} = getPluginState(view.state) || {};
|
|
170
|
+
const {
|
|
171
|
+
selectedAnnotations: prevSelectedAnnotations
|
|
172
|
+
} = getPluginState(_prevState) || {};
|
|
173
|
+
const selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
|
|
174
|
+
// If the new state has an unresolved selected annotation, and it's different from
|
|
175
|
+
// the previous one then we mark the select annotation experience as complete.
|
|
176
|
+
if (
|
|
177
|
+
//This checks the selected annotation is different from the previous one
|
|
178
|
+
selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 ? void 0 : (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
|
|
179
|
+
// This ensures that the selected annotation is unresolved
|
|
180
|
+
annotations && annotations[selectedAnnotationId] === false) {
|
|
181
|
+
var _options$selectCommen;
|
|
182
|
+
// The selectComponentExperience is using a simplified object, which is why it's type asserted.
|
|
183
|
+
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 ? void 0 : _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
186
184
|
}
|
|
187
185
|
const {
|
|
188
186
|
dirtyAnnotations
|
|
@@ -29,6 +29,10 @@ export const getValidNodes = state => {
|
|
|
29
29
|
* This only applies when the selection range exactly matches the bookmark range
|
|
30
30
|
* which should be the case immediately after the comment button is clicked
|
|
31
31
|
* if the user creates a different selection range, the floating toolbar should still be shown
|
|
32
|
+
* @param root0
|
|
33
|
+
* @param root0.state
|
|
34
|
+
* @param root0.bookmark
|
|
35
|
+
* @example
|
|
32
36
|
*/
|
|
33
37
|
export const shouldSuppressFloatingToolbar = ({
|
|
34
38
|
state,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { useRef } from 'react';
|
|
2
2
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
3
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
4
4
|
import { sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
@@ -78,6 +78,7 @@ export function InlineCommentView({
|
|
|
78
78
|
state,
|
|
79
79
|
dispatch
|
|
80
80
|
} = editorView;
|
|
81
|
+
const lastSelectedAnnotationId = useRef();
|
|
81
82
|
const {
|
|
82
83
|
createComponent: CreateComponent,
|
|
83
84
|
viewComponent: ViewComponent
|
|
@@ -133,9 +134,17 @@ export function InlineCommentView({
|
|
|
133
134
|
|
|
134
135
|
// Create Component
|
|
135
136
|
if (bookmark) {
|
|
137
|
+
var _selectedAnnotations$;
|
|
136
138
|
if (!CreateComponent) {
|
|
137
139
|
return null;
|
|
138
140
|
}
|
|
141
|
+
const currentlySelectedAnnotation = selectedAnnotations === null || selectedAnnotations === void 0 ? void 0 : (_selectedAnnotations$ = selectedAnnotations[0]) === null || _selectedAnnotations$ === void 0 ? void 0 : _selectedAnnotations$.id;
|
|
142
|
+
const isAnnotationSelectionChanged = currentlySelectedAnnotation !== lastSelectedAnnotationId.current;
|
|
143
|
+
|
|
144
|
+
// Update the last selected annotation ID if the selection was updated
|
|
145
|
+
if (isAnnotationSelectionChanged) {
|
|
146
|
+
lastSelectedAnnotationId.current = currentlySelectedAnnotation;
|
|
147
|
+
}
|
|
139
148
|
const inlineNodeTypes = getRangeInlineNodeNames({
|
|
140
149
|
doc: state.doc,
|
|
141
150
|
pos: selection
|
|
@@ -149,6 +158,7 @@ export function InlineCommentView({
|
|
|
149
158
|
}, /*#__PURE__*/React.createElement(CreateComponent, {
|
|
150
159
|
dom: dom,
|
|
151
160
|
textSelection: textSelection,
|
|
161
|
+
wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged,
|
|
152
162
|
onCreate: id => {
|
|
153
163
|
if (!fg('platform_editor_comments_api_manager')) {
|
|
154
164
|
const createAnnotationResult = createAnnotation(editorAnalyticsAPI, editorAPI)(id, AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
|
@@ -221,25 +221,23 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
|
|
|
221
221
|
editorView.root.addEventListener('mouseup', mouseUp);
|
|
222
222
|
return {
|
|
223
223
|
update: function update(view, _prevState) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
242
|
-
}
|
|
224
|
+
var _prevSelectedAnnotati;
|
|
225
|
+
var _ref4 = getPluginState(view.state) || {},
|
|
226
|
+
selectedAnnotations = _ref4.selectedAnnotations,
|
|
227
|
+
annotations = _ref4.annotations;
|
|
228
|
+
var _ref5 = getPluginState(_prevState) || {},
|
|
229
|
+
prevSelectedAnnotations = _ref5.selectedAnnotations;
|
|
230
|
+
var selectedAnnotationId = selectedAnnotations && selectedAnnotations.length !== 0 && selectedAnnotations[0].id ? selectedAnnotations[0].id : undefined;
|
|
231
|
+
// If the new state has an unresolved selected annotation, and it's different from
|
|
232
|
+
// the previous one then we mark the select annotation experience as complete.
|
|
233
|
+
if (
|
|
234
|
+
//This checks the selected annotation is different from the previous one
|
|
235
|
+
selectedAnnotationId && selectedAnnotationId !== (prevSelectedAnnotations === null || prevSelectedAnnotations === void 0 || (_prevSelectedAnnotati = prevSelectedAnnotations[0]) === null || _prevSelectedAnnotati === void 0 ? void 0 : _prevSelectedAnnotati.id) &&
|
|
236
|
+
// This ensures that the selected annotation is unresolved
|
|
237
|
+
annotations && annotations[selectedAnnotationId] === false) {
|
|
238
|
+
var _options$selectCommen;
|
|
239
|
+
// The selectComponentExperience is using a simplified object, which is why it's type asserted.
|
|
240
|
+
(_options$selectCommen = options.selectCommentExperience) === null || _options$selectCommen === void 0 || _options$selectCommen.selectAnnotation.complete(selectedAnnotationId);
|
|
243
241
|
}
|
|
244
242
|
var _ref6 = getPluginState(view.state) || {},
|
|
245
243
|
dirtyAnnotations = _ref6.dirtyAnnotations;
|
|
@@ -25,6 +25,10 @@ export var getValidNodes = function getValidNodes(state) {
|
|
|
25
25
|
* This only applies when the selection range exactly matches the bookmark range
|
|
26
26
|
* which should be the case immediately after the comment button is clicked
|
|
27
27
|
* if the user creates a different selection range, the floating toolbar should still be shown
|
|
28
|
+
* @param root0
|
|
29
|
+
* @param root0.state
|
|
30
|
+
* @param root0.bookmark
|
|
31
|
+
* @example
|
|
28
32
|
*/
|
|
29
33
|
export var shouldSuppressFloatingToolbar = function shouldSuppressFloatingToolbar(_ref) {
|
|
30
34
|
var state = _ref.state,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
import React from 'react';
|
|
2
|
+
import React, { useRef } from 'react';
|
|
3
3
|
import { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
4
4
|
import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import { sharedPluginStateHookMigratorFactory } from '@atlaskit/editor-common/hooks';
|
|
@@ -72,6 +72,7 @@ export function InlineCommentView(_ref3) {
|
|
|
72
72
|
var inlineCommentProvider = providers.inlineComment;
|
|
73
73
|
var state = editorView.state,
|
|
74
74
|
dispatch = editorView.dispatch;
|
|
75
|
+
var lastSelectedAnnotationId = useRef();
|
|
75
76
|
var CreateComponent = inlineCommentProvider.createComponent,
|
|
76
77
|
ViewComponent = inlineCommentProvider.viewComponent;
|
|
77
78
|
var _useInlineCommentView = useInlineCommentViewPluginState({
|
|
@@ -124,9 +125,17 @@ export function InlineCommentView(_ref3) {
|
|
|
124
125
|
|
|
125
126
|
// Create Component
|
|
126
127
|
if (bookmark) {
|
|
128
|
+
var _selectedAnnotations$;
|
|
127
129
|
if (!CreateComponent) {
|
|
128
130
|
return null;
|
|
129
131
|
}
|
|
132
|
+
var currentlySelectedAnnotation = selectedAnnotations === null || selectedAnnotations === void 0 || (_selectedAnnotations$ = selectedAnnotations[0]) === null || _selectedAnnotations$ === void 0 ? void 0 : _selectedAnnotations$.id;
|
|
133
|
+
var isAnnotationSelectionChanged = currentlySelectedAnnotation !== lastSelectedAnnotationId.current;
|
|
134
|
+
|
|
135
|
+
// Update the last selected annotation ID if the selection was updated
|
|
136
|
+
if (isAnnotationSelectionChanged) {
|
|
137
|
+
lastSelectedAnnotationId.current = currentlySelectedAnnotation;
|
|
138
|
+
}
|
|
130
139
|
var inlineNodeTypes = getRangeInlineNodeNames({
|
|
131
140
|
doc: state.doc,
|
|
132
141
|
pos: selection
|
|
@@ -140,6 +149,7 @@ export function InlineCommentView(_ref3) {
|
|
|
140
149
|
}, /*#__PURE__*/React.createElement(CreateComponent, {
|
|
141
150
|
dom: dom,
|
|
142
151
|
textSelection: textSelection,
|
|
152
|
+
wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged,
|
|
143
153
|
onCreate: function onCreate(id) {
|
|
144
154
|
if (!fg('platform_editor_comments_api_manager')) {
|
|
145
155
|
var createAnnotationResult = createAnnotation(editorAnalyticsAPI, editorAPI)(id, AnnotationTypes.INLINE_COMMENT, inlineCommentProvider.supportedBlockNodes)(editorView.state, editorView.dispatch);
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { annotationPlugin } from './annotationPlugin';
|
|
2
2
|
export type { AnnotationPlugin, AnnotationPluginOptions } from './annotationPluginType';
|
|
3
|
-
export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
|
|
3
|
+
export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectAbortReasons, SelectParentAbortReasons, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
|
|
4
4
|
export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AnnotationId } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { ApplyDraftResult, ClearDraftResult, GetDraftResult, StartDraftResult } from '@atlaskit/editor-common/annotation';
|
|
3
3
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { InlineCommentPluginOptions } from './types';
|
|
4
|
+
import type { InlineCommentPluginOptions } from './types';
|
|
5
5
|
export declare const allowAnnotation: (editorView: EditorView, options: InlineCommentPluginOptions) => () => boolean;
|
|
6
6
|
export declare const startDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => () => StartDraftResult;
|
|
7
7
|
export declare const clearDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => () => ClearDraftResult;
|
|
@@ -3,10 +3,10 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { PopupPosition } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
-
import { SelectionBookmark, type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { type SelectionBookmark, type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
9
|
-
import { AnnotationProviders } from '../types';
|
|
9
|
+
import { type AnnotationProviders } from '../types';
|
|
10
10
|
interface BuildToolbarOptions {
|
|
11
11
|
state: EditorState;
|
|
12
12
|
intl: IntlShape;
|
|
@@ -28,6 +28,10 @@ type ShouldSuppressFloatingToolbarOptions = {
|
|
|
28
28
|
* This only applies when the selection range exactly matches the bookmark range
|
|
29
29
|
* which should be the case immediately after the comment button is clicked
|
|
30
30
|
* if the user creates a different selection range, the floating toolbar should still be shown
|
|
31
|
+
* @param root0
|
|
32
|
+
* @param root0.state
|
|
33
|
+
* @param root0.bookmark
|
|
34
|
+
* @example
|
|
31
35
|
*/
|
|
32
36
|
export declare const shouldSuppressFloatingToolbar: ({ state, bookmark, }: ShouldSuppressFloatingToolbarOptions) => boolean;
|
|
33
37
|
export declare const buildSuppressedToolbar: (state: EditorState) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
4
4
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
|
|
6
6
|
/**
|
|
@@ -45,6 +45,7 @@ export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
|
|
|
45
45
|
* Indicates whether we're opening the media comment box from the media toolbar so we can scroll the media into view
|
|
46
46
|
*/
|
|
47
47
|
isOpeningMediaCommentFromToolbar?: boolean;
|
|
48
|
+
wasNewAnnotationSelected?: boolean;
|
|
48
49
|
};
|
|
49
50
|
export type InlineCommentViewComponentProps = AnnotationComponentProps & {
|
|
50
51
|
/**
|
|
@@ -171,7 +172,6 @@ export type StartAttributes = {
|
|
|
171
172
|
blockType?: 'media';
|
|
172
173
|
annotationId: string;
|
|
173
174
|
entryPoint: Exclude<SelectInlineCommentCompoundExperienceEntryPoint, 'keyboard-navigation' | 'comment-navigation'>;
|
|
174
|
-
linkedCompoundTaskId?: string;
|
|
175
175
|
} | {
|
|
176
176
|
pageClass: 'editor' | 'renderer';
|
|
177
177
|
/**
|
|
@@ -181,7 +181,6 @@ export type StartAttributes = {
|
|
|
181
181
|
commentType?: 'block' | 'inline';
|
|
182
182
|
blockType?: 'media';
|
|
183
183
|
entryPoint: 'keyboard-navigation' | 'comment-navigation';
|
|
184
|
-
linkedCompoundTaskId?: string;
|
|
185
184
|
};
|
|
186
185
|
type ExperienceDebugFunction = (params: {
|
|
187
186
|
createAnalyticsEvent: CreateUIAnalyticsEvent;
|
|
@@ -228,19 +227,22 @@ export type InlineCommentCompoundExperience = {
|
|
|
228
227
|
debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
|
|
229
228
|
};
|
|
230
229
|
};
|
|
230
|
+
export type SelectAbortReasons = 'test abort' | 'Comment being resolved';
|
|
231
|
+
export type SelectParentAbortReasons = 'Parent experience aborting with reason: test abort' | 'Parent experience aborting with reason: Comment being resolved';
|
|
231
232
|
export type SelectInlineCommentCompoundExperience = {
|
|
232
233
|
_start: (startAttributes: StartAttributes) => void;
|
|
233
234
|
addCommonAttributes: (additionalCommonAttributes: {
|
|
234
|
-
[key: string]: string | number |
|
|
235
|
+
[key: string]: boolean | null | number | string | undefined | Array<number | string>;
|
|
235
236
|
}) => void;
|
|
236
237
|
abort: (params: {
|
|
237
|
-
abortReason:
|
|
238
|
+
abortReason: SelectAbortReasons;
|
|
239
|
+
abortSubexperiences?: boolean;
|
|
238
240
|
}) => void;
|
|
239
241
|
selectAnnotation: {
|
|
240
242
|
debug: ExperienceDebugFunction;
|
|
241
243
|
start: (startAttributes: StartAttributes) => void;
|
|
242
244
|
abort: (params: {
|
|
243
|
-
abortReason: 'Comment navigation when only one comment';
|
|
245
|
+
abortReason: 'Comment navigation when only one comment' | 'Navigating to general comment' | SelectParentAbortReasons;
|
|
244
246
|
}) => void;
|
|
245
247
|
complete: (startAttributes: StartAttributes) => void;
|
|
246
248
|
};
|
|
@@ -253,7 +255,7 @@ export type SelectInlineCommentCompoundExperience = {
|
|
|
253
255
|
annotationId: string;
|
|
254
256
|
}) => void;
|
|
255
257
|
abort: (params: {
|
|
256
|
-
abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed';
|
|
258
|
+
abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed' | 'InlineComment component unmounted' | SelectParentAbortReasons;
|
|
257
259
|
}) => void;
|
|
258
260
|
fail: (error: Error, extraAttributes?: {
|
|
259
261
|
misalignedBy: number;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { annotationPlugin } from './annotationPlugin';
|
|
2
2
|
export type { AnnotationPlugin, AnnotationPluginOptions } from './annotationPluginType';
|
|
3
|
-
export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
|
|
3
|
+
export type { AnnotationInfo, AnnotationProviders, AnnotationState, AnnotationTypeProvider, InlineCommentAnnotationProvider, InlineCommentCompoundExperience, InlineCommentCreateComponentProps, InlineCommentInputMethod, InlineCommentState, InlineCommentViewComponentProps, SelectAbortReasons, SelectParentAbortReasons, SelectInlineCommentCompoundExperience, SelectInlineCommentCompoundExperienceEntryPoint, SimpleSelectInlineCommentCompoundExperience, StartAttributes, TargetType, } from './types';
|
|
4
4
|
export type { InlineCommentMap, InlineCommentPluginState, InlineCommentPluginOptions, InlineCommentAction, } from './pm-plugins/types';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type AnnotationId } from '@atlaskit/adf-schema';
|
|
2
2
|
import type { ApplyDraftResult, ClearDraftResult, GetDraftResult, StartDraftResult } from '@atlaskit/editor-common/annotation';
|
|
3
3
|
import { type EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
-
import { InlineCommentPluginOptions } from './types';
|
|
4
|
+
import type { InlineCommentPluginOptions } from './types';
|
|
5
5
|
export declare const allowAnnotation: (editorView: EditorView, options: InlineCommentPluginOptions) => () => boolean;
|
|
6
6
|
export declare const startDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => () => StartDraftResult;
|
|
7
7
|
export declare const clearDraft: (editorView: EditorView, options: InlineCommentPluginOptions) => () => ClearDraftResult;
|
|
@@ -3,10 +3,10 @@ import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
|
3
3
|
import type { Command, ExtractInjectionAPI, FloatingToolbarButton } from '@atlaskit/editor-common/types';
|
|
4
4
|
import type { PopupPosition } from '@atlaskit/editor-common/ui';
|
|
5
5
|
import type { NodeType } from '@atlaskit/editor-prosemirror/model';
|
|
6
|
-
import { SelectionBookmark, type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
6
|
+
import { type SelectionBookmark, type EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
7
7
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
8
8
|
import type { AnnotationPlugin } from '../annotationPluginType';
|
|
9
|
-
import { AnnotationProviders } from '../types';
|
|
9
|
+
import { type AnnotationProviders } from '../types';
|
|
10
10
|
interface BuildToolbarOptions {
|
|
11
11
|
state: EditorState;
|
|
12
12
|
intl: IntlShape;
|
|
@@ -28,6 +28,10 @@ type ShouldSuppressFloatingToolbarOptions = {
|
|
|
28
28
|
* This only applies when the selection range exactly matches the bookmark range
|
|
29
29
|
* which should be the case immediately after the comment button is clicked
|
|
30
30
|
* if the user creates a different selection range, the floating toolbar should still be shown
|
|
31
|
+
* @param root0
|
|
32
|
+
* @param root0.state
|
|
33
|
+
* @param root0.bookmark
|
|
34
|
+
* @example
|
|
31
35
|
*/
|
|
32
36
|
export declare const shouldSuppressFloatingToolbar: ({ state, bookmark, }: ShouldSuppressFloatingToolbarOptions) => boolean;
|
|
33
37
|
export declare const buildSuppressedToolbar: (state: EditorState) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { AnnotationTypes } from '@atlaskit/adf-schema';
|
|
3
|
-
import { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
3
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next/types';
|
|
4
4
|
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
5
5
|
import type { AnnotationUpdateEmitter, AnnotationManager } from '@atlaskit/editor-common/annotation';
|
|
6
6
|
/**
|
|
@@ -45,6 +45,7 @@ export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
|
|
|
45
45
|
* Indicates whether we're opening the media comment box from the media toolbar so we can scroll the media into view
|
|
46
46
|
*/
|
|
47
47
|
isOpeningMediaCommentFromToolbar?: boolean;
|
|
48
|
+
wasNewAnnotationSelected?: boolean;
|
|
48
49
|
};
|
|
49
50
|
export type InlineCommentViewComponentProps = AnnotationComponentProps & {
|
|
50
51
|
/**
|
|
@@ -171,7 +172,6 @@ export type StartAttributes = {
|
|
|
171
172
|
blockType?: 'media';
|
|
172
173
|
annotationId: string;
|
|
173
174
|
entryPoint: Exclude<SelectInlineCommentCompoundExperienceEntryPoint, 'keyboard-navigation' | 'comment-navigation'>;
|
|
174
|
-
linkedCompoundTaskId?: string;
|
|
175
175
|
} | {
|
|
176
176
|
pageClass: 'editor' | 'renderer';
|
|
177
177
|
/**
|
|
@@ -181,7 +181,6 @@ export type StartAttributes = {
|
|
|
181
181
|
commentType?: 'block' | 'inline';
|
|
182
182
|
blockType?: 'media';
|
|
183
183
|
entryPoint: 'keyboard-navigation' | 'comment-navigation';
|
|
184
|
-
linkedCompoundTaskId?: string;
|
|
185
184
|
};
|
|
186
185
|
type ExperienceDebugFunction = (params: {
|
|
187
186
|
createAnalyticsEvent: CreateUIAnalyticsEvent;
|
|
@@ -228,19 +227,22 @@ export type InlineCommentCompoundExperience = {
|
|
|
228
227
|
debugPoint: (message: string, attributes?: ExperienceAttributes) => void;
|
|
229
228
|
};
|
|
230
229
|
};
|
|
230
|
+
export type SelectAbortReasons = 'test abort' | 'Comment being resolved';
|
|
231
|
+
export type SelectParentAbortReasons = 'Parent experience aborting with reason: test abort' | 'Parent experience aborting with reason: Comment being resolved';
|
|
231
232
|
export type SelectInlineCommentCompoundExperience = {
|
|
232
233
|
_start: (startAttributes: StartAttributes) => void;
|
|
233
234
|
addCommonAttributes: (additionalCommonAttributes: {
|
|
234
|
-
[key: string]: string | number |
|
|
235
|
+
[key: string]: boolean | null | number | string | undefined | Array<number | string>;
|
|
235
236
|
}) => void;
|
|
236
237
|
abort: (params: {
|
|
237
|
-
abortReason:
|
|
238
|
+
abortReason: SelectAbortReasons;
|
|
239
|
+
abortSubexperiences?: boolean;
|
|
238
240
|
}) => void;
|
|
239
241
|
selectAnnotation: {
|
|
240
242
|
debug: ExperienceDebugFunction;
|
|
241
243
|
start: (startAttributes: StartAttributes) => void;
|
|
242
244
|
abort: (params: {
|
|
243
|
-
abortReason: 'Comment navigation when only one comment';
|
|
245
|
+
abortReason: 'Comment navigation when only one comment' | 'Navigating to general comment' | SelectParentAbortReasons;
|
|
244
246
|
}) => void;
|
|
245
247
|
complete: (startAttributes: StartAttributes) => void;
|
|
246
248
|
};
|
|
@@ -253,7 +255,7 @@ export type SelectInlineCommentCompoundExperience = {
|
|
|
253
255
|
annotationId: string;
|
|
254
256
|
}) => void;
|
|
255
257
|
abort: (params: {
|
|
256
|
-
abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed';
|
|
258
|
+
abortReason: 'Non inline comment being shown' | 'Comment sidebar dismissed' | 'InlineComment component unmounted' | SelectParentAbortReasons;
|
|
257
259
|
}) => void;
|
|
258
260
|
fail: (error: Error, extraAttributes?: {
|
|
259
261
|
misalignedBy: number;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.3",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -33,16 +33,16 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@atlaskit/adf-schema": "^47.6.0",
|
|
35
35
|
"@atlaskit/analytics-next": "^11.0.0",
|
|
36
|
-
"@atlaskit/editor-common": "^105.
|
|
37
|
-
"@atlaskit/editor-plugin-analytics": "^2.
|
|
36
|
+
"@atlaskit/editor-common": "^105.10.0",
|
|
37
|
+
"@atlaskit/editor-plugin-analytics": "^2.3.0",
|
|
38
38
|
"@atlaskit/editor-plugin-connectivity": "^2.0.0",
|
|
39
39
|
"@atlaskit/editor-plugin-editor-viewmode-effects": "^2.0.0",
|
|
40
40
|
"@atlaskit/editor-plugin-feature-flags": "^1.4.0",
|
|
41
41
|
"@atlaskit/editor-prosemirror": "7.0.0",
|
|
42
|
-
"@atlaskit/icon": "^26.
|
|
43
|
-
"@atlaskit/onboarding": "^14.
|
|
42
|
+
"@atlaskit/icon": "^26.3.0",
|
|
43
|
+
"@atlaskit/onboarding": "^14.1.0",
|
|
44
44
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
45
|
-
"@atlaskit/tmp-editor-statsig": "^
|
|
45
|
+
"@atlaskit/tmp-editor-statsig": "^5.0.0",
|
|
46
46
|
"@babel/runtime": "^7.0.0"
|
|
47
47
|
},
|
|
48
48
|
"peerDependencies": {
|
|
@@ -115,9 +115,6 @@
|
|
|
115
115
|
"platform_editor_listen_for_focussed_query_param": {
|
|
116
116
|
"type": "boolean"
|
|
117
117
|
},
|
|
118
|
-
"confluence_comments_select_comment_experience": {
|
|
119
|
-
"type": "boolean"
|
|
120
|
-
},
|
|
121
118
|
"confluence_frontend_handle_annotation_error": {
|
|
122
119
|
"type": "boolean"
|
|
123
120
|
},
|