@atlaskit/editor-plugin-annotation 7.1.25 → 8.0.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,17 @@
1
1
  # @atlaskit/editor-plugin-annotation
2
2
 
3
+ ## 8.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies
8
+
9
+ ## 8.0.0
10
+
11
+ ### Patch Changes
12
+
13
+ - Updated dependencies
14
+
3
15
  ## 7.1.25
4
16
 
5
17
  ### Patch Changes
@@ -166,7 +166,7 @@ var addDeleteAnalytics = function addDeleteAnalytics(editorAnalyticsAPI) {
166
166
  return transaction;
167
167
  };
168
168
  };
169
- var _default = exports.default = {
169
+ var _default_1 = {
170
170
  addAnnotationMark: addAnnotationMark,
171
171
  addInlineComment: addInlineComment,
172
172
  handleDraftState: handleDraftState,
@@ -175,4 +175,5 @@ var _default = exports.default = {
175
175
  addResolveAnalytics: addResolveAnalytics,
176
176
  addPreemptiveGateErrorAnalytics: addPreemptiveGateErrorAnalytics,
177
177
  addDeleteAnalytics: addDeleteAnalytics
178
- };
178
+ };
179
+ var _default = exports.default = _default_1;
@@ -215,44 +215,44 @@ var getDocChangedHandler = function getDocChangedHandler(tr, prevPluginState) {
215
215
  }
216
216
  return handleDocChanged(tr, prevPluginState);
217
217
  };
218
- var _pluginFactory = (0, _utils.pluginFactory)(_utils2.inlineCommentPluginKey, _reducer.default, {
219
- onSelectionChanged: getSelectionChangedHandler(true),
220
- onDocChanged: getDocChangedHandler,
221
- mapping: function mapping(tr, pluginState, editorState) {
222
- var draftDecorationSet = pluginState.draftDecorationSet,
223
- bookmark = pluginState.bookmark;
224
- var mappedDecorationSet = _view.DecorationSet.empty,
225
- mappedBookmark;
226
- var hasMappedDecorations = false;
227
- if (draftDecorationSet) {
228
- mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
229
- }
230
- hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, function (spec) {
231
- return Object.values(_utils2.decorationKey).includes(spec.key);
232
- }).length > 0;
233
-
234
- // When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
235
- // we need to reset bookmark to hide create component and to avoid invalid draft being published
236
- // We only perform this change when document selection has changed.
237
- if (!hasMappedDecorations && shouldClearBookMarkCheck(tr, editorState, bookmark)) {
238
- return _objectSpread(_objectSpread({}, pluginState), {}, {
239
- draftDecorationSet: mappedDecorationSet,
240
- bookmark: undefined
241
- });
242
- }
243
- if (bookmark) {
244
- mappedBookmark = bookmark.map(tr.mapping);
245
- }
218
+ var dest = (0, _utils.pluginFactory)(_utils2.inlineCommentPluginKey, _reducer.default, {
219
+ onSelectionChanged: getSelectionChangedHandler(true),
220
+ onDocChanged: getDocChangedHandler,
221
+ mapping: function mapping(tr, pluginState, editorState) {
222
+ var draftDecorationSet = pluginState.draftDecorationSet,
223
+ bookmark = pluginState.bookmark;
224
+ var mappedDecorationSet = _view.DecorationSet.empty,
225
+ mappedBookmark;
226
+ var hasMappedDecorations = false;
227
+ if (draftDecorationSet) {
228
+ mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
229
+ }
230
+ hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, function (spec) {
231
+ return Object.values(_utils2.decorationKey).includes(spec.key);
232
+ }).length > 0;
246
233
 
247
- // return same pluginState if mappings did not change
248
- if (mappedBookmark === bookmark && mappedDecorationSet === draftDecorationSet) {
249
- return pluginState;
250
- }
234
+ // When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
235
+ // we need to reset bookmark to hide create component and to avoid invalid draft being published
236
+ // We only perform this change when document selection has changed.
237
+ if (!hasMappedDecorations && shouldClearBookMarkCheck(tr, editorState, bookmark)) {
251
238
  return _objectSpread(_objectSpread({}, pluginState), {}, {
252
239
  draftDecorationSet: mappedDecorationSet,
253
- bookmark: mappedBookmark
240
+ bookmark: undefined
254
241
  });
255
242
  }
256
- }),
257
- createPluginState = exports.createPluginState = _pluginFactory.createPluginState,
258
- createCommand = exports.createCommand = _pluginFactory.createCommand;
243
+ if (bookmark) {
244
+ mappedBookmark = bookmark.map(tr.mapping);
245
+ }
246
+
247
+ // return same pluginState if mappings did not change
248
+ if (mappedBookmark === bookmark && mappedDecorationSet === draftDecorationSet) {
249
+ return pluginState;
250
+ }
251
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
252
+ draftDecorationSet: mappedDecorationSet,
253
+ bookmark: mappedBookmark
254
+ });
255
+ }
256
+ });
257
+ var createPluginState = exports.createPluginState = dest.createPluginState;
258
+ var createCommand = exports.createCommand = dest.createCommand;
@@ -133,7 +133,7 @@ const addDeleteAnalytics = editorAnalyticsAPI => (transaction, state) => {
133
133
  editorAnalyticsAPI === null || editorAnalyticsAPI === void 0 ? void 0 : editorAnalyticsAPI.attachAnalyticsEvent(analyticsEvent)(transaction);
134
134
  return transaction;
135
135
  };
136
- export default {
136
+ const _default_1 = {
137
137
  addAnnotationMark,
138
138
  addInlineComment,
139
139
  handleDraftState,
@@ -142,4 +142,5 @@ export default {
142
142
  addResolveAnalytics,
143
143
  addPreemptiveGateErrorAnalytics,
144
144
  addDeleteAnalytics
145
- };
145
+ };
146
+ export default _default_1;
@@ -214,10 +214,7 @@ const getDocChangedHandler = (tr, prevPluginState) => {
214
214
  }
215
215
  return handleDocChanged(tr, prevPluginState);
216
216
  };
217
- export const {
218
- createPluginState,
219
- createCommand
220
- } = pluginFactory(inlineCommentPluginKey, reducer, {
217
+ const dest = pluginFactory(inlineCommentPluginKey, reducer, {
221
218
  onSelectionChanged: getSelectionChangedHandler(true),
222
219
  onDocChanged: getDocChangedHandler,
223
220
  mapping: (tr, pluginState, editorState) => {
@@ -257,4 +254,6 @@ export const {
257
254
  bookmark: mappedBookmark
258
255
  };
259
256
  }
260
- });
257
+ });
258
+ export const createPluginState = dest.createPluginState;
259
+ export const createCommand = dest.createCommand;
@@ -160,7 +160,7 @@ var addDeleteAnalytics = function addDeleteAnalytics(editorAnalyticsAPI) {
160
160
  return transaction;
161
161
  };
162
162
  };
163
- export default {
163
+ var _default_1 = {
164
164
  addAnnotationMark: addAnnotationMark,
165
165
  addInlineComment: addInlineComment,
166
166
  handleDraftState: handleDraftState,
@@ -169,4 +169,5 @@ export default {
169
169
  addResolveAnalytics: addResolveAnalytics,
170
170
  addPreemptiveGateErrorAnalytics: addPreemptiveGateErrorAnalytics,
171
171
  addDeleteAnalytics: addDeleteAnalytics
172
- };
172
+ };
173
+ export default _default_1;
@@ -208,45 +208,44 @@ var getDocChangedHandler = function getDocChangedHandler(tr, prevPluginState) {
208
208
  }
209
209
  return handleDocChanged(tr, prevPluginState);
210
210
  };
211
- var _pluginFactory = pluginFactory(inlineCommentPluginKey, reducer, {
212
- onSelectionChanged: getSelectionChangedHandler(true),
213
- onDocChanged: getDocChangedHandler,
214
- mapping: function mapping(tr, pluginState, editorState) {
215
- var draftDecorationSet = pluginState.draftDecorationSet,
216
- bookmark = pluginState.bookmark;
217
- var mappedDecorationSet = DecorationSet.empty,
218
- mappedBookmark;
219
- var hasMappedDecorations = false;
220
- if (draftDecorationSet) {
221
- mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
222
- }
223
- hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, function (spec) {
224
- return Object.values(decorationKey).includes(spec.key);
225
- }).length > 0;
226
-
227
- // When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
228
- // we need to reset bookmark to hide create component and to avoid invalid draft being published
229
- // We only perform this change when document selection has changed.
230
- if (!hasMappedDecorations && shouldClearBookMarkCheck(tr, editorState, bookmark)) {
231
- return _objectSpread(_objectSpread({}, pluginState), {}, {
232
- draftDecorationSet: mappedDecorationSet,
233
- bookmark: undefined
234
- });
235
- }
236
- if (bookmark) {
237
- mappedBookmark = bookmark.map(tr.mapping);
238
- }
211
+ var dest = pluginFactory(inlineCommentPluginKey, reducer, {
212
+ onSelectionChanged: getSelectionChangedHandler(true),
213
+ onDocChanged: getDocChangedHandler,
214
+ mapping: function mapping(tr, pluginState, editorState) {
215
+ var draftDecorationSet = pluginState.draftDecorationSet,
216
+ bookmark = pluginState.bookmark;
217
+ var mappedDecorationSet = DecorationSet.empty,
218
+ mappedBookmark;
219
+ var hasMappedDecorations = false;
220
+ if (draftDecorationSet) {
221
+ mappedDecorationSet = draftDecorationSet.map(tr.mapping, tr.doc);
222
+ }
223
+ hasMappedDecorations = mappedDecorationSet.find(undefined, undefined, function (spec) {
224
+ return Object.values(decorationKey).includes(spec.key);
225
+ }).length > 0;
239
226
 
240
- // return same pluginState if mappings did not change
241
- if (mappedBookmark === bookmark && mappedDecorationSet === draftDecorationSet) {
242
- return pluginState;
243
- }
227
+ // When changes to decoration target make decoration invalid (e.g. delete text, add mark to node),
228
+ // we need to reset bookmark to hide create component and to avoid invalid draft being published
229
+ // We only perform this change when document selection has changed.
230
+ if (!hasMappedDecorations && shouldClearBookMarkCheck(tr, editorState, bookmark)) {
244
231
  return _objectSpread(_objectSpread({}, pluginState), {}, {
245
232
  draftDecorationSet: mappedDecorationSet,
246
- bookmark: mappedBookmark
233
+ bookmark: undefined
247
234
  });
248
235
  }
249
- }),
250
- createPluginState = _pluginFactory.createPluginState,
251
- createCommand = _pluginFactory.createCommand;
252
- export { createPluginState, createCommand };
236
+ if (bookmark) {
237
+ mappedBookmark = bookmark.map(tr.mapping);
238
+ }
239
+
240
+ // return same pluginState if mappings did not change
241
+ if (mappedBookmark === bookmark && mappedDecorationSet === draftDecorationSet) {
242
+ return pluginState;
243
+ }
244
+ return _objectSpread(_objectSpread({}, pluginState), {}, {
245
+ draftDecorationSet: mappedDecorationSet,
246
+ bookmark: mappedBookmark
247
+ });
248
+ }
249
+ });
250
+ export var createPluginState = dest.createPluginState;
251
+ export var createCommand = dest.createCommand;
@@ -3,7 +3,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { AnnotationPlugin } from '../annotationPluginType';
5
5
  import type { InlineCommentInputMethod } from '../types';
6
- declare const _default: {
6
+ declare const _default_1: {
7
7
  addAnnotationMark: (id: string, supportedBlockNodes?: string[]) => (transaction: Transaction, state: EditorState) => Transaction;
8
8
  addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, supportedBlockNodes?: string[]) => (transaction: Transaction, state: EditorState) => Transaction;
9
9
  handleDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: InlineCommentInputMethod) => (transaction: Transaction, state: EditorState) => Transaction;
@@ -13,4 +13,4 @@ declare const _default: {
13
13
  addPreemptiveGateErrorAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (errorReason?: string) => (transaction: Transaction, state: EditorState) => Transaction;
14
14
  addDeleteAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
15
15
  };
16
- export default _default;
16
+ export default _default_1;
@@ -1,5 +1,7 @@
1
- import { type EditorState, type ReadonlyTransaction, type SelectionBookmark, type Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { InlineCommentPluginState } from './types';
1
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ import { type EditorState, type ReadonlyTransaction, type SafeStateField, type SelectionBookmark, type Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ import type { InlineCommentPluginState, InlineCommentAction } from './types';
3
5
  /**
4
6
  * We clear bookmark on the following conditions:
5
7
  * 1. if current selection is an empty selection, or
@@ -10,4 +12,5 @@ import type { InlineCommentPluginState } from './types';
10
12
  * @example
11
13
  */
12
14
  export declare const shouldClearBookMarkCheck: (tr: ReadonlyTransaction | Transaction, editorState: EditorState, bookmark?: SelectionBookmark) => boolean;
13
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: InlineCommentPluginState | ((state: EditorState) => InlineCommentPluginState)) => import("prosemirror-state").SafeStateField<InlineCommentPluginState>, createCommand: <A = import("./types").InlineCommentAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => import("@atlaskit/editor-common/types").Command;
15
+ export declare const createPluginState: (dispatch: Dispatch, initialState: InlineCommentPluginState | ((state: EditorState) => InlineCommentPluginState)) => SafeStateField<InlineCommentPluginState>;
16
+ export declare const createCommand: <A = InlineCommentAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => Command;
@@ -3,7 +3,7 @@ import type { ExtractInjectionAPI } from '@atlaskit/editor-common/types';
3
3
  import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
4
4
  import type { AnnotationPlugin } from '../annotationPluginType';
5
5
  import type { InlineCommentInputMethod } from '../types';
6
- declare const _default: {
6
+ declare const _default_1: {
7
7
  addAnnotationMark: (id: string, supportedBlockNodes?: string[]) => (transaction: Transaction, state: EditorState) => Transaction;
8
8
  addInlineComment: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined, editorAPI: ExtractInjectionAPI<AnnotationPlugin> | undefined) => (id: string, supportedBlockNodes?: string[]) => (transaction: Transaction, state: EditorState) => Transaction;
9
9
  handleDraftState: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (drafting: boolean, method?: InlineCommentInputMethod) => (transaction: Transaction, state: EditorState) => Transaction;
@@ -13,4 +13,4 @@ declare const _default: {
13
13
  addPreemptiveGateErrorAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (errorReason?: string) => (transaction: Transaction, state: EditorState) => Transaction;
14
14
  addDeleteAnalytics: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (transaction: Transaction, state: EditorState) => Transaction;
15
15
  };
16
- export default _default;
16
+ export default _default_1;
@@ -1,5 +1,7 @@
1
- import { type EditorState, type ReadonlyTransaction, type SelectionBookmark, type Transaction } from '@atlaskit/editor-prosemirror/state';
2
- import type { InlineCommentPluginState } from './types';
1
+ import type { Dispatch } from '@atlaskit/editor-common/event-dispatcher';
2
+ import type { Command } from '@atlaskit/editor-common/types';
3
+ import { type EditorState, type ReadonlyTransaction, type SafeStateField, type SelectionBookmark, type Transaction } from '@atlaskit/editor-prosemirror/state';
4
+ import type { InlineCommentPluginState, InlineCommentAction } from './types';
3
5
  /**
4
6
  * We clear bookmark on the following conditions:
5
7
  * 1. if current selection is an empty selection, or
@@ -10,4 +12,5 @@ import type { InlineCommentPluginState } from './types';
10
12
  * @example
11
13
  */
12
14
  export declare const shouldClearBookMarkCheck: (tr: ReadonlyTransaction | Transaction, editorState: EditorState, bookmark?: SelectionBookmark) => boolean;
13
- export declare const createPluginState: (dispatch: import("@atlaskit/editor-common/event-dispatcher").Dispatch, initialState: InlineCommentPluginState | ((state: EditorState) => InlineCommentPluginState)) => import("prosemirror-state").SafeStateField<InlineCommentPluginState>, createCommand: <A = import("./types").InlineCommentAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => import("@atlaskit/editor-common/types").Command;
15
+ export declare const createPluginState: (dispatch: Dispatch, initialState: InlineCommentPluginState | ((state: EditorState) => InlineCommentPluginState)) => SafeStateField<InlineCommentPluginState>;
16
+ export declare const createCommand: <A = InlineCommentAction>(action: A | ((state: Readonly<EditorState>) => false | A), transform?: (tr: Transaction, state: EditorState) => Transaction) => Command;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-annotation",
3
- "version": "7.1.25",
3
+ "version": "8.0.1",
4
4
  "description": "Annotation plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -28,23 +28,23 @@
28
28
  "atlaskit:src": "src/index.ts",
29
29
  "dependencies": {
30
30
  "@atlaskit/adf-schema": "^52.2.0",
31
- "@atlaskit/editor-plugin-analytics": "^7.0.0",
32
- "@atlaskit/editor-plugin-connectivity": "^7.0.0",
33
- "@atlaskit/editor-plugin-editor-viewmode-effects": "^7.0.0",
34
- "@atlaskit/editor-plugin-feature-flags": "^6.0.0",
35
- "@atlaskit/editor-plugin-toolbar": "^4.1.0",
36
- "@atlaskit/editor-plugin-user-intent": "^5.0.0",
31
+ "@atlaskit/editor-plugin-analytics": "^8.0.0",
32
+ "@atlaskit/editor-plugin-connectivity": "^8.0.0",
33
+ "@atlaskit/editor-plugin-editor-viewmode-effects": "^8.0.0",
34
+ "@atlaskit/editor-plugin-feature-flags": "^7.0.0",
35
+ "@atlaskit/editor-plugin-toolbar": "^5.0.0",
36
+ "@atlaskit/editor-plugin-user-intent": "^6.0.0",
37
37
  "@atlaskit/editor-prosemirror": "^7.3.0",
38
38
  "@atlaskit/editor-toolbar": "^0.19.0",
39
39
  "@atlaskit/editor-toolbar-model": "^0.4.0",
40
40
  "@atlaskit/icon": "^32.0.0",
41
41
  "@atlaskit/platform-feature-flags": "^1.1.0",
42
- "@atlaskit/tmp-editor-statsig": "^35.0.0",
42
+ "@atlaskit/tmp-editor-statsig": "^36.0.0",
43
43
  "@babel/runtime": "^7.0.0",
44
44
  "react-intl-next": "npm:react-intl@^5.18.1"
45
45
  },
46
46
  "peerDependencies": {
47
- "@atlaskit/editor-common": "^111.30.0",
47
+ "@atlaskit/editor-common": "^112.0.0",
48
48
  "react": "^18.2.0",
49
49
  "react-dom": "^18.2.0"
50
50
  },