@atlaskit/editor-common 74.41.2 → 74.42.1
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/analytics/types/table-events.js +1 -0
- package/dist/cjs/monitoring/error.js +1 -1
- package/dist/cjs/preset/plugin-commands.js +10 -0
- package/dist/cjs/preset/plugin-injection-api.js +17 -2
- package/dist/cjs/quick-insert/assets/action.js +23 -6
- package/dist/cjs/quick-insert/assets/code.js +31 -8
- package/dist/cjs/quick-insert/assets/decision.js +19 -5
- package/dist/cjs/quick-insert/assets/divider.js +35 -9
- package/dist/cjs/quick-insert/use-icon-themed.js +20 -0
- package/dist/cjs/ui/DropList/index.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/analytics/types/table-events.js +1 -0
- package/dist/es2019/monitoring/error.js +1 -1
- package/dist/es2019/preset/plugin-commands.js +10 -0
- package/dist/es2019/preset/plugin-injection-api.js +17 -2
- package/dist/es2019/quick-insert/assets/action.js +24 -6
- package/dist/es2019/quick-insert/assets/code.js +32 -8
- package/dist/es2019/quick-insert/assets/decision.js +20 -5
- package/dist/es2019/quick-insert/assets/divider.js +36 -9
- package/dist/es2019/quick-insert/use-icon-themed.js +14 -0
- package/dist/es2019/ui/DropList/index.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/analytics/types/table-events.js +1 -0
- package/dist/esm/monitoring/error.js +1 -1
- package/dist/esm/preset/plugin-commands.js +10 -0
- package/dist/esm/preset/plugin-injection-api.js +17 -2
- package/dist/esm/quick-insert/assets/action.js +23 -6
- package/dist/esm/quick-insert/assets/code.js +31 -8
- package/dist/esm/quick-insert/assets/decision.js +19 -5
- package/dist/esm/quick-insert/assets/divider.js +35 -9
- package/dist/esm/quick-insert/use-icon-themed.js +13 -0
- package/dist/esm/ui/DropList/index.js +1 -1
- package/dist/esm/version.json +1 -1
- package/dist/types/analytics/types/table-events.d.ts +11 -3
- package/dist/types/hooks/useSharedPluginState.d.ts +5 -5
- package/dist/types/preset/plugin-commands.d.ts +10 -0
- package/dist/types/preset/plugin-injection-api.d.ts +9 -1
- package/dist/types/quick-insert/use-icon-themed.d.ts +9 -0
- package/dist/types/types/next-editor-plugin.d.ts +8 -0
- package/dist/types-ts4.5/analytics/types/table-events.d.ts +11 -3
- package/dist/types-ts4.5/hooks/useSharedPluginState.d.ts +5 -5
- package/dist/types-ts4.5/preset/plugin-commands.d.ts +10 -0
- package/dist/types-ts4.5/preset/plugin-injection-api.d.ts +9 -1
- package/dist/types-ts4.5/quick-insert/use-icon-themed.d.ts +9 -0
- package/dist/types-ts4.5/types/next-editor-plugin.d.ts +8 -0
- package/package.json +1 -1
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
3
|
import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
4
|
+
import type { PluginCommand } from '../types/plugin-command';
|
|
3
5
|
type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
|
|
4
6
|
type SharedStateAPIProps = {
|
|
5
7
|
getEditorState: () => EditorState | undefined;
|
|
6
8
|
};
|
|
9
|
+
interface PluginInjectionAPIProps extends SharedStateAPIProps {
|
|
10
|
+
getEditorView: () => EditorView | undefined;
|
|
11
|
+
}
|
|
7
12
|
type EditorStateDiff = {
|
|
8
13
|
readonly newEditorState: EditorState;
|
|
9
14
|
readonly oldEditorState: EditorState | undefined;
|
|
@@ -34,10 +39,13 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
34
39
|
private actionsAPI;
|
|
35
40
|
private commandsAPI;
|
|
36
41
|
private plugins;
|
|
37
|
-
|
|
42
|
+
private getEditorView;
|
|
43
|
+
constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
|
|
38
44
|
api<T extends NextEditorPlugin<any, any>>(): {
|
|
39
45
|
dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>, ..."dependencies" extends keyof (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never) ? (T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"] extends (((config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>) | import("../types/next-editor-plugin").OptionalPlugin<(config?: any, api?: PluginInjectionAPI<any, any> | undefined) => DefaultEditorPlugin<any, any>>)[] ? Exclude<(T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never)["dependencies"], undefined> : [] : []]>;
|
|
46
|
+
executeCommand: (command: PluginCommand | undefined) => boolean;
|
|
40
47
|
};
|
|
48
|
+
private executeCommand;
|
|
41
49
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
42
50
|
onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
|
|
43
51
|
private addPlugin;
|
|
@@ -38,6 +38,14 @@ export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorP
|
|
|
38
38
|
NextEditorPlugin<Name, Metadata>,
|
|
39
39
|
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
40
40
|
]>;
|
|
41
|
+
/**
|
|
42
|
+
* Dispatches a PluginCommand to ProseMirror
|
|
43
|
+
*
|
|
44
|
+
* @param action A function (PluginCommand | undefined) that takes a `Transaction` and returns a `Transaction` if it
|
|
45
|
+
* is successful or `null` if it shouldn't be dispatched.
|
|
46
|
+
* @returns (boolean) if the command was successful in dispatching
|
|
47
|
+
*/
|
|
48
|
+
executeCommand: (action: PluginCommand | undefined) => boolean;
|
|
41
49
|
};
|
|
42
50
|
export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
|
|
43
51
|
dependencies: CreatePluginDependenciesAPI<[
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { TableSortOrder as SortOrder } from '@atlaskit/adf-schema/steps';
|
|
2
2
|
import type { ACTION_SUBJECT, INPUT_METHOD } from './enums';
|
|
3
|
-
import type { TableAEP, UIAEP } from './utils';
|
|
3
|
+
import type { OperationalAEP, TableAEP, UIAEP } from './utils';
|
|
4
4
|
export declare enum TABLE_ACTION {
|
|
5
5
|
DELETED = "deleted",
|
|
6
6
|
CLEARED = "cleared",
|
|
@@ -23,7 +23,8 @@ export declare enum TABLE_ACTION {
|
|
|
23
23
|
ATTEMPTED_TABLE_WIDTH_CHANGE = "attemptedTableWidthChange",
|
|
24
24
|
DISTRIBUTED_COLUMNS_WIDTHS = "distributedColumnsWidths",
|
|
25
25
|
FIXED = "fixed",
|
|
26
|
-
RESIZED = "resized"
|
|
26
|
+
RESIZED = "resized",
|
|
27
|
+
RESIZE_PERF_SAMPLING = "resizePerfSampling"
|
|
27
28
|
}
|
|
28
29
|
export declare enum TABLE_BREAKOUT {
|
|
29
30
|
WIDE = "wide",
|
|
@@ -57,6 +58,12 @@ type ResizedInfo = {
|
|
|
57
58
|
totalTableWidth: number | null;
|
|
58
59
|
nodeSize: number;
|
|
59
60
|
} & TotalRowAndColCount;
|
|
61
|
+
type ResizePreviewInfo = {
|
|
62
|
+
frameRate: number;
|
|
63
|
+
isInitialSample: boolean;
|
|
64
|
+
docSize: number;
|
|
65
|
+
nodeSize: number;
|
|
66
|
+
};
|
|
60
67
|
type TableDeleteAEP = TableAEP<TABLE_ACTION.DELETED, {
|
|
61
68
|
inputMethod: INPUT_METHOD.KEYBOARD | INPUT_METHOD.FLOATING_TB;
|
|
62
69
|
} & TotalRowAndColCount, undefined>;
|
|
@@ -106,5 +113,6 @@ type TableFixedAEP = TableAEP<TABLE_ACTION.FIXED, {
|
|
|
106
113
|
reason: string;
|
|
107
114
|
}, undefined>;
|
|
108
115
|
type TableResizedAEP = TableAEP<TABLE_ACTION.RESIZED, ResizedInfo, undefined>;
|
|
109
|
-
|
|
116
|
+
type TableResizePerfSamplingAEP = OperationalAEP<TABLE_ACTION.RESIZE_PERF_SAMPLING, ACTION_SUBJECT.TABLE, undefined, ResizePreviewInfo, undefined>;
|
|
117
|
+
export type TableEventPayload = TableDeleteAEP | TableClearAEP | TableMergeSplitAEP | TableColorAEP | TableToggleHeaderAEP | TableChangeBreakoutAEP | TableCopyAndCutAEP | TableAddRowOrColumnAEP | TableSortColumnAEP | TableDeleteRowOrColumnAEP | TableReplaceAEP | TableAttemptedResizeAEP | TableDistributeColumnsWidthsAEP | TableCollapsedAEP | TableFixedAEP | TableResizedAEP | TableResizePerfSamplingAEP;
|
|
110
118
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import type { ExtractPluginSharedState,
|
|
2
|
-
type NamedPluginStatesFromInjectionAPI<API extends
|
|
3
|
-
[K in PluginList[number] as `${K}State`]: API extends
|
|
1
|
+
import type { ExtractPluginSharedState, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPIWithDependencies } from '../types/next-editor-plugin';
|
|
2
|
+
type NamedPluginStatesFromInjectionAPI<API extends PluginInjectionAPIWithDependencies<any> | undefined, PluginList extends string[]> = Readonly<{
|
|
3
|
+
[K in PluginList[number] as `${K}State`]: API extends PluginInjectionAPIWithDependencies<any> ? API['dependencies'][K] extends PluginDependenciesAPI<infer Plugin> | undefined ? ExtractPluginSharedState<Plugin> | undefined : never : never;
|
|
4
4
|
}>;
|
|
5
|
-
type ExtractPluginNames<
|
|
5
|
+
type ExtractPluginNames<API extends PluginInjectionAPIWithDependencies<any>> = API extends PluginInjectionAPIWithDependencies<any> ? keyof API['dependencies'] : never;
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* Used to return the current plugin state of
|
|
@@ -35,5 +35,5 @@ type ExtractPluginNames<Name extends string, Metadata extends NextEditorPluginMe
|
|
|
35
35
|
* @returns A corresponding object, the keys are names of the plugin with `State` appended,
|
|
36
36
|
* the values are the shared state exposed by that plugin.
|
|
37
37
|
*/
|
|
38
|
-
export declare function useSharedPluginState<
|
|
38
|
+
export declare function useSharedPluginState<Plugins extends NextEditorPlugin<any, any>[], PluginNames extends ExtractPluginNames<PluginInjectionAPIWithDependencies<Plugins>>[]>(injectionApi: PluginInjectionAPIWithDependencies<Plugins> | undefined, plugins: PluginNames): NamedPluginStatesFromInjectionAPI<typeof injectionApi, PluginNames>;
|
|
39
39
|
export {};
|
|
@@ -1,3 +1,13 @@
|
|
|
1
1
|
import type { Command } from '../types/command';
|
|
2
2
|
import type { PluginCommand } from '../types/plugin-command';
|
|
3
|
+
/**
|
|
4
|
+
* Convert a PluginCommand to a standard Prosemirror Command.
|
|
5
|
+
* The preferred approach to dispatching a `PluginCommand` is via the
|
|
6
|
+
* `executeCommand` on `pluginInjectionAPI`. In some cases
|
|
7
|
+
* the type may require a Command until we refactor this out and this
|
|
8
|
+
* function is suitable for those cases.
|
|
9
|
+
*
|
|
10
|
+
* @param command A plugin command (a function that modifies and returns a `Transaction`)
|
|
11
|
+
* @returns Command
|
|
12
|
+
*/
|
|
3
13
|
export declare function pluginCommandToPMCommand(command: PluginCommand | undefined): Command;
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
2
|
+
import type { EditorView } from '@atlaskit/editor-prosemirror/view';
|
|
2
3
|
import type { DefaultEditorPlugin, NextEditorPlugin, PluginDependenciesAPI, PluginInjectionAPI } from '../types/next-editor-plugin';
|
|
4
|
+
import type { PluginCommand } from '../types/plugin-command';
|
|
3
5
|
type NextEditorPluginInitializedType = ReturnType<NextEditorPlugin<any>>;
|
|
4
6
|
type SharedStateAPIProps = {
|
|
5
7
|
getEditorState: () => EditorState | undefined;
|
|
6
8
|
};
|
|
9
|
+
interface PluginInjectionAPIProps extends SharedStateAPIProps {
|
|
10
|
+
getEditorView: () => EditorView | undefined;
|
|
11
|
+
}
|
|
7
12
|
type EditorStateDiff = {
|
|
8
13
|
readonly newEditorState: EditorState;
|
|
9
14
|
readonly oldEditorState: EditorState | undefined;
|
|
@@ -34,7 +39,8 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
34
39
|
private actionsAPI;
|
|
35
40
|
private commandsAPI;
|
|
36
41
|
private plugins;
|
|
37
|
-
|
|
42
|
+
private getEditorView;
|
|
43
|
+
constructor({ getEditorState, getEditorView }: PluginInjectionAPIProps);
|
|
38
44
|
api<T extends NextEditorPlugin<any, any>>(): {
|
|
39
45
|
dependencies: import("../types/next-editor-plugin").CreatePluginDependenciesAPI<[
|
|
40
46
|
NextEditorPlugin<T extends (config?: any, api?: PluginInjectionAPI<infer Name extends string, any> | undefined) => DefaultEditorPlugin<infer Name extends string, any> ? Name : never, T extends NextEditorPlugin<any, infer Metadata extends import("../types/next-editor-plugin").NextEditorPluginMetadata> ? Metadata : never>,
|
|
@@ -42,7 +48,9 @@ export declare class EditorPluginInjectionAPI implements PluginInjectionAPIDefin
|
|
|
42
48
|
] : [
|
|
43
49
|
]
|
|
44
50
|
]>;
|
|
51
|
+
executeCommand: (command: PluginCommand | undefined) => boolean;
|
|
45
52
|
};
|
|
53
|
+
private executeCommand;
|
|
46
54
|
onEditorViewUpdated: ({ newEditorState, oldEditorState, }: EditorStateDiff) => void;
|
|
47
55
|
onEditorPluginInitialized: (plugin: NextEditorPluginInitializedType) => void;
|
|
48
56
|
private addPlugin;
|
|
@@ -38,6 +38,14 @@ export type PluginInjectionAPI<Name extends string, Metadata extends NextEditorP
|
|
|
38
38
|
NextEditorPlugin<Name, Metadata>,
|
|
39
39
|
...ExtractPluginDependenciesFromMetadata<Metadata>
|
|
40
40
|
]>;
|
|
41
|
+
/**
|
|
42
|
+
* Dispatches a PluginCommand to ProseMirror
|
|
43
|
+
*
|
|
44
|
+
* @param action A function (PluginCommand | undefined) that takes a `Transaction` and returns a `Transaction` if it
|
|
45
|
+
* is successful or `null` if it shouldn't be dispatched.
|
|
46
|
+
* @returns (boolean) if the command was successful in dispatching
|
|
47
|
+
*/
|
|
48
|
+
executeCommand: (action: PluginCommand | undefined) => boolean;
|
|
41
49
|
};
|
|
42
50
|
export type PluginInjectionAPIWithDependency<Plugin> = Plugin extends NextEditorPlugin<infer Name, infer Metadata> ? {
|
|
43
51
|
dependencies: CreatePluginDependenciesAPI<[
|
package/package.json
CHANGED