@atlaskit/editor-plugin-annotation 5.3.0 → 5.3.2

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
+ ## 5.3.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 5.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - [`b85694a21dec9`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/b85694a21dec9) -
14
+ [ux] [ED-29271] don't show Comment button if a draft comment is in progress
15
+ - Updated dependencies
16
+
3
17
  ## 5.3.0
4
18
 
5
19
  ### Minor Changes
@@ -9,6 +9,7 @@ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/de
9
9
  var _analytics = require("@atlaskit/editor-common/analytics");
10
10
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
11
11
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
12
+ var _expValEquals = require("@atlaskit/tmp-editor-statsig/exp-val-equals");
12
13
  var _editorCommands = require("../../editor-commands");
13
14
  var _utils = require("../../pm-plugins/utils");
14
15
  var _types = require("../../types");
@@ -27,9 +28,14 @@ var shouldShowCommentButton = exports.shouldShowCommentButton = function shouldS
27
28
  isVisible = _ref2.isVisible,
28
29
  annotationSelectionType = _ref2.annotationSelectionType;
29
30
  var isMediaSelected = state ? (0, _mediaSingle.currentMediaNodeWithPos)(state) : false;
31
+ var isDrafting = false;
32
+ if ((0, _expValEquals.expValEquals)('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) && state) {
33
+ var _inlineCommentPluginK;
34
+ isDrafting = ((_inlineCommentPluginK = _utils.inlineCommentPluginKey.getState(state)) === null || _inlineCommentPluginK === void 0 ? void 0 : _inlineCommentPluginK.isDrafting) || false;
35
+ }
30
36
 
31
37
  // comments on media can only be added via media floating toolbar
32
- if (isMediaSelected || annotationSelectionType === _types.AnnotationSelectionType.INVALID || !isVisible) {
38
+ if (isDrafting || isMediaSelected || annotationSelectionType === _types.AnnotationSelectionType.INVALID || !isVisible) {
33
39
  return false;
34
40
  }
35
41
  return true;
@@ -1,8 +1,9 @@
1
1
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE } from '@atlaskit/editor-common/analytics';
2
2
  import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
3
3
  import { fg } from '@atlaskit/platform-feature-flags';
4
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
4
5
  import { setInlineCommentDraftState } from '../../editor-commands';
5
- import { isSelectionValid } from '../../pm-plugins/utils';
6
+ import { inlineCommentPluginKey, isSelectionValid } from '../../pm-plugins/utils';
6
7
  import { AnnotationSelectionType } from '../../types';
7
8
  export const isButtonDisabled = ({
8
9
  state,
@@ -19,9 +20,14 @@ export const shouldShowCommentButton = ({
19
20
  annotationSelectionType
20
21
  }) => {
21
22
  const isMediaSelected = state ? currentMediaNodeWithPos(state) : false;
23
+ let isDrafting = false;
24
+ if (expValEquals('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) && state) {
25
+ var _inlineCommentPluginK;
26
+ isDrafting = ((_inlineCommentPluginK = inlineCommentPluginKey.getState(state)) === null || _inlineCommentPluginK === void 0 ? void 0 : _inlineCommentPluginK.isDrafting) || false;
27
+ }
22
28
 
23
29
  // comments on media can only be added via media floating toolbar
24
- if (isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
30
+ if (isDrafting || isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
25
31
  return false;
26
32
  }
27
33
  return true;
@@ -4,8 +4,9 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MODE } from '@atlaskit/editor-common/analytics';
5
5
  import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
6
6
  import { fg } from '@atlaskit/platform-feature-flags';
7
+ import { expValEquals } from '@atlaskit/tmp-editor-statsig/exp-val-equals';
7
8
  import { setInlineCommentDraftState } from '../../editor-commands';
8
- import { isSelectionValid } from '../../pm-plugins/utils';
9
+ import { inlineCommentPluginKey, isSelectionValid } from '../../pm-plugins/utils';
9
10
  import { AnnotationSelectionType } from '../../types';
10
11
  export var isButtonDisabled = function isButtonDisabled(_ref) {
11
12
  var _api$connectivity;
@@ -20,9 +21,14 @@ export var shouldShowCommentButton = function shouldShowCommentButton(_ref2) {
20
21
  isVisible = _ref2.isVisible,
21
22
  annotationSelectionType = _ref2.annotationSelectionType;
22
23
  var isMediaSelected = state ? currentMediaNodeWithPos(state) : false;
24
+ var isDrafting = false;
25
+ if (expValEquals('platform_editor_toolbar_aifc_patch_4', 'isEnabled', true) && state) {
26
+ var _inlineCommentPluginK;
27
+ isDrafting = ((_inlineCommentPluginK = inlineCommentPluginKey.getState(state)) === null || _inlineCommentPluginK === void 0 ? void 0 : _inlineCommentPluginK.isDrafting) || false;
28
+ }
23
29
 
24
30
  // comments on media can only be added via media floating toolbar
25
- if (isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
31
+ if (isDrafting || isMediaSelected || annotationSelectionType === AnnotationSelectionType.INVALID || !isVisible) {
26
32
  return false;
27
33
  }
28
34
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "5.3.0",
3
+ "version": "5.3.2",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -36,17 +36,17 @@
36
36
  "@atlaskit/editor-plugin-toolbar": "^2.1.0",
37
37
  "@atlaskit/editor-plugin-user-intent": "^3.0.0",
38
38
  "@atlaskit/editor-prosemirror": "7.0.0",
39
- "@atlaskit/editor-toolbar": "^0.8.0",
39
+ "@atlaskit/editor-toolbar": "^0.9.0",
40
40
  "@atlaskit/editor-toolbar-model": "^0.2.0",
41
41
  "@atlaskit/icon": "^28.1.0",
42
42
  "@atlaskit/onboarding": "^14.4.0",
43
43
  "@atlaskit/platform-feature-flags": "^1.1.0",
44
- "@atlaskit/tmp-editor-statsig": "^12.18.0",
44
+ "@atlaskit/tmp-editor-statsig": "^12.21.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.5.0",
49
+ "@atlaskit/editor-common": "^109.6.0",
50
50
  "react": "^18.2.0",
51
51
  "react-dom": "^18.2.0"
52
52
  },