@atlaskit/editor-core 187.23.2 → 187.24.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 +17 -0
- package/dist/cjs/create-editor/ReactEditorViewInternal.js +2 -1
- package/dist/cjs/editor-next/editor-internal.js +3 -0
- package/dist/cjs/plugins/base/index.js +2 -1
- package/dist/cjs/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +58 -27
- package/dist/cjs/plugins/text-color/commands/toggle-color.js +1 -1
- package/dist/cjs/presets/context.js +40 -0
- package/dist/cjs/ui/EditorContext/index.js +2 -1
- package/dist/cjs/use-preset.js +51 -0
- package/dist/cjs/version-wrapper.js +1 -1
- package/dist/es2019/create-editor/ReactEditorViewInternal.js +2 -1
- package/dist/es2019/editor-next/editor-internal.js +3 -0
- package/dist/es2019/plugins/base/index.js +2 -1
- package/dist/es2019/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +46 -16
- package/dist/es2019/plugins/text-color/commands/toggle-color.js +2 -2
- package/dist/es2019/presets/context.js +25 -0
- package/dist/es2019/ui/EditorContext/index.js +2 -1
- package/dist/es2019/use-preset.js +45 -0
- package/dist/es2019/version-wrapper.js +1 -1
- package/dist/esm/create-editor/ReactEditorViewInternal.js +2 -1
- package/dist/esm/editor-next/editor-internal.js +3 -0
- package/dist/esm/plugins/base/index.js +2 -1
- package/dist/esm/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.js +58 -28
- package/dist/esm/plugins/text-color/commands/toggle-color.js +2 -2
- package/dist/esm/presets/context.js +26 -0
- package/dist/esm/ui/EditorContext/index.js +2 -1
- package/dist/esm/use-preset.js +45 -0
- package/dist/esm/version-wrapper.js +1 -1
- package/dist/types/create-editor/ReactEditorViewInternal.d.ts +2 -0
- package/dist/types/labs/next/presets/default.d.ts +28 -28
- package/dist/types/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types/plugins/emoji/index.d.ts +2 -2
- package/dist/types/plugins/find-replace/index.d.ts +1 -1
- package/dist/types/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +7 -4
- package/dist/types/presets/context.d.ts +15 -0
- package/dist/types/use-preset.d.ts +48 -0
- package/dist/types-ts4.5/create-editor/ReactEditorViewInternal.d.ts +2 -0
- package/dist/types-ts4.5/labs/next/presets/default.d.ts +28 -28
- package/dist/types-ts4.5/plugins/emoji/commands/insert-emoji.d.ts +2 -2
- package/dist/types-ts4.5/plugins/emoji/index.d.ts +2 -2
- package/dist/types-ts4.5/plugins/find-replace/index.d.ts +1 -1
- package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts +7 -4
- package/dist/types-ts4.5/presets/context.d.ts +15 -0
- package/dist/types-ts4.5/use-preset.d.ts +52 -0
- package/package.json +7 -4
- package/report.api.md +6 -0
- package/tmp/api-report-tmp.d.ts +6 -0
- package/use-preset/package.json +15 -0
- package/dist/cjs/version.json +0 -5
- package/dist/es2019/version.json +0 -5
- package/dist/esm/version.json +0 -5
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { DependencyList } from 'react';
|
|
2
|
+
import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
3
|
+
import type { AllEditorPresetPluginTypes, PublicPluginAPI, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
+
type ExtractNextEditorPlugins<Plugins extends AllEditorPresetPluginTypes[]> = {
|
|
5
|
+
[PluginNumber in keyof Plugins]: Plugins[PluginNumber] extends NextEditorPlugin<infer Name, infer Metadata> ? NextEditorPlugin<Name, Metadata> : Plugins[PluginNumber] extends [
|
|
6
|
+
NextEditorPlugin<infer Name, infer Metadata>,
|
|
7
|
+
any
|
|
8
|
+
] ? NextEditorPlugin<Name, Metadata> : never;
|
|
9
|
+
};
|
|
10
|
+
interface PresetAPI<PluginNames extends string[] = [], StackPlugins extends AllEditorPresetPluginTypes[] = []> {
|
|
11
|
+
editorApi: PublicPluginAPI<ExtractNextEditorPlugins<StackPlugins>> | undefined;
|
|
12
|
+
preset: EditorPresetBuilder<PluginNames, StackPlugins>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Creates a preset.
|
|
16
|
+
*
|
|
17
|
+
* Takes an input function that returns a preset (and memoizes it) depending
|
|
18
|
+
* on the dependency array provided.
|
|
19
|
+
*
|
|
20
|
+
* Returns a pluginInjectionApi in order to apply actions and subscribe to plugin
|
|
21
|
+
* changes outside of the editor.
|
|
22
|
+
*
|
|
23
|
+
* @param createPreset
|
|
24
|
+
* @param dependencies
|
|
25
|
+
* @returns PresetAPI ({ pluginInjectionApi, preset, actionBuilder })
|
|
26
|
+
*
|
|
27
|
+
* Example:
|
|
28
|
+
* ```ts
|
|
29
|
+
* function ExampleEditor() {
|
|
30
|
+
* const { preset, editorApi } = usePreset(() =>
|
|
31
|
+
* new EditorPresetBuilder().add(plugin1).add(plugin2)
|
|
32
|
+
* , []);
|
|
33
|
+
*
|
|
34
|
+
* // Can execute typesafe commands based on plugin1 or 2
|
|
35
|
+
* const runCommand = () => editorApi.executeCommand(
|
|
36
|
+
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
37
|
+
* )
|
|
38
|
+
* return (
|
|
39
|
+
* <>
|
|
40
|
+
* <Editor preset={preset} />
|
|
41
|
+
* <Button onClick={runCommand}>Run command</Button>
|
|
42
|
+
* </>
|
|
43
|
+
* )
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function usePreset<PluginNames extends string[] = [], StackPlugins extends AllEditorPresetPluginTypes[] = []>(createPreset: () => EditorPresetBuilder<PluginNames, StackPlugins>, dependencies: DependencyList): PresetAPI<PluginNames, StackPlugins>;
|
|
48
|
+
export {};
|
|
@@ -16,6 +16,7 @@ import { FULL_WIDTH_MODE } from '@atlaskit/editor-common/analytics';
|
|
|
16
16
|
import type { EditorAppearance, EditorConfig, EditorReactContext, EditorPlugin, EditorProps } from '../types';
|
|
17
17
|
import type { EditorNextProps } from '../types/editor-props';
|
|
18
18
|
import type { PortalProviderAPI } from '@atlaskit/editor-common/portal-provider';
|
|
19
|
+
import type { SetEditorAPI } from '../presets/context';
|
|
19
20
|
import { TransactionTracker } from '../utils/performance/track-transactions';
|
|
20
21
|
import type { FireAnalyticsCallback, AnalyticsEventPayload, DispatchAnalyticsEvent } from '@atlaskit/editor-common/analytics';
|
|
21
22
|
import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
@@ -26,6 +27,7 @@ export interface EditorViewProps {
|
|
|
26
27
|
portalProviderAPI: PortalProviderAPI;
|
|
27
28
|
disabled?: boolean;
|
|
28
29
|
experienceStore?: ExperienceStore;
|
|
30
|
+
setEditorApi?: SetEditorAPI;
|
|
29
31
|
render?: (props: {
|
|
30
32
|
editor: JSX.Element;
|
|
31
33
|
view?: EditorView;
|
|
@@ -320,13 +320,13 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
320
320
|
}>>
|
|
321
321
|
];
|
|
322
322
|
commands: {
|
|
323
|
-
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
324
|
-
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
325
|
-
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").
|
|
326
|
-
toggleCode: import("@atlaskit/editor-plugin-text-formatting").
|
|
327
|
-
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").
|
|
328
|
-
toggleEm: import("@atlaskit/editor-plugin-text-formatting").
|
|
329
|
-
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").
|
|
323
|
+
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
324
|
+
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
325
|
+
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
326
|
+
toggleCode: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
327
|
+
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
328
|
+
toggleEm: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
329
|
+
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
330
330
|
};
|
|
331
331
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"textFormatting", {
|
|
332
332
|
pluginConfiguration: TextFormattingOptions | undefined;
|
|
@@ -366,13 +366,13 @@ export declare function createDefaultPreset(options: EditorPresetProps & Default
|
|
|
366
366
|
}>>
|
|
367
367
|
];
|
|
368
368
|
commands: {
|
|
369
|
-
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
370
|
-
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
371
|
-
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").
|
|
372
|
-
toggleCode: import("@atlaskit/editor-plugin-text-formatting").
|
|
373
|
-
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").
|
|
374
|
-
toggleEm: import("@atlaskit/editor-plugin-text-formatting").
|
|
375
|
-
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").
|
|
369
|
+
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
370
|
+
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
371
|
+
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
372
|
+
toggleCode: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
373
|
+
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
374
|
+
toggleEm: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
375
|
+
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
376
376
|
};
|
|
377
377
|
}>,
|
|
378
378
|
(config?: HyperlinkPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"hyperlink", {
|
|
@@ -771,13 +771,13 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
771
771
|
}>>
|
|
772
772
|
];
|
|
773
773
|
commands: {
|
|
774
|
-
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
775
|
-
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
776
|
-
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").
|
|
777
|
-
toggleCode: import("@atlaskit/editor-plugin-text-formatting").
|
|
778
|
-
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").
|
|
779
|
-
toggleEm: import("@atlaskit/editor-plugin-text-formatting").
|
|
780
|
-
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").
|
|
774
|
+
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
775
|
+
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
776
|
+
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
777
|
+
toggleCode: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
778
|
+
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
779
|
+
toggleEm: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
780
|
+
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
781
781
|
};
|
|
782
782
|
}> | undefined) => import("@atlaskit/editor-common/types").DefaultEditorPlugin<"textFormatting", {
|
|
783
783
|
pluginConfiguration: TextFormattingOptions | undefined;
|
|
@@ -817,13 +817,13 @@ export declare function useDefaultPreset(props: EditorPresetProps & DefaultPrese
|
|
|
817
817
|
}>>
|
|
818
818
|
];
|
|
819
819
|
commands: {
|
|
820
|
-
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
821
|
-
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").
|
|
822
|
-
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").
|
|
823
|
-
toggleCode: import("@atlaskit/editor-plugin-text-formatting").
|
|
824
|
-
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").
|
|
825
|
-
toggleEm: import("@atlaskit/editor-plugin-text-formatting").
|
|
826
|
-
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").
|
|
820
|
+
toggleSuperscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
821
|
+
toggleSubscript: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
822
|
+
toggleStrike: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
823
|
+
toggleCode: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
824
|
+
toggleUnderline: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
825
|
+
toggleEm: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
826
|
+
toggleStrong: import("@atlaskit/editor-plugin-text-formatting").ToggleMarkEditorCommand;
|
|
827
827
|
};
|
|
828
828
|
}>,
|
|
829
829
|
(config?: HyperlinkPluginOptions | undefined, api?: import("@atlaskit/editor-common/types").PluginInjectionAPI<"hyperlink", {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { EmojiId } from '@atlaskit/emoji';
|
|
2
|
-
import type {
|
|
2
|
+
import type { EditorCommand } from '@atlaskit/editor-common/types';
|
|
3
3
|
import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
|
|
4
|
-
export declare const insertEmoji: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) =>
|
|
4
|
+
export declare const insertEmoji: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
@@ -2,7 +2,7 @@ import { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
|
|
|
2
2
|
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
|
|
3
3
|
import { PluginKey } from '@atlaskit/editor-prosemirror/state';
|
|
4
4
|
import type { EmojiDescription, EmojiProvider, EmojiId } from '@atlaskit/emoji';
|
|
5
|
-
import type { Command, NextEditorPlugin, PMPluginFactoryParams, OptionalPlugin,
|
|
5
|
+
import type { Command, NextEditorPlugin, PMPluginFactoryParams, OptionalPlugin, EditorCommand } from '@atlaskit/editor-common/types';
|
|
6
6
|
import { INPUT_METHOD } from '@atlaskit/editor-common/analytics';
|
|
7
7
|
import type { TypeAheadItem } from '../type-ahead/types';
|
|
8
8
|
import type { EmojiPluginOptions, EmojiPluginState } from './types';
|
|
@@ -20,7 +20,7 @@ export type EmojiPlugin = NextEditorPlugin<'emoji', {
|
|
|
20
20
|
];
|
|
21
21
|
sharedState: EmojiPluginState | undefined;
|
|
22
22
|
commands: {
|
|
23
|
-
insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) =>
|
|
23
|
+
insertEmoji: (emojiId: EmojiId, inputMethod?: INPUT_METHOD.PICKER | INPUT_METHOD.ASCII | INPUT_METHOD.TYPEAHEAD) => EditorCommand;
|
|
24
24
|
};
|
|
25
25
|
}>;
|
|
26
26
|
export declare const emojiPlugin: EmojiPlugin;
|
package/dist/types-ts4.5/plugins/media/ui/ResizableMediaSingle/ResizableMediaSingleNext.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type { RichMediaLayout as MediaSingleLayout } from '@atlaskit/adf-schema'
|
|
|
5
5
|
import type { MediaClientConfig } from '@atlaskit/media-core';
|
|
6
6
|
import type { Props } from './types';
|
|
7
7
|
import type { Dimensions, HandleResize, HandleResizeStart, Position, Snap } from '@atlaskit/editor-common/resizer';
|
|
8
|
-
import type { GuidelineConfig, GuidelineSnapsReference } from '@atlaskit/editor-common/guideline';
|
|
8
|
+
import type { GuidelineConfig, RelativeGuides, GuidelineSnapsReference } from '@atlaskit/editor-common/guideline';
|
|
9
9
|
type State = {
|
|
10
10
|
offsetLeft: number;
|
|
11
11
|
isVideoFile: boolean;
|
|
@@ -13,11 +13,12 @@ type State = {
|
|
|
13
13
|
isResizing: boolean;
|
|
14
14
|
size: Dimensions;
|
|
15
15
|
snaps: Snap;
|
|
16
|
+
relativeGuides: RelativeGuides;
|
|
17
|
+
guidelines: GuidelineConfig[];
|
|
16
18
|
};
|
|
17
19
|
export declare const resizerNextTestId = "mediaSingle.resizerNext.testid";
|
|
18
20
|
type ResizableMediaSingleNextProps = Props;
|
|
19
|
-
declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
20
|
-
private guidelines;
|
|
21
|
+
export declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSingleNextProps, State> {
|
|
21
22
|
private lastSnappedGuidelineKeys;
|
|
22
23
|
constructor(props: ResizableMediaSingleNextProps);
|
|
23
24
|
/**
|
|
@@ -30,10 +31,11 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
30
31
|
componentDidUpdate(prevProps: Props): boolean;
|
|
31
32
|
isNestedNode(): boolean;
|
|
32
33
|
private getDefaultGuidelines;
|
|
33
|
-
private
|
|
34
|
+
private updateGuidelines;
|
|
34
35
|
get wrappedLayout(): boolean;
|
|
35
36
|
componentDidMount(): Promise<void>;
|
|
36
37
|
UNSAFE_componentWillReceiveProps(nextProps: Props): void;
|
|
38
|
+
get aspectRatio(): number;
|
|
37
39
|
checkVideoFile(viewMediaClientConfig?: MediaClientConfig): Promise<void>;
|
|
38
40
|
calcNewSize: (newWidth: number, stop: boolean) => {
|
|
39
41
|
width: number | null;
|
|
@@ -55,6 +57,7 @@ declare class ResizableMediaSingleNext extends React.Component<ResizableMediaSin
|
|
|
55
57
|
private setIsResizing;
|
|
56
58
|
private updateSizeInPluginState;
|
|
57
59
|
private calcMaxWidth;
|
|
60
|
+
private getRelativeGuides;
|
|
58
61
|
updateActiveGuidelines: (width: number | undefined, guidelines: GuidelineConfig[], guidelineSnapsReference: GuidelineSnapsReference) => void;
|
|
59
62
|
roundPixelValue: (value: number) => number;
|
|
60
63
|
getHeightFromNewWidth: (originalWidth: number, originalHeight: number, newWidth: number) => number;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
3
|
+
export type SetEditorAPI = (editorApi: PublicPluginAPI<any>) => void;
|
|
4
|
+
export interface EditorAPIContextType {
|
|
5
|
+
editorApi?: PublicPluginAPI<any>;
|
|
6
|
+
setEditorApi?: SetEditorAPI;
|
|
7
|
+
}
|
|
8
|
+
export declare const EditorAPIContext: React.Context<EditorAPIContextType>;
|
|
9
|
+
interface EditorAPIProviderProps {
|
|
10
|
+
children: React.ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare const PresetContextProvider: ({ children }: EditorAPIProviderProps) => JSX.Element;
|
|
13
|
+
export declare const usePresetContext: () => PublicPluginAPI<any> | undefined;
|
|
14
|
+
export declare const useSetPresetContext: () => SetEditorAPI | undefined;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { DependencyList } from 'react';
|
|
2
|
+
import type { EditorPresetBuilder } from '@atlaskit/editor-common/preset';
|
|
3
|
+
import type { AllEditorPresetPluginTypes, PublicPluginAPI, NextEditorPlugin } from '@atlaskit/editor-common/types';
|
|
4
|
+
type ExtractNextEditorPlugins<Plugins extends AllEditorPresetPluginTypes[]> = {
|
|
5
|
+
[PluginNumber in keyof Plugins]: Plugins[PluginNumber] extends NextEditorPlugin<infer Name, infer Metadata> ? NextEditorPlugin<Name, Metadata> : Plugins[PluginNumber] extends [
|
|
6
|
+
NextEditorPlugin<infer Name, infer Metadata>,
|
|
7
|
+
any
|
|
8
|
+
] ? NextEditorPlugin<Name, Metadata> : never;
|
|
9
|
+
};
|
|
10
|
+
interface PresetAPI<PluginNames extends string[] = [
|
|
11
|
+
], StackPlugins extends AllEditorPresetPluginTypes[] = [
|
|
12
|
+
]> {
|
|
13
|
+
editorApi: PublicPluginAPI<ExtractNextEditorPlugins<StackPlugins>> | undefined;
|
|
14
|
+
preset: EditorPresetBuilder<PluginNames, StackPlugins>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Creates a preset.
|
|
18
|
+
*
|
|
19
|
+
* Takes an input function that returns a preset (and memoizes it) depending
|
|
20
|
+
* on the dependency array provided.
|
|
21
|
+
*
|
|
22
|
+
* Returns a pluginInjectionApi in order to apply actions and subscribe to plugin
|
|
23
|
+
* changes outside of the editor.
|
|
24
|
+
*
|
|
25
|
+
* @param createPreset
|
|
26
|
+
* @param dependencies
|
|
27
|
+
* @returns PresetAPI ({ pluginInjectionApi, preset, actionBuilder })
|
|
28
|
+
*
|
|
29
|
+
* Example:
|
|
30
|
+
* ```ts
|
|
31
|
+
* function ExampleEditor() {
|
|
32
|
+
* const { preset, editorApi } = usePreset(() =>
|
|
33
|
+
* new EditorPresetBuilder().add(plugin1).add(plugin2)
|
|
34
|
+
* , []);
|
|
35
|
+
*
|
|
36
|
+
* // Can execute typesafe commands based on plugin1 or 2
|
|
37
|
+
* const runCommand = () => editorApi.executeCommand(
|
|
38
|
+
* editorApi.dependencies.plugin1.commands.doSomething()
|
|
39
|
+
* )
|
|
40
|
+
* return (
|
|
41
|
+
* <>
|
|
42
|
+
* <Editor preset={preset} />
|
|
43
|
+
* <Button onClick={runCommand}>Run command</Button>
|
|
44
|
+
* </>
|
|
45
|
+
* )
|
|
46
|
+
* }
|
|
47
|
+
* ```
|
|
48
|
+
*/
|
|
49
|
+
export declare function usePreset<PluginNames extends string[] = [
|
|
50
|
+
], StackPlugins extends AllEditorPresetPluginTypes[] = [
|
|
51
|
+
]>(createPreset: () => EditorPresetBuilder<PluginNames, StackPlugins>, dependencies: DependencyList): PresetAPI<PluginNames, StackPlugins>;
|
|
52
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/editor-core",
|
|
3
|
-
"version": "187.
|
|
3
|
+
"version": "187.24.1",
|
|
4
4
|
"description": "A package contains Atlassian editor core functionality",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@atlaskit/code": "^14.6.0",
|
|
56
56
|
"@atlaskit/date": "^0.10.0",
|
|
57
57
|
"@atlaskit/datetime-picker": "^12.7.0",
|
|
58
|
-
"@atlaskit/editor-common": "^74.
|
|
58
|
+
"@atlaskit/editor-common": "^74.46.0",
|
|
59
59
|
"@atlaskit/editor-json-transformer": "^8.10.0",
|
|
60
60
|
"@atlaskit/editor-markdown-transformer": "^5.2.5",
|
|
61
61
|
"@atlaskit/editor-palette": "1.5.1",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"@atlaskit/editor-plugin-guideline": "^0.3.4",
|
|
73
73
|
"@atlaskit/editor-plugin-hyperlink": "^0.3.0",
|
|
74
74
|
"@atlaskit/editor-plugin-image-upload": "^0.1.0",
|
|
75
|
-
"@atlaskit/editor-plugin-table": "^2.
|
|
75
|
+
"@atlaskit/editor-plugin-table": "^2.9.0",
|
|
76
76
|
"@atlaskit/editor-plugin-text-formatting": "^0.2.0",
|
|
77
77
|
"@atlaskit/editor-plugin-width": "^0.1.0",
|
|
78
78
|
"@atlaskit/editor-prosemirror": "1.1.0",
|
|
@@ -146,7 +146,7 @@
|
|
|
146
146
|
"@atlaskit/collab-provider": "9.10.1",
|
|
147
147
|
"@atlaskit/dropdown-menu": "^11.11.0",
|
|
148
148
|
"@atlaskit/editor-extension-dropbox": "^0.4.0",
|
|
149
|
-
"@atlaskit/editor-plugin-table": "^2.
|
|
149
|
+
"@atlaskit/editor-plugin-table": "^2.9.0",
|
|
150
150
|
"@atlaskit/editor-test-helpers": "^18.11.0",
|
|
151
151
|
"@atlaskit/flag": "^15.2.0",
|
|
152
152
|
"@atlaskit/icon-object": "^6.3.0",
|
|
@@ -248,6 +248,9 @@
|
|
|
248
248
|
"type": "boolean",
|
|
249
249
|
"referenceOnly": "true"
|
|
250
250
|
},
|
|
251
|
+
"platform.editor.disable-chrome-88-selection-fix_uk53m": {
|
|
252
|
+
"type": "boolean"
|
|
253
|
+
},
|
|
251
254
|
"platform.linking-platform.datasource-jira_issues": {
|
|
252
255
|
"type": "boolean",
|
|
253
256
|
"referenceOnly": "true"
|
package/report.api.md
CHANGED
|
@@ -130,6 +130,7 @@ import { PresenceResource } from '@atlaskit/mention/resource';
|
|
|
130
130
|
import PropTypes from 'prop-types';
|
|
131
131
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
132
132
|
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
133
|
+
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
133
134
|
import { PureComponent } from 'react';
|
|
134
135
|
import { QuickInsertActionInsert } from '@atlaskit/editor-common/provider-factory';
|
|
135
136
|
import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -974,6 +975,8 @@ interface EditorViewProps {
|
|
|
974
975
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
975
976
|
editorRef: React_2.RefObject<HTMLDivElement>;
|
|
976
977
|
}) => JSX.Element;
|
|
978
|
+
// (undocumented)
|
|
979
|
+
setEditorApi?: SetEditorAPI;
|
|
977
980
|
}
|
|
978
981
|
|
|
979
982
|
// @public (undocumented)
|
|
@@ -1957,6 +1960,9 @@ export function setBlockTypeWithAnalytics(
|
|
|
1957
1960
|
editorAnalyticsApi: EditorAnalyticsAPI | undefined,
|
|
1958
1961
|
): Command_2;
|
|
1959
1962
|
|
|
1963
|
+
// @public (undocumented)
|
|
1964
|
+
type SetEditorAPI = (editorApi: PublicPluginAPI<any>) => void;
|
|
1965
|
+
|
|
1960
1966
|
// @public (undocumented)
|
|
1961
1967
|
export const setIsExpanded: (isExpanded: boolean) => Command_2;
|
|
1962
1968
|
|
package/tmp/api-report-tmp.d.ts
CHANGED
|
@@ -119,6 +119,7 @@ import { PresenceResource } from '@atlaskit/mention/resource';
|
|
|
119
119
|
import PropTypes from 'prop-types';
|
|
120
120
|
import type { ProviderFactory } from '@atlaskit/editor-common/provider-factory';
|
|
121
121
|
import type { Providers } from '@atlaskit/editor-common/provider-factory';
|
|
122
|
+
import type { PublicPluginAPI } from '@atlaskit/editor-common/types';
|
|
122
123
|
import { PureComponent } from 'react';
|
|
123
124
|
import { QuickInsertActionInsert } from '@atlaskit/editor-common/provider-factory';
|
|
124
125
|
import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory';
|
|
@@ -898,6 +899,8 @@ interface EditorViewProps {
|
|
|
898
899
|
dispatchAnalyticsEvent: DispatchAnalyticsEvent;
|
|
899
900
|
editorRef: React_2.RefObject<HTMLDivElement>;
|
|
900
901
|
}) => JSX.Element;
|
|
902
|
+
// (undocumented)
|
|
903
|
+
setEditorApi?: SetEditorAPI;
|
|
901
904
|
}
|
|
902
905
|
|
|
903
906
|
// @public (undocumented)
|
|
@@ -1737,6 +1740,9 @@ export function setBlockType(name: string): Command_2;
|
|
|
1737
1740
|
// @public (undocumented)
|
|
1738
1741
|
export function setBlockTypeWithAnalytics(name: string, inputMethod: BlockTypeInputMethod, editorAnalyticsApi: EditorAnalyticsAPI | undefined): Command_2;
|
|
1739
1742
|
|
|
1743
|
+
// @public (undocumented)
|
|
1744
|
+
type SetEditorAPI = (editorApi: PublicPluginAPI<any>) => void;
|
|
1745
|
+
|
|
1740
1746
|
// @public (undocumented)
|
|
1741
1747
|
export const setIsExpanded: (isExpanded: boolean) => Command_2;
|
|
1742
1748
|
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atlaskit/editor-core/use-preset",
|
|
3
|
+
"main": "../dist/cjs/use-preset.js",
|
|
4
|
+
"module": "../dist/esm/use-preset.js",
|
|
5
|
+
"module:es2019": "../dist/es2019/use-preset.js",
|
|
6
|
+
"sideEffects": false,
|
|
7
|
+
"types": "../dist/types/use-preset.d.ts",
|
|
8
|
+
"typesVersions": {
|
|
9
|
+
">=4.5 <4.9": {
|
|
10
|
+
"*": [
|
|
11
|
+
"../dist/types-ts4.5/use-preset.d.ts"
|
|
12
|
+
]
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
}
|
package/dist/cjs/version.json
DELETED
package/dist/es2019/version.json
DELETED