@atlaskit/editor-common 76.31.0 → 76.32.0

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-common
2
2
 
3
+ ## 76.32.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#63540](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/63540) [`f90baf9336e6`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/f90baf9336e6) - [ux] EDF-52: Hide quickInsert AI items based on AI config item isVisible handler (such as when documents are empty). This change is behind the platform flag platform.editor.ai-dynamic-show-hide-quick-insert-items_4ie8s (since it depends on adoption of a corresponding editor-common version to be enabled).
8
+
3
9
  ## 76.31.0
4
10
 
5
11
  ### Minor Changes
@@ -16,7 +16,7 @@ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "functio
16
16
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
17
17
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
18
18
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
19
- var packageVersion = "76.31.0";
19
+ var packageVersion = "76.32.0";
20
20
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
21
21
  // Remove URL as it has UGC
22
22
  // TODO: Sanitise the URL instead of just removing it
@@ -10,14 +10,29 @@ var _fuse = _interopRequireDefault(require("fuse.js"));
10
10
  var _memoizeOne = _interopRequireDefault(require("memoize-one"));
11
11
  var processQuickInsertItems = function processQuickInsertItems(items, intl) {
12
12
  return items.reduce(function (acc, item) {
13
- if (typeof item === 'function') {
13
+ if (typeof item === 'function' &&
14
+ // we preserve handler items with disableMemo so that we
15
+ // can process them in a later step outside of memoizations
16
+ !item.disableMemo) {
14
17
  var quickInsertItems = item(intl);
15
18
  return acc.concat(quickInsertItems);
16
19
  }
17
20
  return acc.concat(item);
18
21
  }, []);
19
22
  };
20
- var memoProcessQuickInsertItems = exports.memoProcessQuickInsertItems = (0, _memoizeOne.default)(processQuickInsertItems);
23
+ var memoizedProcessQuickInsertItems = (0, _memoizeOne.default)(processQuickInsertItems);
24
+ var memoProcessQuickInsertItems = exports.memoProcessQuickInsertItems = function memoProcessQuickInsertItems(items, intl) {
25
+ var memoizedResults = memoizedProcessQuickInsertItems(items, intl);
26
+ var hasDisabledMemos = items.some(function (item) {
27
+ return typeof item === 'function' && item.disableMemo;
28
+ });
29
+ if (!hasDisabledMemos) {
30
+ return memoizedResults;
31
+ }
32
+ return memoizedResults.flatMap(function (item) {
33
+ return typeof item === 'function' && item.disableMemo ? item(intl) : item;
34
+ });
35
+ };
21
36
  var options = {
22
37
  threshold: 0.3,
23
38
  keys: [{
@@ -22,7 +22,7 @@ var _templateObject, _templateObject2, _templateObject3;
22
22
  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); }; }
23
23
  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 */
24
24
  var packageName = "@atlaskit/editor-common";
25
- var packageVersion = "76.31.0";
25
+ var packageVersion = "76.32.0";
26
26
  var halfFocusRing = 1;
27
27
  var dropOffset = '0, 8';
28
28
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,6 +1,6 @@
1
1
  const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
2
2
  const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
3
- const packageVersion = "76.31.0";
3
+ const packageVersion = "76.32.0";
4
4
  const sanitiseSentryEvents = (data, _hint) => {
5
5
  // Remove URL as it has UGC
6
6
  // TODO: Sanitise the URL instead of just removing it
@@ -2,14 +2,25 @@ import Fuse from 'fuse.js';
2
2
  import memoizeOne from 'memoize-one';
3
3
  const processQuickInsertItems = (items, intl) => {
4
4
  return items.reduce((acc, item) => {
5
- if (typeof item === 'function') {
5
+ if (typeof item === 'function' &&
6
+ // we preserve handler items with disableMemo so that we
7
+ // can process them in a later step outside of memoizations
8
+ !item.disableMemo) {
6
9
  const quickInsertItems = item(intl);
7
10
  return acc.concat(quickInsertItems);
8
11
  }
9
12
  return acc.concat(item);
10
13
  }, []);
11
14
  };
12
- export const memoProcessQuickInsertItems = memoizeOne(processQuickInsertItems);
15
+ const memoizedProcessQuickInsertItems = memoizeOne(processQuickInsertItems);
16
+ export const memoProcessQuickInsertItems = (items, intl) => {
17
+ const memoizedResults = memoizedProcessQuickInsertItems(items, intl);
18
+ const hasDisabledMemos = items.some(item => typeof item === 'function' && item.disableMemo);
19
+ if (!hasDisabledMemos) {
20
+ return memoizedResults;
21
+ }
22
+ return memoizedResults.flatMap(item => typeof item === 'function' && item.disableMemo ? item(intl) : item);
23
+ };
13
24
  const options = {
14
25
  threshold: 0.3,
15
26
  keys: [{
@@ -7,7 +7,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
7
7
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
8
8
  import Layer from '../Layer';
9
9
  const packageName = "@atlaskit/editor-common";
10
- const packageVersion = "76.31.0";
10
+ const packageVersion = "76.32.0";
11
11
  const halfFocusRing = 1;
12
12
  const dropOffset = '0, 8';
13
13
  class DropList extends Component {
@@ -6,7 +6,7 @@ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbol
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
8
8
  var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
9
- var packageVersion = "76.31.0";
9
+ var packageVersion = "76.32.0";
10
10
  var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
11
11
  // Remove URL as it has UGC
12
12
  // TODO: Sanitise the URL instead of just removing it
@@ -2,14 +2,29 @@ import Fuse from 'fuse.js';
2
2
  import memoizeOne from 'memoize-one';
3
3
  var processQuickInsertItems = function processQuickInsertItems(items, intl) {
4
4
  return items.reduce(function (acc, item) {
5
- if (typeof item === 'function') {
5
+ if (typeof item === 'function' &&
6
+ // we preserve handler items with disableMemo so that we
7
+ // can process them in a later step outside of memoizations
8
+ !item.disableMemo) {
6
9
  var quickInsertItems = item(intl);
7
10
  return acc.concat(quickInsertItems);
8
11
  }
9
12
  return acc.concat(item);
10
13
  }, []);
11
14
  };
12
- export var memoProcessQuickInsertItems = memoizeOne(processQuickInsertItems);
15
+ var memoizedProcessQuickInsertItems = memoizeOne(processQuickInsertItems);
16
+ export var memoProcessQuickInsertItems = function memoProcessQuickInsertItems(items, intl) {
17
+ var memoizedResults = memoizedProcessQuickInsertItems(items, intl);
18
+ var hasDisabledMemos = items.some(function (item) {
19
+ return typeof item === 'function' && item.disableMemo;
20
+ });
21
+ if (!hasDisabledMemos) {
22
+ return memoizedResults;
23
+ }
24
+ return memoizedResults.flatMap(function (item) {
25
+ return typeof item === 'function' && item.disableMemo ? item(intl) : item;
26
+ });
27
+ };
13
28
  var options = {
14
29
  threshold: 0.3,
15
30
  keys: [{
@@ -17,7 +17,7 @@ import { createAndFireEvent, withAnalyticsContext, withAnalyticsEvents } from '@
17
17
  import { N0, N50A, N60A, N900 } from '@atlaskit/theme/colors';
18
18
  import Layer from '../Layer';
19
19
  var packageName = "@atlaskit/editor-common";
20
- var packageVersion = "76.31.0";
20
+ var packageVersion = "76.32.0";
21
21
  var halfFocusRing = 1;
22
22
  var dropOffset = '0, 8';
23
23
  var DropList = /*#__PURE__*/function (_Component) {
@@ -1,8 +1,7 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { QuickInsertItem } from '../provider-factory';
3
3
  import type { QuickInsertHandler } from '../types';
4
- declare const processQuickInsertItems: (items: Array<QuickInsertHandler | QuickInsertItem>, intl: IntlShape) => QuickInsertItem[];
5
- export declare const memoProcessQuickInsertItems: typeof processQuickInsertItems;
4
+ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandler>, intl: IntlShape) => QuickInsertItem[];
6
5
  /**
7
6
  * This function is used to find and sort QuickInsertItems based on a given query string.
8
7
  *
@@ -12,4 +11,3 @@ export declare const memoProcessQuickInsertItems: typeof processQuickInsertItems
12
11
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
13
12
  */
14
13
  export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
15
- export {};
@@ -48,7 +48,7 @@ export type { TOOLBAR_MENU_TYPE } from './insert-block';
48
48
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
49
49
  export type { LayoutPluginOptions } from './layout';
50
50
  export type { LongPressSelectionPluginOptions } from './selection';
51
- export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, } from './quick-insert';
51
+ export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, QuickInsertHandlerFn, } from './quick-insert';
52
52
  export type { Refs, RefsNode, DocBuilder } from './doc-builder';
53
53
  export type { SelectionToolbarGroup, SelectionToolbarHandler, } from './selection-toolbar';
54
54
  export type { FeedbackInfo } from './feedback-dialog';
@@ -4,7 +4,10 @@ import type { EmptyStateHandler } from './empty-state-handler';
4
4
  export type QuickInsertOptions = boolean | {
5
5
  provider: Promise<QuickInsertProvider>;
6
6
  };
7
- export type QuickInsertHandler = Array<QuickInsertItem> | ((intl: IntlShape) => Array<QuickInsertItem>);
7
+ export type QuickInsertHandlerFn = ((intl: IntlShape) => Array<QuickInsertItem>) & {
8
+ disableMemo?: boolean;
9
+ };
10
+ export type QuickInsertHandler = Array<QuickInsertItem> | QuickInsertHandlerFn;
8
11
  export type IconProps = {
9
12
  label?: string;
10
13
  };
@@ -1,8 +1,7 @@
1
1
  import type { IntlShape } from 'react-intl-next';
2
2
  import type { QuickInsertItem } from '../provider-factory';
3
3
  import type { QuickInsertHandler } from '../types';
4
- declare const processQuickInsertItems: (items: Array<QuickInsertHandler | QuickInsertItem>, intl: IntlShape) => QuickInsertItem[];
5
- export declare const memoProcessQuickInsertItems: typeof processQuickInsertItems;
4
+ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandler>, intl: IntlShape) => QuickInsertItem[];
6
5
  /**
7
6
  * This function is used to find and sort QuickInsertItems based on a given query string.
8
7
  *
@@ -12,4 +11,3 @@ export declare const memoProcessQuickInsertItems: typeof processQuickInsertItems
12
11
  * @returns {QuickInsertItem[]} - Returns a sorted array of QuickInsertItems based on the priority. If the query string is empty, it will return the array sorted by priority. If a query string is provided, it will return an array of QuickInsertItems that match the query string, sorted by relevance to the query.
13
12
  */
14
13
  export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
15
- export {};
@@ -48,7 +48,7 @@ export type { TOOLBAR_MENU_TYPE } from './insert-block';
48
48
  export type { TextFormattingOptions, TextFormattingState, InputMethodToolbar, InputMethodBasic, } from './text-formatting';
49
49
  export type { LayoutPluginOptions } from './layout';
50
50
  export type { LongPressSelectionPluginOptions } from './selection';
51
- export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, } from './quick-insert';
51
+ export type { QuickInsertPluginState, QuickInsertPluginStateKeys, QuickInsertOptions, QuickInsertPluginOptions, QuickInsertSearchOptions, QuickInsertSharedState, QuickInsertHandler, QuickInsertHandlerFn, } from './quick-insert';
52
52
  export type { Refs, RefsNode, DocBuilder } from './doc-builder';
53
53
  export type { SelectionToolbarGroup, SelectionToolbarHandler, } from './selection-toolbar';
54
54
  export type { FeedbackInfo } from './feedback-dialog';
@@ -4,7 +4,10 @@ import type { EmptyStateHandler } from './empty-state-handler';
4
4
  export type QuickInsertOptions = boolean | {
5
5
  provider: Promise<QuickInsertProvider>;
6
6
  };
7
- export type QuickInsertHandler = Array<QuickInsertItem> | ((intl: IntlShape) => Array<QuickInsertItem>);
7
+ export type QuickInsertHandlerFn = ((intl: IntlShape) => Array<QuickInsertItem>) & {
8
+ disableMemo?: boolean;
9
+ };
10
+ export type QuickInsertHandler = Array<QuickInsertItem> | QuickInsertHandlerFn;
8
11
  export type IconProps = {
9
12
  label?: string;
10
13
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-common",
3
- "version": "76.31.0",
3
+ "version": "76.32.0",
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/"