@atlaskit/editor-core 187.38.1 → 187.38.3

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/cjs/labs/next/presets/default.js +2 -2
  3. package/dist/cjs/plugins/index.js +0 -7
  4. package/dist/cjs/plugins/media/index.js +2 -2
  5. package/dist/cjs/plugins/media/nodeviews/mediaSingle.js +2 -3
  6. package/dist/cjs/plugins/media/pm-plugins/main.js +11 -12
  7. package/dist/cjs/plugins/media/toolbar/linking.js +4 -2
  8. package/dist/cjs/version-wrapper.js +1 -1
  9. package/dist/es2019/labs/next/presets/default.js +1 -1
  10. package/dist/es2019/plugins/index.js +0 -1
  11. package/dist/es2019/plugins/media/index.js +2 -2
  12. package/dist/es2019/plugins/media/nodeviews/mediaSingle.js +1 -1
  13. package/dist/es2019/plugins/media/pm-plugins/main.js +11 -12
  14. package/dist/es2019/plugins/media/toolbar/linking.js +4 -2
  15. package/dist/es2019/version-wrapper.js +1 -1
  16. package/dist/esm/labs/next/presets/default.js +1 -1
  17. package/dist/esm/plugins/index.js +0 -1
  18. package/dist/esm/plugins/media/index.js +2 -2
  19. package/dist/esm/plugins/media/nodeviews/mediaSingle.js +2 -3
  20. package/dist/esm/plugins/media/pm-plugins/main.js +11 -12
  21. package/dist/esm/plugins/media/toolbar/linking.js +4 -2
  22. package/dist/esm/version-wrapper.js +1 -1
  23. package/dist/types/labs/next/presets/default.d.ts +1 -1
  24. package/dist/types/plugins/index.d.ts +0 -1
  25. package/dist/types/plugins/media/commands/linking.d.ts +2 -2
  26. package/dist/types/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  27. package/dist/types/plugins/media/picker-facade.d.ts +4 -4
  28. package/dist/types/plugins/media/pm-plugins/alt-text/commands.d.ts +1 -1
  29. package/dist/types/plugins/media/pm-plugins/alt-text/keymap.d.ts +1 -1
  30. package/dist/types/plugins/media/pm-plugins/keymap.d.ts +1 -1
  31. package/dist/types/plugins/media/pm-plugins/main.d.ts +4 -4
  32. package/dist/types/plugins/media/toolbar/alt-text.d.ts +1 -1
  33. package/dist/types/plugins/media/toolbar/commands.d.ts +4 -4
  34. package/dist/types/plugins/media/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
  35. package/dist/types/plugins/media/ui/MediaPicker/DropzoneWrapper.d.ts +3 -3
  36. package/dist/types/plugins/media/ui/MediaPicker/PickerFacadeProvider.d.ts +3 -3
  37. package/dist/types/plugins/media/utils/media-files.d.ts +2 -2
  38. package/dist/types/plugins/media/utils/media-single.d.ts +1 -1
  39. package/dist/types-ts4.5/labs/next/presets/default.d.ts +1 -1
  40. package/dist/types-ts4.5/plugins/index.d.ts +0 -1
  41. package/dist/types-ts4.5/plugins/media/commands/linking.d.ts +2 -2
  42. package/dist/types-ts4.5/plugins/media/nodeviews/mediaSingle.d.ts +1 -1
  43. package/dist/types-ts4.5/plugins/media/picker-facade.d.ts +4 -4
  44. package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/commands.d.ts +1 -1
  45. package/dist/types-ts4.5/plugins/media/pm-plugins/alt-text/keymap.d.ts +1 -1
  46. package/dist/types-ts4.5/plugins/media/pm-plugins/keymap.d.ts +1 -1
  47. package/dist/types-ts4.5/plugins/media/pm-plugins/main.d.ts +4 -4
  48. package/dist/types-ts4.5/plugins/media/toolbar/alt-text.d.ts +1 -1
  49. package/dist/types-ts4.5/plugins/media/toolbar/commands.d.ts +4 -4
  50. package/dist/types-ts4.5/plugins/media/ui/MediaPicker/BrowserWrapper.d.ts +2 -2
  51. package/dist/types-ts4.5/plugins/media/ui/MediaPicker/DropzoneWrapper.d.ts +3 -3
  52. package/dist/types-ts4.5/plugins/media/ui/MediaPicker/PickerFacadeProvider.d.ts +3 -3
  53. package/dist/types-ts4.5/plugins/media/utils/media-files.d.ts +2 -2
  54. package/dist/types-ts4.5/plugins/media/utils/media-single.d.ts +1 -1
  55. package/package.json +3 -2
  56. package/report.api.md +7 -14
  57. package/tmp/api-report-tmp.d.ts +7 -14
  58. package/dist/cjs/plugins/placeholder/index.js +0 -135
  59. package/dist/es2019/plugins/placeholder/index.js +0 -123
  60. package/dist/esm/plugins/placeholder/index.js +0 -124
  61. package/dist/types/plugins/placeholder/index.d.ts +0 -22
  62. package/dist/types-ts4.5/plugins/placeholder/index.d.ts +0 -26
@@ -3,8 +3,8 @@ import type { Command } from '../../../types';
3
3
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  export declare const DEFAULT_BORDER_COLOR = "#091e4224";
5
5
  export declare const DEFAULT_BORDER_SIZE = 2;
6
- export declare const changeInlineToMediaCard: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
7
- export declare const changeMediaCardToInline: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
6
+ export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
7
+ export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
8
8
  export declare const removeInlineCard: Command;
9
- export declare const toggleBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
10
- export declare const setBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
9
+ export declare const toggleBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
10
+ export declare const setBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { MediaPluginState } from '../../pm-plugins/types';
3
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
2
+ import type { MediaPluginState } from '../../pm-plugins/types';
3
+ import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
4
  type Props = {
5
5
  mediaState: MediaPluginState;
6
6
  isOpen?: boolean;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { MediaPluginState } from '../../pm-plugins/types';
3
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { EditorAppearance } from '../../../../types/editor-appearance';
2
+ import type { MediaPluginState } from '../../pm-plugins/types';
3
+ import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
+ import type { EditorAppearance } from '../../../../types/editor-appearance';
5
5
  type Props = {
6
6
  mediaState: MediaPluginState;
7
7
  isActive: boolean;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { ClipboardConfig, BrowserConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
3
- import { MediaClientConfig } from '@atlaskit/media-core';
2
+ import type { ClipboardConfig, BrowserConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
3
+ import type { MediaClientConfig } from '@atlaskit/media-core';
4
4
  import PickerFacade from '../../picker-facade';
5
- import { MediaPluginState } from '../../pm-plugins/types';
5
+ import type { MediaPluginState } from '../../pm-plugins/types';
6
6
  export interface ChildrenProps {
7
7
  config: ClipboardConfig | BrowserConfig | DropzoneConfig;
8
8
  mediaClientConfig: MediaClientConfig;
@@ -14,7 +14,7 @@ export declare const canInsertMediaInline: (state: EditorState) => boolean;
14
14
  * @param mediaState Media file to be added to the editor
15
15
  * @param collection Collection for the media to be added
16
16
  */
17
- export declare const insertMediaInlineNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
17
+ export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
18
18
  /**
19
19
  * Insert a media into an existing media group
20
20
  * or create a new media group to insert the new media.
@@ -22,7 +22,7 @@ export declare const insertMediaInlineNode: (editorAnalyticsAPI?: EditorAnalytic
22
22
  * @param mediaStates Media files to be added to the editor
23
23
  * @param collection Collection for the media to be added
24
24
  */
25
- export declare const insertMediaGroupNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
25
+ export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
26
26
  /**
27
27
  * Return position of media to be inserted, if it is inside a list
28
28
  * @param content Content to be inserted
@@ -14,7 +14,7 @@ export interface MediaSingleState extends MediaState {
14
14
  contextId?: string;
15
15
  }
16
16
  export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
17
- export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
17
+ export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => boolean;
18
18
  export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, newInsertionBehaviour?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
19
19
  export declare const createMediaSingleNode: (schema: Schema, collection: string, maxWidth?: number, minWidth?: number, alignLeftOnInsert?: boolean) => (mediaState: MediaSingleState) => PMNode;
20
20
  export declare function transformSliceForMedia(slice: Slice, schema: Schema): (selection: Selection) => Slice;
@@ -4,7 +4,7 @@ import type { BasePluginOptions } from '../../../plugins/base';
4
4
  import type { EditorProps } from '../../../types/editor-props';
5
5
  import type { EditorPresetProps } from './types';
6
6
  import type { BlockTypePluginOptions } from '../../../plugins/block-type/types';
7
- import type { PlaceholderPluginOptions } from '../../../plugins/placeholder';
7
+ import type { PlaceholderPluginOptions } from '@atlaskit/editor-plugin-placeholder';
8
8
  import type { AnnotationProviders } from '../../../plugins/annotation';
9
9
  import type { TextFormattingOptions, HyperlinkPluginOptions, QuickInsertPluginOptions } from '@atlaskit/editor-common/types';
10
10
  import type { CodeBlockOptions } from '../../../plugins/code-block/types';
@@ -18,7 +18,6 @@ export { default as mediaPlugin } from './media';
18
18
  export { default as mentionsPlugin } from './mentions';
19
19
  export { default as panelPlugin } from './panel';
20
20
  export { default as pastePlugin } from './paste';
21
- export { default as placeholderPlugin } from './placeholder';
22
21
  export { default as placeholderTextPlugin } from './placeholder-text';
23
22
  export { default as quickInsertPlugin } from './quick-insert';
24
23
  export { default as saveOnEnterPlugin } from './save-on-enter';
@@ -6,5 +6,5 @@ import type { INPUT_METHOD, EditorAnalyticsAPI } from '@atlaskit/editor-common/a
6
6
  export declare const showLinkingToolbar: import("@atlaskit/editor-common/types").Command;
7
7
  export declare const showLinkingToolbarWithMediaTypeCheck: Command;
8
8
  export declare const hideLinkingToolbar: (state: EditorState, dispatch?: CommandDispatch, view?: EditorView, focusFloatingToolbar?: boolean) => void;
9
- export declare const unlink: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
10
- export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
9
+ export declare const unlink: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
10
+ export declare const setUrlToMedia: (url: string, inputMethod: INPUT_METHOD.TYPEAHEAD | INPUT_METHOD.MANUAL, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
@@ -58,5 +58,5 @@ declare class MediaSingleNodeView extends ReactNodeView<MediaSingleNodeViewProps
58
58
  render(props: MediaSingleNodeViewProps, forwardRef?: ForwardRef): jsx.JSX.Element;
59
59
  ignoreMutation(): boolean;
60
60
  }
61
- export declare const ReactMediaSingleNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, mediaOptions?: MediaOptions, pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin>) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaSingleNodeView;
61
+ export declare const ReactMediaSingleNode: (portalProviderAPI: PortalProviderAPI, eventDispatcher: EventDispatcher, providerFactory: ProviderFactory, pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined, dispatchAnalyticsEvent?: DispatchAnalyticsEvent, mediaOptions?: MediaOptions) => (node: PMNode, view: EditorView, getPos: getPosHandler) => MediaSingleNodeView;
62
62
  export {};
@@ -1,8 +1,8 @@
1
- import { UploadPreviewUpdateEventPayload, UploadParams, UploadErrorEventPayload, UploadEndEventPayload } from '@atlaskit/media-picker/types';
2
- import { MediaClientConfig } from '@atlaskit/media-core';
1
+ import type { UploadPreviewUpdateEventPayload, UploadParams, UploadErrorEventPayload, UploadEndEventPayload } from '@atlaskit/media-picker/types';
2
+ import type { MediaClientConfig } from '@atlaskit/media-core';
3
3
  import type { ErrorReportingHandler } from '@atlaskit/editor-common/utils';
4
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
5
- import { MediaState, CustomMediaPicker, MobileUploadEndEventPayload } from './types';
4
+ import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
5
+ import type { MediaState, CustomMediaPicker, MobileUploadEndEventPayload } from './types';
6
6
  export type PickerType = 'clipboard' | 'dropzone' | 'customMediaPicker';
7
7
  export type ExtendedComponentConfigs = {
8
8
  customMediaPicker: CustomMediaPicker;
@@ -1,4 +1,4 @@
1
1
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
2
2
  export declare const closeMediaAltTextMenu: import("@atlaskit/editor-common/types").Command;
3
- export declare const openMediaAltTextMenu: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
3
+ export declare const openMediaAltTextMenu: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => import("@atlaskit/editor-common/types").Command;
4
4
  export declare const updateAltText: (newAltText: string) => import("@atlaskit/editor-common/types").Command;
@@ -1,4 +1,4 @@
1
1
  import type { Schema } from '@atlaskit/editor-prosemirror/model';
2
2
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
3
3
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- export default function keymapPlugin(schema: Schema, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): SafePlugin;
4
+ export default function keymapPlugin(schema: Schema, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
@@ -1,5 +1,5 @@
1
1
  import type { SafePlugin } from '@atlaskit/editor-common/safe-plugin';
2
2
  import type { MediaOptions } from '../types';
3
3
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
- export declare function keymapPlugin(options?: MediaOptions, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined): SafePlugin;
4
+ export declare function keymapPlugin(options: MediaOptions | undefined, editorAnalyticsAPI: EditorAnalyticsAPI | undefined): SafePlugin;
5
5
  export default keymapPlugin;
@@ -53,8 +53,8 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
53
53
  showEditingDialog?: boolean;
54
54
  mediaOptions?: MediaOptions;
55
55
  dispatch?: Dispatch;
56
- pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin>;
57
- constructor(state: EditorState, options: MediaPluginOptions, mediaOptions?: MediaOptions, newInsertionBehaviour?: boolean, dispatch?: Dispatch, pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin>);
56
+ pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined;
57
+ constructor(state: EditorState, options: MediaPluginOptions, mediaOptions: MediaOptions | undefined, newInsertionBehaviour: boolean | undefined, dispatch: Dispatch | undefined, pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined);
58
58
  onContextIdentifierProvider: (_name: string, provider?: Promise<ContextIdentifierProvider>) => Promise<void>;
59
59
  setMediaProvider: (mediaProvider?: Promise<MediaProvider>) => Promise<void>;
60
60
  getMediaOptions: () => MediaPluginOptions;
@@ -68,7 +68,7 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
68
68
  *
69
69
  * called when we insert a new file via the picker (connected via pickerfacade)
70
70
  */
71
- insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string, pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin> | undefined) => void;
71
+ insertFile: (mediaState: MediaState, onMediaStateChanged: MediaStateEventSubscriber, pickerType?: string) => void;
72
72
  addPendingTask: (task: Promise<any>) => void;
73
73
  splitMediaGroup: () => boolean;
74
74
  onPopupPickerClose: () => void;
@@ -115,4 +115,4 @@ export declare class MediaPluginStateImplementation implements MediaPluginState
115
115
  updateAndDispatch(props: Partial<Pick<this, 'allowsUploads' | 'allUploadsFinished' | 'isFullscreen'>>): void;
116
116
  }
117
117
  export declare const getMediaPluginState: (state: EditorState) => MediaPluginState;
118
- export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, reactContext: () => {}, getIntl: () => IntlShape, dispatch?: Dispatch, mediaOptions?: MediaOptions, newInsertionBehaviour?: boolean, pluginInjectionApi?: ExtractInjectionAPI<typeof mediaPlugin>) => SafePlugin<MediaPluginState>;
118
+ export declare const createPlugin: (_schema: Schema, options: MediaPluginOptions, reactContext: () => {}, getIntl: () => IntlShape, pluginInjectionApi: ExtractInjectionAPI<typeof mediaPlugin> | undefined, dispatch?: Dispatch, mediaOptions?: MediaOptions, newInsertionBehaviour?: boolean) => SafePlugin<MediaPluginState>;
@@ -5,7 +5,7 @@ import type { MediaToolbarBaseConfig } from '../types';
5
5
  import type { EditorState } from '@atlaskit/editor-prosemirror/state';
6
6
  import type { ForceFocusSelector } from '@atlaskit/editor-plugin-floating-toolbar';
7
7
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
8
- export declare const altTextButton: (intl: IntlShape, state: EditorState, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => FloatingToolbarButton<Command>;
8
+ export declare const altTextButton: (intl: IntlShape, state: EditorState, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => FloatingToolbarButton<Command>;
9
9
  export declare const altTextEditComponent: (options?: AltTextToolbarOptions) => FloatingToolbarCustom<Command>;
10
10
  export interface AltTextToolbarOptions {
11
11
  altTextValidator?: (value: string) => string[];
@@ -3,8 +3,8 @@ import type { Command } from '../../../types';
3
3
  import type { EditorAnalyticsAPI } from '@atlaskit/editor-common/analytics';
4
4
  export declare const DEFAULT_BORDER_COLOR = "#091e4224";
5
5
  export declare const DEFAULT_BORDER_SIZE = 2;
6
- export declare const changeInlineToMediaCard: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
7
- export declare const changeMediaCardToInline: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
6
+ export declare const changeInlineToMediaCard: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
7
+ export declare const changeMediaCardToInline: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
8
8
  export declare const removeInlineCard: Command;
9
- export declare const toggleBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => Command;
10
- export declare const setBorderMark: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
9
+ export declare const toggleBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => Command;
10
+ export declare const setBorderMark: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (attrs: Partial<BorderMarkAttributes>) => Command;
@@ -1,6 +1,6 @@
1
1
  /// <reference types="react" />
2
- import { MediaPluginState } from '../../pm-plugins/types';
3
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
2
+ import type { MediaPluginState } from '../../pm-plugins/types';
3
+ import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
4
  type Props = {
5
5
  mediaState: MediaPluginState;
6
6
  isOpen?: boolean;
@@ -1,7 +1,7 @@
1
1
  /// <reference types="react" />
2
- import { MediaPluginState } from '../../pm-plugins/types';
3
- import { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
- import { EditorAppearance } from '../../../../types/editor-appearance';
2
+ import type { MediaPluginState } from '../../pm-plugins/types';
3
+ import type { MediaFeatureFlags } from '@atlaskit/media-common/mediaFeatureFlags';
4
+ import type { EditorAppearance } from '../../../../types/editor-appearance';
5
5
  type Props = {
6
6
  mediaState: MediaPluginState;
7
7
  isActive: boolean;
@@ -1,8 +1,8 @@
1
1
  import React from 'react';
2
- import { ClipboardConfig, BrowserConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
3
- import { MediaClientConfig } from '@atlaskit/media-core';
2
+ import type { ClipboardConfig, BrowserConfig, DropzoneConfig } from '@atlaskit/media-picker/types';
3
+ import type { MediaClientConfig } from '@atlaskit/media-core';
4
4
  import PickerFacade from '../../picker-facade';
5
- import { MediaPluginState } from '../../pm-plugins/types';
5
+ import type { MediaPluginState } from '../../pm-plugins/types';
6
6
  export interface ChildrenProps {
7
7
  config: ClipboardConfig | BrowserConfig | DropzoneConfig;
8
8
  mediaClientConfig: MediaClientConfig;
@@ -14,7 +14,7 @@ export declare const canInsertMediaInline: (state: EditorState) => boolean;
14
14
  * @param mediaState Media file to be added to the editor
15
15
  * @param collection Collection for the media to be added
16
16
  */
17
- export declare const insertMediaInlineNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
17
+ export declare const insertMediaInlineNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaState: MediaState, collection: string, inputMethod?: InputMethodInsertMedia) => boolean;
18
18
  /**
19
19
  * Insert a media into an existing media group
20
20
  * or create a new media group to insert the new media.
@@ -22,7 +22,7 @@ export declare const insertMediaInlineNode: (editorAnalyticsAPI?: EditorAnalytic
22
22
  * @param mediaStates Media files to be added to the editor
23
23
  * @param collection Collection for the media to be added
24
24
  */
25
- export declare const insertMediaGroupNode: (editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
25
+ export declare const insertMediaGroupNode: (editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => (view: EditorView, mediaStates: MediaState[], collection: string, inputMethod?: InputMethodInsertMedia) => void;
26
26
  /**
27
27
  * Return position of media to be inserted, if it is inside a list
28
28
  * @param content Content to be inserted
@@ -14,7 +14,7 @@ export interface MediaSingleState extends MediaState {
14
14
  contextId?: string;
15
15
  }
16
16
  export declare const isMediaSingle: (schema: Schema, fileMimeType?: string) => boolean;
17
- export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
17
+ export declare const insertMediaAsMediaSingle: (view: EditorView, node: PMNode, inputMethod: InputMethodInsertMedia, editorAnalyticsAPI: EditorAnalyticsAPI | undefined) => boolean;
18
18
  export declare const insertMediaSingleNode: (view: EditorView, mediaState: MediaState, inputMethod?: InputMethodInsertMedia, collection?: string, alignLeftOnInsert?: boolean, newInsertionBehaviour?: boolean, widthPluginState?: WidthPluginState | undefined, editorAnalyticsAPI?: EditorAnalyticsAPI | undefined) => boolean;
19
19
  export declare const createMediaSingleNode: (schema: Schema, collection: string, maxWidth?: number, minWidth?: number, alignLeftOnInsert?: boolean) => (mediaState: MediaSingleState) => PMNode;
20
20
  export declare function transformSliceForMedia(slice: Slice, schema: Schema): (selection: Selection) => Slice;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/editor-core",
3
- "version": "187.38.1",
3
+ "version": "187.38.3",
4
4
  "description": "A package contains Atlassian editor core functionality",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -76,6 +76,7 @@
76
76
  "@atlaskit/editor-plugin-hyperlink": "^0.4.0",
77
77
  "@atlaskit/editor-plugin-image-upload": "^0.2.0",
78
78
  "@atlaskit/editor-plugin-list": "^1.2.0",
79
+ "@atlaskit/editor-plugin-placeholder": "^0.1.0",
79
80
  "@atlaskit/editor-plugin-rule": "^0.1.0",
80
81
  "@atlaskit/editor-plugin-table": "^2.12.0",
81
82
  "@atlaskit/editor-plugin-text-formatting": "^0.4.0",
@@ -149,7 +150,7 @@
149
150
  "@af/integration-testing": "*",
150
151
  "@atlaskit/code": "^14.6.0",
151
152
  "@atlaskit/collab-provider": "9.12.1",
152
- "@atlaskit/dropdown-menu": "^11.12.0",
153
+ "@atlaskit/dropdown-menu": "^11.13.0",
153
154
  "@atlaskit/editor-extension-dropbox": "^0.4.0",
154
155
  "@atlaskit/editor-plugin-table": "^2.12.0",
155
156
  "@atlaskit/flag": "^15.2.0",
package/report.api.md CHANGED
@@ -100,9 +100,9 @@ import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/ty
100
100
  import { MacroAttributes } from '@atlaskit/editor-common/provider-factory';
101
101
  import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
102
102
  import { MarkConfig } from '@atlaskit/editor-common/types';
103
- import { MediaClientConfig } from '@atlaskit/media-core';
103
+ import type { MediaClientConfig } from '@atlaskit/media-core';
104
104
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
105
- import { MediaFeatureFlags as MediaFeatureFlags_2 } from '@atlaskit/media-common/mediaFeatureFlags';
105
+ import type { MediaFeatureFlags as MediaFeatureFlags_2 } from '@atlaskit/media-common/mediaFeatureFlags';
106
106
  import type { MediaFile } from '@atlaskit/media-picker/types';
107
107
  import type { MediaProvider as MediaProvider_2 } from '@atlaskit/editor-common/provider-factory';
108
108
  import type { MentionDescription } from '@atlaskit/mention';
@@ -120,6 +120,7 @@ import type { NodeView } from '@atlaskit/editor-prosemirror/view';
120
120
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
121
121
  import { PaletteColor } from '@atlaskit/editor-common/ui-color';
122
122
  import { PerformanceTracking } from '@atlaskit/editor-common/types';
123
+ import type { PlaceholderPluginOptions } from '@atlaskit/editor-plugin-placeholder';
123
124
  import type { PluginConfig } from '@atlaskit/editor-plugin-table/types';
124
125
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
125
126
  import { PMPlugin } from '@atlaskit/editor-common/types';
@@ -165,10 +166,10 @@ import type { TypeAheadItem as TypeAheadItem_2 } from '@atlaskit/editor-common/t
165
166
  import type { TypeAheadPluginOptions } from '@atlaskit/editor-plugin-type-ahead';
166
167
  import type { TypeAheadStats } from '@atlaskit/editor-common/types';
167
168
  import { UIComponentFactory } from '@atlaskit/editor-common/types';
168
- import { UploadEndEventPayload } from '@atlaskit/media-picker/types';
169
- import { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
170
- import { UploadParams } from '@atlaskit/media-picker/types';
171
- import { UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
169
+ import type { UploadEndEventPayload } from '@atlaskit/media-picker/types';
170
+ import type { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
171
+ import type { UploadParams } from '@atlaskit/media-picker/types';
172
+ import type { UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
172
173
  import type { UseStickyToolbarType } from '@atlaskit/editor-common/ui';
173
174
  import type { WeekDay } from '@atlaskit/calendar/types';
174
175
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
@@ -1664,14 +1665,6 @@ type PickerFacadeConfig = {
1664
1665
  // @public (undocumented)
1665
1666
  type PickerType = 'clipboard' | 'customMediaPicker' | 'dropzone';
1666
1667
 
1667
- // @public (undocumented)
1668
- interface PlaceholderPluginOptions {
1669
- // (undocumented)
1670
- placeholder?: string;
1671
- // (undocumented)
1672
- placeholderBracketHint?: string;
1673
- }
1674
-
1675
1668
  // @public (undocumented)
1676
1669
  interface PlaceholderTextOptions {
1677
1670
  // (undocumented)
@@ -89,9 +89,9 @@ import type { LongPressSelectionPluginOptions } from '@atlaskit/editor-common/ty
89
89
  import { MacroAttributes } from '@atlaskit/editor-common/provider-factory';
90
90
  import { MacroProvider } from '@atlaskit/editor-common/provider-factory';
91
91
  import { MarkConfig } from '@atlaskit/editor-common/types';
92
- import { MediaClientConfig } from '@atlaskit/media-core';
92
+ import type { MediaClientConfig } from '@atlaskit/media-core';
93
93
  import type { MediaFeatureFlags } from '@atlaskit/media-common';
94
- import { MediaFeatureFlags as MediaFeatureFlags_2 } from '@atlaskit/media-common/mediaFeatureFlags';
94
+ import type { MediaFeatureFlags as MediaFeatureFlags_2 } from '@atlaskit/media-common/mediaFeatureFlags';
95
95
  import type { MediaFile } from '@atlaskit/media-picker/types';
96
96
  import type { MediaProvider as MediaProvider_2 } from '@atlaskit/editor-common/provider-factory';
97
97
  import type { MentionDescription } from '@atlaskit/mention';
@@ -109,6 +109,7 @@ import type { NodeView } from '@atlaskit/editor-prosemirror/view';
109
109
  import type { OptionalPlugin } from '@atlaskit/editor-common/types';
110
110
  import { PaletteColor } from '@atlaskit/editor-common/ui-color';
111
111
  import { PerformanceTracking } from '@atlaskit/editor-common/types';
112
+ import type { PlaceholderPluginOptions } from '@atlaskit/editor-plugin-placeholder';
112
113
  import type { PluginConfig } from '@atlaskit/editor-plugin-table/types';
113
114
  import { PluginKey } from '@atlaskit/editor-prosemirror/state';
114
115
  import { PMPlugin } from '@atlaskit/editor-common/types';
@@ -154,10 +155,10 @@ import type { TypeAheadItem as TypeAheadItem_2 } from '@atlaskit/editor-common/t
154
155
  import type { TypeAheadPluginOptions } from '@atlaskit/editor-plugin-type-ahead';
155
156
  import type { TypeAheadStats } from '@atlaskit/editor-common/types';
156
157
  import { UIComponentFactory } from '@atlaskit/editor-common/types';
157
- import { UploadEndEventPayload } from '@atlaskit/media-picker/types';
158
- import { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
159
- import { UploadParams } from '@atlaskit/media-picker/types';
160
- import { UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
158
+ import type { UploadEndEventPayload } from '@atlaskit/media-picker/types';
159
+ import type { UploadErrorEventPayload } from '@atlaskit/media-picker/types';
160
+ import type { UploadParams } from '@atlaskit/media-picker/types';
161
+ import type { UploadPreviewUpdateEventPayload } from '@atlaskit/media-picker/types';
161
162
  import type { UseStickyToolbarType } from '@atlaskit/editor-common/ui';
162
163
  import type { WeekDay } from '@atlaskit/calendar/types';
163
164
  import type { WidthPlugin } from '@atlaskit/editor-plugin-width';
@@ -1493,14 +1494,6 @@ type PickerFacadeConfig = {
1493
1494
  // @public (undocumented)
1494
1495
  type PickerType = 'clipboard' | 'customMediaPicker' | 'dropzone';
1495
1496
 
1496
- // @public (undocumented)
1497
- interface PlaceholderPluginOptions {
1498
- // (undocumented)
1499
- placeholder?: string;
1500
- // (undocumented)
1501
- placeholderBracketHint?: string;
1502
- }
1503
-
1504
1497
  // @public (undocumented)
1505
1498
  interface PlaceholderTextOptions {
1506
1499
  // (undocumented)
@@ -1,135 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.createPlaceholderDecoration = createPlaceholderDecoration;
7
- exports.createPlugin = createPlugin;
8
- exports.pluginKey = exports.placeholderTestId = exports.default = void 0;
9
- var _safePlugin = require("@atlaskit/editor-common/safe-plugin");
10
- var _utils = require("@atlaskit/editor-common/utils");
11
- var _state = require("@atlaskit/editor-prosemirror/state");
12
- var _view = require("@atlaskit/editor-prosemirror/view");
13
- var pluginKey = new _state.PluginKey('placeholderPlugin');
14
- exports.pluginKey = pluginKey;
15
- function getPlaceholderState(editorState) {
16
- return pluginKey.getState(editorState);
17
- }
18
- var placeholderTestId = 'placeholder-test-id';
19
- exports.placeholderTestId = placeholderTestId;
20
- function createPlaceholderDecoration(editorState, placeholderText) {
21
- var pos = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
22
- var placeholderDecoration = document.createElement('span');
23
- var placeholderNodeWithText = placeholderDecoration;
24
- placeholderDecoration.setAttribute('data-testid', placeholderTestId);
25
- placeholderDecoration.className = 'placeholder-decoration';
26
-
27
- // PM sets contenteditable to false on Decorations so Firefox doesn't display the flashing cursor
28
- // So adding an extra span which will contain the placeholder text
29
- if (_utils.browser.gecko) {
30
- var placeholderNode = document.createElement('span');
31
- placeholderNode.setAttribute('contenteditable', 'true'); // explicitly overriding the default Decoration behaviour
32
- placeholderDecoration.appendChild(placeholderNode);
33
- placeholderNodeWithText = placeholderNode;
34
- }
35
- placeholderNodeWithText.textContent = placeholderText || ' ';
36
-
37
- // ME-2289 Tapping on backspace in empty editor hides and displays the keyboard
38
- // Add a editable buff node as the cursor moving forward is inevitable
39
- // when backspace in GBoard composition
40
- if (_utils.browser.android && _utils.browser.chrome) {
41
- var buffNode = document.createElement('span');
42
- buffNode.setAttribute('class', 'placeholder-android');
43
- buffNode.setAttribute('contenteditable', 'true');
44
- buffNode.textContent = ' ';
45
- placeholderDecoration.appendChild(buffNode);
46
- }
47
- return _view.DecorationSet.create(editorState.doc, [_view.Decoration.widget(pos, placeholderDecoration, {
48
- side: 0,
49
- key: 'placeholder'
50
- })]);
51
- }
52
- function setPlaceHolderState(placeholderText, pos) {
53
- return {
54
- hasPlaceholder: true,
55
- placeholderText: placeholderText,
56
- pos: pos ? pos : 1
57
- };
58
- }
59
- var emptyPlaceholder = {
60
- hasPlaceholder: false
61
- };
62
- function createPlaceHolderStateFrom(isEditorFocused, editorState, isTypeAheadOpen, defaultPlaceholderText, bracketPlaceholderText) {
63
- if (isTypeAheadOpen !== null && isTypeAheadOpen !== void 0 && isTypeAheadOpen(editorState)) {
64
- return emptyPlaceholder;
65
- }
66
- if (defaultPlaceholderText && (0, _utils.isEmptyDocument)(editorState.doc)) {
67
- return setPlaceHolderState(defaultPlaceholderText);
68
- }
69
- if (bracketPlaceholderText && (0, _utils.bracketTyped)(editorState) && isEditorFocused) {
70
- var $from = editorState.selection.$from;
71
- // Space is to account for positioning of the bracket
72
- var bracketHint = ' ' + bracketPlaceholderText;
73
- return setPlaceHolderState(bracketHint, $from.pos - 1);
74
- }
75
- return emptyPlaceholder;
76
- }
77
- function createPlugin(defaultPlaceholderText, bracketPlaceholderText, api) {
78
- if (!defaultPlaceholderText && !bracketPlaceholderText) {
79
- return;
80
- }
81
- return new _safePlugin.SafePlugin({
82
- key: pluginKey,
83
- state: {
84
- init: function init(_, state) {
85
- var _api$focus, _api$focus$sharedStat;
86
- return createPlaceHolderStateFrom(Boolean(api === null || api === void 0 ? void 0 : (_api$focus = api.focus) === null || _api$focus === void 0 ? void 0 : (_api$focus$sharedStat = _api$focus.sharedState.currentState()) === null || _api$focus$sharedStat === void 0 ? void 0 : _api$focus$sharedStat.hasFocus), state, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
87
- },
88
- apply: function apply(tr, _oldPluginState, _oldEditorState, newEditorState) {
89
- var _api$focus2, _api$focus2$sharedSta;
90
- var meta = tr.getMeta(pluginKey);
91
- var isEditorFocused = Boolean(api === null || api === void 0 ? void 0 : (_api$focus2 = api.focus) === null || _api$focus2 === void 0 ? void 0 : (_api$focus2$sharedSta = _api$focus2.sharedState.currentState()) === null || _api$focus2$sharedSta === void 0 ? void 0 : _api$focus2$sharedSta.hasFocus);
92
- if (meta) {
93
- if (meta.removePlaceholder) {
94
- return emptyPlaceholder;
95
- }
96
- if (meta.applyPlaceholderIfEmpty) {
97
- return createPlaceHolderStateFrom(isEditorFocused, newEditorState, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
98
- }
99
- }
100
- return createPlaceHolderStateFrom(isEditorFocused, newEditorState, api === null || api === void 0 ? void 0 : api.typeAhead.actions.isOpen, defaultPlaceholderText, bracketPlaceholderText);
101
- }
102
- },
103
- props: {
104
- decorations: function decorations(editorState) {
105
- var _api$composition;
106
- var _getPlaceholderState = getPlaceholderState(editorState),
107
- hasPlaceholder = _getPlaceholderState.hasPlaceholder,
108
- placeholderText = _getPlaceholderState.placeholderText,
109
- pos = _getPlaceholderState.pos;
110
- var compositionPluginState = api === null || api === void 0 ? void 0 : (_api$composition = api.composition) === null || _api$composition === void 0 ? void 0 : _api$composition.sharedState.currentState();
111
- if (hasPlaceholder && placeholderText && pos !== undefined && !(compositionPluginState !== null && compositionPluginState !== void 0 && compositionPluginState.isComposing)) {
112
- return createPlaceholderDecoration(editorState, placeholderText, pos);
113
- }
114
- return;
115
- }
116
- }
117
- });
118
- }
119
- var placeholderPlugin = function placeholderPlugin(_ref) {
120
- var options = _ref.config,
121
- api = _ref.api;
122
- return {
123
- name: 'placeholder',
124
- pmPlugins: function pmPlugins() {
125
- return [{
126
- name: 'placeholder',
127
- plugin: function plugin() {
128
- return createPlugin(options && options.placeholder, options && options.placeholderBracketHint, api);
129
- }
130
- }];
131
- }
132
- };
133
- };
134
- var _default = placeholderPlugin;
135
- exports.default = _default;