@atlaskit/editor-plugin-type-ahead 0.3.2 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @atlaskit/editor-plugin-type-ahead
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#41143](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/41143) [`7d6dfe2befa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7d6dfe2befa) - [ED-20003] Replace TyepAhead API for Editor Plugin Injection API
8
+
9
+ ## 0.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#40955](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/40955) [`30dc2b1e6c9`](https://bitbucket.org/atlassian/atlassian-frontend/commits/30dc2b1e6c9) - [ED-19746] Decoupling mentions plugin from Editor-core libraries
14
+
3
15
  ## 0.3.2
4
16
 
5
17
  ### Patch Changes
@@ -16,16 +28,16 @@
16
28
 
17
29
  ### Minor Changes
18
30
 
19
- - [`ef0c2a89c72`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ef0c2a89c72) - Add isTypeAheadOpen action to type-ahead plugin. Decouple placeholder plugin from editor-core.
31
+ - [#39575](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39575) [`ef0c2a89c72`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ef0c2a89c72) - Add isTypeAheadOpen action to type-ahead plugin. Decouple placeholder plugin from editor-core.
20
32
 
21
33
  ## 0.2.0
22
34
 
23
35
  ### Minor Changes
24
36
 
25
- - [`ad3c5c21079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad3c5c21079) - Updating all plugins with minor version to correct issue with semver.
37
+ - [#39325](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39325) [`ad3c5c21079`](https://bitbucket.org/atlassian/atlassian-frontend/commits/ad3c5c21079) - Updating all plugins with minor version to correct issue with semver.
26
38
 
27
39
  ## 0.1.1
28
40
 
29
41
  ### Patch Changes
30
42
 
31
- - [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
43
+ - [#39177](https://bitbucket.org/atlassian/atlassian-frontend/pull-requests/39177) [`24e27147cbd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/24e27147cbd) - Added atlaskit docs to all existing plugins.
package/README.md CHANGED
@@ -27,4 +27,4 @@ Please see [Atlaskit - Editor plugin type ahead](https://atlaskit.atlassian.com/
27
27
  For internal Atlassian, visit the slack channel [#help-editor](https://atlassian.slack.com/archives/CFG3PSQ9E) for support or visit [go/editor-help](https://go/editor-help) to submit a bug.
28
28
  ## License
29
29
  ---
30
- Please see [Atlassian Frontend - License](https://developer.atlassian.com/cloud/framework/atlassian-frontend/#license) for more licensing information.
30
+ Please see [Atlassian Frontend - License](https://hello.atlassian.net/wiki/spaces/AF/pages/2589099144/Documentation#License) for more licensing information.
@@ -1,29 +1,48 @@
1
1
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { EditorCommand, NextEditorPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
+ import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
5
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
7
  export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
6
- type Props = {
8
+ export type TypeAheadPluginOptions = {
9
+ isMobile?: boolean;
10
+ createAnalyticsEvent?: CreateUIAnalyticsEvent;
11
+ };
12
+ type OpenTypeAheadProps = {
7
13
  triggerHandler: TypeAheadHandler;
8
14
  inputMethod: TypeAheadInputMethod;
9
15
  query?: string;
10
16
  };
11
- export type TypeAheadPluginOptions = {
12
- isMobile?: boolean;
13
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
17
+ type InsertTypeAheadItemProps = {
18
+ triggerHandler: TypeAheadHandler;
19
+ contentItem: TypeAheadItem;
20
+ query: string;
21
+ sourceListItem: TypeAheadItem[];
22
+ mode?: SelectItemMode;
23
+ };
24
+ type CloseTypeAheadProps = {
25
+ insertCurrentQueryAsRawText: boolean;
26
+ attachCommand?: Command;
14
27
  };
15
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
16
28
  /**
17
29
  * Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
18
30
  * from `@atlaskit/editor-core`.
19
31
  */
20
32
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
21
33
  pluginConfiguration: TypeAheadPluginOptions | undefined;
34
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
35
+ sharedState: {
36
+ query: string;
37
+ };
22
38
  actions: {
23
39
  isOpen: (editorState: EditorState) => boolean;
24
- };
25
- commands: {
26
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
40
+ isAllowed: (editorState: EditorState) => boolean;
41
+ insert: (props: InsertTypeAheadItemProps) => boolean;
42
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
43
+ open: (props: OpenTypeAheadProps) => boolean;
44
+ close: (props: CloseTypeAheadProps) => boolean;
45
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
27
46
  };
28
47
  }>;
29
48
  export {};
@@ -1,29 +1,50 @@
1
1
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
2
2
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
3
- import type { EditorCommand, NextEditorPlugin, TypeAheadHandler } from '@atlaskit/editor-common/types';
4
- import type { EditorState } from '@atlaskit/editor-prosemirror/state';
3
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
4
+ import type { Command, NextEditorPlugin, OptionalPlugin, TypeAheadHandler, TypeAheadItem } from '@atlaskit/editor-common/types';
5
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
6
+ import type { EditorState, Transaction } from '@atlaskit/editor-prosemirror/state';
5
7
  export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBOARD | INPUT_METHOD.QUICK_INSERT | INPUT_METHOD.TOOLBAR;
6
- type Props = {
8
+ export type TypeAheadPluginOptions = {
9
+ isMobile?: boolean;
10
+ createAnalyticsEvent?: CreateUIAnalyticsEvent;
11
+ };
12
+ type OpenTypeAheadProps = {
7
13
  triggerHandler: TypeAheadHandler;
8
14
  inputMethod: TypeAheadInputMethod;
9
15
  query?: string;
10
16
  };
11
- export type TypeAheadPluginOptions = {
12
- isMobile?: boolean;
13
- createAnalyticsEvent?: CreateUIAnalyticsEvent;
17
+ type InsertTypeAheadItemProps = {
18
+ triggerHandler: TypeAheadHandler;
19
+ contentItem: TypeAheadItem;
20
+ query: string;
21
+ sourceListItem: TypeAheadItem[];
22
+ mode?: SelectItemMode;
23
+ };
24
+ type CloseTypeAheadProps = {
25
+ insertCurrentQueryAsRawText: boolean;
26
+ attachCommand?: Command;
14
27
  };
15
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
16
28
  /**
17
29
  * Type ahead plugin to be added to an `EditorPresetBuilder` and used with `ComposableEditor`
18
30
  * from `@atlaskit/editor-core`.
19
31
  */
20
32
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
21
33
  pluginConfiguration: TypeAheadPluginOptions | undefined;
34
+ dependencies: [
35
+ OptionalPlugin<AnalyticsPlugin>
36
+ ];
37
+ sharedState: {
38
+ query: string;
39
+ };
22
40
  actions: {
23
41
  isOpen: (editorState: EditorState) => boolean;
24
- };
25
- commands: {
26
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
42
+ isAllowed: (editorState: EditorState) => boolean;
43
+ insert: (props: InsertTypeAheadItemProps) => boolean;
44
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
45
+ open: (props: OpenTypeAheadProps) => boolean;
46
+ close: (props: CloseTypeAheadProps) => boolean;
47
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
27
48
  };
28
49
  }>;
29
50
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-plugin-type-ahead",
3
- "version": "0.3.2",
3
+ "version": "0.5.0",
4
4
  "description": "Type-ahead plugin for @atlaskit/editor-core",
5
5
  "author": "Atlassian Pty Ltd",
6
6
  "license": "Apache-2.0",
@@ -31,7 +31,8 @@
31
31
  ".": "./src/index.ts"
32
32
  },
33
33
  "dependencies": {
34
- "@atlaskit/editor-common": "^76.0.0",
34
+ "@atlaskit/editor-common": "^76.6.0",
35
+ "@atlaskit/editor-plugin-analytics": "^0.2.0",
35
36
  "@atlaskit/editor-prosemirror": "1.1.0",
36
37
  "@babel/runtime": "^7.0.0"
37
38
  },
package/report.api.md CHANGED
@@ -15,18 +15,35 @@
15
15
  <!--SECTION START: Main Entry Types-->
16
16
 
17
17
  ```ts
18
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
19
+ import type { Command } from '@atlaskit/editor-common/types';
18
20
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
19
- import type { EditorCommand } from '@atlaskit/editor-common/types';
20
21
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
21
22
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
22
23
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
24
+ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
25
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
26
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
23
27
  import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
28
+ import type { TypeAheadItem } from '@atlaskit/editor-common/types';
24
29
 
25
30
  // @public (undocumented)
26
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
31
+ type CloseTypeAheadProps = {
32
+ insertCurrentQueryAsRawText: boolean;
33
+ attachCommand?: Command;
34
+ };
27
35
 
28
36
  // @public (undocumented)
29
- type Props = {
37
+ type InsertTypeAheadItemProps = {
38
+ triggerHandler: TypeAheadHandler;
39
+ contentItem: TypeAheadItem;
40
+ query: string;
41
+ sourceListItem: TypeAheadItem[];
42
+ mode?: SelectItemMode;
43
+ };
44
+
45
+ // @public (undocumented)
46
+ type OpenTypeAheadProps = {
30
47
  triggerHandler: TypeAheadHandler;
31
48
  inputMethod: TypeAheadInputMethod;
32
49
  query?: string;
@@ -44,11 +61,20 @@ export type TypeAheadPlugin = NextEditorPlugin<
44
61
  'typeAhead',
45
62
  {
46
63
  pluginConfiguration: TypeAheadPluginOptions | undefined;
64
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
65
+ sharedState: {
66
+ query: string;
67
+ };
47
68
  actions: {
48
69
  isOpen: (editorState: EditorState) => boolean;
49
- };
50
- commands: {
51
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
70
+ isAllowed: (editorState: EditorState) => boolean;
71
+ insert: (props: InsertTypeAheadItemProps) => boolean;
72
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
73
+ open: (props: OpenTypeAheadProps) => boolean;
74
+ close: (props: CloseTypeAheadProps) => boolean;
75
+ openAtTransaction: (
76
+ props: OpenTypeAheadProps,
77
+ ) => (tr: Transaction) => boolean;
52
78
  };
53
79
  }
54
80
  >;
@@ -4,18 +4,35 @@
4
4
 
5
5
  ```ts
6
6
 
7
+ import type { AnalyticsPlugin } from '@atlaskit/editor-plugin-analytics';
8
+ import type { Command } from '@atlaskit/editor-common/types';
7
9
  import type { CreateUIAnalyticsEvent } from '@atlaskit/analytics-next';
8
- import type { EditorCommand } from '@atlaskit/editor-common/types';
9
10
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
10
11
  import type { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
11
12
  import type { NextEditorPlugin } from '@atlaskit/editor-common/types';
13
+ import type { OptionalPlugin } from '@atlaskit/editor-common/types';
14
+ import type { SelectItemMode } from '@atlaskit/editor-common/type-ahead';
15
+ import type { Transaction } from '@atlaskit/editor-prosemirror/state';
12
16
  import type { TypeAheadHandler } from '@atlaskit/editor-common/types';
17
+ import type { TypeAheadItem } from '@atlaskit/editor-common/types';
13
18
 
14
19
  // @public (undocumented)
15
- type OpenTypeAheadAtCursorType = (props: Props) => EditorCommand;
20
+ type CloseTypeAheadProps = {
21
+ insertCurrentQueryAsRawText: boolean;
22
+ attachCommand?: Command;
23
+ };
16
24
 
17
25
  // @public (undocumented)
18
- type Props = {
26
+ type InsertTypeAheadItemProps = {
27
+ triggerHandler: TypeAheadHandler;
28
+ contentItem: TypeAheadItem;
29
+ query: string;
30
+ sourceListItem: TypeAheadItem[];
31
+ mode?: SelectItemMode;
32
+ };
33
+
34
+ // @public (undocumented)
35
+ type OpenTypeAheadProps = {
19
36
  triggerHandler: TypeAheadHandler;
20
37
  inputMethod: TypeAheadInputMethod;
21
38
  query?: string;
@@ -27,11 +44,18 @@ export type TypeAheadInputMethod = INPUT_METHOD.INSERT_MENU | INPUT_METHOD.KEYBO
27
44
  // @public
28
45
  export type TypeAheadPlugin = NextEditorPlugin<'typeAhead', {
29
46
  pluginConfiguration: TypeAheadPluginOptions | undefined;
47
+ dependencies: [OptionalPlugin<AnalyticsPlugin>];
48
+ sharedState: {
49
+ query: string;
50
+ };
30
51
  actions: {
31
52
  isOpen: (editorState: EditorState) => boolean;
32
- };
33
- commands: {
34
- openTypeAheadAtCursor: OpenTypeAheadAtCursorType;
53
+ isAllowed: (editorState: EditorState) => boolean;
54
+ insert: (props: InsertTypeAheadItemProps) => boolean;
55
+ findHandlerByTrigger: (trigger: string) => TypeAheadHandler | null;
56
+ open: (props: OpenTypeAheadProps) => boolean;
57
+ close: (props: CloseTypeAheadProps) => boolean;
58
+ openAtTransaction: (props: OpenTypeAheadProps) => (tr: Transaction) => boolean;
35
59
  };
36
60
  }>;
37
61