@atlaskit/editor-plugin-annotation 1.25.6 → 1.26.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 CHANGED
@@ -1,5 +1,22 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.26.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#173684](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/173684)
8
+ [`e022c83d84bd3`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/e022c83d84bd3) -
9
+ Fix errors caused by not checking for undefined annotation toolbar
10
+
11
+ ## 1.25.7
12
+
13
+ ### Patch Changes
14
+
15
+ - [#172933](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/172933)
16
+ [`8323af2381d00`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/8323af2381d00) -
17
+ [ux] Arranges items in the Selection toolbar under the Contextual toolbar experiment flag
18
+ - Updated dependencies
19
+
3
20
  ## 1.25.6
4
21
 
5
22
  ### Patch Changes
@@ -11,16 +11,20 @@ Object.defineProperty(exports, "AnnotationUpdateEmitter", {
11
11
  }
12
12
  });
13
13
  exports.annotationPlugin = void 0;
14
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
14
15
  var _react = _interopRequireDefault(require("react"));
15
16
  var _adfSchema = require("@atlaskit/adf-schema");
16
17
  var _annotation = require("@atlaskit/editor-common/annotation");
17
18
  var _hooks = require("@atlaskit/editor-common/hooks");
19
+ var _experiments = require("@atlaskit/tmp-editor-statsig/experiments");
18
20
  var _editorCommands = require("./editor-commands");
19
21
  var _inlineComment = require("./pm-plugins/inline-comment");
20
22
  var _keymap = require("./pm-plugins/keymap");
21
23
  var _toolbar = require("./pm-plugins/toolbar");
22
24
  var _utils = require("./pm-plugins/utils");
23
25
  var _InlineCommentView = require("./ui/InlineCommentView");
26
+ 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; }
27
+ 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; }
24
28
  var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref) {
25
29
  var _api$featureFlags, _api$analytics;
26
30
  var annotationProviders = _ref.config,
@@ -88,12 +92,19 @@ var annotationPlugin = exports.annotationPlugin = function annotationPlugin(_ref
88
92
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
89
93
  var _api$analytics4;
90
94
  var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
91
- return (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
95
+ var toolbarConfig = (0, _toolbar.buildToolbar)(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
92
96
  state: state,
93
97
  intl: intl,
94
98
  isToolbarAbove: isToolbarAbove,
95
99
  api: api
96
100
  });
101
+ if (!toolbarConfig) {
102
+ return undefined;
103
+ } else {
104
+ return _objectSpread(_objectSpread({}, toolbarConfig), {}, {
105
+ rank: (0, _experiments.editorExperiment)('contextual_formatting_toolbar', true) ? 1 : undefined
106
+ });
107
+ }
97
108
  }
98
109
  }
99
110
  },
@@ -70,7 +70,9 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
70
70
  var commentDisabledMessage = intl.formatMessage((0, _platformFeatureFlags.fg)('editor_inline_comments_on_inline_nodes') ? _messages.annotationMessages.createCommentDisabled : _messages.annotationMessages.createCommentInvalid);
71
71
  var createComment = {
72
72
  type: 'button',
73
- showTitle: true,
73
+ showTitle: (0, _experiments.editorExperiment)('contextual_formatting_toolbar', true, {
74
+ exposure: true
75
+ }) ? false : true,
74
76
  disabled: selectionValid === _types.AnnotationSelectionType.DISABLED,
75
77
  testId: _types.AnnotationTestIds.floatingToolbarCreateButton,
76
78
  icon: _comment.default,
@@ -2,6 +2,7 @@ import React from 'react';
2
2
  import { annotation } from '@atlaskit/adf-schema';
3
3
  import { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
4
4
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
5
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
6
  import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
6
7
  import { inlineCommentPlugin } from './pm-plugins/inline-comment';
7
8
  import { keymapPlugin } from './pm-plugins/keymap';
@@ -77,12 +78,20 @@ export const annotationPlugin = ({
77
78
  const {
78
79
  isToolbarAbove
79
80
  } = annotationProviders.inlineComment;
80
- return buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
81
+ const toolbarConfig = buildToolbar(api === null || api === void 0 ? void 0 : (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
81
82
  state,
82
83
  intl,
83
84
  isToolbarAbove,
84
85
  api
85
86
  });
87
+ if (!toolbarConfig) {
88
+ return undefined;
89
+ } else {
90
+ return {
91
+ ...toolbarConfig,
92
+ rank: editorExperiment('contextual_formatting_toolbar', true) ? 1 : undefined
93
+ };
94
+ }
86
95
  }
87
96
  }
88
97
  },
@@ -62,7 +62,9 @@ export const buildToolbar = editorAnalyticsAPI => ({
62
62
  const commentDisabledMessage = intl.formatMessage(fg('editor_inline_comments_on_inline_nodes') ? annotationMessages.createCommentDisabled : annotationMessages.createCommentInvalid);
63
63
  const createComment = {
64
64
  type: 'button',
65
- showTitle: true,
65
+ showTitle: editorExperiment('contextual_formatting_toolbar', true, {
66
+ exposure: true
67
+ }) ? false : true,
66
68
  disabled: selectionValid === AnnotationSelectionType.DISABLED,
67
69
  testId: AnnotationTestIds.floatingToolbarCreateButton,
68
70
  icon: CommentIcon,
@@ -1,7 +1,11 @@
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; }
1
4
  import React from 'react';
2
5
  import { annotation } from '@atlaskit/adf-schema';
3
6
  import { AnnotationUpdateEmitter } from '@atlaskit/editor-common/annotation';
4
7
  import { useSharedPluginState } from '@atlaskit/editor-common/hooks';
8
+ import { editorExperiment } from '@atlaskit/tmp-editor-statsig/experiments';
5
9
  import { setInlineCommentDraftState, showInlineCommentForBlockNode } from './editor-commands';
6
10
  import { inlineCommentPlugin } from './pm-plugins/inline-comment';
7
11
  import { keymapPlugin } from './pm-plugins/keymap';
@@ -75,12 +79,19 @@ export var annotationPlugin = function annotationPlugin(_ref) {
75
79
  if (pluginState && pluginState.isVisible && !pluginState.bookmark && !pluginState.mouseData.isSelecting) {
76
80
  var _api$analytics4;
77
81
  var isToolbarAbove = annotationProviders.inlineComment.isToolbarAbove;
78
- return buildToolbar(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
82
+ var toolbarConfig = buildToolbar(api === null || api === void 0 || (_api$analytics4 = api.analytics) === null || _api$analytics4 === void 0 ? void 0 : _api$analytics4.actions)({
79
83
  state: state,
80
84
  intl: intl,
81
85
  isToolbarAbove: isToolbarAbove,
82
86
  api: api
83
87
  });
88
+ if (!toolbarConfig) {
89
+ return undefined;
90
+ } else {
91
+ return _objectSpread(_objectSpread({}, toolbarConfig), {}, {
92
+ rank: editorExperiment('contextual_formatting_toolbar', true) ? 1 : undefined
93
+ });
94
+ }
84
95
  }
85
96
  }
86
97
  },
@@ -63,7 +63,9 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
63
63
  var commentDisabledMessage = intl.formatMessage(fg('editor_inline_comments_on_inline_nodes') ? annotationMessages.createCommentDisabled : annotationMessages.createCommentInvalid);
64
64
  var createComment = {
65
65
  type: 'button',
66
- showTitle: true,
66
+ showTitle: editorExperiment('contextual_formatting_toolbar', true, {
67
+ exposure: true
68
+ }) ? false : true,
67
69
  disabled: selectionValid === AnnotationSelectionType.DISABLED,
68
70
  testId: AnnotationTestIds.floatingToolbarCreateButton,
69
71
  icon: CommentIcon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.25.6",
3
+ "version": "1.26.0",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "dependencies": {
34
34
  "@atlaskit/adf-schema": "^46.1.0",
35
- "@atlaskit/editor-common": "^96.0.0",
35
+ "@atlaskit/editor-common": "^96.1.0",
36
36
  "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-editor-viewmode-effects": "^1.1.0",
38
38
  "@atlaskit/editor-plugin-engagement-platform": "^2.1.0",