@atlaskit/editor-plugin-annotation 10.0.1 → 10.0.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,11 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 10.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
3
9
  ## 10.0.1
4
10
 
5
11
  ### Patch Changes
@@ -1,13 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.InlineCommentView = InlineCommentView;
9
8
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
10
- var _react = _interopRequireWildcard(require("react"));
9
+ var _react = _interopRequireDefault(require("react"));
11
10
  var _adfSchema = require("@atlaskit/adf-schema");
12
11
  var _analytics = require("@atlaskit/editor-common/analytics");
13
12
  var _hooks = require("@atlaskit/editor-common/hooks");
@@ -20,7 +19,6 @@ var _editorCommands = require("../editor-commands");
20
19
  var _utils3 = require("../pm-plugins/utils");
21
20
  var _types = require("../types");
22
21
  var _AnnotationViewWrapper = require("./AnnotationViewWrapper");
23
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
24
22
  var findPosForDOM = function findPosForDOM(sel) {
25
23
  var $from = sel.$from,
26
24
  from = sel.from;
@@ -59,7 +57,6 @@ function InlineCommentView(_ref) {
59
57
  var inlineCommentProvider = providers.inlineComment;
60
58
  var state = editorView.state,
61
59
  dispatch = editorView.dispatch;
62
- var lastSelectedAnnotationId = (0, _react.useRef)();
63
60
  var CreateComponent = inlineCommentProvider.createComponent,
64
61
  ViewComponent = inlineCommentProvider.viewComponent;
65
62
  var _useSharedPluginState = (0, _hooks.useSharedPluginStateWithSelector)(editorAPI, ['annotation'], selector),
@@ -108,17 +105,9 @@ function InlineCommentView(_ref) {
108
105
 
109
106
  // Create Component
110
107
  if (bookmark) {
111
- var _selectedAnnotations$;
112
108
  if (!CreateComponent) {
113
109
  return null;
114
110
  }
115
- var currentlySelectedAnnotation = selectedAnnotations === null || selectedAnnotations === void 0 || (_selectedAnnotations$ = selectedAnnotations[0]) === null || _selectedAnnotations$ === void 0 ? void 0 : _selectedAnnotations$.id;
116
- var isAnnotationSelectionChanged = currentlySelectedAnnotation !== lastSelectedAnnotationId.current;
117
-
118
- // Update the last selected annotation ID if the selection was updated
119
- if (isAnnotationSelectionChanged) {
120
- lastSelectedAnnotationId.current = currentlySelectedAnnotation;
121
- }
122
111
  var inlineNodeTypes = (0, _utils.getRangeInlineNodeNames)({
123
112
  doc: state.doc,
124
113
  pos: selection
@@ -131,8 +120,7 @@ function InlineCommentView(_ref) {
131
120
  "data-editor-popup": "true"
132
121
  }, /*#__PURE__*/_react.default.createElement(CreateComponent, {
133
122
  dom: dom,
134
- textSelection: textSelection,
135
- wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged
123
+ textSelection: textSelection
136
124
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
137
125
  ,
138
126
  onCreate: function onCreate(id) {
@@ -1,4 +1,4 @@
1
- import React, { useRef } from 'react';
1
+ import React from 'react';
2
2
  import { AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
4
4
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
@@ -54,7 +54,6 @@ export function InlineCommentView({
54
54
  state,
55
55
  dispatch
56
56
  } = editorView;
57
- const lastSelectedAnnotationId = useRef();
58
57
  const {
59
58
  createComponent: CreateComponent,
60
59
  viewComponent: ViewComponent
@@ -106,17 +105,9 @@ export function InlineCommentView({
106
105
 
107
106
  // Create Component
108
107
  if (bookmark) {
109
- var _selectedAnnotations$;
110
108
  if (!CreateComponent) {
111
109
  return null;
112
110
  }
113
- const currentlySelectedAnnotation = selectedAnnotations === null || selectedAnnotations === void 0 ? void 0 : (_selectedAnnotations$ = selectedAnnotations[0]) === null || _selectedAnnotations$ === void 0 ? void 0 : _selectedAnnotations$.id;
114
- const isAnnotationSelectionChanged = currentlySelectedAnnotation !== lastSelectedAnnotationId.current;
115
-
116
- // Update the last selected annotation ID if the selection was updated
117
- if (isAnnotationSelectionChanged) {
118
- lastSelectedAnnotationId.current = currentlySelectedAnnotation;
119
- }
120
111
  const inlineNodeTypes = getRangeInlineNodeNames({
121
112
  doc: state.doc,
122
113
  pos: selection
@@ -129,8 +120,7 @@ export function InlineCommentView({
129
120
  "data-editor-popup": "true"
130
121
  }, /*#__PURE__*/React.createElement(CreateComponent, {
131
122
  dom: dom,
132
- textSelection: textSelection,
133
- wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged
123
+ textSelection: textSelection
134
124
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
135
125
  ,
136
126
  onCreate: id => {
@@ -1,5 +1,5 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
- import React, { useRef } from 'react';
2
+ import React from 'react';
3
3
  import { AnnotationTypes } from '@atlaskit/adf-schema';
4
4
  import { ACTION, ACTION_SUBJECT, ACTION_SUBJECT_ID, CONTENT_COMPONENT, EVENT_TYPE, RESOLVE_METHOD } from '@atlaskit/editor-common/analytics';
5
5
  import { useSharedPluginStateWithSelector } from '@atlaskit/editor-common/hooks';
@@ -50,7 +50,6 @@ export function InlineCommentView(_ref) {
50
50
  var inlineCommentProvider = providers.inlineComment;
51
51
  var state = editorView.state,
52
52
  dispatch = editorView.dispatch;
53
- var lastSelectedAnnotationId = useRef();
54
53
  var CreateComponent = inlineCommentProvider.createComponent,
55
54
  ViewComponent = inlineCommentProvider.viewComponent;
56
55
  var _useSharedPluginState = useSharedPluginStateWithSelector(editorAPI, ['annotation'], selector),
@@ -99,17 +98,9 @@ export function InlineCommentView(_ref) {
99
98
 
100
99
  // Create Component
101
100
  if (bookmark) {
102
- var _selectedAnnotations$;
103
101
  if (!CreateComponent) {
104
102
  return null;
105
103
  }
106
- var currentlySelectedAnnotation = selectedAnnotations === null || selectedAnnotations === void 0 || (_selectedAnnotations$ = selectedAnnotations[0]) === null || _selectedAnnotations$ === void 0 ? void 0 : _selectedAnnotations$.id;
107
- var isAnnotationSelectionChanged = currentlySelectedAnnotation !== lastSelectedAnnotationId.current;
108
-
109
- // Update the last selected annotation ID if the selection was updated
110
- if (isAnnotationSelectionChanged) {
111
- lastSelectedAnnotationId.current = currentlySelectedAnnotation;
112
- }
113
104
  var inlineNodeTypes = getRangeInlineNodeNames({
114
105
  doc: state.doc,
115
106
  pos: selection
@@ -122,8 +113,7 @@ export function InlineCommentView(_ref) {
122
113
  "data-editor-popup": "true"
123
114
  }, /*#__PURE__*/React.createElement(CreateComponent, {
124
115
  dom: dom,
125
- textSelection: textSelection,
126
- wasNewAnnotationSelected: !!currentlySelectedAnnotation && isAnnotationSelectionChanged
116
+ textSelection: textSelection
127
117
  // eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
128
118
  ,
129
119
  onCreate: function onCreate(id) {
@@ -44,7 +44,6 @@ export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
44
44
  * Creates an annotation mark in the document with the given id.
45
45
  */
46
46
  onCreate: (id: string) => void;
47
- wasNewAnnotationSelected?: boolean;
48
47
  };
49
48
  export type InlineCommentViewComponentProps = AnnotationComponentProps & {
50
49
  /**
@@ -145,11 +144,11 @@ export declare enum AnnotationSelectionType {
145
144
  VALID = "valid"
146
145
  }
147
146
  export declare const AnnotationTestIds: {
148
- prefix: string;
147
+ componentClose: string;
148
+ componentSave: string;
149
149
  floatingComponent: string;
150
150
  floatingToolbarCreateButton: string;
151
- componentSave: string;
152
- componentClose: string;
151
+ prefix: string;
153
152
  };
154
153
  export type CoordsAtPos = {
155
154
  bottom: number;
@@ -44,7 +44,6 @@ export type InlineCommentCreateComponentProps = AnnotationComponentProps & {
44
44
  * Creates an annotation mark in the document with the given id.
45
45
  */
46
46
  onCreate: (id: string) => void;
47
- wasNewAnnotationSelected?: boolean;
48
47
  };
49
48
  export type InlineCommentViewComponentProps = AnnotationComponentProps & {
50
49
  /**
@@ -145,11 +144,11 @@ export declare enum AnnotationSelectionType {
145
144
  VALID = "valid"
146
145
  }
147
146
  export declare const AnnotationTestIds: {
148
- prefix: string;
147
+ componentClose: string;
148
+ componentSave: string;
149
149
  floatingComponent: string;
150
150
  floatingToolbarCreateButton: string;
151
- componentSave: string;
152
- componentClose: string;
151
+ prefix: string;
153
152
  };
154
153
  export type CoordsAtPos = {
155
154
  bottom: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "10.0.1",
3
+ "version": "10.0.2",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -39,11 +39,11 @@
39
39
  "@atlaskit/editor-toolbar-model": "^0.4.0",
40
40
  "@atlaskit/icon": "^34.2.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^63.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^64.0.0",
43
43
  "@babel/runtime": "^7.0.0"
44
44
  },
45
45
  "peerDependencies": {
46
- "@atlaskit/editor-common": "^114.2.0",
46
+ "@atlaskit/editor-common": "^114.5.0",
47
47
  "react": "^18.2.0",
48
48
  "react-dom": "^18.2.0",
49
49
  "react-intl": "^5.25.1 || ^6.0.0 || ^7.0.0"