@atlaskit/editor-common 94.0.0 → 94.1.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 +9 -0
- package/afm-jira/tsconfig.json +0 -3
- package/afm-post-office/tsconfig.json +0 -3
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/quick-insert/utils.js +10 -2
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/quick-insert/utils.js +9 -2
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/quick-insert/utils.js +10 -2
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/types/quick-insert/utils.d.ts +2 -1
- package/dist/types/types/quick-insert.d.ts +7 -1
- package/dist/types-ts4.5/quick-insert/utils.d.ts +2 -1
- package/dist/types-ts4.5/types/quick-insert.d.ts +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# @atlaskit/editor-common
|
|
2
2
|
|
|
3
|
+
## 94.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#154398](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/154398)
|
|
8
|
+
[`ca1591355d790`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/ca1591355d790) -
|
|
9
|
+
[ux] Allows for passing functions to the quickInsert plugin that allow for capturing element
|
|
10
|
+
insertion metrics and then using that data to change the element sort order
|
|
11
|
+
|
|
3
12
|
## 94.0.0
|
|
4
13
|
|
|
5
14
|
### Major Changes
|
package/afm-jira/tsconfig.json
CHANGED
|
@@ -146,9 +146,6 @@
|
|
|
146
146
|
{
|
|
147
147
|
"path": "../../../design-system/tooltip/afm-post-office/tsconfig.json"
|
|
148
148
|
},
|
|
149
|
-
{
|
|
150
|
-
"path": "../../../data/ufo-external/afm-post-office/tsconfig.json"
|
|
151
|
-
},
|
|
152
149
|
{
|
|
153
150
|
"path": "../../../design-system/width-detector/afm-post-office/tsconfig.json"
|
|
154
151
|
},
|
|
@@ -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 = "94.
|
|
20
|
+
var packageVersion = "94.1.0";
|
|
21
21
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
22
22
|
// Remove URL as it has UGC
|
|
23
23
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -6,8 +6,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.find = find;
|
|
8
8
|
exports.memoProcessQuickInsertItems = void 0;
|
|
9
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
10
|
var _fuse = _interopRequireDefault(require("fuse.js"));
|
|
10
11
|
var _memoizeOne = _interopRequireDefault(require("memoize-one"));
|
|
12
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
13
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
11
14
|
var processQuickInsertItems = function processQuickInsertItems(items, intl) {
|
|
12
15
|
return items.reduce(function (acc, item) {
|
|
13
16
|
if (typeof item === 'function' &&
|
|
@@ -35,6 +38,7 @@ var memoProcessQuickInsertItems = exports.memoProcessQuickInsertItems = function
|
|
|
35
38
|
};
|
|
36
39
|
var options = {
|
|
37
40
|
threshold: 0.3,
|
|
41
|
+
includeScore: true,
|
|
38
42
|
keys: [{
|
|
39
43
|
name: 'title',
|
|
40
44
|
weight: 0.57
|
|
@@ -61,8 +65,12 @@ var options = {
|
|
|
61
65
|
* @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
|
|
62
66
|
* @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.
|
|
63
67
|
*/
|
|
64
|
-
function find(query, items) {
|
|
65
|
-
var
|
|
68
|
+
function find(query, items, prioritySortingFn) {
|
|
69
|
+
var fuseOptions = _objectSpread({}, options);
|
|
70
|
+
if (prioritySortingFn) {
|
|
71
|
+
fuseOptions.sortFn = prioritySortingFn(items);
|
|
72
|
+
}
|
|
73
|
+
var fuse = new _fuse.default(items, fuseOptions);
|
|
66
74
|
if (query === '') {
|
|
67
75
|
// Copy and sort list by priority
|
|
68
76
|
return items.slice(0).sort(function (a, b) {
|
|
@@ -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 = "94.
|
|
27
|
+
var packageVersion = "94.1.0";
|
|
28
28
|
var halfFocusRing = 1;
|
|
29
29
|
var dropOffset = '0, 8';
|
|
30
30
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -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 = "94.
|
|
4
|
+
const packageVersion = "94.1.0";
|
|
5
5
|
const sanitiseSentryEvents = (data, _hint) => {
|
|
6
6
|
// Remove URL as it has UGC
|
|
7
7
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -23,6 +23,7 @@ export const memoProcessQuickInsertItems = (items, intl) => {
|
|
|
23
23
|
};
|
|
24
24
|
const options = {
|
|
25
25
|
threshold: 0.3,
|
|
26
|
+
includeScore: true,
|
|
26
27
|
keys: [{
|
|
27
28
|
name: 'title',
|
|
28
29
|
weight: 0.57
|
|
@@ -49,8 +50,14 @@ const options = {
|
|
|
49
50
|
* @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
|
|
50
51
|
* @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.
|
|
51
52
|
*/
|
|
52
|
-
export function find(query, items) {
|
|
53
|
-
const
|
|
53
|
+
export function find(query, items, prioritySortingFn) {
|
|
54
|
+
const fuseOptions = {
|
|
55
|
+
...options
|
|
56
|
+
};
|
|
57
|
+
if (prioritySortingFn) {
|
|
58
|
+
fuseOptions.sortFn = prioritySortingFn(items);
|
|
59
|
+
}
|
|
60
|
+
const fuse = new Fuse(items, fuseOptions);
|
|
54
61
|
if (query === '') {
|
|
55
62
|
// Copy and sort list by priority
|
|
56
63
|
return items.slice(0).sort((a, b) => (a.priority || Number.POSITIVE_INFINITY) - (b.priority || Number.POSITIVE_INFINITY));
|
|
@@ -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 = "94.
|
|
16
|
+
const packageVersion = "94.1.0";
|
|
17
17
|
const halfFocusRing = 1;
|
|
18
18
|
const dropOffset = '0, 8';
|
|
19
19
|
class DropList extends Component {
|
|
@@ -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 = "94.
|
|
10
|
+
var packageVersion = "94.1.0";
|
|
11
11
|
var sanitiseSentryEvents = function sanitiseSentryEvents(data, _hint) {
|
|
12
12
|
// Remove URL as it has UGC
|
|
13
13
|
// TODO: Sanitise the URL instead of just removing it
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
+
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; }
|
|
1
4
|
import Fuse from 'fuse.js';
|
|
2
5
|
import memoizeOne from 'memoize-one';
|
|
3
6
|
var processQuickInsertItems = function processQuickInsertItems(items, intl) {
|
|
@@ -27,6 +30,7 @@ export var memoProcessQuickInsertItems = function memoProcessQuickInsertItems(it
|
|
|
27
30
|
};
|
|
28
31
|
var options = {
|
|
29
32
|
threshold: 0.3,
|
|
33
|
+
includeScore: true,
|
|
30
34
|
keys: [{
|
|
31
35
|
name: 'title',
|
|
32
36
|
weight: 0.57
|
|
@@ -53,8 +57,12 @@ var options = {
|
|
|
53
57
|
* @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
|
|
54
58
|
* @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.
|
|
55
59
|
*/
|
|
56
|
-
export function find(query, items) {
|
|
57
|
-
var
|
|
60
|
+
export function find(query, items, prioritySortingFn) {
|
|
61
|
+
var fuseOptions = _objectSpread({}, options);
|
|
62
|
+
if (prioritySortingFn) {
|
|
63
|
+
fuseOptions.sortFn = prioritySortingFn(items);
|
|
64
|
+
}
|
|
65
|
+
var fuse = new Fuse(items, fuseOptions);
|
|
58
66
|
if (query === '') {
|
|
59
67
|
// Copy and sort list by priority
|
|
60
68
|
return items.slice(0).sort(function (a, b) {
|
|
@@ -21,7 +21,7 @@ import withAnalyticsContext from '@atlaskit/analytics-next/withAnalyticsContext'
|
|
|
21
21
|
import withAnalyticsEvents from '@atlaskit/analytics-next/withAnalyticsEvents';
|
|
22
22
|
import Layer from '../Layer';
|
|
23
23
|
var packageName = "@atlaskit/editor-common";
|
|
24
|
-
var packageVersion = "94.
|
|
24
|
+
var packageVersion = "94.1.0";
|
|
25
25
|
var halfFocusRing = 1;
|
|
26
26
|
var dropOffset = '0, 8';
|
|
27
27
|
var DropList = /*#__PURE__*/function (_Component) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
1
2
|
import type { IntlShape } from 'react-intl-next';
|
|
2
3
|
import type { QuickInsertItem } from '../provider-factory';
|
|
3
4
|
import type { QuickInsertHandler } from '../types';
|
|
@@ -10,4 +11,4 @@ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandl
|
|
|
10
11
|
* @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
|
|
11
12
|
* @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.
|
|
12
13
|
*/
|
|
13
|
-
export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
|
|
14
|
+
export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction): QuickInsertItem[];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type Fuse from 'fuse.js';
|
|
1
2
|
import type { IntlShape } from 'react-intl-next';
|
|
2
3
|
import type { QuickInsertItem, QuickInsertProvider } from '../provider-factory';
|
|
3
4
|
import type { EmptyStateHandler } from './empty-state-handler';
|
|
4
5
|
export type QuickInsertOptions = boolean | {
|
|
5
|
-
provider
|
|
6
|
+
provider?: Promise<QuickInsertProvider>;
|
|
7
|
+
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
|
|
8
|
+
onInsert?: (item: QuickInsertItem) => void;
|
|
6
9
|
};
|
|
7
10
|
export type QuickInsertHandlerFn = ((intl: IntlShape) => Array<QuickInsertItem>) & {
|
|
8
11
|
disableMemo?: boolean;
|
|
@@ -16,6 +19,7 @@ export type QuickInsertSearchOptions = {
|
|
|
16
19
|
category?: string;
|
|
17
20
|
disableDefaultItems?: boolean;
|
|
18
21
|
featuredItems?: boolean;
|
|
22
|
+
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
|
|
19
23
|
};
|
|
20
24
|
export type QuickInsertPluginState = {
|
|
21
25
|
isElementBrowserModalOpen: boolean;
|
|
@@ -32,6 +36,8 @@ export interface QuickInsertPluginOptions {
|
|
|
32
36
|
enableElementBrowser?: boolean;
|
|
33
37
|
elementBrowserHelpUrl?: string;
|
|
34
38
|
emptyStateHandler?: EmptyStateHandler;
|
|
39
|
+
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
|
|
40
|
+
onInsert?: (item: QuickInsertItem) => void;
|
|
35
41
|
}
|
|
36
42
|
export type QuickInsertSharedState = {
|
|
37
43
|
lazyDefaultItems: () => QuickInsertItem[];
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import Fuse from 'fuse.js';
|
|
1
2
|
import type { IntlShape } from 'react-intl-next';
|
|
2
3
|
import type { QuickInsertItem } from '../provider-factory';
|
|
3
4
|
import type { QuickInsertHandler } from '../types';
|
|
@@ -10,4 +11,4 @@ export declare const memoProcessQuickInsertItems: (items: Array<QuickInsertHandl
|
|
|
10
11
|
* @param {QuickInsertItem[]} items - An array of QuickInsertItems to be searched.
|
|
11
12
|
* @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.
|
|
12
13
|
*/
|
|
13
|
-
export declare function find(query: string, items: QuickInsertItem[]): QuickInsertItem[];
|
|
14
|
+
export declare function find(query: string, items: QuickInsertItem[], prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction): QuickInsertItem[];
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import type Fuse from 'fuse.js';
|
|
1
2
|
import type { IntlShape } from 'react-intl-next';
|
|
2
3
|
import type { QuickInsertItem, QuickInsertProvider } from '../provider-factory';
|
|
3
4
|
import type { EmptyStateHandler } from './empty-state-handler';
|
|
4
5
|
export type QuickInsertOptions = boolean | {
|
|
5
|
-
provider
|
|
6
|
+
provider?: Promise<QuickInsertProvider>;
|
|
7
|
+
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
|
|
8
|
+
onInsert?: (item: QuickInsertItem) => void;
|
|
6
9
|
};
|
|
7
10
|
export type QuickInsertHandlerFn = ((intl: IntlShape) => Array<QuickInsertItem>) & {
|
|
8
11
|
disableMemo?: boolean;
|
|
@@ -16,6 +19,7 @@ export type QuickInsertSearchOptions = {
|
|
|
16
19
|
category?: string;
|
|
17
20
|
disableDefaultItems?: boolean;
|
|
18
21
|
featuredItems?: boolean;
|
|
22
|
+
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
|
|
19
23
|
};
|
|
20
24
|
export type QuickInsertPluginState = {
|
|
21
25
|
isElementBrowserModalOpen: boolean;
|
|
@@ -32,6 +36,8 @@ export interface QuickInsertPluginOptions {
|
|
|
32
36
|
enableElementBrowser?: boolean;
|
|
33
37
|
elementBrowserHelpUrl?: string;
|
|
34
38
|
emptyStateHandler?: EmptyStateHandler;
|
|
39
|
+
prioritySortingFn?: (items: QuickInsertItem[]) => Fuse.FuseSortFunction;
|
|
40
|
+
onInsert?: (item: QuickInsertItem) => void;
|
|
35
41
|
}
|
|
36
42
|
export type QuickInsertSharedState = {
|
|
37
43
|
lazyDefaultItems: () => QuickInsertItem[];
|
package/package.json
CHANGED