@atlaskit/editor-plugin-annotation 3.2.3 → 3.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/cjs/annotationPlugin.js +6 -2
- package/dist/cjs/pm-plugins/toolbar.js +13 -3
- package/dist/cjs/ui/CommentButton/CommentButton.js +14 -14
- package/dist/es2019/annotationPlugin.js +6 -2
- package/dist/es2019/pm-plugins/toolbar.js +10 -3
- package/dist/es2019/ui/CommentButton/CommentButton.js +14 -14
- package/dist/esm/annotationPlugin.js +6 -2
- package/dist/esm/pm-plugins/toolbar.js +13 -3
- package/dist/esm/ui/CommentButton/CommentButton.js +14 -14
- package/dist/types/pm-plugins/toolbar.d.ts +3 -1
- package/dist/types/types/index.d.ts +2 -0
- package/dist/types-ts4.5/pm-plugins/toolbar.d.ts +3 -1
- package/dist/types-ts4.5/types/index.d.ts +2 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,34 @@
|
|
|
1
1
|
# @atlaskit/editor-plugin-annotation
|
|
2
2
|
|
|
3
|
+
## 3.3.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`3145f278b1f7a`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/3145f278b1f7a) -
|
|
8
|
+
[ux] [ED-28473] minor UI updates for editor-toolbar
|
|
9
|
+
|
|
10
|
+
- Use ADS ButtonGroup for ToolbarButtonGroup
|
|
11
|
+
- Remove groupLocation prop and use CSS instead
|
|
12
|
+
- Use DropdownItemGroup for ToolbarDropdownItemSection and expand props for section separator and
|
|
13
|
+
title
|
|
14
|
+
- Support ReactNode as content for ToolbarTooltip and add missing shortcuts in tooltips
|
|
15
|
+
- Center Icons for split buttons and make chevron icon 24px wide
|
|
16
|
+
- Align dropdown menu UI with current editor design
|
|
17
|
+
|
|
18
|
+
- Updated dependencies
|
|
19
|
+
|
|
20
|
+
## 3.3.0
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- [`5b6e41650fd59`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/5b6e41650fd59) -
|
|
25
|
+
[ux] Introduce two new properties (getCanAddComments and contentType) which are used to disable
|
|
26
|
+
the toolbar's Comment button when the user doesn't have create comment permissions
|
|
27
|
+
|
|
28
|
+
### Patch Changes
|
|
29
|
+
|
|
30
|
+
- Updated dependencies
|
|
31
|
+
|
|
3
32
|
## 3.2.3
|
|
4
33
|
|
|
5
34
|
### Patch Changes
|
|
@@ -106,7 +106,9 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
106
106
|
var _api$analytics4;
|
|
107
107
|
var _annotationProviders$ = annotationProviders.inlineComment,
|
|
108
108
|
isToolbarAbove = _annotationProviders$.isToolbarAbove,
|
|
109
|
-
onCommentButtonMount = _annotationProviders$.onCommentButtonMount
|
|
109
|
+
onCommentButtonMount = _annotationProviders$.onCommentButtonMount,
|
|
110
|
+
getCanAddComments = _annotationProviders$.getCanAddComments,
|
|
111
|
+
contentType = _annotationProviders$.contentType;
|
|
110
112
|
var toolbarConfig = (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
|
|
111
113
|
state: state,
|
|
112
114
|
intl: intl,
|
|
@@ -114,7 +116,9 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
|
|
|
114
116
|
api: api,
|
|
115
117
|
createCommentExperience: annotationProviders.createCommentExperience,
|
|
116
118
|
annotationManager: annotationProviders.annotationManager,
|
|
117
|
-
onCommentButtonMount: onCommentButtonMount
|
|
119
|
+
onCommentButtonMount: onCommentButtonMount,
|
|
120
|
+
getCanAddComments: getCanAddComments,
|
|
121
|
+
contentType: contentType
|
|
118
122
|
});
|
|
119
123
|
if (!toolbarConfig) {
|
|
120
124
|
return undefined;
|
|
@@ -68,7 +68,12 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
|
|
|
68
68
|
api = _ref2.api,
|
|
69
69
|
createCommentExperience = _ref2.createCommentExperience,
|
|
70
70
|
annotationManager = _ref2.annotationManager,
|
|
71
|
-
onCommentButtonMount = _ref2.onCommentButtonMount
|
|
71
|
+
onCommentButtonMount = _ref2.onCommentButtonMount,
|
|
72
|
+
_ref2$getCanAddCommen = _ref2.getCanAddComments,
|
|
73
|
+
getCanAddComments = _ref2$getCanAddCommen === void 0 ? function () {
|
|
74
|
+
return true;
|
|
75
|
+
} : _ref2$getCanAddCommen,
|
|
76
|
+
contentType = _ref2.contentType;
|
|
72
77
|
var selectionValid = (0, _utils2.isSelectionValid)(state);
|
|
73
78
|
var isMediaSelected = (0, _mediaSingle.currentMediaNodeWithPos)(state);
|
|
74
79
|
|
|
@@ -78,15 +83,20 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
|
|
|
78
83
|
}
|
|
79
84
|
var createCommentMessage = intl.formatMessage(_messages.annotationMessages.createComment);
|
|
80
85
|
var commentDisabledMessage = intl.formatMessage((0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? _messages.annotationMessages.createCommentDisabled : _messages.annotationMessages.createCommentInvalid);
|
|
86
|
+
var canAddComments = getCanAddComments();
|
|
87
|
+
var isCommentButtonDisabled = !canAddComments || selectionValid === _types.AnnotationSelectionType.DISABLED;
|
|
88
|
+
var disabledTooltipContent = !canAddComments ? intl.formatMessage(_messages.annotationMessages.noPermissionToAddComment, {
|
|
89
|
+
contentType: contentType
|
|
90
|
+
}) : commentDisabledMessage;
|
|
81
91
|
var createComment = {
|
|
82
92
|
type: 'button',
|
|
83
93
|
showTitle: true,
|
|
84
|
-
disabled:
|
|
94
|
+
disabled: isCommentButtonDisabled || (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
|
|
85
95
|
testId: _types.AnnotationTestIds.floatingToolbarCreateButton,
|
|
86
96
|
interactionName: 'start-inline-comment-action',
|
|
87
97
|
icon: _comment.default,
|
|
88
98
|
iconFallback: _comment.default,
|
|
89
|
-
tooltipContent:
|
|
99
|
+
tooltipContent: isCommentButtonDisabled ? disabledTooltipContent : /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
90
100
|
description: createCommentMessage,
|
|
91
101
|
keymap: _keymaps.addInlineComment
|
|
92
102
|
}),
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.CommentButton = void 0;
|
|
8
8
|
var _react = _interopRequireDefault(require("react"));
|
|
9
9
|
var _reactIntlNext = require("react-intl-next");
|
|
10
|
+
var _keymaps = require("@atlaskit/editor-common/keymaps");
|
|
10
11
|
var _messages = require("@atlaskit/editor-common/messages");
|
|
11
12
|
var _toolbar = require("@atlaskit/editor-common/toolbar");
|
|
12
13
|
var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
|
|
@@ -65,18 +66,17 @@ var CommentButton = exports.CommentButton = function CommentButton(_ref) {
|
|
|
65
66
|
state: state,
|
|
66
67
|
api: api
|
|
67
68
|
});
|
|
68
|
-
return (
|
|
69
|
-
/*#__PURE__*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
);
|
|
69
|
+
return /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarTooltip, {
|
|
70
|
+
content: isDisabled ? commentDisabledMessage : /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
|
|
71
|
+
description: commentMessage,
|
|
72
|
+
keymap: _keymaps.addInlineComment
|
|
73
|
+
})
|
|
74
|
+
}, /*#__PURE__*/_react.default.createElement(_editorToolbar.ToolbarButton, {
|
|
75
|
+
iconBefore: /*#__PURE__*/_react.default.createElement(_editorToolbar.CommentIcon, {
|
|
76
|
+
label: ""
|
|
77
|
+
}),
|
|
78
|
+
onClick: onClick,
|
|
79
|
+
testId: _types.AnnotationTestIds.floatingToolbarCreateButton,
|
|
80
|
+
isDisabled: isDisabled
|
|
81
|
+
}, commentMessage));
|
|
82
82
|
};
|
|
@@ -96,7 +96,9 @@ export const annotationPlugin = ({
|
|
|
96
96
|
var _api$analytics4;
|
|
97
97
|
const {
|
|
98
98
|
isToolbarAbove,
|
|
99
|
-
onCommentButtonMount
|
|
99
|
+
onCommentButtonMount,
|
|
100
|
+
getCanAddComments,
|
|
101
|
+
contentType
|
|
100
102
|
} = annotationProviders.inlineComment;
|
|
101
103
|
const toolbarConfig = buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
|
|
102
104
|
state,
|
|
@@ -105,7 +107,9 @@ export const annotationPlugin = ({
|
|
|
105
107
|
api,
|
|
106
108
|
createCommentExperience: annotationProviders.createCommentExperience,
|
|
107
109
|
annotationManager: annotationProviders.annotationManager,
|
|
108
|
-
onCommentButtonMount
|
|
110
|
+
onCommentButtonMount,
|
|
111
|
+
getCanAddComments,
|
|
112
|
+
contentType
|
|
109
113
|
});
|
|
110
114
|
if (!toolbarConfig) {
|
|
111
115
|
return undefined;
|
|
@@ -64,7 +64,9 @@ export const buildToolbar = editorAnalyticsAPI => ({
|
|
|
64
64
|
api,
|
|
65
65
|
createCommentExperience,
|
|
66
66
|
annotationManager,
|
|
67
|
-
onCommentButtonMount
|
|
67
|
+
onCommentButtonMount,
|
|
68
|
+
getCanAddComments = () => true,
|
|
69
|
+
contentType
|
|
68
70
|
}) => {
|
|
69
71
|
var _api$connectivity, _api$connectivity$sha, _api$connectivity$sha2;
|
|
70
72
|
const selectionValid = isSelectionValid(state);
|
|
@@ -76,15 +78,20 @@ export const buildToolbar = editorAnalyticsAPI => ({
|
|
|
76
78
|
}
|
|
77
79
|
const createCommentMessage = intl.formatMessage(annotationMessages.createComment);
|
|
78
80
|
const commentDisabledMessage = intl.formatMessage(fg('editor_inline_comments_on_inline_nodes') ? annotationMessages.createCommentDisabled : annotationMessages.createCommentInvalid);
|
|
81
|
+
const canAddComments = getCanAddComments();
|
|
82
|
+
const isCommentButtonDisabled = !canAddComments || selectionValid === AnnotationSelectionType.DISABLED;
|
|
83
|
+
const disabledTooltipContent = !canAddComments ? intl.formatMessage(annotationMessages.noPermissionToAddComment, {
|
|
84
|
+
contentType
|
|
85
|
+
}) : commentDisabledMessage;
|
|
79
86
|
const createComment = {
|
|
80
87
|
type: 'button',
|
|
81
88
|
showTitle: true,
|
|
82
|
-
disabled:
|
|
89
|
+
disabled: isCommentButtonDisabled || (api === null || api === void 0 ? void 0 : (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 ? void 0 : (_api$connectivity$sha = _api$connectivity.sharedState) === null || _api$connectivity$sha === void 0 ? void 0 : (_api$connectivity$sha2 = _api$connectivity$sha.currentState()) === null || _api$connectivity$sha2 === void 0 ? void 0 : _api$connectivity$sha2.mode) === 'offline',
|
|
83
90
|
testId: AnnotationTestIds.floatingToolbarCreateButton,
|
|
84
91
|
interactionName: 'start-inline-comment-action',
|
|
85
92
|
icon: CommentIcon,
|
|
86
93
|
iconFallback: CommentIcon,
|
|
87
|
-
tooltipContent:
|
|
94
|
+
tooltipContent: isCommentButtonDisabled ? disabledTooltipContent : /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
88
95
|
description: createCommentMessage,
|
|
89
96
|
keymap: addInlineComment
|
|
90
97
|
}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { ToolTipContent, addInlineComment } from '@atlaskit/editor-common/keymaps';
|
|
3
4
|
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
6
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
@@ -61,18 +62,17 @@ export const CommentButton = ({
|
|
|
61
62
|
state,
|
|
62
63
|
api
|
|
63
64
|
});
|
|
64
|
-
return (
|
|
65
|
-
/*#__PURE__*/
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
);
|
|
65
|
+
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
66
|
+
content: isDisabled ? commentDisabledMessage : /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
67
|
+
description: commentMessage,
|
|
68
|
+
keymap: addInlineComment
|
|
69
|
+
})
|
|
70
|
+
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
71
|
+
iconBefore: /*#__PURE__*/React.createElement(NewCommentIcon, {
|
|
72
|
+
label: ""
|
|
73
|
+
}),
|
|
74
|
+
onClick: onClick,
|
|
75
|
+
testId: AnnotationTestIds.floatingToolbarCreateButton,
|
|
76
|
+
isDisabled: isDisabled
|
|
77
|
+
}, commentMessage));
|
|
78
78
|
};
|
|
@@ -99,7 +99,9 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
99
99
|
var _api$analytics4;
|
|
100
100
|
var _annotationProviders$ = annotationProviders.inlineComment,
|
|
101
101
|
isToolbarAbove = _annotationProviders$.isToolbarAbove,
|
|
102
|
-
onCommentButtonMount = _annotationProviders$.onCommentButtonMount
|
|
102
|
+
onCommentButtonMount = _annotationProviders$.onCommentButtonMount,
|
|
103
|
+
getCanAddComments = _annotationProviders$.getCanAddComments,
|
|
104
|
+
contentType = _annotationProviders$.contentType;
|
|
103
105
|
var toolbarConfig = buildToolbar(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
|
|
104
106
|
state: state,
|
|
105
107
|
intl: intl,
|
|
@@ -107,7 +109,9 @@ export var annotationPlugin = function annotationPlugin(_ref) {
|
|
|
107
109
|
api: api,
|
|
108
110
|
createCommentExperience: annotationProviders.createCommentExperience,
|
|
109
111
|
annotationManager: annotationProviders.annotationManager,
|
|
110
|
-
onCommentButtonMount: onCommentButtonMount
|
|
112
|
+
onCommentButtonMount: onCommentButtonMount,
|
|
113
|
+
getCanAddComments: getCanAddComments,
|
|
114
|
+
contentType: contentType
|
|
111
115
|
});
|
|
112
116
|
if (!toolbarConfig) {
|
|
113
117
|
return undefined;
|
|
@@ -61,7 +61,12 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
|
|
|
61
61
|
api = _ref2.api,
|
|
62
62
|
createCommentExperience = _ref2.createCommentExperience,
|
|
63
63
|
annotationManager = _ref2.annotationManager,
|
|
64
|
-
onCommentButtonMount = _ref2.onCommentButtonMount
|
|
64
|
+
onCommentButtonMount = _ref2.onCommentButtonMount,
|
|
65
|
+
_ref2$getCanAddCommen = _ref2.getCanAddComments,
|
|
66
|
+
getCanAddComments = _ref2$getCanAddCommen === void 0 ? function () {
|
|
67
|
+
return true;
|
|
68
|
+
} : _ref2$getCanAddCommen,
|
|
69
|
+
contentType = _ref2.contentType;
|
|
65
70
|
var selectionValid = isSelectionValid(state);
|
|
66
71
|
var isMediaSelected = currentMediaNodeWithPos(state);
|
|
67
72
|
|
|
@@ -71,15 +76,20 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
|
|
|
71
76
|
}
|
|
72
77
|
var createCommentMessage = intl.formatMessage(annotationMessages.createComment);
|
|
73
78
|
var commentDisabledMessage = intl.formatMessage(fg('editor_inline_comments_on_inline_nodes') ? annotationMessages.createCommentDisabled : annotationMessages.createCommentInvalid);
|
|
79
|
+
var canAddComments = getCanAddComments();
|
|
80
|
+
var isCommentButtonDisabled = !canAddComments || selectionValid === AnnotationSelectionType.DISABLED;
|
|
81
|
+
var disabledTooltipContent = !canAddComments ? intl.formatMessage(annotationMessages.noPermissionToAddComment, {
|
|
82
|
+
contentType: contentType
|
|
83
|
+
}) : commentDisabledMessage;
|
|
74
84
|
var createComment = {
|
|
75
85
|
type: 'button',
|
|
76
86
|
showTitle: true,
|
|
77
|
-
disabled:
|
|
87
|
+
disabled: isCommentButtonDisabled || (api === null || api === void 0 || (_api$connectivity = api.connectivity) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.sharedState) === null || _api$connectivity === void 0 || (_api$connectivity = _api$connectivity.currentState()) === null || _api$connectivity === void 0 ? void 0 : _api$connectivity.mode) === 'offline',
|
|
78
88
|
testId: AnnotationTestIds.floatingToolbarCreateButton,
|
|
79
89
|
interactionName: 'start-inline-comment-action',
|
|
80
90
|
icon: CommentIcon,
|
|
81
91
|
iconFallback: CommentIcon,
|
|
82
|
-
tooltipContent:
|
|
92
|
+
tooltipContent: isCommentButtonDisabled ? disabledTooltipContent : /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
83
93
|
description: createCommentMessage,
|
|
84
94
|
keymap: addInlineComment
|
|
85
95
|
}),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { useIntl } from 'react-intl-next';
|
|
3
|
+
import { ToolTipContent, addInlineComment } from '@atlaskit/editor-common/keymaps';
|
|
3
4
|
import { annotationMessages } from '@atlaskit/editor-common/messages';
|
|
4
5
|
import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
|
|
5
6
|
import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
|
|
@@ -58,18 +59,17 @@ export var CommentButton = function CommentButton(_ref) {
|
|
|
58
59
|
state: state,
|
|
59
60
|
api: api
|
|
60
61
|
});
|
|
61
|
-
return (
|
|
62
|
-
/*#__PURE__*/
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
);
|
|
62
|
+
return /*#__PURE__*/React.createElement(ToolbarTooltip, {
|
|
63
|
+
content: isDisabled ? commentDisabledMessage : /*#__PURE__*/React.createElement(ToolTipContent, {
|
|
64
|
+
description: commentMessage,
|
|
65
|
+
keymap: addInlineComment
|
|
66
|
+
})
|
|
67
|
+
}, /*#__PURE__*/React.createElement(ToolbarButton, {
|
|
68
|
+
iconBefore: /*#__PURE__*/React.createElement(NewCommentIcon, {
|
|
69
|
+
label: ""
|
|
70
|
+
}),
|
|
71
|
+
onClick: onClick,
|
|
72
|
+
testId: AnnotationTestIds.floatingToolbarCreateButton,
|
|
73
|
+
isDisabled: isDisabled
|
|
74
|
+
}, commentMessage));
|
|
75
75
|
};
|
|
@@ -17,6 +17,8 @@ interface BuildToolbarOptions {
|
|
|
17
17
|
createCommentExperience?: AnnotationProviders['createCommentExperience'];
|
|
18
18
|
annotationManager?: AnnotationProviders['annotationManager'];
|
|
19
19
|
onCommentButtonMount?: () => void;
|
|
20
|
+
getCanAddComments?: () => boolean;
|
|
21
|
+
contentType?: string;
|
|
20
22
|
}
|
|
21
23
|
export declare const getValidNodes: (state: EditorState) => NodeType[];
|
|
22
24
|
type ShouldSuppressFloatingToolbarOptions = {
|
|
@@ -40,7 +42,7 @@ export declare const buildSuppressedToolbar: (state: EditorState) => {
|
|
|
40
42
|
title: string;
|
|
41
43
|
__suppressAllToolbars: boolean;
|
|
42
44
|
};
|
|
43
|
-
export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, annotationManager, onCommentButtonMount, }: BuildToolbarOptions) => {
|
|
45
|
+
export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, annotationManager, onCommentButtonMount, getCanAddComments, contentType, }: BuildToolbarOptions) => {
|
|
44
46
|
title: string;
|
|
45
47
|
nodeType: NodeType[];
|
|
46
48
|
items: FloatingToolbarButton<Command>[];
|
|
@@ -107,6 +107,8 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
|
|
|
107
107
|
*/
|
|
108
108
|
supportedBlockNodes?: string[];
|
|
109
109
|
onCommentButtonMount?: () => void;
|
|
110
|
+
getCanAddComments?: () => boolean;
|
|
111
|
+
contentType?: string;
|
|
110
112
|
};
|
|
111
113
|
export interface AnnotationProviders {
|
|
112
114
|
inlineComment: InlineCommentAnnotationProvider;
|
|
@@ -17,6 +17,8 @@ interface BuildToolbarOptions {
|
|
|
17
17
|
createCommentExperience?: AnnotationProviders['createCommentExperience'];
|
|
18
18
|
annotationManager?: AnnotationProviders['annotationManager'];
|
|
19
19
|
onCommentButtonMount?: () => void;
|
|
20
|
+
getCanAddComments?: () => boolean;
|
|
21
|
+
contentType?: string;
|
|
20
22
|
}
|
|
21
23
|
export declare const getValidNodes: (state: EditorState) => NodeType[];
|
|
22
24
|
type ShouldSuppressFloatingToolbarOptions = {
|
|
@@ -40,7 +42,7 @@ export declare const buildSuppressedToolbar: (state: EditorState) => {
|
|
|
40
42
|
title: string;
|
|
41
43
|
__suppressAllToolbars: boolean;
|
|
42
44
|
};
|
|
43
|
-
export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, annotationManager, onCommentButtonMount, }: BuildToolbarOptions) => {
|
|
45
|
+
export declare const buildToolbar: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => ({ state, intl, isToolbarAbove, _supportedNodes, api, createCommentExperience, annotationManager, onCommentButtonMount, getCanAddComments, contentType, }: BuildToolbarOptions) => {
|
|
44
46
|
title: string;
|
|
45
47
|
nodeType: NodeType[];
|
|
46
48
|
items: FloatingToolbarButton<Command>[];
|
|
@@ -107,6 +107,8 @@ export type InlineCommentAnnotationProvider = AnnotationTypeProvider<AnnotationT
|
|
|
107
107
|
*/
|
|
108
108
|
supportedBlockNodes?: string[];
|
|
109
109
|
onCommentButtonMount?: () => void;
|
|
110
|
+
getCanAddComments?: () => boolean;
|
|
111
|
+
contentType?: string;
|
|
110
112
|
};
|
|
111
113
|
export interface AnnotationProviders {
|
|
112
114
|
inlineComment: InlineCommentAnnotationProvider;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-plugin-annotation",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
4
4
|
"description": "Annotation plugin for @atlaskit/editor-core",
|
|
5
5
|
"author": "Atlassian Pty Ltd",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"@atlaskit/icon": "^27.12.0",
|
|
44
44
|
"@atlaskit/onboarding": "^14.3.0",
|
|
45
45
|
"@atlaskit/platform-feature-flags": "^1.1.0",
|
|
46
|
-
"@atlaskit/tmp-editor-statsig": "^9.
|
|
46
|
+
"@atlaskit/tmp-editor-statsig": "^9.29.0",
|
|
47
47
|
"@babel/runtime": "^7.0.0",
|
|
48
48
|
"react-intl-next": "npm:react-intl@^5.18.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
|
-
"@atlaskit/editor-common": "^107.
|
|
51
|
+
"@atlaskit/editor-common": "^107.24.0",
|
|
52
52
|
"react": "^18.2.0",
|
|
53
53
|
"react-dom": "^18.2.0"
|
|
54
54
|
},
|