@atlaskit/editor-common 104.1.2 → 104.1.3

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,15 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 104.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#142925](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/142925)
8
+ [`e013698350bef`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/e013698350bef) -
9
+ This updates the renderer to use the new annotation manager create comment APIs and disables the
10
+ use of the old create hooks. This should be backward compatible and can be controled by a FG
11
+ - Updated dependencies
12
+
3
13
  ## 104.1.2
4
14
 
5
15
  ### Patch Changes
@@ -35,7 +35,6 @@ var AnnotationUpdateEmitter = exports.AnnotationUpdateEmitter = /*#__PURE__*/fun
35
35
  }
36
36
  }]);
37
37
  }(_events.EventEmitter); // type ActionResult = { step: Step; doc: JSONDocNode } | false;
38
- // } & AnnotationByMatches)
39
38
  // | false;
40
39
  // ### Events
41
40
  // ### Hook Results
@@ -17,7 +17,7 @@ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return
17
17
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
18
18
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
19
19
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
20
- var packageVersion = "104.1.2";
20
+ var packageVersion = "104.1.3";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
23
23
  * @jsx jsx
24
24
  */ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
25
25
  var packageName = "@atlaskit/editor-common";
26
- var packageVersion = "104.1.2";
26
+ var packageVersion = "104.1.3";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -11,7 +11,6 @@ export class AnnotationUpdateEmitter extends EventEmitter {
11
11
 
12
12
  // type ActionResult = { step: Step; doc: JSONDocNode } | false;
13
13
 
14
- // } & AnnotationByMatches)
15
14
  // | false;
16
15
 
17
16
  // ### Events
@@ -1,7 +1,7 @@
1
1
  import { isFedRamp } from './environment';
2
2
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
3
3
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
4
- const packageVersion = "104.1.2";
4
+ const packageVersion = "104.1.3";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -13,7 +13,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
13
13
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
14
14
  import Layer from '../Layer';
15
15
  const packageName = "@atlaskit/editor-common";
16
- const packageVersion = "104.1.2";
16
+ const packageVersion = "104.1.3";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -30,7 +30,6 @@ export var AnnotationUpdateEmitter = /*#__PURE__*/function (_EventEmitter) {
30
30
 
31
31
  // type ActionResult = { step: Step; doc: JSONDocNode } | false;
32
32
 
33
- // } & AnnotationByMatches)
34
33
  // | false;
35
34
 
36
35
  // ### Events
@@ -7,7 +7,7 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
7
7
  import { isFedRamp } from './environment';
8
8
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
9
9
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
10
- var packageVersion = "104.1.2";
10
+ var packageVersion = "104.1.3";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -20,7 +20,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
20
20
  import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
21
21
  import Layer from '../Layer';
22
22
  var packageName = "@atlaskit/editor-common";
23
- var packageVersion = "104.1.2";
23
+ var packageVersion = "104.1.3";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -4,7 +4,7 @@
4
4
  import { EventEmitter } from 'events';
5
5
  import type { AnnotationId } from '@atlaskit/adf-schema';
6
6
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
7
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
7
+ import type { AddNodeMarkStep, AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
8
8
  export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation' | 'sethoveredannotation' | 'removehoveredannotation' | 'closeinlinecomment';
9
9
  export type VisibilityEvent = 'setvisibility';
10
10
  type AnnotationCallback = (params: string) => void;
@@ -14,13 +14,19 @@ export declare class AnnotationUpdateEmitter extends EventEmitter {
14
14
  on(event: UpdateEvent, listener: (annotationId: string) => void): this;
15
15
  off(event: string, listener: AnnotationCallback | VisibilityCallback): this;
16
16
  }
17
- type ActionResult = {
18
- step: Step;
17
+ type AnnotationByMatches = {
18
+ originalSelection: string;
19
+ numMatches: number;
20
+ matchIndex: number;
21
+ pos?: number;
22
+ };
23
+ export type ActionResult = {
24
+ step: AddMarkStep | AddNodeMarkStep;
19
25
  doc: JSONDocNode;
20
26
  /** The list of types of all inline nodes, which were wrapped by annotation. */
21
27
  inlineNodeTypes?: string[];
22
28
  targetNodeType?: string;
23
- };
29
+ } & AnnotationByMatches;
24
30
  export type AnnotationDraftStartedData = {
25
31
  targetElement: HTMLElement | undefined;
26
32
  /**
@@ -64,6 +70,11 @@ export type ApplyDraftResult = {
64
70
  } | {
65
71
  success: true;
66
72
  targetElement: HTMLElement | undefined;
73
+ /**
74
+ * The actionResult will be set if the id passed to the applyDraft method is different from the id created
75
+ * from the startDraft call.
76
+ */
77
+ actionResult: ActionResult | undefined;
67
78
  };
68
79
  export type GetDraftResult = {
69
80
  success: false;
@@ -99,7 +110,21 @@ export type AnnotationManagerMethods = {
99
110
  allowAnnotation: () => boolean;
100
111
  startDraft: () => StartDraftResult;
101
112
  clearDraft: () => ClearDraftResult;
113
+ /**
114
+ * This will apply the current draft to the document.
115
+ *
116
+ * If an id is passed, it will be used to apply the draft, it will
117
+ * also generate a new actionResult value if the passed id is different from the one returned from the startDraft method.
118
+ *
119
+ * @param id The id of the annotation to apply. Ideally the same as the one returned from the startDraft method.
120
+ * If the id is different, the actionResult will contain a step and document with the new id. Changing the id is discouraged
121
+ * as this creates different behaviour between the editor and renderer.
122
+ */
102
123
  applyDraft: (id: AnnotationId) => ApplyDraftResult;
124
+ /**
125
+ * This can be used to inspect the current active draft.
126
+ * @returns The current draft data. If the draft is not started, it will return an error.
127
+ */
103
128
  getDraft: () => GetDraftResult;
104
129
  setIsAnnotationSelected: (id: AnnotationId, isSelected: boolean) => SelectAnnotationResult;
105
130
  setIsAnnotationHovered: (id: AnnotationId, isHovered: boolean) => HoverAnnotationResult;
@@ -113,6 +138,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
113
138
  setPreemptiveGate(handler: () => Promise<boolean>): AnnotationManager;
114
139
  /**
115
140
  * This method is used to run the configured preemptive gate check.
141
+ * @private
116
142
  * @internal
117
143
  */
118
144
  checkPreemptiveGate(): Promise<boolean>;
@@ -121,6 +147,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
121
147
  onAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
122
148
  offAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
123
149
  /**
150
+ * @private
124
151
  * @internal
125
152
  * This method is intended for internal Platform use only. It is not intended for use by Product code.
126
153
  */
@@ -132,11 +159,13 @@ export type AnnotationManager = AnnotationManagerMethods & {
132
159
  data: AnnotationSelectedChangeData;
133
160
  }): AnnotationManager;
134
161
  /**
162
+ * @private
135
163
  * @internal
136
164
  * This method is intended for internal Platform use only. It is not intended for use by Product code.
137
165
  */
138
166
  hook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
139
167
  /**
168
+ *
140
169
  * @internal
141
170
  * This method is intended for internal Platform use only. It is not intended for use by Product code.
142
171
  */
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
4
+ import type { AddNodeMarkStep, AddMarkStep, Step } from '@atlaskit/editor-prosemirror/transform';
5
5
  import type { AnnotationManager } from '../../annotation';
6
6
  import type { AnnotationState, AnnotationUpdateEmitter } from './emitter';
7
7
  export type AnnotationByMatches = {
@@ -16,7 +16,7 @@ type ActionResult = {
16
16
  doc: JSONDocNode;
17
17
  } | false;
18
18
  export type AnnotationActionResult = ({
19
- step: Step;
19
+ step: AddMarkStep | AddNodeMarkStep;
20
20
  doc: JSONDocNode;
21
21
  /** The list of types of all inline nodes, which were wrapped by annotation. */
22
22
  inlineNodeTypes?: string[];
@@ -4,7 +4,7 @@
4
4
  import { EventEmitter } from 'events';
5
5
  import type { AnnotationId } from '@atlaskit/adf-schema';
6
6
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
7
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
7
+ import type { AddNodeMarkStep, AddMarkStep } from '@atlaskit/editor-prosemirror/transform';
8
8
  export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'unresolve' | 'setselectedannotation' | 'sethoveredannotation' | 'removehoveredannotation' | 'closeinlinecomment';
9
9
  export type VisibilityEvent = 'setvisibility';
10
10
  type AnnotationCallback = (params: string) => void;
@@ -14,13 +14,19 @@ export declare class AnnotationUpdateEmitter extends EventEmitter {
14
14
  on(event: UpdateEvent, listener: (annotationId: string) => void): this;
15
15
  off(event: string, listener: AnnotationCallback | VisibilityCallback): this;
16
16
  }
17
- type ActionResult = {
18
- step: Step;
17
+ type AnnotationByMatches = {
18
+ originalSelection: string;
19
+ numMatches: number;
20
+ matchIndex: number;
21
+ pos?: number;
22
+ };
23
+ export type ActionResult = {
24
+ step: AddMarkStep | AddNodeMarkStep;
19
25
  doc: JSONDocNode;
20
26
  /** The list of types of all inline nodes, which were wrapped by annotation. */
21
27
  inlineNodeTypes?: string[];
22
28
  targetNodeType?: string;
23
- };
29
+ } & AnnotationByMatches;
24
30
  export type AnnotationDraftStartedData = {
25
31
  targetElement: HTMLElement | undefined;
26
32
  /**
@@ -64,6 +70,11 @@ export type ApplyDraftResult = {
64
70
  } | {
65
71
  success: true;
66
72
  targetElement: HTMLElement | undefined;
73
+ /**
74
+ * The actionResult will be set if the id passed to the applyDraft method is different from the id created
75
+ * from the startDraft call.
76
+ */
77
+ actionResult: ActionResult | undefined;
67
78
  };
68
79
  export type GetDraftResult = {
69
80
  success: false;
@@ -99,7 +110,21 @@ export type AnnotationManagerMethods = {
99
110
  allowAnnotation: () => boolean;
100
111
  startDraft: () => StartDraftResult;
101
112
  clearDraft: () => ClearDraftResult;
113
+ /**
114
+ * This will apply the current draft to the document.
115
+ *
116
+ * If an id is passed, it will be used to apply the draft, it will
117
+ * also generate a new actionResult value if the passed id is different from the one returned from the startDraft method.
118
+ *
119
+ * @param id The id of the annotation to apply. Ideally the same as the one returned from the startDraft method.
120
+ * If the id is different, the actionResult will contain a step and document with the new id. Changing the id is discouraged
121
+ * as this creates different behaviour between the editor and renderer.
122
+ */
102
123
  applyDraft: (id: AnnotationId) => ApplyDraftResult;
124
+ /**
125
+ * This can be used to inspect the current active draft.
126
+ * @returns The current draft data. If the draft is not started, it will return an error.
127
+ */
103
128
  getDraft: () => GetDraftResult;
104
129
  setIsAnnotationSelected: (id: AnnotationId, isSelected: boolean) => SelectAnnotationResult;
105
130
  setIsAnnotationHovered: (id: AnnotationId, isHovered: boolean) => HoverAnnotationResult;
@@ -113,6 +138,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
113
138
  setPreemptiveGate(handler: () => Promise<boolean>): AnnotationManager;
114
139
  /**
115
140
  * This method is used to run the configured preemptive gate check.
141
+ * @private
116
142
  * @internal
117
143
  */
118
144
  checkPreemptiveGate(): Promise<boolean>;
@@ -121,6 +147,7 @@ export type AnnotationManager = AnnotationManagerMethods & {
121
147
  onAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
122
148
  offAnnotationSelectionChange(handler: (data: AnnotationSelectedChangeData) => void): AnnotationManager;
123
149
  /**
150
+ * @private
124
151
  * @internal
125
152
  * This method is intended for internal Platform use only. It is not intended for use by Product code.
126
153
  */
@@ -132,11 +159,13 @@ export type AnnotationManager = AnnotationManagerMethods & {
132
159
  data: AnnotationSelectedChangeData;
133
160
  }): AnnotationManager;
134
161
  /**
162
+ * @private
135
163
  * @internal
136
164
  * This method is intended for internal Platform use only. It is not intended for use by Product code.
137
165
  */
138
166
  hook<H extends keyof AnnotationManagerMethods>(method: H, handler: AnnotationManagerMethods[H]): AnnotationManager;
139
167
  /**
168
+ *
140
169
  * @internal
141
170
  * This method is intended for internal Platform use only. It is not intended for use by Product code.
142
171
  */
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
2
  import type { AnnotationId, AnnotationTypes } from '@atlaskit/adf-schema';
3
3
  import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
4
- import type { Step } from '@atlaskit/editor-prosemirror/transform';
4
+ import type { AddNodeMarkStep, AddMarkStep, Step } from '@atlaskit/editor-prosemirror/transform';
5
5
  import type { AnnotationManager } from '../../annotation';
6
6
  import type { AnnotationState, AnnotationUpdateEmitter } from './emitter';
7
7
  export type AnnotationByMatches = {
@@ -16,7 +16,7 @@ type ActionResult = {
16
16
  doc: JSONDocNode;
17
17
  } | false;
18
18
  export type AnnotationActionResult = ({
19
- step: Step;
19
+ step: AddMarkStep | AddNodeMarkStep;
20
20
  doc: JSONDocNode;
21
21
  /** The list of types of all inline nodes, which were wrapped by annotation. */
22
22
  inlineNodeTypes?: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "104.1.2",
3
+ "version": "104.1.3",
4
4
  "description": "A package that contains common classes and components for editor and renderer",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"