@atlaskit/editor-common 102.11.0 → 102.11.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,15 @@
1
1
  # @atlaskit/editor-common
2
2
 
3
+ ## 102.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [#128991](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/pull-requests/128991)
8
+ [`c24ae5545b4ba`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/c24ae5545b4ba) -
9
+ Fix bug where requestDocument was throttling at a module level rather than per editor - this was
10
+ causing issues in products that use multiple editors at the same time.
11
+ - Updated dependencies
12
+
3
13
  ## 102.11.0
4
14
 
5
15
  ### Minor Changes
@@ -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 = "102.11.0";
20
+ var packageVersion = "102.11.1";
21
21
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
22
22
  // Remove URL as it has UGC
23
23
  // Ignored via go/ees007
@@ -13,6 +13,8 @@ var _requestDocument = require("./requestDocument");
13
13
  */
14
14
  var corePlugin = exports.corePlugin = function corePlugin(_ref) {
15
15
  var config = _ref.config;
16
+ // Create the document request throttler per editor (rather than at a module level)
17
+ var scheduleDocumentRequest = (0, _requestDocument.createThrottleSchedule)(_requestDocument.returnDocumentRequest);
16
18
  return {
17
19
  name: 'core',
18
20
  actions: {
@@ -75,7 +77,7 @@ var corePlugin = exports.corePlugin = function corePlugin(_ref) {
75
77
  requestDocument: function requestDocument(onReceive, options) {
76
78
  var _config$getEditorView;
77
79
  var view = (_config$getEditorView = config === null || config === void 0 ? void 0 : config.getEditorView()) !== null && _config$getEditorView !== void 0 ? _config$getEditorView : null;
78
- (0, _requestDocument.scheduleDocumentRequest)(view, onReceive, options === null || options === void 0 ? void 0 : options.transformer, config === null || config === void 0 ? void 0 : config.fireAnalyticsEvent);
80
+ scheduleDocumentRequest(view, onReceive, options === null || options === void 0 ? void 0 : options.transformer, config === null || config === void 0 ? void 0 : config.fireAnalyticsEvent);
79
81
  },
80
82
  createTransformer: function createTransformer(cb) {
81
83
  var _config$getEditorView2;
@@ -4,7 +4,8 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.scheduleDocumentRequest = void 0;
7
+ exports.createThrottleSchedule = createThrottleSchedule;
8
+ exports.returnDocumentRequest = returnDocumentRequest;
8
9
  exports.toJSON = toJSON;
9
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
11
  var _editorJsonTransformer = require("@atlaskit/editor-json-transformer");
@@ -44,7 +45,6 @@ function createThrottleSchedule(callback) {
44
45
  };
45
46
  return wrapperFn;
46
47
  }
47
- var scheduleDocumentRequest = exports.scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
48
48
 
49
49
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
50
50
  function returnDocumentRequest(editorView, callback, transformer, fireAnalyticsEvent) {
@@ -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 = "102.11.0";
26
+ var packageVersion = "102.11.1";
27
27
  var halfFocusRing = 1;
28
28
  var dropOffset = '0, 8';
29
29
  // Ignored via go/ees005
@@ -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 = "102.11.0";
4
+ const packageVersion = "102.11.1";
5
5
  const sanitiseSentryEvents = (data, _hint) => {
6
6
  // Remove URL as it has UGC
7
7
  // Ignored via go/ees007
@@ -1,6 +1,6 @@
1
1
  import { processRawFragmentValue, processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
2
2
  import { editorCommandToPMCommand } from '../editor-commands';
3
- import { scheduleDocumentRequest } from './requestDocument';
3
+ import { createThrottleSchedule, returnDocumentRequest } from './requestDocument';
4
4
 
5
5
  /**
6
6
  * Core plugin that is always included in the preset.
@@ -9,6 +9,8 @@ import { scheduleDocumentRequest } from './requestDocument';
9
9
  export const corePlugin = ({
10
10
  config
11
11
  }) => {
12
+ // Create the document request throttler per editor (rather than at a module level)
13
+ const scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
12
14
  return {
13
15
  name: 'core',
14
16
  actions: {
@@ -9,7 +9,7 @@ export function toJSON(node) {
9
9
  /**
10
10
  * This throttles the callback with requestIdleCallback.
11
11
  */
12
- function createThrottleSchedule(callback) {
12
+ export function createThrottleSchedule(callback) {
13
13
  let frameId;
14
14
  let lastArgs;
15
15
  const wrapperFn = (...args) => {
@@ -32,10 +32,9 @@ function createThrottleSchedule(callback) {
32
32
  };
33
33
  return wrapperFn;
34
34
  }
35
- export const scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
36
35
 
37
36
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
38
- function returnDocumentRequest(editorView, callback, transformer, fireAnalyticsEvent) {
37
+ export function returnDocumentRequest(editorView, callback, transformer, fireAnalyticsEvent) {
39
38
  var _editorView$state;
40
39
  const {
41
40
  doc,
@@ -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 = "102.11.0";
16
+ const packageVersion = "102.11.1";
17
17
  const halfFocusRing = 1;
18
18
  const dropOffset = '0, 8';
19
19
  // Ignored via go/ees005
@@ -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 = "102.11.0";
10
+ var packageVersion = "102.11.1";
11
11
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
12
12
  // Remove URL as it has UGC
13
13
  // Ignored via go/ees007
@@ -1,6 +1,6 @@
1
1
  import { processRawFragmentValue, processRawValue, processRawValueWithoutValidation } from '../../utils/processRawValue';
2
2
  import { editorCommandToPMCommand } from '../editor-commands';
3
- import { scheduleDocumentRequest } from './requestDocument';
3
+ import { createThrottleSchedule, returnDocumentRequest } from './requestDocument';
4
4
 
5
5
  /**
6
6
  * Core plugin that is always included in the preset.
@@ -8,6 +8,8 @@ import { scheduleDocumentRequest } from './requestDocument';
8
8
  */
9
9
  export var corePlugin = function corePlugin(_ref) {
10
10
  var config = _ref.config;
11
+ // Create the document request throttler per editor (rather than at a module level)
12
+ var scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
11
13
  return {
12
14
  name: 'core',
13
15
  actions: {
@@ -10,7 +10,7 @@ export function toJSON(node) {
10
10
  /**
11
11
  * This throttles the callback with requestIdleCallback.
12
12
  */
13
- function createThrottleSchedule(callback) {
13
+ export function createThrottleSchedule(callback) {
14
14
  var frameId;
15
15
  var lastArgs;
16
16
  var wrapperFn = function wrapperFn() {
@@ -36,10 +36,9 @@ function createThrottleSchedule(callback) {
36
36
  };
37
37
  return wrapperFn;
38
38
  }
39
- export var scheduleDocumentRequest = createThrottleSchedule(returnDocumentRequest);
40
39
 
41
40
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
42
- function returnDocumentRequest(editorView, callback, transformer, fireAnalyticsEvent) {
41
+ export function returnDocumentRequest(editorView, callback, transformer, fireAnalyticsEvent) {
43
42
  var _editorView$state;
44
43
  var _ref = (_editorView$state = editorView === null || editorView === void 0 ? void 0 : editorView.state) !== null && _editorView$state !== void 0 ? _editorView$state : {},
45
44
  doc = _ref.doc,
@@ -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 = "102.11.0";
23
+ var packageVersion = "102.11.1";
24
24
  var halfFocusRing = 1;
25
25
  var dropOffset = '0, 8';
26
26
  // Ignored via go/ees005
@@ -2,6 +2,10 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
2
  import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import { type FireAnalyticsCallback } from '../../analytics';
5
- import type { InferTransformerResultCallback, Transformer } from '../../types';
5
+ import type { DefaultTransformerResultCallback, InferTransformerResultCallback, Transformer } from '../../types';
6
6
  export declare function toJSON(node: PMNode): JSONDocNode;
7
- export declare const scheduleDocumentRequest: <GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: InferTransformerResultCallback<Transformer<any>>, transformer?: Transformer<any> | undefined, fireAnalyticsEvent?: FireAnalyticsCallback | undefined) => void;
7
+ /**
8
+ * This throttles the callback with requestIdleCallback.
9
+ */
10
+ export declare function createThrottleSchedule<GenericTransformer extends Transformer<any> = Transformer<JSONDocNode>>(callback: typeof returnDocumentRequest<GenericTransformer>): (editorView: EditorView | null, callback: GenericTransformer extends undefined ? DefaultTransformerResultCallback : InferTransformerResultCallback<GenericTransformer>, transformer?: GenericTransformer | undefined, fireAnalyticsEvent?: FireAnalyticsCallback | undefined) => void;
11
+ export declare function returnDocumentRequest<GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: GenericTransformer extends undefined ? DefaultTransformerResultCallback : InferTransformerResultCallback<GenericTransformer>, transformer?: GenericTransformer, fireAnalyticsEvent?: FireAnalyticsCallback): undefined;
@@ -2,6 +2,10 @@ import type { JSONDocNode } from '@atlaskit/editor-json-transformer';
2
2
  import { Node as PMNode } from '@atlaskit/editor-prosemirror/model';
3
3
  import type { EditorView } from '@atlaskit/editor-prosemirror/view';
4
4
  import { type FireAnalyticsCallback } from '../../analytics';
5
- import type { InferTransformerResultCallback, Transformer } from '../../types';
5
+ import type { DefaultTransformerResultCallback, InferTransformerResultCallback, Transformer } from '../../types';
6
6
  export declare function toJSON(node: PMNode): JSONDocNode;
7
- export declare const scheduleDocumentRequest: <GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: InferTransformerResultCallback<Transformer<any>>, transformer?: Transformer<any> | undefined, fireAnalyticsEvent?: FireAnalyticsCallback | undefined) => void;
7
+ /**
8
+ * This throttles the callback with requestIdleCallback.
9
+ */
10
+ export declare function createThrottleSchedule<GenericTransformer extends Transformer<any> = Transformer<JSONDocNode>>(callback: typeof returnDocumentRequest<GenericTransformer>): (editorView: EditorView | null, callback: GenericTransformer extends undefined ? DefaultTransformerResultCallback : InferTransformerResultCallback<GenericTransformer>, transformer?: GenericTransformer | undefined, fireAnalyticsEvent?: FireAnalyticsCallback | undefined) => void;
11
+ export declare function returnDocumentRequest<GenericTransformer extends Transformer<any> | undefined>(editorView: EditorView | null, callback: GenericTransformer extends undefined ? DefaultTransformerResultCallback : InferTransformerResultCallback<GenericTransformer>, transformer?: GenericTransformer, fireAnalyticsEvent?: FireAnalyticsCallback): undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "102.11.0",
3
+ "version": "102.11.1",
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/"