@atlaskit/editor-common 119.13.1 → 119.14.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 +14 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/is-recommended-item.js +19 -0
- package/dist/cjs/type-ahead/TypeAheadSurfaceContext.js +11 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/is-recommended-item.js +19 -0
- package/dist/es2019/type-ahead/TypeAheadSurfaceContext.js +5 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/is-recommended-item.js +13 -0
- package/dist/esm/type-ahead/TypeAheadSurfaceContext.js +5 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/quick-insert/QuickInsertContext.d.ts +3 -0
- package/dist/types/quick-insert/is-recommended-item.d.ts +8 -0
- package/dist/types/type-ahead/TypeAheadSurfaceContext.d.ts +8 -0
- package/dist/types/type-ahead/index.d.ts +1 -0
- package/dist/types/types/quick-insert.d.ts +2 -0
- package/package.json +2 -2
- package/quick-insert/is-recommended-item/package.json +10 -0
- package/type-ahead-surface-context/package.json +10 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 119.14.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`edcef04b6350e`](https://bitbucket.org/atlassian/atlassian-frontend-monorepo/commits/edcef04b6350e) -
|
|
8
|
+
Add the Quick Insert recommendation resolver API and typed surface context support for the gated
|
|
9
|
+
`platform_editor_slash_command` Recommended menu. TypeAhead uses immutable surface context for
|
|
10
|
+
visibility and React context for registered Quick Insert rendering, while Quick Insert keeps one
|
|
11
|
+
recommendation snapshot per menu open. Fix Quick Insert declaration generation.
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Updated dependencies
|
|
16
|
+
|
|
3
17
|
## 119.13.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -28,7 +28,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
28
28
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
29
29
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
30
30
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
31
|
-
var packageVersion = "119.13.
|
|
31
|
+
var packageVersion = "119.13.1";
|
|
32
32
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
33
33
|
// Remove URL as it has UGC
|
|
34
34
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.defaultIsRecommendedItem = void 0;
|
|
8
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
+
var _keys = require("./keys");
|
|
10
|
+
/** Resolves an item's recommendation rank, or excludes it with `null`. */
|
|
11
|
+
|
|
12
|
+
var defaultRanks = (0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)((0, _defineProperty2.default)({}, _keys.ASK_ROVO_MENU_ITEM.key, 0), _keys.HYPERLINK_MENU_ITEM.key, 1), _keys.MEDIA_INSERT_MENU_ITEM.key, 2), _keys.EMOJI_MENU_ITEM.key, 3), _keys.MENTION_MENU_ITEM.key, 4);
|
|
13
|
+
|
|
14
|
+
/** Default Quick Insert recommendations in their intended display order. */
|
|
15
|
+
var defaultIsRecommendedItem = exports.defaultIsRecommendedItem = function defaultIsRecommendedItem(_ref) {
|
|
16
|
+
var _defaultRanks$itemKey;
|
|
17
|
+
var itemKey = _ref.itemKey;
|
|
18
|
+
return (_defaultRanks$itemKey = defaultRanks[itemKey]) !== null && _defaultRanks$itemKey !== void 0 ? _defaultRanks$itemKey : null;
|
|
19
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.TYPE_AHEAD_SURFACE_CONTEXT = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Immutable context used while resolving a TypeAhead surface.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
var TYPE_AHEAD_SURFACE_CONTEXT = exports.TYPE_AHEAD_SURFACE_CONTEXT = Symbol('type-ahead-surface-context');
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.
|
|
|
24
24
|
* @jsx jsx
|
|
25
25
|
*/ // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
|
|
26
26
|
var packageName = "@atlaskit/editor-common";
|
|
27
|
-
var packageVersion = "119.13.
|
|
27
|
+
var packageVersion = "119.13.1";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var fadeIn = (0, _react2.keyframes)({
|
|
@@ -14,7 +14,7 @@ const NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
14
14
|
const RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
15
15
|
const SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
16
16
|
const packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
17
|
-
const packageVersion = "119.13.
|
|
17
|
+
const packageVersion = "119.13.1";
|
|
18
18
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
19
19
|
// Remove URL as it has UGC
|
|
20
20
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ASK_ROVO_MENU_ITEM, EMOJI_MENU_ITEM, HYPERLINK_MENU_ITEM, MEDIA_INSERT_MENU_ITEM, MENTION_MENU_ITEM } from './keys';
|
|
2
|
+
|
|
3
|
+
/** Resolves an item's recommendation rank, or excludes it with `null`. */
|
|
4
|
+
|
|
5
|
+
const defaultRanks = {
|
|
6
|
+
[ASK_ROVO_MENU_ITEM.key]: 0,
|
|
7
|
+
[HYPERLINK_MENU_ITEM.key]: 1,
|
|
8
|
+
[MEDIA_INSERT_MENU_ITEM.key]: 2,
|
|
9
|
+
[EMOJI_MENU_ITEM.key]: 3,
|
|
10
|
+
[MENTION_MENU_ITEM.key]: 4
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
/** Default Quick Insert recommendations in their intended display order. */
|
|
14
|
+
export const defaultIsRecommendedItem = ({
|
|
15
|
+
itemKey
|
|
16
|
+
}) => {
|
|
17
|
+
var _defaultRanks$itemKey;
|
|
18
|
+
return (_defaultRanks$itemKey = defaultRanks[itemKey]) !== null && _defaultRanks$itemKey !== void 0 ? _defaultRanks$itemKey : null;
|
|
19
|
+
};
|
|
@@ -14,7 +14,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
14
14
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
15
15
|
import Layer from '../Layer';
|
|
16
16
|
const packageName = "@atlaskit/editor-common";
|
|
17
|
-
const packageVersion = "119.13.
|
|
17
|
+
const packageVersion = "119.13.1";
|
|
18
18
|
const halfFocusRing = 1;
|
|
19
19
|
const dropOffset = '0, 8';
|
|
20
20
|
const fadeIn = keyframes({
|
|
@@ -20,7 +20,7 @@ var NETWORK_FAILURE_REGEX = /^network failure/i;
|
|
|
20
20
|
var RESIZE_OBSERVER_LOOP_REGEX = /ResizeObserver loop completed with undelivered notifications/;
|
|
21
21
|
var SENTRY_DSN = 'https://0b10c8e02fb44d8796c047b102c9bee8@o55978.ingest.sentry.io/4505129224110080';
|
|
22
22
|
var packageName = 'editor-common'; // Sentry doesn't accept '/' in its releases https://docs.sentry.io/platforms/javascript/configuration/releases/
|
|
23
|
-
var packageVersion = "119.13.
|
|
23
|
+
var packageVersion = "119.13.1";
|
|
24
24
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
25
25
|
// Remove URL as it has UGC
|
|
26
26
|
// Ignored via go/ees007
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
import { ASK_ROVO_MENU_ITEM, EMOJI_MENU_ITEM, HYPERLINK_MENU_ITEM, MEDIA_INSERT_MENU_ITEM, MENTION_MENU_ITEM } from './keys';
|
|
3
|
+
|
|
4
|
+
/** Resolves an item's recommendation rank, or excludes it with `null`. */
|
|
5
|
+
|
|
6
|
+
var defaultRanks = _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, ASK_ROVO_MENU_ITEM.key, 0), HYPERLINK_MENU_ITEM.key, 1), MEDIA_INSERT_MENU_ITEM.key, 2), EMOJI_MENU_ITEM.key, 3), MENTION_MENU_ITEM.key, 4);
|
|
7
|
+
|
|
8
|
+
/** Default Quick Insert recommendations in their intended display order. */
|
|
9
|
+
export var defaultIsRecommendedItem = function defaultIsRecommendedItem(_ref) {
|
|
10
|
+
var _defaultRanks$itemKey;
|
|
11
|
+
var itemKey = _ref.itemKey;
|
|
12
|
+
return (_defaultRanks$itemKey = defaultRanks[itemKey]) !== null && _defaultRanks$itemKey !== void 0 ? _defaultRanks$itemKey : null;
|
|
13
|
+
};
|
|
@@ -21,7 +21,7 @@ import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
|
21
21
|
import { fg } from '@atlaskit/platform-feature-flags';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "119.13.
|
|
24
|
+
var packageVersion = "119.13.1";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var fadeIn = keyframes({
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Context } from 'react';
|
|
2
2
|
import type { Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
4
|
+
import type { SurfaceContext } from '@atlaskit/editor-ui-control-model/types';
|
|
4
5
|
import type { INPUT_METHOD } from '../analytics';
|
|
5
6
|
import type { TypeAheadInsert } from '../types';
|
|
6
7
|
export type QuickInsertSelectionHandler = (context: {
|
|
@@ -14,6 +15,8 @@ export type QuickInsertContextValue = {
|
|
|
14
15
|
id: string;
|
|
15
16
|
isSelected: boolean;
|
|
16
17
|
};
|
|
18
|
+
menuOpenId?: symbol;
|
|
17
19
|
select: (selectionHandler: QuickInsertSelectionHandler) => void;
|
|
20
|
+
surfaceContext?: SurfaceContext;
|
|
18
21
|
};
|
|
19
22
|
export declare const QuickInsertContext: Context<QuickInsertContextValue | null>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type IsRecommendedItemOptions = {
|
|
2
|
+
itemKey: string;
|
|
3
|
+
};
|
|
4
|
+
/** Resolves an item's recommendation rank, or excludes it with `null`. */
|
|
5
|
+
export type IsRecommendedItemResult = number | null;
|
|
6
|
+
export type IsRecommendedItem = (options: IsRecommendedItemOptions) => IsRecommendedItemResult;
|
|
7
|
+
/** Default Quick Insert recommendations in their intended display order. */
|
|
8
|
+
export declare const defaultIsRecommendedItem: IsRecommendedItem;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ContextToken } from '@atlaskit/editor-ui-control-model/types';
|
|
2
|
+
/**
|
|
3
|
+
* Immutable context used while resolving a TypeAhead surface.
|
|
4
|
+
*/
|
|
5
|
+
export type TypeAheadSurfaceContext = {
|
|
6
|
+
readonly menuOpenId: symbol;
|
|
7
|
+
};
|
|
8
|
+
export declare const TYPE_AHEAD_SURFACE_CONTEXT: ContextToken<TypeAheadSurfaceContext>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type Fuse from 'fuse.js';
|
|
2
2
|
import type { IntlShape } from 'react-intl';
|
|
3
3
|
import type { QuickInsertItem, QuickInsertProvider } from '../provider-factory';
|
|
4
|
+
import type { IsRecommendedItem } from '../quick-insert/is-recommended-item';
|
|
4
5
|
import type { EmptyStateHandler } from './empty-state-handler';
|
|
5
6
|
export type QuickInsertOptions = boolean | {
|
|
6
7
|
disableDefaultItems?: boolean;
|
|
@@ -61,6 +62,7 @@ export interface QuickInsertPluginOptions {
|
|
|
61
62
|
* `/` menu. Used by Markdown Mode to allowlist only items whose
|
|
62
63
|
* underlying node/mark has a clean GFM round-trip.
|
|
63
64
|
*/
|
|
65
|
+
isRecommendedItem?: IsRecommendedItem;
|
|
64
66
|
itemFilter?: (item: QuickInsertItem) => boolean;
|
|
65
67
|
onInsert?: (item: QuickInsertItem) => void;
|
|
66
68
|
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-common",
|
|
3
|
-
"version": "119.
|
|
3
|
+
"version": "119.14.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/"
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"@atlaskit/editor-tables": "^3.0.0",
|
|
50
50
|
"@atlaskit/editor-toolbar": "^2.6.0",
|
|
51
51
|
"@atlaskit/editor-toolbar-model": "^1.2.0",
|
|
52
|
-
"@atlaskit/editor-ui-control-model": "^2.
|
|
52
|
+
"@atlaskit/editor-ui-control-model": "^2.8.0",
|
|
53
53
|
"@atlaskit/emoji": "^72.1.0",
|
|
54
54
|
"@atlaskit/feature-gate-js-client": "^6.0.0",
|
|
55
55
|
"@atlaskit/icon": "^37.5.0",
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/quick-insert/is-recommended-item",
|
|
3
|
+
"main": "../../dist/cjs/quick-insert/is-recommended-item.js",
|
|
4
|
+
"module": "../../dist/esm/quick-insert/is-recommended-item.js",
|
|
5
|
+
"module:es2019": "../../dist/es2019/quick-insert/is-recommended-item.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../../dist/types/quick-insert/is-recommended-item.d.ts"
|
|
10
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-common/type-ahead-surface-context",
|
|
3
|
+
"main": "../dist/cjs/type-ahead/TypeAheadSurfaceContext.js",
|
|
4
|
+
"module": "../dist/esm/type-ahead/TypeAheadSurfaceContext.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/type-ahead/TypeAheadSurfaceContext.js",
|
|
6
|
+
"sideEffects": [
|
|
7
|
+
"**/*.compiled.css"
|
|
8
|
+
],
|
|
9
|
+
"types": "../dist/types/type-ahead/TypeAheadSurfaceContext.d.ts"
|
|
10
|
+
}
|