@atlaskit/editor-plugin-annotation 1.20.0 → 1.21.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,26 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 1.21.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#151611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151611)
8
+ [`ee71cb75c933c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ee71cb75c933c) -
9
+ ED-25294 add new attribute as engagement platform message trigger
10
+
11
+ ### Patch Changes
12
+
13
+ - [#152308](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152308)
14
+ [`f331ed1265bfc`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f331ed1265bfc) -
15
+ ED-24671 Clean up platform_editor_element_drag_and_drop_ed_24638 feature gate
16
+ - [#151611](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/151611)
17
+ [`ee71cb75c933c`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ee71cb75c933c) -
18
+ ED-25294-add-more-attributes-analytics-event
19
+ - [#152510](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/152510)
20
+ [`dcf9edde7ac7b`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/dcf9edde7ac7b) -
21
+ bump adf-schema to 42.0.1
22
+ - Updated dependencies
23
+
3
24
  ## 1.20.0
4
25
 
5
26
  ### 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) {
@@ -43,6 +43,16 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
43
43
  }),
44
44
  title: createCommentMessage,
45
45
  onMount: function onMount() {
46
+ var _getRangeInlineNodeNa;
47
+ // Check if the selection includes an non-text inline node
48
+ var inlineCommentPluginState = (0, _utils2.getPluginState)(state);
49
+ var inlineNodeNames = (_getRangeInlineNodeNa = (0, _utils.getRangeInlineNodeNames)({
50
+ doc: state.doc,
51
+ pos: (0, _utils2.resolveDraftBookmark)(state, inlineCommentPluginState === null || inlineCommentPluginState === void 0 ? void 0 : inlineCommentPluginState.bookmark)
52
+ })) !== null && _getRangeInlineNodeNa !== void 0 ? _getRangeInlineNodeNa : [];
53
+ var isNonTextInlineNodeInludedInComment = inlineNodeNames.filter(function (nodeName) {
54
+ return nodeName !== 'text';
55
+ }).length > 0;
46
56
  if (editorAnalyticsAPI) {
47
57
  editorAnalyticsAPI.fireAnalyticsEvent({
48
58
  action: _analytics.ACTION.VIEWED,
@@ -50,6 +60,12 @@ var buildToolbar = exports.buildToolbar = function buildToolbar(editorAnalyticsA
50
60
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.INLINE_COMMENT,
51
61
  eventType: _analytics.EVENT_TYPE.UI,
52
62
  attributes: {
63
+ /**
64
+ * This attribute is used as the trigger to display an engagement platform promotion message
65
+ * when isNonTextInlineNodeInludedInComment is true, and isDisabled is false,
66
+ * A spotlight/flag will be shown to the user to encourage them to comment on inline nodes.
67
+ */
68
+ isNonTextInlineNodeInludedInComment: isNonTextInlineNodeInludedInComment,
53
69
  isDisabled: selectionValid === _types.AnnotationSelectionType.DISABLED,
54
70
  inputMethod: _analytics.INPUT_METHOD.FLOATING_TB,
55
71
  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,12 @@ 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';
6
+ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
7
7
  import CommentIcon from '@atlaskit/icon/glyph/comment';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { setInlineCommentDraftState } from './commands';
10
10
  import { AnnotationSelectionType, AnnotationTestIds } from './types';
11
- import { isSelectionValid } from './utils';
11
+ import { getPluginState, isSelectionValid, resolveDraftBookmark } from './utils';
12
12
  export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove = false, isCommentOnMediaOn, _supportedNodes = []) => {
13
13
  const {
14
14
  schema
@@ -34,6 +34,14 @@ export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove =
34
34
  }),
35
35
  title: createCommentMessage,
36
36
  onMount: () => {
37
+ var _getRangeInlineNodeNa;
38
+ // Check if the selection includes an non-text inline node
39
+ const inlineCommentPluginState = getPluginState(state);
40
+ const inlineNodeNames = (_getRangeInlineNodeNa = getRangeInlineNodeNames({
41
+ doc: state.doc,
42
+ pos: resolveDraftBookmark(state, inlineCommentPluginState === null || inlineCommentPluginState === void 0 ? void 0 : inlineCommentPluginState.bookmark)
43
+ })) !== null && _getRangeInlineNodeNa !== void 0 ? _getRangeInlineNodeNa : [];
44
+ const isNonTextInlineNodeInludedInComment = inlineNodeNames.filter(nodeName => nodeName !== 'text').length > 0;
37
45
  if (editorAnalyticsAPI) {
38
46
  editorAnalyticsAPI.fireAnalyticsEvent({
39
47
  action: ACTION.VIEWED,
@@ -41,6 +49,12 @@ export const buildToolbar = editorAnalyticsAPI => (state, intl, isToolbarAbove =
41
49
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
42
50
  eventType: EVENT_TYPE.UI,
43
51
  attributes: {
52
+ /**
53
+ * This attribute is used as the trigger to display an engagement platform promotion message
54
+ * when isNonTextInlineNodeInludedInComment is true, and isDisabled is false,
55
+ * A spotlight/flag will be shown to the user to encourage them to comment on inline nodes.
56
+ */
57
+ isNonTextInlineNodeInludedInComment,
44
58
  isDisabled: selectionValid === AnnotationSelectionType.DISABLED,
45
59
  inputMethod: INPUT_METHOD.FLOATING_TB,
46
60
  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,12 @@ 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';
6
+ import { calculateToolbarPositionAboveSelection, calculateToolbarPositionTrackHead, getRangeInlineNodeNames } from '@atlaskit/editor-common/utils';
7
7
  import CommentIcon from '@atlaskit/icon/glyph/comment';
8
8
  import { fg } from '@atlaskit/platform-feature-flags';
9
9
  import { setInlineCommentDraftState } from './commands';
10
10
  import { AnnotationSelectionType, AnnotationTestIds } from './types';
11
- import { isSelectionValid } from './utils';
11
+ import { getPluginState, isSelectionValid, resolveDraftBookmark } from './utils';
12
12
  export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
13
13
  return function (state, intl) {
14
14
  var isToolbarAbove = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
@@ -36,6 +36,16 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
36
36
  }),
37
37
  title: createCommentMessage,
38
38
  onMount: function onMount() {
39
+ var _getRangeInlineNodeNa;
40
+ // Check if the selection includes an non-text inline node
41
+ var inlineCommentPluginState = getPluginState(state);
42
+ var 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
+ var isNonTextInlineNodeInludedInComment = inlineNodeNames.filter(function (nodeName) {
47
+ return nodeName !== 'text';
48
+ }).length > 0;
39
49
  if (editorAnalyticsAPI) {
40
50
  editorAnalyticsAPI.fireAnalyticsEvent({
41
51
  action: ACTION.VIEWED,
@@ -43,6 +53,12 @@ export var buildToolbar = function buildToolbar(editorAnalyticsAPI) {
43
53
  actionSubjectId: ACTION_SUBJECT_ID.INLINE_COMMENT,
44
54
  eventType: EVENT_TYPE.UI,
45
55
  attributes: {
56
+ /**
57
+ * This attribute is used as the trigger to display an engagement platform promotion message
58
+ * when isNonTextInlineNodeInludedInComment is true, and isDisabled is false,
59
+ * A spotlight/flag will be shown to the user to encourage them to comment on inline nodes.
60
+ */
61
+ isNonTextInlineNodeInludedInComment: isNonTextInlineNodeInludedInComment,
46
62
  isDisabled: selectionValid === AnnotationSelectionType.DISABLED,
47
63
  inputMethod: INPUT_METHOD.FLOATING_TB,
48
64
  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.0",
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
  }