@atlaskit/editor-core 188.10.4 → 188.10.7
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 +13 -0
- package/dist/cjs/create-editor/ReactEditorView.js +3 -4
- package/dist/cjs/create-editor/create-editor.js +3 -6
- package/dist/cjs/create-editor/feature-flags-from-props.js +7 -9
- package/dist/cjs/labs/next/presets/universal.js +2 -1
- package/dist/cjs/plugins/index.js +0 -7
- package/dist/cjs/utils/performance/instrumented-plugin.js +4 -10
- package/dist/cjs/utils/performance/safer-transactions.js +2 -5
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorView.js +3 -4
- package/dist/es2019/create-editor/create-editor.js +3 -6
- package/dist/es2019/create-editor/feature-flags-from-props.js +7 -9
- package/dist/es2019/labs/next/presets/universal.js +2 -1
- package/dist/es2019/plugins/index.js +0 -1
- package/dist/es2019/utils/performance/instrumented-plugin.js +4 -8
- package/dist/es2019/utils/performance/safer-transactions.js +2 -5
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorView.js +3 -4
- package/dist/esm/create-editor/create-editor.js +3 -6
- package/dist/esm/create-editor/feature-flags-from-props.js +7 -9
- package/dist/esm/labs/next/presets/universal.js +2 -1
- package/dist/esm/plugins/index.js +0 -1
- package/dist/esm/utils/performance/instrumented-plugin.js +4 -10
- package/dist/esm/utils/performance/safer-transactions.js +2 -5
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/plugins/index.d.ts +0 -1
- package/dist/types/plugins/insert-block/types.d.ts +2 -4
- package/dist/types/types/editor-props.d.ts +1 -1
- package/dist/types/utils/performance/instrumented-plugin.d.ts +0 -3
- package/dist/types/utils/performance/safer-transactions.d.ts +1 -2
- package/dist/types-ts4.5/plugins/index.d.ts +0 -1
- package/dist/types-ts4.5/plugins/insert-block/types.d.ts +2 -4
- package/dist/types-ts4.5/types/editor-props.d.ts +1 -1
- package/dist/types-ts4.5/utils/performance/instrumented-plugin.d.ts +0 -3
- package/dist/types-ts4.5/utils/performance/safer-transactions.d.ts +1 -2
- package/package.json +2 -2
- package/report.api.md +1 -9
- package/tmp/api-report-tmp.d.ts +1 -9
- package/dist/cjs/plugins/mentions/analytics.js +0 -157
- package/dist/cjs/plugins/mentions/index.js +0 -142
- package/dist/cjs/plugins/mentions/messages.js +0 -29
- package/dist/cjs/plugins/mentions/nodeviews/mention.js +0 -117
- package/dist/cjs/plugins/mentions/pm-plugins/key.js +0 -8
- package/dist/cjs/plugins/mentions/pm-plugins/main.js +0 -156
- package/dist/cjs/plugins/mentions/pm-plugins/utils.js +0 -23
- package/dist/cjs/plugins/mentions/type-ahead/index.js +0 -362
- package/dist/cjs/plugins/mentions/types.js +0 -5
- package/dist/cjs/plugins/mentions/ui/InviteItem/index.js +0 -76
- package/dist/cjs/plugins/mentions/ui/InviteItem/styles.js +0 -19
- package/dist/cjs/plugins/mentions/ui/Mention/index.js +0 -98
- package/dist/cjs/plugins/mentions/ui/ToolbarMention/index.js +0 -63
- package/dist/cjs/plugins/mentions/utils.js +0 -32
- package/dist/es2019/plugins/mentions/analytics.js +0 -147
- package/dist/es2019/plugins/mentions/index.js +0 -124
- package/dist/es2019/plugins/mentions/messages.js +0 -23
- package/dist/es2019/plugins/mentions/nodeviews/mention.js +0 -80
- package/dist/es2019/plugins/mentions/pm-plugins/key.js +0 -2
- package/dist/es2019/plugins/mentions/pm-plugins/main.js +0 -143
- package/dist/es2019/plugins/mentions/pm-plugins/utils.js +0 -14
- package/dist/es2019/plugins/mentions/type-ahead/index.js +0 -338
- package/dist/es2019/plugins/mentions/types.js +0 -1
- package/dist/es2019/plugins/mentions/ui/InviteItem/index.js +0 -66
- package/dist/es2019/plugins/mentions/ui/InviteItem/styles.js +0 -47
- package/dist/es2019/plugins/mentions/ui/Mention/index.js +0 -71
- package/dist/es2019/plugins/mentions/ui/ToolbarMention/index.js +0 -33
- package/dist/es2019/plugins/mentions/utils.js +0 -20
- package/dist/esm/plugins/mentions/analytics.js +0 -150
- package/dist/esm/plugins/mentions/index.js +0 -130
- package/dist/esm/plugins/mentions/messages.js +0 -23
- package/dist/esm/plugins/mentions/nodeviews/mention.js +0 -107
- package/dist/esm/plugins/mentions/pm-plugins/key.js +0 -2
- package/dist/esm/plugins/mentions/pm-plugins/main.js +0 -148
- package/dist/esm/plugins/mentions/pm-plugins/utils.js +0 -16
- package/dist/esm/plugins/mentions/type-ahead/index.js +0 -350
- package/dist/esm/plugins/mentions/types.js +0 -1
- package/dist/esm/plugins/mentions/ui/InviteItem/index.js +0 -65
- package/dist/esm/plugins/mentions/ui/InviteItem/styles.js +0 -12
- package/dist/esm/plugins/mentions/ui/Mention/index.js +0 -91
- package/dist/esm/plugins/mentions/ui/ToolbarMention/index.js +0 -53
- package/dist/esm/plugins/mentions/utils.js +0 -26
- package/dist/types/plugins/mentions/analytics.d.ts +0 -13
- package/dist/types/plugins/mentions/index.d.ts +0 -19
- package/dist/types/plugins/mentions/messages.d.ts +0 -22
- package/dist/types/plugins/mentions/nodeviews/mention.d.ts +0 -9
- package/dist/types/plugins/mentions/pm-plugins/key.d.ts +0 -3
- package/dist/types/plugins/mentions/pm-plugins/main.d.ts +0 -6
- package/dist/types/plugins/mentions/pm-plugins/utils.d.ts +0 -4
- package/dist/types/plugins/mentions/type-ahead/index.d.ts +0 -17
- package/dist/types/plugins/mentions/types.d.ts +0 -24
- package/dist/types/plugins/mentions/ui/InviteItem/index.d.ts +0 -22
- package/dist/types/plugins/mentions/ui/InviteItem/styles.d.ts +0 -8
- package/dist/types/plugins/mentions/ui/Mention/index.d.ts +0 -19
- package/dist/types/plugins/mentions/ui/ToolbarMention/index.d.ts +0 -13
- package/dist/types/plugins/mentions/utils.d.ts +0 -8
- package/dist/types-ts4.5/plugins/mentions/analytics.d.ts +0 -13
- package/dist/types-ts4.5/plugins/mentions/index.d.ts +0 -22
- package/dist/types-ts4.5/plugins/mentions/messages.d.ts +0 -22
- package/dist/types-ts4.5/plugins/mentions/nodeviews/mention.d.ts +0 -9
- package/dist/types-ts4.5/plugins/mentions/pm-plugins/key.d.ts +0 -3
- package/dist/types-ts4.5/plugins/mentions/pm-plugins/main.d.ts +0 -6
- package/dist/types-ts4.5/plugins/mentions/pm-plugins/utils.d.ts +0 -4
- package/dist/types-ts4.5/plugins/mentions/type-ahead/index.d.ts +0 -17
- package/dist/types-ts4.5/plugins/mentions/types.d.ts +0 -24
- package/dist/types-ts4.5/plugins/mentions/ui/InviteItem/index.d.ts +0 -22
- package/dist/types-ts4.5/plugins/mentions/ui/InviteItem/styles.d.ts +0 -8
- package/dist/types-ts4.5/plugins/mentions/ui/Mention/index.d.ts +0 -19
- package/dist/types-ts4.5/plugins/mentions/ui/ToolbarMention/index.d.ts +0 -13
- package/dist/types-ts4.5/plugins/mentions/utils.d.ts +0 -8
|
@@ -20,7 +20,7 @@ import type { DatePluginConfig } from '@atlaskit/editor-plugin-date';
|
|
|
20
20
|
import type { FindReplaceOptions } from '../plugins/find-replace/types';
|
|
21
21
|
import type { LayoutPluginOptions } from '../plugins/layout/types';
|
|
22
22
|
import type { MediaOptions, MediaState } from '@atlaskit/editor-plugin-media/types';
|
|
23
|
-
import type { MentionPluginConfig } from '
|
|
23
|
+
import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
|
|
24
24
|
import type { PanelPluginConfig } from '../plugins/panel/types';
|
|
25
25
|
import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
|
|
26
26
|
import type { TextColorPluginConfig } from '../plugins/text-color/pm-plugins/main';
|
|
@@ -2,11 +2,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorProps } from '../../types/editor-props';
|
|
4
4
|
import type { TransactionTracker } from './track-transactions';
|
|
5
|
-
import type { FeatureFlags } from '../../types/feature-flags';
|
|
6
5
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
6
|
type InstrumentedPluginOptions = EditorProps['performanceTracking'] & {
|
|
8
|
-
saferDispatchedTransactions?: FeatureFlags['saferDispatchedTransactions'];
|
|
9
|
-
saferDispatchedTransactionsAnalyticsOnly?: FeatureFlags['saferDispatchedTransactionsAnalyticsOnly'];
|
|
10
7
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
8
|
};
|
|
12
9
|
export declare class InstrumentedPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
@@ -3,7 +3,6 @@ export declare const UNSAFE_PROPERTY_SET_ERROR = "Setting an unsafe property on
|
|
|
3
3
|
interface FreezeUnsafeTransactionOptions {
|
|
4
4
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
5
5
|
pluginKey?: string;
|
|
6
|
-
analyticsOnly?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey,
|
|
7
|
+
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey, }: FreezeUnsafeTransactionOptions) => ProxyHandler<TrType>;
|
|
9
8
|
export {};
|
|
@@ -11,7 +11,6 @@ export { default as layoutPlugin } from './layout';
|
|
|
11
11
|
export { default as toolbarListsIndentationPlugin } from './toolbar-lists-indentation';
|
|
12
12
|
export { default as macroPlugin } from './macro';
|
|
13
13
|
export { default as maxContentSizePlugin } from './max-content-size';
|
|
14
|
-
export { default as mentionsPlugin } from './mentions';
|
|
15
14
|
export { default as panelPlugin } from './panel';
|
|
16
15
|
export { default as pastePlugin } from './paste';
|
|
17
16
|
export { default as placeholderTextPlugin } from './placeholder-text';
|
|
@@ -6,7 +6,6 @@ import type { tablesPlugin } from '@atlaskit/editor-plugin-table';
|
|
|
6
6
|
import type { hyperlinkPlugin } from '@atlaskit/editor-plugin-hyperlink';
|
|
7
7
|
import type { FeatureFlagsPlugin } from '@atlaskit/editor-plugin-feature-flags';
|
|
8
8
|
import type { analyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
9
|
-
import type mentionsPlugin from '../mentions';
|
|
10
9
|
import type { QuickInsertPlugin } from '@atlaskit/editor-plugin-quick-insert';
|
|
11
10
|
import type { BlockTypePlugin } from '@atlaskit/editor-plugin-block-type';
|
|
12
11
|
import type codeBlockPlugin from '../code-block';
|
|
@@ -14,7 +13,7 @@ import type panelPlugin from '../panel';
|
|
|
14
13
|
import type { RulePlugin } from '@atlaskit/editor-plugin-rule';
|
|
15
14
|
import type { MediaPlugin } from '@atlaskit/editor-plugin-media';
|
|
16
15
|
import type { TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
17
|
-
import type {
|
|
16
|
+
import type { MentionsPlugin } from '@atlaskit/editor-plugin-mentions';
|
|
18
17
|
import type { StatusPlugin } from '@atlaskit/editor-plugin-status';
|
|
19
18
|
export type InsertBlockPluginDependencies = [
|
|
20
19
|
FeatureFlagsPlugin,
|
|
@@ -25,13 +24,12 @@ export type InsertBlockPluginDependencies = [
|
|
|
25
24
|
OptionalPlugin<BlockTypePlugin>,
|
|
26
25
|
OptionalPlugin<typeof analyticsPlugin>,
|
|
27
26
|
OptionalPlugin<ImageUploadPlugin>,
|
|
28
|
-
OptionalPlugin<typeof mentionsPlugin>,
|
|
29
27
|
OptionalPlugin<EmojiPlugin>,
|
|
30
28
|
OptionalPlugin<QuickInsertPlugin>,
|
|
31
29
|
OptionalPlugin<RulePlugin>,
|
|
32
30
|
OptionalPlugin<typeof codeBlockPlugin>,
|
|
33
31
|
OptionalPlugin<typeof panelPlugin>,
|
|
34
32
|
OptionalPlugin<MediaPlugin>,
|
|
35
|
-
OptionalPlugin<
|
|
33
|
+
OptionalPlugin<MentionsPlugin>,
|
|
36
34
|
OptionalPlugin<StatusPlugin>
|
|
37
35
|
];
|
|
@@ -20,7 +20,7 @@ import type { DatePluginConfig } from '@atlaskit/editor-plugin-date';
|
|
|
20
20
|
import type { FindReplaceOptions } from '../plugins/find-replace/types';
|
|
21
21
|
import type { LayoutPluginOptions } from '../plugins/layout/types';
|
|
22
22
|
import type { MediaOptions, MediaState } from '@atlaskit/editor-plugin-media/types';
|
|
23
|
-
import type { MentionPluginConfig } from '
|
|
23
|
+
import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
|
|
24
24
|
import type { PanelPluginConfig } from '../plugins/panel/types';
|
|
25
25
|
import type { PlaceholderTextOptions } from '../plugins/placeholder-text/types';
|
|
26
26
|
import type { TextColorPluginConfig } from '../plugins/text-color/pm-plugins/main';
|
|
@@ -2,11 +2,8 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { SafePluginSpec } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import type { EditorProps } from '../../types/editor-props';
|
|
4
4
|
import type { TransactionTracker } from './track-transactions';
|
|
5
|
-
import type { FeatureFlags } from '../../types/feature-flags';
|
|
6
5
|
import type { DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
7
6
|
type InstrumentedPluginOptions = EditorProps['performanceTracking'] & {
|
|
8
|
-
saferDispatchedTransactions?: FeatureFlags['saferDispatchedTransactions'];
|
|
9
|
-
saferDispatchedTransactionsAnalyticsOnly?: FeatureFlags['saferDispatchedTransactionsAnalyticsOnly'];
|
|
10
7
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
11
8
|
};
|
|
12
9
|
export declare class InstrumentedPlugin<PluginState> extends SafePlugin<PluginState> {
|
|
@@ -3,7 +3,6 @@ export declare const UNSAFE_PROPERTY_SET_ERROR = "Setting an unsafe property on
|
|
|
3
3
|
interface FreezeUnsafeTransactionOptions {
|
|
4
4
|
dispatchAnalyticsEvent?: DispatchAnalyticsEvent;
|
|
5
5
|
pluginKey?: string;
|
|
6
|
-
analyticsOnly?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey,
|
|
7
|
+
export declare const freezeUnsafeTransactionProperties: <TrType extends object>({ dispatchAnalyticsEvent, pluginKey, }: FreezeUnsafeTransactionOptions) => ProxyHandler<TrType>;
|
|
9
8
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "188.10.
|
|
3
|
+
"version": "188.10.7",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
"@atlaskit/activity-provider": "^2.4.0",
|
|
43
43
|
"@atlaskit/adf-schema": "^32.0.0",
|
|
44
44
|
"@atlaskit/adf-utils": "^19.0.0",
|
|
45
|
-
"@atlaskit/analytics-gas-types": "^5.1.0",
|
|
46
45
|
"@atlaskit/analytics-listeners": "^8.7.0",
|
|
47
46
|
"@atlaskit/analytics-namespaced-context": "^6.7.0",
|
|
48
47
|
"@atlaskit/analytics-next": "^9.1.0",
|
|
@@ -85,6 +84,7 @@
|
|
|
85
84
|
"@atlaskit/editor-plugin-image-upload": "^0.2.0",
|
|
86
85
|
"@atlaskit/editor-plugin-list": "^1.3.0",
|
|
87
86
|
"@atlaskit/editor-plugin-media": "^0.3.0",
|
|
87
|
+
"@atlaskit/editor-plugin-mentions": "^0.1.0",
|
|
88
88
|
"@atlaskit/editor-plugin-placeholder": "^0.1.0",
|
|
89
89
|
"@atlaskit/editor-plugin-quick-insert": "^0.2.0",
|
|
90
90
|
"@atlaskit/editor-plugin-rule": "^0.1.0",
|
package/report.api.md
CHANGED
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
```ts
|
|
18
18
|
/// <reference types="node" />
|
|
19
|
-
/// <reference types="react" />
|
|
20
19
|
|
|
21
20
|
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
22
21
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
@@ -57,6 +56,7 @@ import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
|
|
|
57
56
|
import { MediaOptions } from '@atlaskit/editor-plugin-media/types';
|
|
58
57
|
import { MediaProvider as MediaProvider_2 } from '@atlaskit/editor-common/provider-factory';
|
|
59
58
|
import type { MediaState } from '@atlaskit/editor-plugin-media/types';
|
|
59
|
+
import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
|
|
60
60
|
import { MentionProvider } from '@atlaskit/mention/resource';
|
|
61
61
|
import { MentionResource } from '@atlaskit/mention/resource';
|
|
62
62
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
@@ -654,14 +654,6 @@ export { MediaOptions };
|
|
|
654
654
|
|
|
655
655
|
export { MediaProvider_2 as MediaProvider };
|
|
656
656
|
|
|
657
|
-
// @public (undocumented)
|
|
658
|
-
interface MentionPluginConfig {
|
|
659
|
-
// (undocumented)
|
|
660
|
-
HighlightComponent?: React.ComponentType;
|
|
661
|
-
// (undocumented)
|
|
662
|
-
insertDisplayName?: boolean;
|
|
663
|
-
}
|
|
664
|
-
|
|
665
657
|
export { MentionProvider };
|
|
666
658
|
|
|
667
659
|
export { MentionResource };
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
```ts
|
|
6
6
|
|
|
7
7
|
/// <reference types="node" />
|
|
8
|
-
/// <reference types="react" />
|
|
9
8
|
|
|
10
9
|
import { ACTION } from '@atlaskit/editor-common/analytics';
|
|
11
10
|
import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics';
|
|
@@ -46,6 +45,7 @@ import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
|
|
|
46
45
|
import { MediaOptions } from '@atlaskit/editor-plugin-media/types';
|
|
47
46
|
import { MediaProvider as MediaProvider_2 } from '@atlaskit/editor-common/provider-factory';
|
|
48
47
|
import type { MediaState } from '@atlaskit/editor-plugin-media/types';
|
|
48
|
+
import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions';
|
|
49
49
|
import { MentionProvider } from '@atlaskit/mention/resource';
|
|
50
50
|
import { MentionResource } from '@atlaskit/mention/resource';
|
|
51
51
|
import type { MenuItem } from '@atlaskit/editor-common/ui-menu';
|
|
@@ -602,14 +602,6 @@ export { MediaOptions }
|
|
|
602
602
|
|
|
603
603
|
export { MediaProvider_2 as MediaProvider }
|
|
604
604
|
|
|
605
|
-
// @public (undocumented)
|
|
606
|
-
interface MentionPluginConfig {
|
|
607
|
-
// (undocumented)
|
|
608
|
-
HighlightComponent?: React.ComponentType;
|
|
609
|
-
// (undocumented)
|
|
610
|
-
insertDisplayName?: boolean;
|
|
611
|
-
}
|
|
612
|
-
|
|
613
605
|
export { MentionProvider }
|
|
614
606
|
|
|
615
607
|
export { MentionResource }
|
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.buildTypeAheadRenderedPayload = exports.buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteExposurePayload = exports.buildTypeAheadInsertedPayload = exports.buildTypeAheadCancelPayload = exports.buildAnalyticsPayload = void 0;
|
|
8
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
9
|
-
var _analyticsGasTypes = require("@atlaskit/analytics-gas-types");
|
|
10
|
-
var _resource = require("@atlaskit/mention/resource");
|
|
11
|
-
var _utils = require("./utils");
|
|
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; }
|
|
14
|
-
var componentName = 'mention';
|
|
15
|
-
var buildAnalyticsPayload = exports.buildAnalyticsPayload = function buildAnalyticsPayload(actionSubject, action, eventType, sessionId) {
|
|
16
|
-
var otherAttributes = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
17
|
-
var tags = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : [];
|
|
18
|
-
return {
|
|
19
|
-
action: action,
|
|
20
|
-
actionSubject: actionSubject,
|
|
21
|
-
eventType: eventType,
|
|
22
|
-
attributes: _objectSpread({
|
|
23
|
-
componentName: componentName,
|
|
24
|
-
sessionId: sessionId
|
|
25
|
-
}, otherAttributes),
|
|
26
|
-
tags: tags
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
var emptyQueryResponse = {
|
|
30
|
-
queryLength: 0,
|
|
31
|
-
spaceInQuery: false
|
|
32
|
-
};
|
|
33
|
-
var extractAttributesFromQuery = function extractAttributesFromQuery(query) {
|
|
34
|
-
if (query) {
|
|
35
|
-
return {
|
|
36
|
-
queryLength: query.length,
|
|
37
|
-
spaceInQuery: query.indexOf(' ') !== -1
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return emptyQueryResponse;
|
|
41
|
-
};
|
|
42
|
-
var buildTypeAheadCancelPayload = exports.buildTypeAheadCancelPayload = function buildTypeAheadCancelPayload(duration, upKeyCount, downKeyCount, sessionId, query) {
|
|
43
|
-
var _extractAttributesFro = extractAttributesFromQuery(query),
|
|
44
|
-
queryLength = _extractAttributesFro.queryLength,
|
|
45
|
-
spaceInQuery = _extractAttributesFro.spaceInQuery;
|
|
46
|
-
return buildAnalyticsPayload('mentionTypeahead', 'cancelled', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
47
|
-
duration: duration,
|
|
48
|
-
downKeyCount: downKeyCount,
|
|
49
|
-
upKeyCount: upKeyCount,
|
|
50
|
-
queryLength: queryLength,
|
|
51
|
-
spaceInQuery: spaceInQuery
|
|
52
|
-
});
|
|
53
|
-
};
|
|
54
|
-
var getPosition = function getPosition(mentionList, selectedMention) {
|
|
55
|
-
if (mentionList) {
|
|
56
|
-
var index = mentionList.findIndex(function (mention) {
|
|
57
|
-
return mention.id === selectedMention.id;
|
|
58
|
-
});
|
|
59
|
-
return index === -1 ? undefined : index;
|
|
60
|
-
}
|
|
61
|
-
return;
|
|
62
|
-
};
|
|
63
|
-
var isClicked = function isClicked(insertType) {
|
|
64
|
-
return insertType === 'selected';
|
|
65
|
-
};
|
|
66
|
-
var buildTypeAheadInviteItemViewedPayload = exports.buildTypeAheadInviteItemViewedPayload = function buildTypeAheadInviteItemViewedPayload(sessionId, contextIdentifierProvider, userRole) {
|
|
67
|
-
var _ref = contextIdentifierProvider || {},
|
|
68
|
-
containerId = _ref.containerId,
|
|
69
|
-
objectId = _ref.objectId,
|
|
70
|
-
childObjectId = _ref.childObjectId;
|
|
71
|
-
return buildAnalyticsPayload('inviteItem', 'rendered', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
72
|
-
containerId: containerId,
|
|
73
|
-
objectId: objectId,
|
|
74
|
-
childObjectId: childObjectId,
|
|
75
|
-
userRole: userRole
|
|
76
|
-
});
|
|
77
|
-
};
|
|
78
|
-
var buildTypeAheadInviteExposurePayload = exports.buildTypeAheadInviteExposurePayload = function buildTypeAheadInviteExposurePayload(sessionId, contextIdentifierProvider, inviteExperimentCohort, userRole) {
|
|
79
|
-
var _ref2 = contextIdentifierProvider || {},
|
|
80
|
-
containerId = _ref2.containerId,
|
|
81
|
-
objectId = _ref2.objectId,
|
|
82
|
-
childObjectId = _ref2.childObjectId;
|
|
83
|
-
return buildAnalyticsPayload('feature', 'exposed', _analyticsGasTypes.OPERATIONAL_EVENT_TYPE, sessionId, {
|
|
84
|
-
flagKey: 'confluence.frontend.invite.from.mention',
|
|
85
|
-
value: inviteExperimentCohort || 'not-enrolled',
|
|
86
|
-
containerId: containerId,
|
|
87
|
-
objectId: objectId,
|
|
88
|
-
childObjectId: childObjectId,
|
|
89
|
-
userRole: userRole
|
|
90
|
-
}, ['measurement', 'hasCustomAttributes']);
|
|
91
|
-
};
|
|
92
|
-
var buildTypeAheadInviteItemClickedPayload = exports.buildTypeAheadInviteItemClickedPayload = function buildTypeAheadInviteItemClickedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, query, contextIdentifierProvider, userRole) {
|
|
93
|
-
var _extractAttributesFro2 = extractAttributesFromQuery(query),
|
|
94
|
-
queryLength = _extractAttributesFro2.queryLength,
|
|
95
|
-
spaceInQuery = _extractAttributesFro2.spaceInQuery;
|
|
96
|
-
var _ref3 = contextIdentifierProvider || {},
|
|
97
|
-
containerId = _ref3.containerId,
|
|
98
|
-
objectId = _ref3.objectId,
|
|
99
|
-
childObjectId = _ref3.childObjectId;
|
|
100
|
-
return buildAnalyticsPayload('inviteItem', isClicked(insertType) ? 'clicked' : 'pressed', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
101
|
-
duration: duration,
|
|
102
|
-
queryLength: queryLength,
|
|
103
|
-
spaceInQuery: spaceInQuery,
|
|
104
|
-
upKeyCount: upKeyCount,
|
|
105
|
-
downKeyCount: downKeyCount,
|
|
106
|
-
containerId: containerId,
|
|
107
|
-
objectId: objectId,
|
|
108
|
-
childObjectId: childObjectId,
|
|
109
|
-
userRole: userRole
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
var buildTypeAheadInsertedPayload = exports.buildTypeAheadInsertedPayload = function buildTypeAheadInsertedPayload(duration, upKeyCount, downKeyCount, sessionId, insertType, mention, mentionList, query, contextIdentifierProvider) {
|
|
113
|
-
var _extractAttributesFro3 = extractAttributesFromQuery(query),
|
|
114
|
-
queryLength = _extractAttributesFro3.queryLength,
|
|
115
|
-
spaceInQuery = _extractAttributesFro3.spaceInQuery;
|
|
116
|
-
var analyticsPayload = buildAnalyticsPayload('mentionTypeahead', isClicked(insertType) ? 'clicked' : 'pressed', _analyticsGasTypes.UI_EVENT_TYPE, sessionId, {
|
|
117
|
-
duration: duration,
|
|
118
|
-
position: getPosition(mentionList, mention),
|
|
119
|
-
keyboardKey: isClicked(insertType) ? undefined : insertType,
|
|
120
|
-
source: mention.source,
|
|
121
|
-
queryLength: queryLength,
|
|
122
|
-
spaceInQuery: spaceInQuery,
|
|
123
|
-
isSpecial: (0, _resource.isSpecialMention)(mention),
|
|
124
|
-
accessLevel: mention.accessLevel || '',
|
|
125
|
-
userType: mention.userType,
|
|
126
|
-
userId: mention.id,
|
|
127
|
-
upKeyCount: upKeyCount,
|
|
128
|
-
downKeyCount: downKeyCount,
|
|
129
|
-
memberCount: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.memberCount : null,
|
|
130
|
-
includesYou: (0, _utils.isTeamType)(mention.userType) && mention.context ? mention.context.includesYou : null
|
|
131
|
-
});
|
|
132
|
-
if (contextIdentifierProvider) {
|
|
133
|
-
analyticsPayload.containerId = contextIdentifierProvider.containerId || undefined;
|
|
134
|
-
analyticsPayload.objectId = contextIdentifierProvider.objectId || undefined;
|
|
135
|
-
analyticsPayload.childObjectId = contextIdentifierProvider.childObjectId || undefined;
|
|
136
|
-
}
|
|
137
|
-
return analyticsPayload;
|
|
138
|
-
};
|
|
139
|
-
var buildTypeAheadRenderedPayload = exports.buildTypeAheadRenderedPayload = function buildTypeAheadRenderedPayload(duration, userIds, query, teams) {
|
|
140
|
-
var _extractAttributesFro4 = extractAttributesFromQuery(query),
|
|
141
|
-
queryLength = _extractAttributesFro4.queryLength,
|
|
142
|
-
spaceInQuery = _extractAttributesFro4.spaceInQuery;
|
|
143
|
-
var actionSubject = userIds ? 'mentionTypeahead' : 'teamMentionTypeahead';
|
|
144
|
-
return {
|
|
145
|
-
action: 'rendered',
|
|
146
|
-
actionSubject: actionSubject,
|
|
147
|
-
eventType: _analyticsGasTypes.OPERATIONAL_EVENT_TYPE,
|
|
148
|
-
attributes: {
|
|
149
|
-
componentName: componentName,
|
|
150
|
-
duration: duration,
|
|
151
|
-
userIds: userIds,
|
|
152
|
-
teams: teams,
|
|
153
|
-
queryLength: queryLength,
|
|
154
|
-
spaceInQuery: spaceInQuery
|
|
155
|
-
}
|
|
156
|
-
};
|
|
157
|
-
};
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
Object.defineProperty(exports, "mentionPluginKey", {
|
|
9
|
-
enumerable: true,
|
|
10
|
-
get: function get() {
|
|
11
|
-
return _key.mentionPluginKey;
|
|
12
|
-
}
|
|
13
|
-
});
|
|
14
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
var _react = _interopRequireDefault(require("react"));
|
|
16
|
-
var _uuid = _interopRequireDefault(require("uuid"));
|
|
17
|
-
var _resource = require("@atlaskit/mention/resource");
|
|
18
|
-
var _adfSchema = require("@atlaskit/adf-schema");
|
|
19
|
-
var _withPluginState = require("@atlaskit/editor-common/with-plugin-state");
|
|
20
|
-
var _ToolbarMention = _interopRequireDefault(require("./ui/ToolbarMention"));
|
|
21
|
-
var _analytics = require("@atlaskit/editor-common/analytics");
|
|
22
|
-
var _quickInsert = require("@atlaskit/editor-common/quick-insert");
|
|
23
|
-
var _messages = require("@atlaskit/editor-common/messages");
|
|
24
|
-
var _typeAhead = require("./type-ahead");
|
|
25
|
-
var _key = require("./pm-plugins/key");
|
|
26
|
-
var _main = require("./pm-plugins/main");
|
|
27
|
-
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; }
|
|
28
|
-
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; }
|
|
29
|
-
var mentionsPlugin = function mentionsPlugin(_ref) {
|
|
30
|
-
var options = _ref.config,
|
|
31
|
-
api = _ref.api;
|
|
32
|
-
var sessionId = (0, _uuid.default)();
|
|
33
|
-
var fireEvent = function fireEvent(payload) {
|
|
34
|
-
var _api$analytics$shared, _api$analytics;
|
|
35
|
-
var _ref2 = (_api$analytics$shared = api === null || api === void 0 || (_api$analytics = api.analytics) === null || _api$analytics === void 0 ? void 0 : _api$analytics.sharedState.currentState()) !== null && _api$analytics$shared !== void 0 ? _api$analytics$shared : {},
|
|
36
|
-
createAnalyticsEvent = _ref2.createAnalyticsEvent;
|
|
37
|
-
if (!createAnalyticsEvent) {
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (payload.attributes && !payload.attributes.sessionId) {
|
|
41
|
-
payload.attributes.sessionId = sessionId;
|
|
42
|
-
}
|
|
43
|
-
createAnalyticsEvent(payload).fire(_resource.ELEMENTS_CHANNEL);
|
|
44
|
-
};
|
|
45
|
-
var typeAhead = (0, _typeAhead.createTypeAheadConfig)({
|
|
46
|
-
sanitizePrivateContent: options === null || options === void 0 ? void 0 : options.sanitizePrivateContent,
|
|
47
|
-
mentionInsertDisplayName: options === null || options === void 0 ? void 0 : options.insertDisplayName,
|
|
48
|
-
HighlightComponent: options === null || options === void 0 ? void 0 : options.HighlightComponent,
|
|
49
|
-
fireEvent: fireEvent
|
|
50
|
-
});
|
|
51
|
-
return {
|
|
52
|
-
name: 'mention',
|
|
53
|
-
nodes: function nodes() {
|
|
54
|
-
return [{
|
|
55
|
-
name: 'mention',
|
|
56
|
-
node: _adfSchema.mention
|
|
57
|
-
}];
|
|
58
|
-
},
|
|
59
|
-
pmPlugins: function pmPlugins() {
|
|
60
|
-
return [{
|
|
61
|
-
name: 'mention',
|
|
62
|
-
plugin: function plugin(pmPluginFactoryParams) {
|
|
63
|
-
return (0, _main.createMentionPlugin)(pmPluginFactoryParams, fireEvent, options);
|
|
64
|
-
}
|
|
65
|
-
}];
|
|
66
|
-
},
|
|
67
|
-
secondaryToolbarComponent: function secondaryToolbarComponent(_ref3) {
|
|
68
|
-
var editorView = _ref3.editorView,
|
|
69
|
-
disabled = _ref3.disabled;
|
|
70
|
-
var openMentionTypeAhead = function openMentionTypeAhead() {
|
|
71
|
-
var _api$typeAhead;
|
|
72
|
-
api === null || api === void 0 || (_api$typeAhead = api.typeAhead) === null || _api$typeAhead === void 0 || (_api$typeAhead = _api$typeAhead.actions) === null || _api$typeAhead === void 0 || _api$typeAhead.open({
|
|
73
|
-
triggerHandler: typeAhead,
|
|
74
|
-
inputMethod: _analytics.INPUT_METHOD.INSERT_MENU
|
|
75
|
-
});
|
|
76
|
-
};
|
|
77
|
-
return /*#__PURE__*/_react.default.createElement(_withPluginState.WithPluginState, {
|
|
78
|
-
editorView: editorView,
|
|
79
|
-
plugins: {
|
|
80
|
-
mentionState: _key.mentionPluginKey
|
|
81
|
-
},
|
|
82
|
-
render: function render(_ref4) {
|
|
83
|
-
var _ref4$mentionState = _ref4.mentionState,
|
|
84
|
-
mentionState = _ref4$mentionState === void 0 ? {} : _ref4$mentionState;
|
|
85
|
-
return !mentionState.mentionProvider ? null : /*#__PURE__*/_react.default.createElement(_ToolbarMention.default, {
|
|
86
|
-
editorView: editorView,
|
|
87
|
-
onInsertMention: openMentionTypeAhead,
|
|
88
|
-
isDisabled: disabled || (api === null || api === void 0 ? void 0 : api.typeAhead.actions.isAllowed(editorView.state))
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
});
|
|
92
|
-
},
|
|
93
|
-
actions: {
|
|
94
|
-
openTypeAhead: function openTypeAhead(inputMethod) {
|
|
95
|
-
var _api$typeAhead2;
|
|
96
|
-
return Boolean(api === null || api === void 0 || (_api$typeAhead2 = api.typeAhead) === null || _api$typeAhead2 === void 0 || (_api$typeAhead2 = _api$typeAhead2.actions) === null || _api$typeAhead2 === void 0 ? void 0 : _api$typeAhead2.open({
|
|
97
|
-
triggerHandler: typeAhead,
|
|
98
|
-
inputMethod: inputMethod
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
getSharedState: function getSharedState(editorState) {
|
|
103
|
-
if (!editorState) {
|
|
104
|
-
return undefined;
|
|
105
|
-
}
|
|
106
|
-
var mentionPluginState = _key.mentionPluginKey.getState(editorState);
|
|
107
|
-
return _objectSpread(_objectSpread({}, mentionPluginState), {}, {
|
|
108
|
-
typeAheadHandler: typeAhead
|
|
109
|
-
});
|
|
110
|
-
},
|
|
111
|
-
pluginsOptions: {
|
|
112
|
-
quickInsert: function quickInsert(_ref5) {
|
|
113
|
-
var formatMessage = _ref5.formatMessage;
|
|
114
|
-
return [{
|
|
115
|
-
id: 'mention',
|
|
116
|
-
title: formatMessage(_messages.toolbarInsertBlockMessages.mention),
|
|
117
|
-
description: formatMessage(_messages.toolbarInsertBlockMessages.mentionDescription),
|
|
118
|
-
keywords: ['team', 'user'],
|
|
119
|
-
priority: 400,
|
|
120
|
-
keyshortcut: '@',
|
|
121
|
-
icon: function icon() {
|
|
122
|
-
return /*#__PURE__*/_react.default.createElement(_quickInsert.IconMention, null);
|
|
123
|
-
},
|
|
124
|
-
action: function action(insert, state) {
|
|
125
|
-
var tr = insert(undefined);
|
|
126
|
-
var pluginState = _key.mentionPluginKey.getState(state);
|
|
127
|
-
if (pluginState && pluginState.canInsertMention === false) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
api === null || api === void 0 || api.typeAhead.actions.openAtTransaction({
|
|
131
|
-
triggerHandler: typeAhead,
|
|
132
|
-
inputMethod: _analytics.INPUT_METHOD.QUICK_INSERT
|
|
133
|
-
})(tr);
|
|
134
|
-
return tr;
|
|
135
|
-
}
|
|
136
|
-
}];
|
|
137
|
-
},
|
|
138
|
-
typeAhead: typeAhead
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
var _default = exports.default = mentionsPlugin;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.messages = void 0;
|
|
7
|
-
var _reactIntlNext = require("react-intl-next");
|
|
8
|
-
var messages = exports.messages = (0, _reactIntlNext.defineMessages)({
|
|
9
|
-
inviteItemTitle: {
|
|
10
|
-
id: 'fabric.editor.inviteItem.title',
|
|
11
|
-
defaultMessage: '{userRole, select, admin {Invite} trusted {Invite} other {Add}} teammate to {productName}',
|
|
12
|
-
description: 'Title of the invite teammate item in typeahead plugin'
|
|
13
|
-
},
|
|
14
|
-
mentionsAddLabel: {
|
|
15
|
-
id: 'fabric.editor.mentionsAddLabel',
|
|
16
|
-
defaultMessage: 'add-icon',
|
|
17
|
-
description: 'icon label to describe adding a new mention'
|
|
18
|
-
},
|
|
19
|
-
mentionsIconLabel: {
|
|
20
|
-
id: 'fabric.editor.mentionsIconLabel',
|
|
21
|
-
defaultMessage: 'Mention',
|
|
22
|
-
description: 'icon label to describe the mention icon'
|
|
23
|
-
},
|
|
24
|
-
mentionsNodeLabel: {
|
|
25
|
-
id: 'fabric.editor.mentionNode.label',
|
|
26
|
-
defaultMessage: 'Tagged user',
|
|
27
|
-
description: 'Label to indicate mention node to Screen reader users, that preceeds with user name ex: "Tagged user @XXX'
|
|
28
|
-
}
|
|
29
|
-
});
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.MentionNodeView = void 0;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
13
|
-
var _providerFactory = require("@atlaskit/editor-common/provider-factory");
|
|
14
|
-
var _Mention = _interopRequireDefault(require("../ui/Mention"));
|
|
15
|
-
var _reactIntlNext = require("react-intl-next");
|
|
16
|
-
var _messages = require("../messages");
|
|
17
|
-
var _mention = require("@atlaskit/mention");
|
|
18
|
-
var _types = require("@atlaskit/mention/types");
|
|
19
|
-
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
-
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; }
|
|
21
|
-
var UNKNOWN_USER_ID = '_|unknown|_';
|
|
22
|
-
var MentionAssistiveTextComponent = function MentionAssistiveTextComponent(_ref) {
|
|
23
|
-
var id = _ref.id,
|
|
24
|
-
text = _ref.text,
|
|
25
|
-
providers = _ref.providers,
|
|
26
|
-
accessLevel = _ref.accessLevel,
|
|
27
|
-
mentionProvider = _ref.mentionProvider;
|
|
28
|
-
var _useState = (0, _react.useState)(text),
|
|
29
|
-
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
30
|
-
resolvedName = _useState2[0],
|
|
31
|
-
setResolvedName = _useState2[1];
|
|
32
|
-
var intl = (0, _reactIntlNext.useIntl)();
|
|
33
|
-
var processName = function processName(name) {
|
|
34
|
-
if (name.status === _mention.MentionNameStatus.OK) {
|
|
35
|
-
return "@".concat(name.name || '');
|
|
36
|
-
} else {
|
|
37
|
-
return "@".concat(UNKNOWN_USER_ID);
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
(0, _react.useEffect)(function () {
|
|
41
|
-
if (mentionProvider) {
|
|
42
|
-
mentionProvider.then( /*#__PURE__*/function () {
|
|
43
|
-
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(provider) {
|
|
44
|
-
var nameDetail;
|
|
45
|
-
return _regenerator.default.wrap(function _callee$(_context) {
|
|
46
|
-
while (1) switch (_context.prev = _context.next) {
|
|
47
|
-
case 0:
|
|
48
|
-
if (!(!text && (0, _mention.isResolvingMentionProvider)(provider))) {
|
|
49
|
-
_context.next = 13;
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
nameDetail = provider.resolveMentionName(id);
|
|
53
|
-
if (!(0, _types.isPromise)(nameDetail)) {
|
|
54
|
-
_context.next = 10;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
_context.t0 = processName;
|
|
58
|
-
_context.next = 6;
|
|
59
|
-
return nameDetail;
|
|
60
|
-
case 6:
|
|
61
|
-
_context.t1 = _context.sent;
|
|
62
|
-
return _context.abrupt("return", (0, _context.t0)(_context.t1));
|
|
63
|
-
case 10:
|
|
64
|
-
return _context.abrupt("return", processName(nameDetail));
|
|
65
|
-
case 11:
|
|
66
|
-
_context.next = 14;
|
|
67
|
-
break;
|
|
68
|
-
case 13:
|
|
69
|
-
return _context.abrupt("return", text);
|
|
70
|
-
case 14:
|
|
71
|
-
case "end":
|
|
72
|
-
return _context.stop();
|
|
73
|
-
}
|
|
74
|
-
}, _callee);
|
|
75
|
-
}));
|
|
76
|
-
return function (_x) {
|
|
77
|
-
return _ref2.apply(this, arguments);
|
|
78
|
-
};
|
|
79
|
-
}()).then(function (resolvedName) {
|
|
80
|
-
setResolvedName(resolvedName);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
}, [id, text, mentionProvider]);
|
|
84
|
-
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement("span", {
|
|
85
|
-
className: 'assistive'
|
|
86
|
-
}, "".concat(intl.formatMessage(_messages.messages.mentionsNodeLabel), " ").concat(resolvedName)), /*#__PURE__*/_react.default.createElement("span", {
|
|
87
|
-
"aria-hidden": "true"
|
|
88
|
-
}, /*#__PURE__*/_react.default.createElement(_Mention.default, {
|
|
89
|
-
id: id,
|
|
90
|
-
text: resolvedName,
|
|
91
|
-
accessLevel: accessLevel,
|
|
92
|
-
providers: providers
|
|
93
|
-
})));
|
|
94
|
-
};
|
|
95
|
-
var MentionNodeView = exports.MentionNodeView = function MentionNodeView(props) {
|
|
96
|
-
var providerFactory = props.providerFactory;
|
|
97
|
-
var _props$node$attrs = props.node.attrs,
|
|
98
|
-
id = _props$node$attrs.id,
|
|
99
|
-
text = _props$node$attrs.text,
|
|
100
|
-
accessLevel = _props$node$attrs.accessLevel;
|
|
101
|
-
var renderAssistiveTextWithProviders = function renderAssistiveTextWithProviders(providers) {
|
|
102
|
-
var _ref3 = providers,
|
|
103
|
-
mentionProvider = _ref3.mentionProvider;
|
|
104
|
-
return /*#__PURE__*/_react.default.createElement(MentionAssistiveTextComponent, {
|
|
105
|
-
mentionProvider: mentionProvider,
|
|
106
|
-
id: id,
|
|
107
|
-
text: text,
|
|
108
|
-
providers: providerFactory,
|
|
109
|
-
accessLevel: accessLevel
|
|
110
|
-
});
|
|
111
|
-
};
|
|
112
|
-
return /*#__PURE__*/_react.default.createElement(_providerFactory.WithProviders, {
|
|
113
|
-
providers: ['mentionProvider', 'profilecardProvider'],
|
|
114
|
-
providerFactory: providerFactory,
|
|
115
|
-
renderNode: renderAssistiveTextWithProviders
|
|
116
|
-
});
|
|
117
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.mentionPluginKey = void 0;
|
|
7
|
-
var _state = require("@atlaskit/editor-prosemirror/state");
|
|
8
|
-
var mentionPluginKey = exports.mentionPluginKey = new _state.PluginKey('mentionPlugin');
|