@atlaskit/editor-plugin-annotation 6.2.4 → 6.2.6

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 6.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 6.2.5
10
+
11
+ ### Patch Changes
12
+
13
+ - [`351b338797ae4`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/351b338797ae4) -
14
+ ED-29460 Clean up platform_editor_toolbar_aifc_fix_editor_view
15
+ - Updated dependencies
16
+
3
17
  ## 6.2.4
4
18
 
5
19
  ### Patch Changes
@@ -13,7 +13,6 @@ var _toolbar = require("@atlaskit/editor-common/toolbar");
13
13
  var _useSharedPluginStateSelector = require("@atlaskit/editor-common/use-shared-plugin-state-selector");
14
14
  var _editorToolbar = require("@atlaskit/editor-toolbar");
15
15
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
- var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
17
16
  var _utils = require("../../pm-plugins/utils");
18
17
  var _types = require("../../types");
19
18
  var _hooks = require("./hooks");
@@ -26,19 +25,12 @@ var CommentButton = exports.CommentButton = function CommentButton(_ref) {
26
25
  var bookmark = (0, _useSharedPluginStateSelector.useSharedPluginStateSelector)(api, 'annotation.bookmark');
27
26
  var _useEditorToolbar = (0, _toolbar.useEditorToolbar)(),
28
27
  editorView = _useEditorToolbar.editorView;
29
- // Warning! Do not destructure editorView, it will become stale
30
- var _ref2 = editorView !== null && editorView !== void 0 ? editorView : {
31
- state: null,
32
- dispatch: null
33
- },
34
- state = _ref2.state,
35
- dispatch = _ref2.dispatch;
36
- var annotationSelectionType = state ? (0, _utils.isSelectionValid)(state) : _types.AnnotationSelectionType.INVALID;
37
- var _ref3 = (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : {},
38
- getCanAddComments = _ref3.getCanAddComments,
39
- contentType = _ref3.contentType;
28
+ var annotationSelectionType = editorView !== null && editorView !== void 0 && editorView.state ? (0, _utils.isSelectionValid)(editorView.state) : _types.AnnotationSelectionType.INVALID;
29
+ var _ref2 = (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : {},
30
+ getCanAddComments = _ref2.getCanAddComments,
31
+ contentType = _ref2.contentType;
40
32
  (0, _hooks.useCommentButtonMount)({
41
- state: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
33
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
42
34
  annotationProviders: annotationProviders,
43
35
  api: api,
44
36
  annotationSelectionType: annotationSelectionType,
@@ -46,43 +38,34 @@ var CommentButton = exports.CommentButton = function CommentButton(_ref) {
46
38
  });
47
39
  var intl = (0, _reactIntlNext.useIntl)();
48
40
  var onClick = function onClick() {
49
- if (!api || !state || !dispatch || !annotationProviders || !(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
41
+ if (!api || !annotationProviders || !(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
50
42
  return;
51
43
  }
52
44
  (0, _utils2.fireOnClickAnalyticsEvent)({
53
45
  api: api
54
46
  });
55
- if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
56
- (0, _utils2.startCommentExperience)({
57
- annotationProviders: annotationProviders,
58
- api: api,
59
- state: editorView.state,
60
- dispatch: editorView.dispatch
61
- });
62
- } else {
63
- (0, _utils2.startCommentExperience)({
64
- annotationProviders: annotationProviders,
65
- api: api,
66
- state: state,
67
- dispatch: dispatch
68
- });
69
- }
47
+ (0, _utils2.startCommentExperience)({
48
+ annotationProviders: annotationProviders,
49
+ api: api,
50
+ state: editorView.state,
51
+ dispatch: editorView.dispatch
52
+ });
70
53
  };
71
54
  if (!(0, _utils2.shouldShowCommentButton)({
72
- state: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
55
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
73
56
  isVisible: isVisible,
74
57
  annotationSelectionType: annotationSelectionType
75
58
  })) {
76
59
  return null;
77
60
  }
78
- var canAddComments = (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) && getCanAddComments ? getCanAddComments() : true;
61
+ var canAddComments = getCanAddComments ? getCanAddComments() : true;
79
62
  var commentMessage = intl.formatMessage(_messages.annotationMessages.createComment);
80
63
  var commentDisabledMessage = intl.formatMessage((0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? _messages.annotationMessages.createCommentDisabled : _messages.annotationMessages.createCommentInvalid);
81
64
  var noPermissionToAddCommentMessage = intl.formatMessage(_messages.annotationMessages.noPermissionToAddComment, {
82
65
  contentType: contentType
83
66
  });
84
67
  var isDisabled = (0, _utils2.isButtonDisabled)({
85
- state: (0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
68
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
86
69
  api: api,
87
70
  canAddComments: canAddComments
88
71
  });
@@ -6,7 +6,6 @@ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
6
6
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
7
7
  import { ToolbarButton, CommentIcon as NewCommentIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { isSelectionValid } from '../../pm-plugins/utils';
11
10
  import { AnnotationSelectionType, AnnotationTestIds } from '../../types';
12
11
  import { useCommentButtonMount } from './hooks';
@@ -21,21 +20,13 @@ export const CommentButton = ({
21
20
  const {
22
21
  editorView
23
22
  } = useEditorToolbar();
24
- // Warning! Do not destructure editorView, it will become stale
25
- const {
26
- state,
27
- dispatch
28
- } = editorView !== null && editorView !== void 0 ? editorView : {
29
- state: null,
30
- dispatch: null
31
- };
32
- const annotationSelectionType = state ? isSelectionValid(state) : AnnotationSelectionType.INVALID;
23
+ const annotationSelectionType = editorView !== null && editorView !== void 0 && editorView.state ? isSelectionValid(editorView.state) : AnnotationSelectionType.INVALID;
33
24
  const {
34
25
  getCanAddComments,
35
26
  contentType
36
27
  } = (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : {};
37
28
  useCommentButtonMount({
38
- state: expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
29
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
39
30
  annotationProviders,
40
31
  api,
41
32
  annotationSelectionType,
@@ -43,43 +34,34 @@ export const CommentButton = ({
43
34
  });
44
35
  const intl = useIntl();
45
36
  const onClick = () => {
46
- if (!api || !state || !dispatch || !annotationProviders || !(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
37
+ if (!api || !annotationProviders || !(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
47
38
  return;
48
39
  }
49
40
  fireOnClickAnalyticsEvent({
50
41
  api
51
42
  });
52
- if (expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
53
- startCommentExperience({
54
- annotationProviders,
55
- api,
56
- state: editorView.state,
57
- dispatch: editorView.dispatch
58
- });
59
- } else {
60
- startCommentExperience({
61
- annotationProviders,
62
- api,
63
- state,
64
- dispatch
65
- });
66
- }
43
+ startCommentExperience({
44
+ annotationProviders,
45
+ api,
46
+ state: editorView.state,
47
+ dispatch: editorView.dispatch
48
+ });
67
49
  };
68
50
  if (!shouldShowCommentButton({
69
- state: expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
51
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
70
52
  isVisible,
71
53
  annotationSelectionType
72
54
  })) {
73
55
  return null;
74
56
  }
75
- const canAddComments = expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) && getCanAddComments ? getCanAddComments() : true;
57
+ const canAddComments = getCanAddComments ? getCanAddComments() : true;
76
58
  const commentMessage = intl.formatMessage(annotationMessages.createComment);
77
59
  const commentDisabledMessage = intl.formatMessage(fg('editor_inline_comments_on_inline_nodes') ? annotationMessages.createCommentDisabled : annotationMessages.createCommentInvalid);
78
60
  const noPermissionToAddCommentMessage = intl.formatMessage(annotationMessages.noPermissionToAddComment, {
79
61
  contentType
80
62
  });
81
63
  const isDisabled = isButtonDisabled({
82
- state: expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
64
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
83
65
  api,
84
66
  canAddComments
85
67
  });
@@ -6,7 +6,6 @@ import { useEditorToolbar } from '@atlaskit/editor-common/toolbar';
6
6
  import { useSharedPluginStateSelector } from '@atlaskit/editor-common/use-shared-plugin-state-selector';
7
7
  import { ToolbarButton, CommentIcon as NewCommentIcon, ToolbarTooltip } from '@atlaskit/editor-toolbar';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
- import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
10
9
  import { isSelectionValid } from '../../pm-plugins/utils';
11
10
  import { AnnotationSelectionType, AnnotationTestIds } from '../../types';
12
11
  import { useCommentButtonMount } from './hooks';
@@ -19,19 +18,12 @@ export var CommentButton = function CommentButton(_ref) {
19
18
  var bookmark = useSharedPluginStateSelector(api, 'annotation.bookmark');
20
19
  var _useEditorToolbar = useEditorToolbar(),
21
20
  editorView = _useEditorToolbar.editorView;
22
- // Warning! Do not destructure editorView, it will become stale
23
- var _ref2 = editorView !== null && editorView !== void 0 ? editorView : {
24
- state: null,
25
- dispatch: null
26
- },
27
- state = _ref2.state,
28
- dispatch = _ref2.dispatch;
29
- var annotationSelectionType = state ? isSelectionValid(state) : AnnotationSelectionType.INVALID;
30
- var _ref3 = (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : {},
31
- getCanAddComments = _ref3.getCanAddComments,
32
- contentType = _ref3.contentType;
21
+ var annotationSelectionType = editorView !== null && editorView !== void 0 && editorView.state ? isSelectionValid(editorView.state) : AnnotationSelectionType.INVALID;
22
+ var _ref2 = (_annotationProviders$ = annotationProviders === null || annotationProviders === void 0 ? void 0 : annotationProviders.inlineComment) !== null && _annotationProviders$ !== void 0 ? _annotationProviders$ : {},
23
+ getCanAddComments = _ref2.getCanAddComments,
24
+ contentType = _ref2.contentType;
33
25
  useCommentButtonMount({
34
- state: expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
26
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
35
27
  annotationProviders: annotationProviders,
36
28
  api: api,
37
29
  annotationSelectionType: annotationSelectionType,
@@ -39,43 +31,34 @@ export var CommentButton = function CommentButton(_ref) {
39
31
  });
40
32
  var intl = useIntl();
41
33
  var onClick = function onClick() {
42
- if (!api || !state || !dispatch || !annotationProviders || !(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
34
+ if (!api || !annotationProviders || !(editorView !== null && editorView !== void 0 && editorView.state) || !(editorView !== null && editorView !== void 0 && editorView.dispatch)) {
43
35
  return;
44
36
  }
45
37
  fireOnClickAnalyticsEvent({
46
38
  api: api
47
39
  });
48
- if (expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true)) {
49
- startCommentExperience({
50
- annotationProviders: annotationProviders,
51
- api: api,
52
- state: editorView.state,
53
- dispatch: editorView.dispatch
54
- });
55
- } else {
56
- startCommentExperience({
57
- annotationProviders: annotationProviders,
58
- api: api,
59
- state: state,
60
- dispatch: dispatch
61
- });
62
- }
40
+ startCommentExperience({
41
+ annotationProviders: annotationProviders,
42
+ api: api,
43
+ state: editorView.state,
44
+ dispatch: editorView.dispatch
45
+ });
63
46
  };
64
47
  if (!shouldShowCommentButton({
65
- state: expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
48
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
66
49
  isVisible: isVisible,
67
50
  annotationSelectionType: annotationSelectionType
68
51
  })) {
69
52
  return null;
70
53
  }
71
- var canAddComments = expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) && getCanAddComments ? getCanAddComments() : true;
54
+ var canAddComments = getCanAddComments ? getCanAddComments() : true;
72
55
  var commentMessage = intl.formatMessage(annotationMessages.createComment);
73
56
  var commentDisabledMessage = intl.formatMessage(fg('editor_inline_comments_on_inline_nodes') ? annotationMessages.createCommentDisabled : annotationMessages.createCommentInvalid);
74
57
  var noPermissionToAddCommentMessage = intl.formatMessage(annotationMessages.noPermissionToAddComment, {
75
58
  contentType: contentType
76
59
  });
77
60
  var isDisabled = isButtonDisabled({
78
- state: expValEquals('platform_editor_toolbar_aifc_fix_editor_view', 'isEnabled', true) ? editorView === null || editorView === void 0 ? void 0 : editorView.state : state,
61
+ state: editorView === null || editorView === void 0 ? void 0 : editorView.state,
79
62
  api: api,
80
63
  canAddComments: canAddComments
81
64
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "6.2.4",
3
+ "version": "6.2.6",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,12 +36,12 @@
36
36
  "@atlaskit/editor-plugin-toolbar": "^3.4.0",
37
37
  "@atlaskit/editor-plugin-user-intent": "^4.0.0",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/editor-toolbar": "^0.16.0",
39
+ "@atlaskit/editor-toolbar": "^0.17.0",
40
40
  "@atlaskit/editor-toolbar-model": "^0.2.0",
41
41
  "@atlaskit/icon": "^28.5.0",
42
42
  "@atlaskit/onboarding": "^14.4.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^13.21.0",
44
+ "@atlaskit/tmp-editor-statsig": "^13.22.0",
45
45
  "@babel/runtime": "^7.0.0",
46
46
  "react-intl-next": "npm:react-intl@^5.18.1"
47
47
  },