@atlaskit/editor-core 188.7.6 → 188.8.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 +10 -0
- package/dist/cjs/plugins/type-ahead/index.js +4 -372
- package/dist/cjs/plugins/type-ahead/plugin.js +382 -0
- package/dist/cjs/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +17 -8
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/plugins/type-ahead/index.js +2 -375
- package/dist/es2019/plugins/type-ahead/plugin.js +381 -0
- package/dist/es2019/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +17 -8
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/plugins/type-ahead/index.js +2 -368
- package/dist/esm/plugins/type-ahead/plugin.js +374 -0
- package/dist/esm/plugins/view-update-subscription/subscribe/toolbarAndPickerUpdates.js +17 -8
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/labs/next/presets/default.d.ts +30 -12
- package/dist/types/plugins/type-ahead/index.d.ts +3 -14
- package/dist/types/plugins/type-ahead/plugin.d.ts +10 -0
- package/dist/types/plugins/type-ahead/types.d.ts +51 -6
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +30 -12
- package/dist/types-ts4.5/plugins/type-ahead/index.d.ts +3 -14
- package/dist/types-ts4.5/plugins/type-ahead/plugin.d.ts +10 -0
- package/dist/types-ts4.5/plugins/type-ahead/types.d.ts +53 -6
- package/package.json +2 -2
- package/dist/cjs/plugins/view-update-subscription/subscribe/type-ahead-updates.js +0 -33
- package/dist/es2019/plugins/view-update-subscription/subscribe/type-ahead-updates.js +0 -28
- package/dist/esm/plugins/view-update-subscription/subscribe/type-ahead-updates.js +0 -27
- package/dist/types/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +0 -9
- package/dist/types-ts4.5/plugins/view-update-subscription/subscribe/type-ahead-updates.d.ts +0 -9
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
4
|
+
import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
7
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import type { EditorState, Transaction, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
8
|
import type { CloseSelectionOptions } from './constants';
|
|
4
|
-
|
|
5
|
-
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
6
|
-
import type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
7
|
-
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
8
|
-
export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInputMethod, };
|
|
9
|
+
export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, };
|
|
9
10
|
export type OnSelectItem = (props: {
|
|
10
11
|
index: number;
|
|
11
12
|
item: TypeAheadItem;
|
|
@@ -62,3 +63,47 @@ export type CreateTypeAheadDecorations = (tr: ReadonlyTransaction, options: {
|
|
|
62
63
|
stats: TypeAheadStatsSerializable | null;
|
|
63
64
|
};
|
|
64
65
|
export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => boolean;
|
|
66
|
+
export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
67
|
+
export type TypeAheadPluginOptions = {
|
|
68
|
+
isMobile?: boolean;
|
|
69
|
+
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
70
|
+
};
|
|
71
|
+
type OpenTypeAheadProps = {
|
|
72
|
+
triggerHandler: TypeAheadHandler;
|
|
73
|
+
inputMethod: TypeAheadInputMethod;
|
|
74
|
+
query?: string;
|
|
75
|
+
};
|
|
76
|
+
type InsertTypeAheadItemProps = {
|
|
77
|
+
triggerHandler: TypeAheadHandler;
|
|
78
|
+
contentItem: TypeAheadItem;
|
|
79
|
+
query: string;
|
|
80
|
+
sourceListItem: TypeAheadItem[];
|
|
81
|
+
mode?: SelectItemMode;
|
|
82
|
+
};
|
|
83
|
+
type CloseTypeAheadProps = {
|
|
84
|
+
insertCurrentQueryAsRawText: boolean;
|
|
85
|
+
attachCommand?: Command;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
89
|
+
* from `@atlaskit/editor-core`.
|
|
90
|
+
*/
|
|
91
|
+
export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
92
|
+
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
93
|
+
dependencies: [OptionalPlugin<AnalyticsPlugin>];
|
|
94
|
+
sharedState: {
|
|
95
|
+
query: string;
|
|
96
|
+
isOpen: boolean;
|
|
97
|
+
isAllowed: boolean;
|
|
98
|
+
currentHandler?: TypeAheadHandler;
|
|
99
|
+
};
|
|
100
|
+
actions: {
|
|
101
|
+
isOpen: (editorState: EditorState) => boolean;
|
|
102
|
+
isAllowed: (editorState: EditorState) => boolean;
|
|
103
|
+
insert: (props: InsertTypeAheadItemProps) => boolean;
|
|
104
|
+
findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
|
|
105
|
+
open: (props: OpenTypeAheadProps) => boolean;
|
|
106
|
+
close: (props: CloseTypeAheadProps) => boolean;
|
|
107
|
+
openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
|
|
108
|
+
};
|
|
109
|
+
}>;
|
|
@@ -370,7 +370,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
370
370
|
sharedState: import("@atlaskit/editor-plugin-composition").CompositionState;
|
|
371
371
|
}, undefined>,
|
|
372
372
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"typeAhead", {
|
|
373
|
-
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
373
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined;
|
|
374
374
|
dependencies: [
|
|
375
375
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
376
376
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -389,6 +389,9 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
389
389
|
];
|
|
390
390
|
sharedState: {
|
|
391
391
|
query: string;
|
|
392
|
+
isOpen: boolean;
|
|
393
|
+
isAllowed: boolean;
|
|
394
|
+
currentHandler?: import("@atlaskit/editor-common/types").TypeAheadHandler | undefined;
|
|
392
395
|
};
|
|
393
396
|
actions: {
|
|
394
397
|
isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
|
|
@@ -416,7 +419,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
416
419
|
query?: string | undefined;
|
|
417
420
|
}) => (tr: import("prosemirror-state").Transaction) => boolean;
|
|
418
421
|
};
|
|
419
|
-
}, TypeAheadPluginOptions | undefined>
|
|
422
|
+
}, import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined>
|
|
420
423
|
];
|
|
421
424
|
}, PlaceholderPluginOptions | undefined>,
|
|
422
425
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"typeAhead", {
|
|
@@ -439,6 +442,9 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
439
442
|
];
|
|
440
443
|
sharedState: {
|
|
441
444
|
query: string;
|
|
445
|
+
isOpen: boolean;
|
|
446
|
+
isAllowed: boolean;
|
|
447
|
+
currentHandler?: import("@atlaskit/editor-common/types").TypeAheadHandler | undefined;
|
|
442
448
|
};
|
|
443
449
|
actions: {
|
|
444
450
|
isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
|
|
@@ -453,7 +459,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
453
459
|
findHandlerByTrigger: (trigger: string) => import("@atlaskit/editor-common/types").TypeAheadHandler | null;
|
|
454
460
|
open: (props: {
|
|
455
461
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
456
|
-
inputMethod: import("
|
|
462
|
+
inputMethod: import("../../../plugins/type-ahead").TypeAheadInputMethod;
|
|
457
463
|
query?: string | undefined;
|
|
458
464
|
}) => boolean;
|
|
459
465
|
close: (props: {
|
|
@@ -462,7 +468,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
462
468
|
}) => boolean;
|
|
463
469
|
openAtTransaction: (props: {
|
|
464
470
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
465
|
-
inputMethod: import("
|
|
471
|
+
inputMethod: import("../../../plugins/type-ahead").TypeAheadInputMethod;
|
|
466
472
|
query?: string | undefined;
|
|
467
473
|
}) => (tr: import("prosemirror-state").Transaction) => boolean;
|
|
468
474
|
};
|
|
@@ -471,7 +477,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
471
477
|
pluginConfiguration: QuickInsertPluginOptions | undefined;
|
|
472
478
|
dependencies: [
|
|
473
479
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"typeAhead", {
|
|
474
|
-
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
480
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined;
|
|
475
481
|
dependencies: [
|
|
476
482
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
477
483
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -490,6 +496,9 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
490
496
|
];
|
|
491
497
|
sharedState: {
|
|
492
498
|
query: string;
|
|
499
|
+
isOpen: boolean;
|
|
500
|
+
isAllowed: boolean;
|
|
501
|
+
currentHandler?: import("@atlaskit/editor-common/types").TypeAheadHandler | undefined;
|
|
493
502
|
};
|
|
494
503
|
actions: {
|
|
495
504
|
isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
|
|
@@ -517,7 +526,7 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
517
526
|
query?: string | undefined;
|
|
518
527
|
}) => (tr: import("prosemirror-state").Transaction) => boolean;
|
|
519
528
|
};
|
|
520
|
-
}, TypeAheadPluginOptions | undefined>
|
|
529
|
+
}, import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined>
|
|
521
530
|
];
|
|
522
531
|
sharedState: import("@atlaskit/editor-plugin-quick-insert").QuickInsertSharedState | null;
|
|
523
532
|
actions: {
|
|
@@ -932,7 +941,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
932
941
|
sharedState: import("@atlaskit/editor-plugin-composition").CompositionState;
|
|
933
942
|
}, undefined>,
|
|
934
943
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"typeAhead", {
|
|
935
|
-
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
944
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined;
|
|
936
945
|
dependencies: [
|
|
937
946
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
938
947
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -951,6 +960,9 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
951
960
|
];
|
|
952
961
|
sharedState: {
|
|
953
962
|
query: string;
|
|
963
|
+
isOpen: boolean;
|
|
964
|
+
isAllowed: boolean;
|
|
965
|
+
currentHandler?: import("@atlaskit/editor-common/types").TypeAheadHandler | undefined;
|
|
954
966
|
};
|
|
955
967
|
actions: {
|
|
956
968
|
isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
|
|
@@ -978,7 +990,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
978
990
|
query?: string | undefined;
|
|
979
991
|
}) => (tr: import("prosemirror-state").Transaction) => boolean;
|
|
980
992
|
};
|
|
981
|
-
}, TypeAheadPluginOptions | undefined>
|
|
993
|
+
}, import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined>
|
|
982
994
|
];
|
|
983
995
|
}, PlaceholderPluginOptions | undefined>,
|
|
984
996
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"typeAhead", {
|
|
@@ -1001,6 +1013,9 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
1001
1013
|
];
|
|
1002
1014
|
sharedState: {
|
|
1003
1015
|
query: string;
|
|
1016
|
+
isOpen: boolean;
|
|
1017
|
+
isAllowed: boolean;
|
|
1018
|
+
currentHandler?: import("@atlaskit/editor-common/types").TypeAheadHandler | undefined;
|
|
1004
1019
|
};
|
|
1005
1020
|
actions: {
|
|
1006
1021
|
isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
|
|
@@ -1015,7 +1030,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
1015
1030
|
findHandlerByTrigger: (trigger: string) => import("@atlaskit/editor-common/types").TypeAheadHandler | null;
|
|
1016
1031
|
open: (props: {
|
|
1017
1032
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
1018
|
-
inputMethod: import("
|
|
1033
|
+
inputMethod: import("../../../plugins/type-ahead").TypeAheadInputMethod;
|
|
1019
1034
|
query?: string | undefined;
|
|
1020
1035
|
}) => boolean;
|
|
1021
1036
|
close: (props: {
|
|
@@ -1024,7 +1039,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
1024
1039
|
}) => boolean;
|
|
1025
1040
|
openAtTransaction: (props: {
|
|
1026
1041
|
triggerHandler: import("@atlaskit/editor-common/types").TypeAheadHandler;
|
|
1027
|
-
inputMethod: import("
|
|
1042
|
+
inputMethod: import("../../../plugins/type-ahead").TypeAheadInputMethod;
|
|
1028
1043
|
query?: string | undefined;
|
|
1029
1044
|
}) => (tr: import("prosemirror-state").Transaction) => boolean;
|
|
1030
1045
|
};
|
|
@@ -1033,7 +1048,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
1033
1048
|
pluginConfiguration: QuickInsertPluginOptions | undefined;
|
|
1034
1049
|
dependencies: [
|
|
1035
1050
|
import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"typeAhead", {
|
|
1036
|
-
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
1051
|
+
pluginConfiguration: import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined;
|
|
1037
1052
|
dependencies: [
|
|
1038
1053
|
import("@atlaskit/editor-common/types").OptionalPlugin<import("@atlaskit/editor-common/types").NextEditorPluginFunctionOptionalConfigDefinition<"analytics", {
|
|
1039
1054
|
pluginConfiguration: import("@atlaskit/editor-plugin-analytics").AnalyticsPluginOptions;
|
|
@@ -1052,6 +1067,9 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
1052
1067
|
];
|
|
1053
1068
|
sharedState: {
|
|
1054
1069
|
query: string;
|
|
1070
|
+
isOpen: boolean;
|
|
1071
|
+
isAllowed: boolean;
|
|
1072
|
+
currentHandler?: import("@atlaskit/editor-common/types").TypeAheadHandler | undefined;
|
|
1055
1073
|
};
|
|
1056
1074
|
actions: {
|
|
1057
1075
|
isOpen: (editorState: import("prosemirror-state").EditorState) => boolean;
|
|
@@ -1079,7 +1097,7 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
1079
1097
|
query?: string | undefined;
|
|
1080
1098
|
}) => (tr: import("prosemirror-state").Transaction) => boolean;
|
|
1081
1099
|
};
|
|
1082
|
-
}, TypeAheadPluginOptions | undefined>
|
|
1100
|
+
}, import("@atlaskit/editor-plugin-type-ahead").TypeAheadPluginOptions | undefined>
|
|
1083
1101
|
];
|
|
1084
1102
|
sharedState: import("@atlaskit/editor-plugin-quick-insert").QuickInsertSharedState | null;
|
|
1085
1103
|
actions: {
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { TypeAheadPluginOptions, TypeAheadPlugin } from '@atlaskit/editor-plugin-type-ahead';
|
|
3
|
-
export type { TypeAheadPluginOptions, TypeAheadPlugin };
|
|
4
|
-
/**
|
|
5
|
-
*
|
|
6
|
-
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
7
|
-
*
|
|
8
|
-
* https://product-fabric.atlassian.net/wiki/spaces/E/pages/2992177582/Technical+TypeAhead+Data+Flow
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*/
|
|
12
|
-
declare const typeAheadPlugin: TypeAheadPlugin;
|
|
1
|
+
import { typeAheadPlugin } from './plugin';
|
|
13
2
|
export default typeAheadPlugin;
|
|
14
|
-
export {
|
|
15
|
-
export type { TypeAheadHandler, TypeAheadPluginState } from './types';
|
|
3
|
+
export { typeAheadPlugin };
|
|
4
|
+
export type { TypeAheadHandler, TypeAheadInputMethod, TypeAheadPlugin, TypeAheadPluginOptions, TypeAheadPluginState, } from './types';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { TypeAheadPlugin } from './types';
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* Revamped typeahead using decorations instead of the `typeAheadQuery` mark
|
|
5
|
+
*
|
|
6
|
+
* https://product-fabric.atlassian.net/wiki/spaces/E/pages/2992177582/Technical+TypeAhead+Data+Flow
|
|
7
|
+
*
|
|
8
|
+
*
|
|
9
|
+
*/
|
|
10
|
+
export declare const typeAheadPlugin: TypeAheadPlugin;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
|
|
2
|
+
import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
3
|
+
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
4
|
+
import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInsert, TypeAheadItem, TypeAheadItemRenderProps, TypeAheadSelectItem, TypeAheadStats, UiComponentFactoryParams } from '@atlaskit/editor-common/types';
|
|
5
|
+
import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
|
|
6
|
+
import type { EditorState, ReadonlyTransaction, Transaction } from '@atlaskit/editor-prosemirror/state';
|
|
1
7
|
import type { DecorationSet } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import type { EditorState, Transaction, ReadonlyTransaction } from '@atlaskit/editor-prosemirror/state';
|
|
3
8
|
import type { CloseSelectionOptions } from './constants';
|
|
4
|
-
|
|
5
|
-
import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
|
|
6
|
-
import type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler } from '@atlaskit/editor-common/types';
|
|
7
|
-
import type { TypeAheadInputMethod } from '@atlaskit/editor-plugin-type-ahead';
|
|
8
|
-
export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, TypeAheadInputMethod, };
|
|
9
|
+
export type { TypeAheadStats, TypeAheadItemRenderProps, TypeAheadInsert, TypeAheadSelectItem, TypeAheadItem, TypeAheadForceSelect, TypeAheadHandler, };
|
|
9
10
|
export type OnSelectItem = (props: {
|
|
10
11
|
index: number;
|
|
11
12
|
item: TypeAheadItem;
|
|
@@ -62,3 +63,49 @@ export type CreateTypeAheadDecorations = (tr: ReadonlyTransaction, options: {
|
|
|
62
63
|
stats: TypeAheadStatsSerializable | null;
|
|
63
64
|
};
|
|
64
65
|
export type RemoveTypeAheadDecorations = (decorationSet?: DecorationSet) => boolean;
|
|
66
|
+
export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
|
|
67
|
+
export type TypeAheadPluginOptions = {
|
|
68
|
+
isMobile?: boolean;
|
|
69
|
+
createAnalyticsEvent?: CreateUIAnalyticsEvent;
|
|
70
|
+
};
|
|
71
|
+
type OpenTypeAheadProps = {
|
|
72
|
+
triggerHandler: TypeAheadHandler;
|
|
73
|
+
inputMethod: TypeAheadInputMethod;
|
|
74
|
+
query?: string;
|
|
75
|
+
};
|
|
76
|
+
type InsertTypeAheadItemProps = {
|
|
77
|
+
triggerHandler: TypeAheadHandler;
|
|
78
|
+
contentItem: TypeAheadItem;
|
|
79
|
+
query: string;
|
|
80
|
+
sourceListItem: TypeAheadItem[];
|
|
81
|
+
mode?: SelectItemMode;
|
|
82
|
+
};
|
|
83
|
+
type CloseTypeAheadProps = {
|
|
84
|
+
insertCurrentQueryAsRawText: boolean;
|
|
85
|
+
attachCommand?: Command;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
|
|
89
|
+
* from `@atlaskit/editor-core`.
|
|
90
|
+
*/
|
|
91
|
+
export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
|
|
92
|
+
pluginConfiguration: TypeAheadPluginOptions | undefined;
|
|
93
|
+
dependencies: [
|
|
94
|
+
OptionalPlugin<AnalyticsPlugin>
|
|
95
|
+
];
|
|
96
|
+
sharedState: {
|
|
97
|
+
query: string;
|
|
98
|
+
isOpen: boolean;
|
|
99
|
+
isAllowed: boolean;
|
|
100
|
+
currentHandler?: TypeAheadHandler;
|
|
101
|
+
};
|
|
102
|
+
actions: {
|
|
103
|
+
isOpen: (editorState: EditorState) => boolean;
|
|
104
|
+
isAllowed: (editorState: EditorState) => boolean;
|
|
105
|
+
insert: (props: InsertTypeAheadItemProps) => boolean;
|
|
106
|
+
findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
|
|
107
|
+
open: (props: OpenTypeAheadProps) => boolean;
|
|
108
|
+
close: (props: CloseTypeAheadProps) => boolean;
|
|
109
|
+
openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
|
|
110
|
+
};
|
|
111
|
+
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "188.
|
|
3
|
+
"version": "188.8.0",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"@atlaskit/editor-plugin-selection": "^0.1.0",
|
|
91
91
|
"@atlaskit/editor-plugin-table": "^5.2.0",
|
|
92
92
|
"@atlaskit/editor-plugin-text-formatting": "^0.4.0",
|
|
93
|
-
"@atlaskit/editor-plugin-type-ahead": "^0.
|
|
93
|
+
"@atlaskit/editor-plugin-type-ahead": "^0.6.0",
|
|
94
94
|
"@atlaskit/editor-plugin-unsupported-content": "^0.2.0",
|
|
95
95
|
"@atlaskit/editor-plugin-width": "^0.2.0",
|
|
96
96
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.subscribeTypeAheadUpdates = void 0;
|
|
7
|
-
var _ = require("..");
|
|
8
|
-
var _key = require("../../type-ahead/pm-plugins/key");
|
|
9
|
-
var subscribeTypeAheadUpdates = exports.subscribeTypeAheadUpdates = function subscribeTypeAheadUpdates(editorView, cb) {
|
|
10
|
-
var subscription = function subscription(_ref) {
|
|
11
|
-
var newEditorState = _ref.newEditorState,
|
|
12
|
-
oldEditorState = _ref.oldEditorState;
|
|
13
|
-
var newPluginState = _key.pluginKey.getState(newEditorState);
|
|
14
|
-
var oldPluginState = _key.pluginKey.getState(oldEditorState);
|
|
15
|
-
if (!oldPluginState || !newPluginState) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
cb({
|
|
19
|
-
oldPluginState: oldPluginState,
|
|
20
|
-
newPluginState: newPluginState
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
var tracker = _.trackerStore.get(editorView);
|
|
24
|
-
if (tracker) {
|
|
25
|
-
tracker.add(subscription);
|
|
26
|
-
}
|
|
27
|
-
return function () {
|
|
28
|
-
var tracker = _.trackerStore.get(editorView);
|
|
29
|
-
if (tracker) {
|
|
30
|
-
tracker.remove(subscription);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { trackerStore } from '..';
|
|
2
|
-
import { pluginKey as typeAheadPluginKey } from '../../type-ahead/pm-plugins/key';
|
|
3
|
-
export const subscribeTypeAheadUpdates = (editorView, cb) => {
|
|
4
|
-
const subscription = ({
|
|
5
|
-
newEditorState,
|
|
6
|
-
oldEditorState
|
|
7
|
-
}) => {
|
|
8
|
-
const newPluginState = typeAheadPluginKey.getState(newEditorState);
|
|
9
|
-
const oldPluginState = typeAheadPluginKey.getState(oldEditorState);
|
|
10
|
-
if (!oldPluginState || !newPluginState) {
|
|
11
|
-
return;
|
|
12
|
-
}
|
|
13
|
-
cb({
|
|
14
|
-
oldPluginState,
|
|
15
|
-
newPluginState
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
const tracker = trackerStore.get(editorView);
|
|
19
|
-
if (tracker) {
|
|
20
|
-
tracker.add(subscription);
|
|
21
|
-
}
|
|
22
|
-
return () => {
|
|
23
|
-
const tracker = trackerStore.get(editorView);
|
|
24
|
-
if (tracker) {
|
|
25
|
-
tracker.remove(subscription);
|
|
26
|
-
}
|
|
27
|
-
};
|
|
28
|
-
};
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { trackerStore } from '..';
|
|
2
|
-
import { pluginKey as typeAheadPluginKey } from '../../type-ahead/pm-plugins/key';
|
|
3
|
-
export var subscribeTypeAheadUpdates = function subscribeTypeAheadUpdates(editorView, cb) {
|
|
4
|
-
var subscription = function subscription(_ref) {
|
|
5
|
-
var newEditorState = _ref.newEditorState,
|
|
6
|
-
oldEditorState = _ref.oldEditorState;
|
|
7
|
-
var newPluginState = typeAheadPluginKey.getState(newEditorState);
|
|
8
|
-
var oldPluginState = typeAheadPluginKey.getState(oldEditorState);
|
|
9
|
-
if (!oldPluginState || !newPluginState) {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
cb({
|
|
13
|
-
oldPluginState: oldPluginState,
|
|
14
|
-
newPluginState: newPluginState
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
var tracker = trackerStore.get(editorView);
|
|
18
|
-
if (tracker) {
|
|
19
|
-
tracker.add(subscription);
|
|
20
|
-
}
|
|
21
|
-
return function () {
|
|
22
|
-
var tracker = trackerStore.get(editorView);
|
|
23
|
-
if (tracker) {
|
|
24
|
-
tracker.remove(subscription);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import type { TypeAheadPluginState } from '../../type-ahead/types';
|
|
3
|
-
type Props = {
|
|
4
|
-
oldPluginState: TypeAheadPluginState;
|
|
5
|
-
newPluginState: TypeAheadPluginState;
|
|
6
|
-
};
|
|
7
|
-
type SubscribeTypeAheadUpdates = (editorView: EditorView, cb: (props: Props) => void) => () => void;
|
|
8
|
-
export declare const subscribeTypeAheadUpdates: SubscribeTypeAheadUpdates;
|
|
9
|
-
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
|
-
import type { TypeAheadPluginState } from '../../type-ahead/types';
|
|
3
|
-
type Props = {
|
|
4
|
-
oldPluginState: TypeAheadPluginState;
|
|
5
|
-
newPluginState: TypeAheadPluginState;
|
|
6
|
-
};
|
|
7
|
-
type SubscribeTypeAheadUpdates = (editorView: EditorView, cb: (props: Props) => void) => () => void;
|
|
8
|
-
export declare const subscribeTypeAheadUpdates: SubscribeTypeAheadUpdates;
|
|
9
|
-
export {};
|