@atlaskit/editor-core 187.20.1 → 187.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/cjs/plugins/annotation/commands/index.js +13 -1
  3. package/dist/cjs/plugins/annotation/pm-plugins/inline-comment.js +9 -2
  4. package/dist/cjs/plugins/annotation/pm-plugins/reducer.js +4 -0
  5. package/dist/cjs/plugins/annotation/pm-plugins/types.js +1 -0
  6. package/dist/cjs/plugins/annotation/ui/InlineCommentView.js +2 -0
  7. package/dist/cjs/plugins/annotation/utils.js +1 -1
  8. package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +39 -19
  9. package/dist/cjs/plugins/media/utils/analytics.js +2 -2
  10. package/dist/cjs/version-wrapper.js +1 -1
  11. package/dist/cjs/version.json +1 -1
  12. package/dist/es2019/plugins/annotation/commands/index.js +9 -0
  13. package/dist/es2019/plugins/annotation/pm-plugins/inline-comment.js +10 -3
  14. package/dist/es2019/plugins/annotation/pm-plugins/reducer.js +5 -0
  15. package/dist/es2019/plugins/annotation/pm-plugins/types.js +1 -0
  16. package/dist/es2019/plugins/annotation/ui/InlineCommentView.js +3 -1
  17. package/dist/es2019/plugins/annotation/utils.js +1 -1
  18. package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +41 -20
  19. package/dist/es2019/plugins/media/utils/analytics.js +2 -2
  20. package/dist/es2019/version-wrapper.js +1 -1
  21. package/dist/es2019/version.json +1 -1
  22. package/dist/esm/plugins/annotation/commands/index.js +11 -0
  23. package/dist/esm/plugins/annotation/pm-plugins/inline-comment.js +10 -3
  24. package/dist/esm/plugins/annotation/pm-plugins/reducer.js +4 -0
  25. package/dist/esm/plugins/annotation/pm-plugins/types.js +1 -0
  26. package/dist/esm/plugins/annotation/ui/InlineCommentView.js +3 -1
  27. package/dist/esm/plugins/annotation/utils.js +1 -1
  28. package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +40 -20
  29. package/dist/esm/plugins/media/utils/analytics.js +2 -2
  30. package/dist/esm/version-wrapper.js +1 -1
  31. package/dist/esm/version.json +1 -1
  32. package/dist/types/plugins/annotation/commands/index.d.ts +1 -0
  33. package/dist/types/plugins/annotation/pm-plugins/types.d.ts +7 -1
  34. package/dist/types/plugins/annotation/types.d.ts +4 -0
  35. package/dist/types/plugins/annotation/update-provider.d.ts +1 -1
  36. package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +2 -0
  37. package/dist/types/plugins/media/utils/analytics.d.ts +1 -1
  38. package/dist/types-ts4.5/plugins/annotation/commands/index.d.ts +1 -0
  39. package/dist/types-ts4.5/plugins/annotation/pm-plugins/types.d.ts +7 -1
  40. package/dist/types-ts4.5/plugins/annotation/types.d.ts +4 -0
  41. package/dist/types-ts4.5/plugins/annotation/update-provider.d.ts +1 -1
  42. package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +2 -0
  43. package/dist/types-ts4.5/plugins/media/utils/analytics.d.ts +1 -1
  44. package/package.json +2 -2
  45. package/report.api.md +7 -1
  46. package/tmp/api-report-tmp.d.ts +2 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-core
2
2
 
3
+ ## 187.21.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`cf71a66559b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/cf71a66559b) - Update analytics event for new resize experience
8
+
9
+ ## 187.21.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`560ce4c7a2b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/560ce4c7a2b) - Pass annotations list to inline comment component
14
+
3
15
  ## 187.20.1
4
16
 
5
17
  ### Patch Changes
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
7
+ exports.updateMouseState = exports.updateInlineCommentResolvedState = exports.setSelectedAnnotation = exports.setInlineCommentsVisibility = exports.setInlineCommentDraftState = exports.removeInlineCommentNearSelection = exports.createAnnotation = exports.closeComponent = exports.clearDirtyMark = exports.addInlineComment = void 0;
8
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
9
  var _adfSchema = require("@atlaskit/adf-schema");
10
10
  var _pluginFactory = require("../pm-plugins/plugin-factory");
@@ -113,6 +113,18 @@ var updateMouseState = function updateMouseState(mouseData) {
113
113
  });
114
114
  };
115
115
  exports.updateMouseState = updateMouseState;
116
+ var setSelectedAnnotation = function setSelectedAnnotation(id) {
117
+ return (0, _pluginFactory.createCommand)({
118
+ type: _types.ACTIONS.SET_SELECTED_ANNOTATION,
119
+ data: {
120
+ selectedAnnotations: [{
121
+ id: id,
122
+ type: _adfSchema.AnnotationTypes.INLINE_COMMENT
123
+ }]
124
+ }
125
+ });
126
+ };
127
+ exports.setSelectedAnnotation = setSelectedAnnotation;
116
128
  var createAnnotation = function createAnnotation(id) {
117
129
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _adfSchema.AnnotationTypes.INLINE_COMMENT;
118
130
  return function (state, dispatch) {
@@ -154,9 +154,16 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
154
154
  var setVisibility = function setVisibility(isVisible) {
155
155
  return onSetVisibility(editorView)(isVisible);
156
156
  };
157
+ var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
158
+ if (!annotationId) {
159
+ (0, _commands.closeComponent)()(editorView.state, editorView.dispatch);
160
+ } else {
161
+ (0, _commands.setSelectedAnnotation)(annotationId)(editorView.state, editorView.dispatch);
162
+ }
163
+ };
157
164
  var updateSubscriber = provider.updateSubscriber;
158
165
  if (updateSubscriber) {
159
- updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
166
+ updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
160
167
  }
161
168
  editorView.root.addEventListener('mouseup', mouseUp);
162
169
  return {
@@ -172,7 +179,7 @@ var inlineCommentPlugin = function inlineCommentPlugin(options) {
172
179
  destroy: function destroy() {
173
180
  editorView.root.removeEventListener('mouseup', mouseUp);
174
181
  if (updateSubscriber) {
175
- updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
182
+ updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
176
183
  }
177
184
  }
178
185
  };
@@ -48,6 +48,10 @@ var _default = function _default(pluginState, action) {
48
48
  return _objectSpread(_objectSpread({}, isVisible ? pluginState : getNewDraftState(pluginState, false)), {}, {
49
49
  isVisible: isVisible
50
50
  });
51
+ case _types.ACTIONS.SET_SELECTED_ANNOTATION:
52
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
53
+ selectedAnnotations: (0, _toConsumableArray2.default)(action.data.selectedAnnotations)
54
+ });
51
55
  default:
52
56
  return pluginState;
53
57
  }
@@ -12,6 +12,7 @@ var ACTIONS = /*#__PURE__*/function (ACTIONS) {
12
12
  ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
13
13
  ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
14
14
  ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
15
+ ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
15
16
  return ACTIONS;
16
17
  }({});
17
18
  exports.ACTIONS = ACTIONS;
@@ -46,6 +46,7 @@ function InlineCommentView(_ref) {
46
46
  bookmark = _ref2.bookmark,
47
47
  selectedAnnotations = _ref2.selectedAnnotations,
48
48
  annotations = _ref2.annotations;
49
+ var annotationsList = (0, _utils2.getAllAnnotations)(editorView.state.doc);
49
50
  var selection = (0, _utils2.getSelectionPositions)(state, inlineCommentState);
50
51
  var position = findPosForDOM(selection);
51
52
  var dom;
@@ -134,6 +135,7 @@ function InlineCommentView(_ref) {
134
135
  key: (0, _utils2.getAnnotationViewKey)(activeAnnotations),
135
136
  onViewed: onAnnotationViewed
136
137
  }, /*#__PURE__*/_react.default.createElement(ViewComponent, {
138
+ annotationsList: annotationsList,
137
139
  annotations: activeAnnotations,
138
140
  dom: dom,
139
141
  onDelete: function onDelete(id) {
@@ -77,7 +77,7 @@ var getAllAnnotations = function getAllAnnotations(doc) {
77
77
  node.marks.filter(function (mark) {
78
78
  return mark.type.name === 'annotation';
79
79
  })
80
- // filter out annotations with invalid attribues as they cause errors when interacting with them
80
+ // filter out annotations with invalid attributes as they cause errors when interacting with them
81
81
  .filter(validateAnnotationMark).forEach(function (m) {
82
82
  return allAnnotationIds.add(m.attrs.id);
83
83
  });
@@ -24,33 +24,18 @@ var _utils2 = require("@atlaskit/editor-common/utils");
24
24
  var _editorSharedStyles = require("@atlaskit/editor-shared-styles");
25
25
  var _styled = require("./styled");
26
26
  var _resizer = require("@atlaskit/editor-common/resizer");
27
- var _analytics = require("@atlaskit/editor-common/analytics");
28
27
  var _classnames = _interopRequireDefault(require("classnames"));
29
28
  var _styles = require("@atlaskit/editor-common/styles");
30
29
  var _mediaSingle = require("@atlaskit/editor-common/media-single");
31
30
  var _guideline = require("@atlaskit/editor-common/guideline");
32
31
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
32
+ var _analytics = require("../../utils/analytics");
33
33
  var _throttle = _interopRequireDefault(require("lodash/throttle"));
34
34
  var _main = require("../../pm-plugins/main");
35
35
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
36
36
  function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } /** @jsx jsx */
37
37
  var resizerNextTestId = 'mediaSingle.resizerNext.testid';
38
-
39
- // TODO: Create new fixed image size event
40
38
  exports.resizerNextTestId = resizerNextTestId;
41
- var getResizeAnalyticsEvent = function getResizeAnalyticsEvent(type, size, layout) {
42
- var actionSubject = type === 'embed' ? _analytics.ACTION_SUBJECT.EMBEDS : _analytics.ACTION_SUBJECT.MEDIA_SINGLE;
43
- return {
44
- action: _analytics.ACTION.EDITED,
45
- actionSubject: actionSubject,
46
- actionSubjectId: _analytics.ACTION_SUBJECT_ID.RESIZED,
47
- attributes: {
48
- size: size,
49
- layout: layout
50
- },
51
- eventType: _analytics.EVENT_TYPE.UI
52
- };
53
- };
54
39
  var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
55
40
  (0, _inherits2.default)(ResizableMediaSingleNext, _React$Component);
56
41
  var _super = _createSuper(ResizableMediaSingleNext);
@@ -59,6 +44,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
59
44
  (0, _classCallCheck2.default)(this, ResizableMediaSingleNext);
60
45
  _this = _super.call(this, props);
61
46
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "guidelines", []);
47
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "lastSnappedGuidelineKeys", []);
62
48
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getAllGuidelines", function () {
63
49
  var _this$props = _this.props,
64
50
  view = _this$props.view,
@@ -171,6 +157,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
171
157
  var _findClosestSnap = (0, _guideline.findClosestSnap)(width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, _mediaSingle.MEDIA_SINGLE_SNAP_GAP),
172
158
  gap = _findClosestSnap.gap,
173
159
  activeGuidelineKeys = _findClosestSnap.keys;
160
+ _this.lastSnappedGuidelineKeys = activeGuidelineKeys;
174
161
  _this.displayGuideline((0, _guideline.getGuidelinesWithHighlights)(gap, _mediaSingle.MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines));
175
162
  }
176
163
  });
@@ -202,6 +189,30 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
202
189
  }
203
190
  }
204
191
  });
192
+ (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "getParentNodeTypeNameFromCurrentPositionNode", function () {
193
+ var $pos = _this.$pos;
194
+ if (!$pos) {
195
+ return undefined;
196
+ }
197
+
198
+ // Supported Parent Nodes
199
+ var _this$props$view$stat = _this.props.view.state.schema.nodes,
200
+ listItem = _this$props$view$stat.listItem,
201
+ expand = _this$props$view$stat.expand,
202
+ tableCell = _this$props$view$stat.tableCell,
203
+ tableHeader = _this$props$view$stat.tableHeader,
204
+ layoutSection = _this$props$view$stat.layoutSection,
205
+ nestedExpand = _this$props$view$stat.nestedExpand;
206
+ var parentNode = (0, _utils.findParentNodeOfTypeClosestToPos)($pos, [listItem, expand, tableCell, tableHeader, layoutSection, nestedExpand]);
207
+
208
+ // Return matched parent node name
209
+ if (parentNode) {
210
+ return parentNode.node.type.name;
211
+ }
212
+
213
+ // Return undefined if parent node cannot be found
214
+ return undefined;
215
+ });
205
216
  (0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "handleResizeStart", function () {
206
217
  _this.setState({
207
218
  isResizing: true
@@ -249,11 +260,20 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
249
260
  width = _this$calculateSizeSt2.width,
250
261
  height = _this$calculateSizeSt2.height,
251
262
  calculatedWidthWithLayout = _this$calculateSizeSt2.calculatedWidthWithLayout;
252
- _this.setIsResizing(false);
253
- _this.displayGuideline([]);
254
263
  if (dispatchAnalyticsEvent) {
255
- dispatchAnalyticsEvent(getResizeAnalyticsEvent(nodeType, calculatedWidthWithLayout.width, calculatedWidthWithLayout.layout));
264
+ var event = (0, _analytics.getMediaResizeAnalyticsEvent)(nodeType || 'mediaSingle', {
265
+ width: width,
266
+ layout: calculatedWidthWithLayout.layout,
267
+ widthType: 'pixel',
268
+ snapType: (0, _guideline.getGuidelineTypeFromKey)(_this.lastSnappedGuidelineKeys, _this.guidelines),
269
+ parentNode: _this.getParentNodeTypeNameFromCurrentPositionNode()
270
+ });
271
+ if (event) {
272
+ dispatchAnalyticsEvent(event);
273
+ }
256
274
  }
275
+ _this.setIsResizing(false);
276
+ _this.displayGuideline([]);
257
277
  _this.setState({
258
278
  isResizing: false,
259
279
  size: {
@@ -9,7 +9,7 @@ var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(type, a
9
9
  if (!attributes) {
10
10
  return;
11
11
  }
12
- var size = attributes.size,
12
+ var width = attributes.width,
13
13
  widthType = attributes.widthType,
14
14
  layout = attributes.layout,
15
15
  snapType = attributes.snapType,
@@ -20,7 +20,7 @@ var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(type, a
20
20
  actionSubject: actionSubject,
21
21
  actionSubjectId: _analytics.ACTION_SUBJECT_ID.RESIZED,
22
22
  attributes: {
23
- size: size,
23
+ width: width,
24
24
  layout: layout,
25
25
  widthType: widthType,
26
26
  snapType: snapType,
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.version = exports.nextMajorVersion = exports.name = void 0;
7
7
  var name = "@atlaskit/editor-core";
8
8
  exports.name = name;
9
- var version = "187.20.1";
9
+ var version = "187.21.1";
10
10
  exports.version = version;
11
11
  var nextMajorVersion = function nextMajorVersion() {
12
12
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.20.1",
3
+ "version": "187.21.1",
4
4
  "sideEffects": false
5
5
  }
@@ -91,6 +91,15 @@ export const updateMouseState = mouseData => createCommand({
91
91
  mouseData
92
92
  }
93
93
  });
94
+ export const setSelectedAnnotation = id => createCommand({
95
+ type: ACTIONS.SET_SELECTED_ANNOTATION,
96
+ data: {
97
+ selectedAnnotations: [{
98
+ id,
99
+ type: AnnotationTypes.INLINE_COMMENT
100
+ }]
101
+ }
102
+ });
94
103
  export const createAnnotation = (id, annotationType = AnnotationTypes.INLINE_COMMENT) => (state, dispatch) => {
95
104
  // don't try to add if there are is no temp highlight bookmarked
96
105
  const {
@@ -3,7 +3,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
4
4
  import { AnnotationTypes } from '@atlaskit/adf-schema';
5
5
  import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
6
- import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility } from '../commands';
6
+ import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
7
7
  import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
8
8
  import { createPluginState } from './plugin-factory';
9
9
  const fetchProviderStates = async (provider, annotationIds) => {
@@ -97,11 +97,18 @@ export const inlineCommentPlugin = options => {
97
97
  const unResolve = annotationId => onUnResolve(editorView.state, editorView.dispatch)(annotationId);
98
98
  const mouseUp = event => onMouseUp(editorView.state, editorView.dispatch)(event);
99
99
  const setVisibility = isVisible => onSetVisibility(editorView)(isVisible);
100
+ const setSelectedAnnotationFn = annotationId => {
101
+ if (!annotationId) {
102
+ closeComponent()(editorView.state, editorView.dispatch);
103
+ } else {
104
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
105
+ }
106
+ };
100
107
  const {
101
108
  updateSubscriber
102
109
  } = provider;
103
110
  if (updateSubscriber) {
104
- updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
111
+ updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
105
112
  }
106
113
  editorView.root.addEventListener('mouseup', mouseUp);
107
114
  return {
@@ -118,7 +125,7 @@ export const inlineCommentPlugin = options => {
118
125
  destroy() {
119
126
  editorView.root.removeEventListener('mouseup', mouseUp);
120
127
  if (updateSubscriber) {
121
- updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
128
+ updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
122
129
  }
123
130
  }
124
131
  };
@@ -51,6 +51,11 @@ export default ((pluginState, action) => {
51
51
  ...(isVisible ? pluginState : getNewDraftState(pluginState, false)),
52
52
  isVisible
53
53
  };
54
+ case ACTIONS.SET_SELECTED_ANNOTATION:
55
+ return {
56
+ ...pluginState,
57
+ selectedAnnotations: [...action.data.selectedAnnotations]
58
+ };
54
59
  default:
55
60
  return pluginState;
56
61
  }
@@ -6,5 +6,6 @@ export let ACTIONS = /*#__PURE__*/function (ACTIONS) {
6
6
  ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
7
7
  ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
8
8
  ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
9
+ ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
9
10
  return ACTIONS;
10
11
  }({});
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
3
3
  import { AnnotationViewWrapper } from './AnnotationViewWrapper';
4
4
  import { AnnotationTestIds } from '../types';
5
- import { getAnnotationViewKey, getSelectionPositions, getPluginState } from '../utils';
5
+ import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
6
6
  import { removeInlineCommentNearSelection, updateInlineCommentResolvedState, setInlineCommentDraftState, createAnnotation, closeComponent } from '../commands';
7
7
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../analytics';
8
8
  import { CONTENT_COMPONENT } from '../../analytics/types';
@@ -46,6 +46,7 @@ export function InlineCommentView({
46
46
  selectedAnnotations,
47
47
  annotations
48
48
  } = inlineCommentState || {};
49
+ const annotationsList = getAllAnnotations(editorView.state.doc);
49
50
  const selection = getSelectionPositions(state, inlineCommentState);
50
51
  const position = findPosForDOM(selection);
51
52
  let dom;
@@ -132,6 +133,7 @@ export function InlineCommentView({
132
133
  key: getAnnotationViewKey(activeAnnotations),
133
134
  onViewed: onAnnotationViewed
134
135
  }, /*#__PURE__*/React.createElement(ViewComponent, {
136
+ annotationsList: annotationsList,
135
137
  annotations: activeAnnotations,
136
138
  dom: dom,
137
139
  onDelete: id => removeInlineCommentNearSelection(id)(state, dispatch),
@@ -52,7 +52,7 @@ export const getAllAnnotations = doc => {
52
52
  const allAnnotationIds = new Set();
53
53
  doc.descendants(node => {
54
54
  node.marks.filter(mark => mark.type.name === 'annotation')
55
- // filter out annotations with invalid attribues as they cause errors when interacting with them
55
+ // filter out annotations with invalid attributes as they cause errors when interacting with them
56
56
  .filter(validateAnnotationMark).forEach(m => allAnnotationIds.add(m.attrs.id));
57
57
  return true;
58
58
  });
@@ -9,34 +9,20 @@ import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/uti
9
9
  import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
10
10
  import { wrapperStyle } from './styled';
11
11
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
12
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
13
12
  import classnames from 'classnames';
14
13
  import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
15
14
  import { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, calculateOffsetLeft, DEFAULT_IMAGE_WIDTH, calcMediaSingleMaxWidth } from '@atlaskit/editor-common/media-single';
16
- import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps } from '@atlaskit/editor-common/guideline';
15
+ import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey } from '@atlaskit/editor-common/guideline';
17
16
  import memoizeOne from 'memoize-one';
17
+ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
18
18
  import throttle from 'lodash/throttle';
19
19
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
20
20
  export const resizerNextTestId = 'mediaSingle.resizerNext.testid';
21
-
22
- // TODO: Create new fixed image size event
23
- const getResizeAnalyticsEvent = (type, size, layout) => {
24
- const actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
25
- return {
26
- action: ACTION.EDITED,
27
- actionSubject,
28
- actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
29
- attributes: {
30
- size,
31
- layout
32
- },
33
- eventType: EVENT_TYPE.UI
34
- };
35
- };
36
21
  class ResizableMediaSingleNext extends React.Component {
37
22
  constructor(props) {
38
23
  super(props);
39
24
  _defineProperty(this, "guidelines", []);
25
+ _defineProperty(this, "lastSnappedGuidelineKeys", []);
40
26
  _defineProperty(this, "getAllGuidelines", () => {
41
27
  const {
42
28
  view,
@@ -155,6 +141,7 @@ class ResizableMediaSingleNext extends React.Component {
155
141
  gap,
156
142
  keys: activeGuidelineKeys
157
143
  } = findClosestSnap(width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, MEDIA_SINGLE_SNAP_GAP);
144
+ this.lastSnappedGuidelineKeys = activeGuidelineKeys;
158
145
  this.displayGuideline(getGuidelinesWithHighlights(gap, MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines));
159
146
  }
160
147
  });
@@ -179,6 +166,31 @@ class ResizableMediaSingleNext extends React.Component {
179
166
  }
180
167
  }
181
168
  });
169
+ _defineProperty(this, "getParentNodeTypeNameFromCurrentPositionNode", () => {
170
+ const $pos = this.$pos;
171
+ if (!$pos) {
172
+ return undefined;
173
+ }
174
+
175
+ // Supported Parent Nodes
176
+ const {
177
+ listItem,
178
+ expand,
179
+ tableCell,
180
+ tableHeader,
181
+ layoutSection,
182
+ nestedExpand
183
+ } = this.props.view.state.schema.nodes;
184
+ const parentNode = findParentNodeOfTypeClosestToPos($pos, [listItem, expand, tableCell, tableHeader, layoutSection, nestedExpand]);
185
+
186
+ // Return matched parent node name
187
+ if (parentNode) {
188
+ return parentNode.node.type.name;
189
+ }
190
+
191
+ // Return undefined if parent node cannot be found
192
+ return undefined;
193
+ });
182
194
  _defineProperty(this, "handleResizeStart", () => {
183
195
  this.setState({
184
196
  isResizing: true
@@ -230,11 +242,20 @@ class ResizableMediaSingleNext extends React.Component {
230
242
  height,
231
243
  calculatedWidthWithLayout
232
244
  } = this.calculateSizeState(size, delta, originalWidth, originalHeight, true);
233
- this.setIsResizing(false);
234
- this.displayGuideline([]);
235
245
  if (dispatchAnalyticsEvent) {
236
- dispatchAnalyticsEvent(getResizeAnalyticsEvent(nodeType, calculatedWidthWithLayout.width, calculatedWidthWithLayout.layout));
246
+ const event = getMediaResizeAnalyticsEvent(nodeType || 'mediaSingle', {
247
+ width,
248
+ layout: calculatedWidthWithLayout.layout,
249
+ widthType: 'pixel',
250
+ snapType: getGuidelineTypeFromKey(this.lastSnappedGuidelineKeys, this.guidelines),
251
+ parentNode: this.getParentNodeTypeNameFromCurrentPositionNode()
252
+ });
253
+ if (event) {
254
+ dispatchAnalyticsEvent(event);
255
+ }
237
256
  }
257
+ this.setIsResizing(false);
258
+ this.displayGuideline([]);
238
259
  this.setState({
239
260
  isResizing: false,
240
261
  size: {
@@ -4,7 +4,7 @@ export const getMediaResizeAnalyticsEvent = (type, attributes) => {
4
4
  return;
5
5
  }
6
6
  const {
7
- size,
7
+ width,
8
8
  widthType,
9
9
  layout,
10
10
  snapType,
@@ -16,7 +16,7 @@ export const getMediaResizeAnalyticsEvent = (type, attributes) => {
16
16
  actionSubject,
17
17
  actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
18
18
  attributes: {
19
- size,
19
+ width,
20
20
  layout,
21
21
  widthType,
22
22
  snapType,
@@ -1,5 +1,5 @@
1
1
  export const name = "@atlaskit/editor-core";
2
- export const version = "187.20.1";
2
+ export const version = "187.21.1";
3
3
  export const nextMajorVersion = () => {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.20.1",
3
+ "version": "187.21.1",
4
4
  "sideEffects": false
5
5
  }
@@ -99,6 +99,17 @@ export var updateMouseState = function updateMouseState(mouseData) {
99
99
  }
100
100
  });
101
101
  };
102
+ export var setSelectedAnnotation = function setSelectedAnnotation(id) {
103
+ return createCommand({
104
+ type: ACTIONS.SET_SELECTED_ANNOTATION,
105
+ data: {
106
+ selectedAnnotations: [{
107
+ id: id,
108
+ type: AnnotationTypes.INLINE_COMMENT
109
+ }]
110
+ }
111
+ });
112
+ };
102
113
  export var createAnnotation = function createAnnotation(id) {
103
114
  var annotationType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : AnnotationTypes.INLINE_COMMENT;
104
115
  return function (state, dispatch) {
@@ -6,7 +6,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
6
6
  import { Decoration, DecorationSet } from '@atlaskit/editor-prosemirror/view';
7
7
  import { AnnotationTypes } from '@atlaskit/adf-schema';
8
8
  import { AnnotationNodeView, getAnnotationViewClassname } from '../nodeviews';
9
- import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility } from '../commands';
9
+ import { updateInlineCommentResolvedState, updateMouseState, clearDirtyMark, setInlineCommentsVisibility, setSelectedAnnotation, closeComponent } from '../commands';
10
10
  import { getAllAnnotations, inlineCommentPluginKey, getPluginState } from '../utils';
11
11
  import { createPluginState } from './plugin-factory';
12
12
  var fetchProviderStates = /*#__PURE__*/function () {
@@ -147,9 +147,16 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
147
147
  var setVisibility = function setVisibility(isVisible) {
148
148
  return onSetVisibility(editorView)(isVisible);
149
149
  };
150
+ var setSelectedAnnotationFn = function setSelectedAnnotationFn(annotationId) {
151
+ if (!annotationId) {
152
+ closeComponent()(editorView.state, editorView.dispatch);
153
+ } else {
154
+ setSelectedAnnotation(annotationId)(editorView.state, editorView.dispatch);
155
+ }
156
+ };
150
157
  var updateSubscriber = provider.updateSubscriber;
151
158
  if (updateSubscriber) {
152
- updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility);
159
+ updateSubscriber.on('resolve', resolve).on('delete', resolve).on('unresolve', unResolve).on('create', unResolve).on('setvisibility', setVisibility).on('setselectedannotation', setSelectedAnnotationFn);
153
160
  }
154
161
  editorView.root.addEventListener('mouseup', mouseUp);
155
162
  return {
@@ -165,7 +172,7 @@ export var inlineCommentPlugin = function inlineCommentPlugin(options) {
165
172
  destroy: function destroy() {
166
173
  editorView.root.removeEventListener('mouseup', mouseUp);
167
174
  if (updateSubscriber) {
168
- updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility);
175
+ updateSubscriber.off('resolve', resolve).off('delete', resolve).off('unresolve', unResolve).off('create', unResolve).off('setvisibility', setVisibility).off('setselectedannotation', setSelectedAnnotationFn);
169
176
  }
170
177
  }
171
178
  };
@@ -41,6 +41,10 @@ export default (function (pluginState, action) {
41
41
  return _objectSpread(_objectSpread({}, isVisible ? pluginState : getNewDraftState(pluginState, false)), {}, {
42
42
  isVisible: isVisible
43
43
  });
44
+ case ACTIONS.SET_SELECTED_ANNOTATION:
45
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
46
+ selectedAnnotations: _toConsumableArray(action.data.selectedAnnotations)
47
+ });
44
48
  default:
45
49
  return pluginState;
46
50
  }
@@ -6,5 +6,6 @@ export var ACTIONS = /*#__PURE__*/function (ACTIONS) {
6
6
  ACTIONS[ACTIONS["ADD_INLINE_COMMENT"] = 4] = "ADD_INLINE_COMMENT";
7
7
  ACTIONS[ACTIONS["INLINE_COMMENT_SET_VISIBLE"] = 5] = "INLINE_COMMENT_SET_VISIBLE";
8
8
  ACTIONS[ACTIONS["CLOSE_COMPONENT"] = 6] = "CLOSE_COMPONENT";
9
+ ACTIONS[ACTIONS["SET_SELECTED_ANNOTATION"] = 7] = "SET_SELECTED_ANNOTATION";
9
10
  return ACTIONS;
10
11
  }({});
@@ -3,7 +3,7 @@ import React from 'react';
3
3
  import { findDomRefAtPos } from '@atlaskit/editor-prosemirror/utils';
4
4
  import { AnnotationViewWrapper } from './AnnotationViewWrapper';
5
5
  import { AnnotationTestIds } from '../types';
6
- import { getAnnotationViewKey, getSelectionPositions, getPluginState } from '../utils';
6
+ import { getAnnotationViewKey, getSelectionPositions, getPluginState, getAllAnnotations } from '../utils';
7
7
  import { removeInlineCommentNearSelection, updateInlineCommentResolvedState, setInlineCommentDraftState, createAnnotation, closeComponent } from '../commands';
8
8
  import { ACTION, ACTION_SUBJECT, EVENT_TYPE, ACTION_SUBJECT_ID } from '../../analytics';
9
9
  import { CONTENT_COMPONENT } from '../../analytics/types';
@@ -39,6 +39,7 @@ export function InlineCommentView(_ref) {
39
39
  bookmark = _ref2.bookmark,
40
40
  selectedAnnotations = _ref2.selectedAnnotations,
41
41
  annotations = _ref2.annotations;
42
+ var annotationsList = getAllAnnotations(editorView.state.doc);
42
43
  var selection = getSelectionPositions(state, inlineCommentState);
43
44
  var position = findPosForDOM(selection);
44
45
  var dom;
@@ -127,6 +128,7 @@ export function InlineCommentView(_ref) {
127
128
  key: getAnnotationViewKey(activeAnnotations),
128
129
  onViewed: onAnnotationViewed
129
130
  }, /*#__PURE__*/React.createElement(ViewComponent, {
131
+ annotationsList: annotationsList,
130
132
  annotations: activeAnnotations,
131
133
  dom: dom,
132
134
  onDelete: function onDelete(id) {
@@ -60,7 +60,7 @@ export var getAllAnnotations = function getAllAnnotations(doc) {
60
60
  node.marks.filter(function (mark) {
61
61
  return mark.type.name === 'annotation';
62
62
  })
63
- // filter out annotations with invalid attribues as they cause errors when interacting with them
63
+ // filter out annotations with invalid attributes as they cause errors when interacting with them
64
64
  .filter(validateAnnotationMark).forEach(function (m) {
65
65
  return allAnnotationIds.add(m.attrs.id);
66
66
  });
@@ -20,30 +20,15 @@ import { nonWrappedLayouts, setNodeSelection } from '@atlaskit/editor-common/uti
20
20
  import { akEditorFullWidthLayoutWidth, akEditorGutterPadding, akEditorDefaultLayoutWidth } from '@atlaskit/editor-shared-styles';
21
21
  import { wrapperStyle } from './styled';
22
22
  import { ResizerNext } from '@atlaskit/editor-common/resizer';
23
- import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, EVENT_TYPE } from '@atlaskit/editor-common/analytics';
24
23
  import classnames from 'classnames';
25
24
  import { richMediaClassName, resizerStyles } from '@atlaskit/editor-common/styles';
26
25
  import { MEDIA_SINGLE_MIN_PIXEL_WIDTH, MEDIA_SINGLE_SNAP_GAP, MEDIA_SINGLE_RESIZE_THROTTLE_TIME, calculateOffsetLeft, DEFAULT_IMAGE_WIDTH, calcMediaSingleMaxWidth } from '@atlaskit/editor-common/media-single';
27
- import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps } from '@atlaskit/editor-common/guideline';
26
+ import { findClosestSnap, getGuidelinesWithHighlights, generateDefaultGuidelines, generateDynamicGuidelines, getGuidelineSnaps, getGuidelineTypeFromKey } from '@atlaskit/editor-common/guideline';
28
27
  import memoizeOne from 'memoize-one';
28
+ import { getMediaResizeAnalyticsEvent } from '../../utils/analytics';
29
29
  import throttle from 'lodash/throttle';
30
30
  import { MEDIA_PLUGIN_IS_RESIZING_KEY, MEDIA_PLUGIN_RESIZING_WIDTH_KEY } from '../../pm-plugins/main';
31
31
  export var resizerNextTestId = 'mediaSingle.resizerNext.testid';
32
-
33
- // TODO: Create new fixed image size event
34
- var getResizeAnalyticsEvent = function getResizeAnalyticsEvent(type, size, layout) {
35
- var actionSubject = type === 'embed' ? ACTION_SUBJECT.EMBEDS : ACTION_SUBJECT.MEDIA_SINGLE;
36
- return {
37
- action: ACTION.EDITED,
38
- actionSubject: actionSubject,
39
- actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
40
- attributes: {
41
- size: size,
42
- layout: layout
43
- },
44
- eventType: EVENT_TYPE.UI
45
- };
46
- };
47
32
  var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
48
33
  _inherits(ResizableMediaSingleNext, _React$Component);
49
34
  var _super = _createSuper(ResizableMediaSingleNext);
@@ -52,6 +37,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
52
37
  _classCallCheck(this, ResizableMediaSingleNext);
53
38
  _this = _super.call(this, props);
54
39
  _defineProperty(_assertThisInitialized(_this), "guidelines", []);
40
+ _defineProperty(_assertThisInitialized(_this), "lastSnappedGuidelineKeys", []);
55
41
  _defineProperty(_assertThisInitialized(_this), "getAllGuidelines", function () {
56
42
  var _this$props = _this.props,
57
43
  view = _this$props.view,
@@ -164,6 +150,7 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
164
150
  var _findClosestSnap = findClosestSnap(width, guidelineSnapsReference.snaps.x, guidelineSnapsReference.guidelineReference, MEDIA_SINGLE_SNAP_GAP),
165
151
  gap = _findClosestSnap.gap,
166
152
  activeGuidelineKeys = _findClosestSnap.keys;
153
+ _this.lastSnappedGuidelineKeys = activeGuidelineKeys;
167
154
  _this.displayGuideline(getGuidelinesWithHighlights(gap, MEDIA_SINGLE_SNAP_GAP, activeGuidelineKeys, guidelines));
168
155
  }
169
156
  });
@@ -195,6 +182,30 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
195
182
  }
196
183
  }
197
184
  });
185
+ _defineProperty(_assertThisInitialized(_this), "getParentNodeTypeNameFromCurrentPositionNode", function () {
186
+ var $pos = _this.$pos;
187
+ if (!$pos) {
188
+ return undefined;
189
+ }
190
+
191
+ // Supported Parent Nodes
192
+ var _this$props$view$stat = _this.props.view.state.schema.nodes,
193
+ listItem = _this$props$view$stat.listItem,
194
+ expand = _this$props$view$stat.expand,
195
+ tableCell = _this$props$view$stat.tableCell,
196
+ tableHeader = _this$props$view$stat.tableHeader,
197
+ layoutSection = _this$props$view$stat.layoutSection,
198
+ nestedExpand = _this$props$view$stat.nestedExpand;
199
+ var parentNode = findParentNodeOfTypeClosestToPos($pos, [listItem, expand, tableCell, tableHeader, layoutSection, nestedExpand]);
200
+
201
+ // Return matched parent node name
202
+ if (parentNode) {
203
+ return parentNode.node.type.name;
204
+ }
205
+
206
+ // Return undefined if parent node cannot be found
207
+ return undefined;
208
+ });
198
209
  _defineProperty(_assertThisInitialized(_this), "handleResizeStart", function () {
199
210
  _this.setState({
200
211
  isResizing: true
@@ -242,11 +253,20 @@ var ResizableMediaSingleNext = /*#__PURE__*/function (_React$Component) {
242
253
  width = _this$calculateSizeSt2.width,
243
254
  height = _this$calculateSizeSt2.height,
244
255
  calculatedWidthWithLayout = _this$calculateSizeSt2.calculatedWidthWithLayout;
245
- _this.setIsResizing(false);
246
- _this.displayGuideline([]);
247
256
  if (dispatchAnalyticsEvent) {
248
- dispatchAnalyticsEvent(getResizeAnalyticsEvent(nodeType, calculatedWidthWithLayout.width, calculatedWidthWithLayout.layout));
257
+ var event = getMediaResizeAnalyticsEvent(nodeType || 'mediaSingle', {
258
+ width: width,
259
+ layout: calculatedWidthWithLayout.layout,
260
+ widthType: 'pixel',
261
+ snapType: getGuidelineTypeFromKey(_this.lastSnappedGuidelineKeys, _this.guidelines),
262
+ parentNode: _this.getParentNodeTypeNameFromCurrentPositionNode()
263
+ });
264
+ if (event) {
265
+ dispatchAnalyticsEvent(event);
266
+ }
249
267
  }
268
+ _this.setIsResizing(false);
269
+ _this.displayGuideline([]);
250
270
  _this.setState({
251
271
  isResizing: false,
252
272
  size: {
@@ -3,7 +3,7 @@ export var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(
3
3
  if (!attributes) {
4
4
  return;
5
5
  }
6
- var size = attributes.size,
6
+ var width = attributes.width,
7
7
  widthType = attributes.widthType,
8
8
  layout = attributes.layout,
9
9
  snapType = attributes.snapType,
@@ -14,7 +14,7 @@ export var getMediaResizeAnalyticsEvent = function getMediaResizeAnalyticsEvent(
14
14
  actionSubject: actionSubject,
15
15
  actionSubjectId: ACTION_SUBJECT_ID.RESIZED,
16
16
  attributes: {
17
- size: size,
17
+ width: width,
18
18
  layout: layout,
19
19
  widthType: widthType,
20
20
  snapType: snapType,
@@ -1,5 +1,5 @@
1
1
  export var name = "@atlaskit/editor-core";
2
- export var version = "187.20.1";
2
+ export var version = "187.21.1";
3
3
  export var nextMajorVersion = function nextMajorVersion() {
4
4
  return [Number(version.split('.')[0]) + 1, 0, 0].join('.');
5
5
  };
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.20.1",
3
+ "version": "187.21.1",
4
4
  "sideEffects": false
5
5
  }
@@ -10,5 +10,6 @@ export declare const removeInlineCommentNearSelection: (id: string) => Command;
10
10
  export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
11
11
  export declare const addInlineComment: (id: string) => Command;
12
12
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
+ export declare const setSelectedAnnotation: (id: string) => Command;
13
14
  export declare const createAnnotation: (id: string, annotationType?: AnnotationTypes) => Command;
14
15
  export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -10,7 +10,8 @@ export declare enum ACTIONS {
10
10
  INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
11
11
  ADD_INLINE_COMMENT = 4,
12
12
  INLINE_COMMENT_SET_VISIBLE = 5,
13
- CLOSE_COMPONENT = 6
13
+ CLOSE_COMPONENT = 6,
14
+ SET_SELECTED_ANNOTATION = 7
14
15
  }
15
16
  export interface InlineCommentPluginOptions {
16
17
  dispatch: Dispatch;
@@ -55,6 +56,11 @@ export type InlineCommentAction = {
55
56
  data: {
56
57
  isVisible: boolean;
57
58
  };
59
+ } | {
60
+ type: ACTIONS.SET_SELECTED_ANNOTATION;
61
+ data: {
62
+ selectedAnnotations: AnnotationInfo[];
63
+ };
58
64
  };
59
65
  export type InlineCommentPluginState = {
60
66
  annotations: InlineCommentMap;
@@ -39,6 +39,10 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
39
39
  * Removes the annotation from the document
40
40
  */
41
41
  onDelete?: (id: string) => void;
42
+ /**
43
+ * Ordered list of annotation ids as shown in the document
44
+ */
45
+ annotationsList?: string[];
42
46
  };
43
47
  export interface AnnotationState<Type, State> {
44
48
  annotationType: Type;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
3
+ export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
4
4
  export type VisibilityEvent = 'setvisibility';
5
5
  export declare class AnnotationUpdateEmitter extends EventEmitter {
6
6
  on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this;
@@ -18,6 +18,7 @@ export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
18
18
  type ResizableMediaSingleNextProps = Props;
19
19
  declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
20
20
  private guidelines;
21
+ private lastSnappedGuidelineKeys;
21
22
  constructor(props: ResizableMediaSingleNextProps);
22
23
  /**
23
24
  * Calculate media single node initial width if props.mediaSingleWidth is undefined
@@ -66,6 +67,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
66
67
  };
67
68
  };
68
69
  selectCurrentMediaNode: () => void;
70
+ getParentNodeTypeNameFromCurrentPositionNode: () => string | undefined;
69
71
  handleResizeStart: HandleResizeStart;
70
72
  handleResize: HandleResize;
71
73
  handleResizeStop: HandleResize;
@@ -1,2 +1,2 @@
1
- import { MediaEventPayload, MediaResizeTrackAction } from '@atlaskit/editor-common/analytics';
1
+ import type { MediaEventPayload, MediaResizeTrackAction } from '@atlaskit/editor-common/analytics';
2
2
  export declare const getMediaResizeAnalyticsEvent: <T extends MediaResizeTrackAction>(type: string, attributes: T["attributes"]) => MediaEventPayload | void;
@@ -10,5 +10,6 @@ export declare const removeInlineCommentNearSelection: (id: string) => Command;
10
10
  export declare const setInlineCommentDraftState: (drafting: boolean, inputMethod?: INPUT_METHOD.TOOLBAR | INPUT_METHOD.SHORTCUT) => Command;
11
11
  export declare const addInlineComment: (id: string) => Command;
12
12
  export declare const updateMouseState: (mouseData: InlineCommentMouseData) => Command;
13
+ export declare const setSelectedAnnotation: (id: string) => Command;
13
14
  export declare const createAnnotation: (id: string, annotationType?: AnnotationTypes) => Command;
14
15
  export declare const setInlineCommentsVisibility: (isVisible: boolean) => Command;
@@ -10,7 +10,8 @@ export declare enum ACTIONS {
10
10
  INLINE_COMMENT_CLEAR_DIRTY_MARK = 3,
11
11
  ADD_INLINE_COMMENT = 4,
12
12
  INLINE_COMMENT_SET_VISIBLE = 5,
13
- CLOSE_COMPONENT = 6
13
+ CLOSE_COMPONENT = 6,
14
+ SET_SELECTED_ANNOTATION = 7
14
15
  }
15
16
  export interface InlineCommentPluginOptions {
16
17
  dispatch: Dispatch;
@@ -55,6 +56,11 @@ export type InlineCommentAction = {
55
56
  data: {
56
57
  isVisible: boolean;
57
58
  };
59
+ } | {
60
+ type: ACTIONS.SET_SELECTED_ANNOTATION;
61
+ data: {
62
+ selectedAnnotations: AnnotationInfo[];
63
+ };
58
64
  };
59
65
  export type InlineCommentPluginState = {
60
66
  annotations: InlineCommentMap;
@@ -39,6 +39,10 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
39
39
  * Removes the annotation from the document
40
40
  */
41
41
  onDelete?: (id: string) => void;
42
+ /**
43
+ * Ordered list of annotation ids as shown in the document
44
+ */
45
+ annotationsList?: string[];
42
46
  };
43
47
  export interface AnnotationState<Type, State> {
44
48
  annotationType: Type;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="node" />
2
2
  import { EventEmitter } from 'events';
3
- export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
3
+ export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation';
4
4
  export type VisibilityEvent = 'setvisibility';
5
5
  export declare class AnnotationUpdateEmitter extends EventEmitter {
6
6
  on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this;
@@ -18,6 +18,7 @@ export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
18
18
  type ResizableMediaSingleNextProps = Props;
19
19
  declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
20
20
  private guidelines;
21
+ private lastSnappedGuidelineKeys;
21
22
  constructor(props: ResizableMediaSingleNextProps);
22
23
  /**
23
24
  * Calculate media single node initial width if props.mediaSingleWidth is undefined
@@ -66,6 +67,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
66
67
  };
67
68
  };
68
69
  selectCurrentMediaNode: () => void;
70
+ getParentNodeTypeNameFromCurrentPositionNode: () => string | undefined;
69
71
  handleResizeStart: HandleResizeStart;
70
72
  handleResize: HandleResize;
71
73
  handleResizeStop: HandleResize;
@@ -1,2 +1,2 @@
1
- import { MediaEventPayload, MediaResizeTrackAction } from '@atlaskit/editor-common/analytics';
1
+ import type { MediaEventPayload, MediaResizeTrackAction } from '@atlaskit/editor-common/analytics';
2
2
  export declare const getMediaResizeAnalyticsEvent: <T extends MediaResizeTrackAction>(type: string, attributes: T["attributes"]) => MediaEventPayload | void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.20.1",
3
+ "version": "187.21.1",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -147,7 +147,7 @@
147
147
  "@atlaskit/dropdown-menu": "^11.11.0",
148
148
  "@atlaskit/editor-extension-dropbox": "^0.4.0",
149
149
  "@atlaskit/editor-plugin-table": "^2.8.0",
150
- "@atlaskit/editor-test-helpers": "^18.10.0",
150
+ "@atlaskit/editor-test-helpers": "^18.11.0",
151
151
  "@atlaskit/flag": "^15.2.0",
152
152
  "@atlaskit/icon-object": "^6.3.0",
153
153
  "@atlaskit/inline-dialog": "^13.6.0",
package/report.api.md CHANGED
@@ -1113,6 +1113,7 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
1113
1113
  annotations: Array<AnnotationInfo>;
1114
1114
  onResolve: (id: string) => void;
1115
1115
  onDelete?: (id: string) => void;
1116
+ annotationsList?: string[];
1116
1117
  };
1117
1118
 
1118
1119
  export { INPUT_METHOD };
@@ -2181,7 +2182,12 @@ interface TypeAheadStatsSerializable extends TypeAheadStats {
2181
2182
  }
2182
2183
 
2183
2184
  // @public (undocumented)
2184
- export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
2185
+ export type UpdateEvent =
2186
+ | 'create'
2187
+ | 'delete'
2188
+ | 'resolve'
2189
+ | 'setselectedannotation'
2190
+ | 'unresolve';
2185
2191
 
2186
2192
  // @public (undocumented)
2187
2193
  export const updateStatus: (status?: StatusType) => Command;
@@ -1016,6 +1016,7 @@ export type InlineCommentViewComponentProps = AnnotationComponentProps & {
1016
1016
  annotations: Array<AnnotationInfo>;
1017
1017
  onResolve: (id: string) => void;
1018
1018
  onDelete?: (id: string) => void;
1019
+ annotationsList?: string[];
1019
1020
  };
1020
1021
 
1021
1022
  export { INPUT_METHOD }
@@ -1941,7 +1942,7 @@ interface TypeAheadStatsSerializable extends TypeAheadStats {
1941
1942
  }
1942
1943
 
1943
1944
  // @public (undocumented)
1944
- export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve';
1945
+ export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'setselectedannotation' | 'unresolve';
1945
1946
 
1946
1947
  // @public (undocumented)
1947
1948
  export const updateStatus: (status?: StatusType) => Command;