@atlaskit/editor-plugin-annotation 1.20.0 → 1.21.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 CHANGED
@@ -1,5 +1,34 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#152823](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152823)
8
+ [`0ec705650807f`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/0ec705650807f) -
9
+ [ux] Migrated comment icon from annotation package
10
+
11
+ ## 1.21.0
12
+
13
+ ### Minor Changes
14
+
15
+ - [#151611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151611)
16
+ [`ee71cb75c933c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ee71cb75c933c) -
17
+ ED-25294 add new attribute as engagement platform message trigger
18
+
19
+ ### Patch Changes
20
+
21
+ - [#152308](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152308)
22
+ [`f331ed1265bfc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f331ed1265bfc) -
23
+ ED-24671 Clean up platform_editor_element_drag_and_drop_ed_24638 feature gate
24
+ - [#151611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151611)
25
+ [`ee71cb75c933c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ee71cb75c933c) -
26
+ ED-25294-add-more-attributes-analytics-event
27
+ - [#152510](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152510)
28
+ [`dcf9edde7ac7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf9edde7ac7b) -
29
+ bump adf-schema to 42.0.1
30
+ - Updated dependencies
31
+
3
32
  ## 1.20.0
4
33
 
5
34
  ### Minor Changes
@@ -216,9 +216,7 @@ var inlineCommentPlugin = exports.inlineCommentPlugin = function inlineCommentPl
216
216
  dragstart: function dragstart(view, event) {
217
217
  // Mouseup won't be triggered after dropping
218
218
  // Hence, update the mouse data to cancel selecting when drag starts
219
- if ((0, _platformFeatureFlags.fg)('platform_editor_element_drag_and_drop_ed_24638')) {
220
- return onMouseUp(view.state, view.dispatch)(event);
221
- }
219
+ return onMouseUp(view.state, view.dispatch)(event);
222
220
  }
223
221
  },
224
222
  decorations: function decorations(state) {
@@ -11,7 +11,8 @@ var _keymaps = require("@atlaskit/editor-common/keymaps");
11
11
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
12
12
  var _messages = require("@atlaskit/editor-common/messages");
13
13
  var _utils = require("@atlaskit/editor-common/utils");
14
- var _comment = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
14
+ var _comment = _interopRequireDefault(require("@atlaskit/icon/core/comment"));
15
+ var _comment2 = _interopRequireDefault(require("@atlaskit/icon/glyph/comment"));
15
16
  var _platformFeatureFlags = require("@atlaskit/platform-feature-flags");
16
17
  var _commands = require("./commands");
17
18
  var _types = require("./types");
@@ -37,12 +38,23 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
37
38
  disabled: selectionValid === _types.AnnotationSelectionType.DISABLED,
38
39
  testId: _types.AnnotationTestIds.floatingToolbarCreateButton,
39
40
  icon: _comment.default,
41
+ iconFallback: _comment2.default,
40
42
  tooltipContent: selectionValid === _types.AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/_react.default.createElement(_keymaps.ToolTipContent, {
41
43
  description: createCommentMessage,
42
44
  keymap: _keymaps.addInlineComment
43
45
  }),
44
46
  title: createCommentMessage,
45
47
  onMount: function onMount() {
48
+ var _getRangeInlineNodeNa;
49
+ // Check if the selection includes an non-text inline node
50
+ var inlineCommentPluginState = (0, _utils2.getPluginState)(state);
51
+ var inlineNodeNames = (_getRangeInlineNodeNa = (0, _utils.getRangeInlineNodeNames)({
52
+ doc: state.doc,
53
+ pos: (0, _utils2.resolveDraftBookmark)(state, inlineCommentPluginState === null || inlineCommentPluginState === void 0 ? void 0 : inlineCommentPluginState.bookmark)
54
+ })) !== null && _getRangeInlineNodeNa !== void 0 ? _getRangeInlineNodeNa : [];
55
+ var isNonTextInlineNodeInludedInComment = inlineNodeNames.filter(function (nodeName) {
56
+ return nodeName !== 'text';
57
+ }).length > 0;
46
58
  if (editorAnalyticsAPI) {
47
59
  editorAnalyticsAPI.fireAnalyticsEvent({
48
60
  action: _analytics.ACTION.VIEWED,
@@ -50,6 +62,12 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
50
62
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
51
63
  eventType: _analytics.EVENT_TYPE.UI,
52
64
  attributes: {
65
+ /**
66
+ * This attribute is used as the trigger to display an engagement platform promotion message
67
+ * when isNonTextInlineNodeInludedInComment is true, and isDisabled is false,
68
+ * A spotlight/flag will be shown to the user to encourage them to comment on inline nodes.
69
+ */
70
+ isNonTextInlineNodeInludedInComment: isNonTextInlineNodeInludedInComment,
53
71
  isDisabled: selectionValid === _types.AnnotationSelectionType.DISABLED,
54
72
  inputMethod: _analytics.INPUT_METHOD.FLOATING_TB,
55
73
  mode: _analytics.MODE.EDITOR
@@ -155,9 +155,7 @@ export const inlineCommentPlugin = options => {
155
155
  dragstart: (view, event) => {
156
156
  // Mouseup won't be triggered after dropping
157
157
  // Hence, update the mouse data to cancel selecting when drag starts
158
- if (fg('platform_editor_element_drag_and_drop_ed_24638')) {
159
- return onMouseUp(view.state, view.dispatch)(event);
160
- }
158
+ return onMouseUp(view.state, view.dispatch)(event);
161
159
  }
162
160
  },
163
161
  decorations(state) {
@@ -3,12 +3,13 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MO
3
3
  import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
5
5
  import { annotationMessages } from '@atlaskit/editor-common/messages';
6
- import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
7
- import CommentIcon from '@atlaskit/icon/glyph/comment';
6
+ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
7
+ import CommentIcon from '@atlaskit/icon/core/comment';
8
+ import LegacyCommentIcon from '@atlaskit/icon/glyph/comment';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { setInlineCommentDraftState } from './commands';
10
11
  import { AnnotationSelectionType, AnnotationTestIds } from './types';
11
- import { isSelectionValid } from './utils';
12
+ import { getPluginState, isSelectionValid, resolveDraftBookmark } from './utils';
12
13
  export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove = false, isCommentOnMediaOn, _supportedNodes = []) => {
13
14
  const {
14
15
  schema
@@ -28,12 +29,21 @@ export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove =
28
29
  disabled: selectionValid === AnnotationSelectionType.DISABLED,
29
30
  testId: AnnotationTestIds.floatingToolbarCreateButton,
30
31
  icon: CommentIcon,
32
+ iconFallback: LegacyCommentIcon,
31
33
  tooltipContent: selectionValid === AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/React.createElement(ToolTipContent, {
32
34
  description: createCommentMessage,
33
35
  keymap: addInlineComment
34
36
  }),
35
37
  title: createCommentMessage,
36
38
  onMount: () => {
39
+ var _getRangeInlineNodeNa;
40
+ // Check if the selection includes an non-text inline node
41
+ const inlineCommentPluginState = getPluginState(state);
42
+ const inlineNodeNames = (_getRangeInlineNodeNa = getRangeInlineNodeNames({
43
+ doc: state.doc,
44
+ pos: resolveDraftBookmark(state, inlineCommentPluginState === null || inlineCommentPluginState === void 0 ? void 0 : inlineCommentPluginState.bookmark)
45
+ })) !== null && _getRangeInlineNodeNa !== void 0 ? _getRangeInlineNodeNa : [];
46
+ const isNonTextInlineNodeInludedInComment = inlineNodeNames.filter(nodeName => nodeName !== 'text').length > 0;
37
47
  if (editorAnalyticsAPI) {
38
48
  editorAnalyticsAPI.fireAnalyticsEvent({
39
49
  action: ACTION.VIEWED,
@@ -41,6 +51,12 @@ export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove =
41
51
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
42
52
  eventType: EVENT_TYPE.UI,
43
53
  attributes: {
54
+ /**
55
+ * This attribute is used as the trigger to display an engagement platform promotion message
56
+ * when isNonTextInlineNodeInludedInComment is true, and isDisabled is false,
57
+ * A spotlight/flag will be shown to the user to encourage them to comment on inline nodes.
58
+ */
59
+ isNonTextInlineNodeInludedInComment,
44
60
  isDisabled: selectionValid === AnnotationSelectionType.DISABLED,
45
61
  inputMethod: INPUT_METHOD.FLOATING_TB,
46
62
  mode: MODE.EDITOR
@@ -209,9 +209,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
209
209
  dragstart: function dragstart(view, event) {
210
210
  // Mouseup won't be triggered after dropping
211
211
  // Hence, update the mouse data to cancel selecting when drag starts
212
- if (fg('platform_editor_element_drag_and_drop_ed_24638')) {
213
- return onMouseUp(view.state, view.dispatch)(event);
214
- }
212
+ return onMouseUp(view.state, view.dispatch)(event);
215
213
  }
216
214
  },
217
215
  decorations: function decorations(state) {
@@ -3,12 +3,13 @@ import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE, INPUT_METHOD, MO
3
3
  import { addInlineComment, ToolTipContent } from '@atlaskit/editor-common/keymaps';
4
4
  import { currentMediaNodeWithPos } from '@atlaskit/editor-common/media-single';
5
5
  import { annotationMessages } from '@atlaskit/editor-common/messages';
6
- import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead } from '@atlaskit/editor-common/utils';
7
- import CommentIcon from '@atlaskit/icon/glyph/comment';
6
+ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
7
+ import CommentIcon from '@atlaskit/icon/core/comment';
8
+ import LegacyCommentIcon from '@atlaskit/icon/glyph/comment';
8
9
  import { fg } from '@atlaskit/platform-feature-flags';
9
10
  import { setInlineCommentDraftState } from './commands';
10
11
  import { AnnotationSelectionType, AnnotationTestIds } from './types';
11
- import { isSelectionValid } from './utils';
12
+ import { getPluginState, isSelectionValid, resolveDraftBookmark } from './utils';
12
13
  export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
13
14
  return function (state, intl) {
14
15
  var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -30,12 +31,23 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
30
31
  disabled: selectionValid === AnnotationSelectionType.DISABLED,
31
32
  testId: AnnotationTestIds.floatingToolbarCreateButton,
32
33
  icon: CommentIcon,
34
+ iconFallback: LegacyCommentIcon,
33
35
  tooltipContent: selectionValid === AnnotationSelectionType.DISABLED ? commentDisabledMessage : /*#__PURE__*/React.createElement(ToolTipContent, {
34
36
  description: createCommentMessage,
35
37
  keymap: addInlineComment
36
38
  }),
37
39
  title: createCommentMessage,
38
40
  onMount: function onMount() {
41
+ var _getRangeInlineNodeNa;
42
+ // Check if the selection includes an non-text inline node
43
+ var inlineCommentPluginState = getPluginState(state);
44
+ var inlineNodeNames = (_getRangeInlineNodeNa = getRangeInlineNodeNames({
45
+ doc: state.doc,
46
+ pos: resolveDraftBookmark(state, inlineCommentPluginState === null || inlineCommentPluginState === void 0 ? void 0 : inlineCommentPluginState.bookmark)
47
+ })) !== null && _getRangeInlineNodeNa !== void 0 ? _getRangeInlineNodeNa : [];
48
+ var isNonTextInlineNodeInludedInComment = inlineNodeNames.filter(function (nodeName) {
49
+ return nodeName !== 'text';
50
+ }).length > 0;
39
51
  if (editorAnalyticsAPI) {
40
52
  editorAnalyticsAPI.fireAnalyticsEvent({
41
53
  action: ACTION.VIEWED,
@@ -43,6 +55,12 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
43
55
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
44
56
  eventType: EVENT_TYPE.UI,
45
57
  attributes: {
58
+ /**
59
+ * This attribute is used as the trigger to display an engagement platform promotion message
60
+ * when isNonTextInlineNodeInludedInComment is true, and isDisabled is false,
61
+ * A spotlight/flag will be shown to the user to encourage them to comment on inline nodes.
62
+ */
63
+ isNonTextInlineNodeInludedInComment: isNonTextInlineNodeInludedInComment,
46
64
  isDisabled: selectionValid === AnnotationSelectionType.DISABLED,
47
65
  inputMethod: INPUT_METHOD.FLOATING_TB,
48
66
  mode: MODE.EDITOR
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "1.20.0",
3
+ "version": "1.21.1",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,9 +31,9 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/adf-schema": "^40.9.4",
35
- "@atlaskit/editor-common": "^93.3.0",
36
- "@atlaskit/editor-plugin-analytics": "^1.9.0",
34
+ "@atlaskit/adf-schema": "^42.0.2",
35
+ "@atlaskit/editor-common": "^93.5.0",
36
+ "@atlaskit/editor-plugin-analytics": "^1.10.0",
37
37
  "@atlaskit/editor-plugin-editor-viewmode-effects": "^1.1.0",
38
38
  "@atlaskit/editor-plugin-feature-flags": "^1.2.0",
39
39
  "@atlaskit/editor-prosemirror": "6.0.0",
@@ -90,9 +90,6 @@
90
90
  "platform-feature-flags": {
91
91
  "editor_inline_comments_on_inline_nodes": {
92
92
  "type": "boolean"
93
- },
94
- "platform_editor_element_drag_and_drop_ed_24638": {
95
- "type": "boolean"
96
93
  }
97
94
  }
98
95
  }