UNPKG

@atlaskit/editor-core

Version:

A package contains Atlassian editor core functionality

806 lines (711 loc) • 23.5 kB
<!-- API Report Version: 2.3 --> ## API Report File for "@atlaskit/editor-core" > Do not edit this file. This report is auto-generated using > [API Extractor](https://api-extractor.com/). > [Learn more about API reports](https://hello.atlassian.net/wiki/spaces/UR/pages/1825484529/Package+API+Reports) ### Table of contents - [Main Entry Types](#main-entry-types) - [Peer Dependencies](#peer-dependencies) ### Main Entry Types <!--SECTION START: Main Entry Types--> ```ts /// <reference types="node" /> import { ACTION } from '@atlaskit/editor-common/analytics'; import { ACTION_SUBJECT } from '@atlaskit/editor-common/analytics'; import { ACTION_SUBJECT_ID } from '@atlaskit/editor-common/analytics'; import type { ActivityProvider } from '@atlaskit/activity-provider'; import { AnalyticsEventPayload } from '@atlaskit/editor-common/analytics'; import type { AnalyticsEventPayload as AnalyticsEventPayload_2 } from '@atlaskit/analytics-next/AnalyticsEvent'; import type { AnnotationTypes } from '@atlaskit/adf-schema'; import type { BlockTypePluginOptions } from '@atlaskit/editor-plugin-block-type'; import type { CardOptions } from '@atlaskit/editor-common/card'; import { CardProvider } from '@atlaskit/editor-common/provider-factory'; import type { CodeBlockOptions } from '@atlaskit/editor-plugin-code-block'; import type { CollabEditOptions } from '@atlaskit/editor-common/collab'; import type { ContextIdentifierProvider } from '@atlaskit/editor-common/provider-factory'; import type { ContextUpdateHandler } from '@atlaskit/editor-common/types'; import type { DatePluginConfig } from '@atlaskit/editor-plugin-date'; import type { EditorActionsOptions } from '@atlaskit/editor-common/types'; import { EditorAppearance } from '@atlaskit/editor-common/types'; import { EditorPlugin } from '@atlaskit/editor-common/types'; import type { EditorState } from '@atlaskit/editor-prosemirror/state'; import type { EditorView } from '@atlaskit/editor-prosemirror/view'; import { EmojiResource } from '@atlaskit/emoji/resource'; import { EmptyStateHandler } from '@atlaskit/editor-common/types'; import type { ErrorReportingHandler } from '@atlaskit/editor-common/utils'; import { EVENT_TYPE } from '@atlaskit/editor-common/analytics'; import { EventDispatcher } from '@atlaskit/editor-common/event-dispatcher'; import { EventEmitter as EventEmitter_2 } from 'events'; import type { ExtensionHandlers } from '@atlaskit/editor-common/extensions'; import type { ExtensionProvider } from '@atlaskit/editor-common/extensions'; import { ExtensionType } from '@atlaskit/editor-common/provider-factory'; import type { FeatureFlags } from '@atlaskit/editor-common/types'; import { INPUT_METHOD } from '@atlaskit/editor-common/analytics'; import { JSONDocNode } from '@atlaskit/editor-json-transformer/types'; import { jsx } from '@emotion/react'; import type { LayoutPluginOptions } from '@atlaskit/editor-plugin-layout'; import type { LinkingOptions } from '@atlaskit/editor-common/types'; import { MacroAttributes } from '@atlaskit/editor-common/provider-factory'; import { MacroProvider } from '@atlaskit/editor-common/provider-factory'; import { MediaOptions } from '@atlaskit/editor-plugin-media/types'; import { MediaProvider as MediaProvider_2 } from '@atlaskit/editor-common/provider-factory'; import type { MediaState } from '@atlaskit/editor-plugin-media/types'; import type { MentionPluginConfig } from '@atlaskit/editor-plugin-mentions'; import { MentionProvider } from '@atlaskit/mention/resource'; import { MentionResource } from '@atlaskit/mention/resource'; import type { MenuItem } from '@atlaskit/editor-common/ui-menu'; import { Node as Node_2 } from '@atlaskit/editor-prosemirror/model'; import type { PanelPluginConfig } from '@atlaskit/editor-plugin-panel'; import { PerformanceTracking } from '@atlaskit/editor-common/types'; import type { PlaceholderTextOptions } from '@atlaskit/editor-plugin-placeholder-text'; import type { PluginConfig } from '@atlaskit/editor-plugin-table/types'; import type { PositionType } from '@atlaskit/tooltip/types'; import { PresenceProvider } from '@atlaskit/mention/resource'; import PropTypes from 'prop-types'; import type { Providers } from '@atlaskit/editor-common/provider-factory'; import { QuickInsertItem } from '@atlaskit/editor-common/provider-factory'; import type { QuickInsertOptions } from '@atlaskit/editor-common/types'; import { QuickInsertProvider } from '@atlaskit/editor-common/provider-factory'; import { default as React_2 } from 'react'; import type { ReactElement } from 'react'; import type { ReplaceRawValue } from '@atlaskit/editor-common/types'; import type { ResolvedEditorState } from '@atlaskit/editor-common/collab'; import type { Schema } from '@atlaskit/editor-prosemirror/model'; import type { SearchProvider } from '@atlaskit/editor-common/provider-factory'; import { setTextSelection } from '@atlaskit/editor-common/utils'; import type { TaskDecisionProvider } from '@atlaskit/task-decision'; import { TeamMentionResource } from '@atlaskit/mention/team-resource'; import type { TextColorPluginConfig } from '@atlaskit/editor-plugin-text-color'; import type { TextFormattingOptions } from '@atlaskit/editor-common/types'; import { ToolbarUIComponentFactory } from '@atlaskit/editor-common/types'; import type { Transaction } from '@atlaskit/editor-prosemirror/state'; import type { Transformer as Transformer_2 } from '@atlaskit/editor-common/types'; import { TypeAheadItem } from '@atlaskit/editor-common/provider-factory'; import { UIComponentFactory } from '@atlaskit/editor-common/types'; import type { UseStickyToolbarType } from '@atlaskit/editor-common/ui'; import { WithIntlProps } from 'react-intl-next'; import type { WrappedComponentProps } from 'react-intl-next'; export { ACTION }; export { ACTION_SUBJECT }; export { ACTION_SUBJECT_ID }; export { AnalyticsEventPayload }; // @public (undocumented) type AnnotationCallback = (params: string) => void; // @public (undocumented) type AnnotationComponentProps = { textSelection?: string; dom?: HTMLElement; onClose?: () => void; }; // @public (undocumented) export type AnnotationInfo = { id: string; type: AnnotationTypes.INLINE_COMMENT; }; // @public (undocumented) export interface AnnotationProviders { // (undocumented) inlineComment: InlineCommentAnnotationProvider; } // @public (undocumented) export interface AnnotationState<Type, State> { // (undocumented) annotationType: Type; // (undocumented) id: string; // (undocumented) state: State; } // @public (undocumented) export interface AnnotationTypeProvider<Type, State> { // (undocumented) disallowOnWhitespace?: boolean; // (undocumented) getState: (annotationIds: string[]) => Promise<AnnotationState<Type, State>[]>; // (undocumented) updateSubscriber?: AnnotationUpdateEmitter; } // @public (undocumented) export class AnnotationUpdateEmitter extends EventEmitter_2 { // (undocumented) off(event: string, listener: AnnotationCallback | VisibilityCallback): this; // (undocumented) on(event: VisibilityEvent, listener: (isVisible: boolean) => void): this; // (undocumented) on(event: UpdateEvent, listener: (annotationId: string) => void): this; } // @public (undocumented) type BeforeAndAfterToolbarComponents = { before: ReactComponents; after: ReactComponents; }; export { CardProvider }; // @public (undocumented) export class CollapsedEditor extends React_2.Component<Props, State> { // (undocumented) componentDidUpdate(): void; // (undocumented) editorComponent?: Editor; // (undocumented) functionalEditor?: boolean; // (undocumented) handleEditorRef: (editorRef?: Editor, editorRefCallback?: any) => void; // (undocumented) previouslyExpanded?: boolean; // (undocumented) render(): any; } // @public (undocumented) export type Command = ( state: EditorState, dispatch?: CommandDispatch, view?: EditorView, ) => boolean; // @public (undocumented) export type CommandDispatch = (tr: Transaction) => void; // @public (undocumented) export function ContextPanel(props: Props_4): jsx.JSX.Element; // @public (undocumented) export class Editor extends React_2.Component<EditorProps> { constructor(props: EditorProps); // (undocumented) static defaultProps: EditorProps; // (undocumented) render(): jsx.JSX.Element; } // @public (undocumented) export class EditorActions<T = any> implements EditorActionsOptions<T> { // (undocumented) __temporaryFixForConfigPanel(): Promise<void>; // (undocumented) appendText(text: string): boolean; // (undocumented) blur(): boolean; // (undocumented) clear(): boolean; // (undocumented) dispatchAnalyticsEvent: (payload: AnalyticsEventPayload_2) => void; // (undocumented) focus(): boolean; // (undocumented) static from<T>( view: EditorView, eventDispatcher: EventDispatcher, transformer?: Transformer_2<T>, ): EditorActions<T>; // (undocumented) getNodeByFragmentLocalId(id: string): Node_2 | undefined; // (undocumented) getNodeByLocalId(id: string): Node_2 | undefined; getResolvedEditorState: () => Promise<ResolvedEditorState | undefined>; getSelectedNode(): Node_2 | undefined; // (undocumented) getValue(): Promise<T | JSONDocNode | undefined>; // (undocumented) isDocumentEmpty(): boolean; // (undocumented) _privateGetEditorView(): EditorView | undefined; // (undocumented) _privateGetEventDispatcher(): EventDispatcher | undefined; // (undocumented) _privateRegisterEditor( editorView: EditorView, eventDispatcher: EventDispatcher, contentTransformer?: Transformer_2<T>, getFeatureFlags?: () => FeatureFlags, ): void; // (undocumented) _privateSubscribe(cb: ContextUpdateHandler): void; // (undocumented) _privateUnregisterEditor(): void; // (undocumented) _privateUnsubscribe(cb: ContextUpdateHandler): void; // (undocumented) replaceDocument( rawValue: any, shouldScrollToBottom?: boolean, shouldAddToHistory?: boolean, ): boolean; // (undocumented) replaceSelection( rawValue: Array<ReplaceRawValue> | ReplaceRawValue, tryToReplace?: boolean, ): boolean; } // @public (undocumented) interface EditorBaseProps { // (undocumented) appearance?: EditorAppearance; // (undocumented) assistiveLabel?: string; // (undocumented) contentComponents?: ReactComponents; // (undocumented) contentTransformerProvider?: (schema: Schema) => Transformer_2<string>; // (undocumented) contextPanel?: ReactComponents; // (undocumented) defaultValue?: Node_2 | Object | string; // (undocumented) disabled?: boolean; // (undocumented) editorActions?: EditorActions; // (undocumented) errorReporterHandler?: ErrorReportingHandler; // (undocumented) extensionProviders?: ExtensionProvidersProp; featureFlags?: { [featureFlag: string]: boolean | string; }; // @deprecated inputSamplingLimit?: number; // (undocumented) maxHeight?: number; // (undocumented) minHeight?: number; // (undocumented) onCancel?: (editorView: EditorView) => void; // (undocumented) onChange?: EditorOnChangeHandler; // (undocumented) onDestroy?: () => void; // (undocumented) onEditorReady?: (editorActions: EditorActions) => void; // (undocumented) persistScrollGutter?: boolean; // (undocumented) placeholder?: string; // (undocumented) placeholderBracketHint?: string; // (undocumented) popupsBoundariesElement?: HTMLElement; // (undocumented) popupsMountPoint?: HTMLElement; // (undocumented) popupsScrollableElement?: HTMLElement; // (undocumented) primaryToolbarIconBefore?: ReactElement; // (undocumented) quickInsert?: QuickInsertOptions; // (undocumented) secondaryToolbarComponents?: ReactComponents; // (undocumented) shouldFocus?: boolean; trackValidTransactions?: | boolean | { samplingRate: number; }; // (undocumented) UNSAFE_useAnalyticsContext?: boolean; useStickyToolbar?: UseStickyToolbarType; } // @public (undocumented) export class EditorContext extends React_2.Component<EditorContextProps, {}> { constructor(props: EditorContextProps); // (undocumented) static childContextTypes: { editorActions: PropTypes.Requireable<object>; }; // (undocumented) getChildContext(): { editorActions: EditorActions<any>; }; // (undocumented) render(): JSX.Element; } // @public (undocumented) type EditorContextProps = { editorActions?: EditorActions; }; // @public (undocumented) export interface EditorInstance { // (undocumented) contentComponents: UIComponentFactory[]; // (undocumented) contentTransformer?: Transformer<string>; // (undocumented) editorView: EditorView; // (undocumented) eventDispatcher: EventDispatcher; // (undocumented) insertMenuItems?: MenuItem[]; // (undocumented) onEditorViewStateUpdatedCallbacks: { pluginName: string; callback: OnEditorViewStateUpdated; }[]; // (undocumented) primaryToolbarComponents: ToolbarUIComponentFactory[]; // (undocumented) secondaryToolbarComponents: UIComponentFactory[]; } // @public (undocumented) type EditorOnChangeHandler = ( editorView: EditorView, meta: { source: 'local' | 'remote'; }, ) => void; export { EditorPlugin }; // @public (undocumented) interface EditorPluginFeatureProps { // (undocumented) allowAnalyticsGASV3?: boolean; // (undocumented) allowBlockType?: BlockTypePluginOptions['allowBlockType']; allowBorderMark?: boolean; // (undocumented) allowBreakout?: boolean; // (undocumented) allowConfluenceInlineComment?: boolean; // (undocumented) allowDate?: DatePluginConfig | boolean; // (undocumented) allowExpand?: | boolean | { allowInsertion?: boolean; allowInteractiveExpand?: boolean; }; // (undocumented) allowExtension?: ExtensionConfig | boolean; // (undocumented) allowFindReplace?: FindReplaceOptions | boolean; allowFragmentMark?: boolean; // (undocumented) allowHelpDialog?: boolean; // (undocumented) allowIndentation?: boolean; // (undocumented) allowJiraIssue?: boolean; // (undocumented) allowLayouts?: LayoutPluginOptions | boolean; // (undocumented) allowNestedTasks?: boolean; allowNewInsertionBehaviour?: boolean; // (undocumented) allowPanel?: PanelPluginConfig | boolean; // (undocumented) allowRule?: boolean; // (undocumented) allowStatus?: | boolean | { menuDisabled: boolean; }; // (undocumented) allowTables?: PluginConfig | boolean; // (undocumented) allowTasksAndDecisions?: boolean; // (undocumented) allowTemplatePlaceholders?: PlaceholderTextOptions | boolean; // (undocumented) allowTextAlignment?: boolean; // (undocumented) allowTextColor?: TextColorPluginConfig | boolean; autoScrollIntoView?: boolean; // (undocumented) codeBlock?: CodeBlockOptions; // (undocumented) elementBrowser?: { showModal?: boolean; replacePlusMenu?: boolean; helpUrl?: string; emptyStateHandler?: EmptyStateHandler; }; // (undocumented) extensionHandlers?: ExtensionHandlers; // (undocumented) feedbackInfo?: FeedbackInfo; // (undocumented) insertMenuItems?: MenuItem[]; // (undocumented) maxContentSize?: number; // (undocumented) mention?: MentionPluginConfig; // @deprecated mentionInsertDisplayName?: boolean; // (undocumented) saveOnEnter?: boolean; // (undocumented) showIndentationButtons?: boolean; // @deprecated (undocumented) smartLinks?: CardOptions; // (undocumented) textFormatting?: TextFormattingOptions; // @deprecated UNSAFE_allowBorderMark?: boolean; // @deprecated (undocumented) UNSAFE_cards?: CardOptions; // (undocumented) uploadErrorHandler?: (state: MediaState) => void; // (undocumented) waitForMediaUpload?: boolean; } // @public (undocumented) type EditorProduct = 'bitbucket' | 'confluence' | 'jira' | 'stride' | undefined; // @public (undocumented) export interface EditorProps extends EditorBaseProps, EditorPluginFeatureProps, EditorSharedPropsWithPlugins, EditorProviderProps { // @deprecated (undocumented) dangerouslyAppendPlugins?: { __plugins: EditorPlugin[]; }; } // @public (undocumented) interface EditorProviderProps { // (undocumented) activityProvider?: Promise<ActivityProvider>; // (undocumented) annotationProviders?: AnnotationProviders; // (undocumented) autoformattingProvider?: Providers['autoformattingProvider']; // (undocumented) collabEditProvider?: Providers['collabEditProvider']; // (undocumented) contextIdentifierProvider?: Promise<ContextIdentifierProvider>; // (undocumented) emojiProvider?: Providers['emojiProvider']; // (undocumented) legacyImageUploadProvider?: Providers['imageUploadProvider']; // (undocumented) macroProvider?: Providers['macroProvider']; // (undocumented) mentionProvider?: Promise<MentionProvider>; // (undocumented) presenceProvider?: Promise<any>; // (undocumented) searchProvider?: Promise<SearchProvider>; // (undocumented) taskDecisionProvider?: Promise<TaskDecisionProvider>; } // @public (undocumented) interface EditorSharedPropsWithPlugins { // (undocumented) allowUndoRedoButtons?: boolean; // (undocumented) collabEdit?: CollabEditOptions; // (undocumented) hideAvatarGroup?: boolean; linking?: LinkingOptions; // (undocumented) media?: MediaOptions; // (undocumented) onSave?: (editorView: EditorView) => void; performanceTracking?: PerformanceTracking; // (undocumented) primaryToolbarComponents?: PrimaryToolbarComponents; // (undocumented) sanitizePrivateContent?: boolean; } export { EmojiResource }; export { EVENT_TYPE }; // @public (undocumented) interface ExtensionConfig { // (undocumented) allowAutoSave?: boolean; // (undocumented) allowBreakout?: boolean; // (undocumented) allowExtendFloatingToolbars?: boolean; } // @public (undocumented) type ExtensionProviders = (ExtensionProvider | Promise<ExtensionProvider>)[]; // @public (undocumented) type ExtensionProvidersProp = ExtensionProviders | ExtensionProvidersWithEditorAction; // @public (undocumented) type ExtensionProvidersWithEditorAction = (editorActions?: EditorActions) => ExtensionProviders; export { ExtensionType }; // @public (undocumented) type FeedbackInfo = { product?: string; packageVersion?: string; packageName?: string; labels?: Array<string>; sessionId?: string; contentId?: string; tabId?: string; }; // @public (undocumented) type FindReplaceOptions = { allowMatchCase?: boolean; }; // @public (undocumented) export function getNodesCount(node: Node_2): Record<string, number>; // @public (undocumented) export type InlineCommentAnnotationProvider = AnnotationTypeProvider< AnnotationTypes.INLINE_COMMENT, InlineCommentState > & { createComponent?: React_2.ComponentType<InlineCommentCreateComponentProps>; viewComponent?: React_2.ComponentType<InlineCommentViewComponentProps>; isToolbarAbove?: boolean; }; // @public (undocumented) export type InlineCommentCreateComponentProps = AnnotationComponentProps & { onCreate: (id: string) => void; }; // @public (undocumented) export type InlineCommentState = { resolved: boolean; }; // @public (undocumented) export type InlineCommentViewComponentProps = AnnotationComponentProps & { annotations: Array<AnnotationInfo>; onResolve: (id: string) => void; onDelete?: (id: string) => void; annotationsList?: string[]; }; export { INPUT_METHOD }; export { MacroAttributes }; export { MacroProvider }; // @public (undocumented) export const measurements: { EDITOR_MOUNTED: string; PROSEMIRROR_RENDERED: string; PROSEMIRROR_CONTENT_RENDERED: string; ON_EDITOR_READY_CALLBACK: string; PASTE: string; }; export { MediaOptions }; export { MediaProvider_2 as MediaProvider }; export { MentionProvider }; export { MentionResource }; // @public (undocumented) const name_2: string; export { name_2 as name }; // @public (undocumented) type OnEditorViewStateUpdated = (props: { readonly originalTransaction: Readonly<Transaction>; readonly transactions: ReadonlyArray<Transaction>; readonly oldEditorState: Readonly<EditorState>; readonly newEditorState: Readonly<EditorState>; }) => void; export { PortalProvider }; export { PortalProviderAPI }; export { PortalRenderer }; export { PresenceProvider }; // @public (undocumented) type PrimaryToolbarComponents = BeforeAndAfterToolbarComponents | ReactComponents; // @public (undocumented) interface Props { // (undocumented) children?: any; // (undocumented) isExpanded?: boolean; // (undocumented) onExpand?: () => void; // (undocumented) onFocus?: (e: React_2.FocusEvent<HTMLInputElement>) => void; // (undocumented) placeholder?: string; } // @public (undocumented) interface Props_2 { // (undocumented) title?: string; // (undocumented) titlePosition?: PositionType; } // @public (undocumented) interface Props_3 { // @deprecated (undocumented) labels?: string[]; // @deprecated (undocumented) packageName?: string; // @deprecated (undocumented) packageVersion?: string; // (undocumented) popupsBoundariesElement?: HTMLElement; // (undocumented) popupsMountPoint?: HTMLElement; // (undocumented) popupsScrollableElement?: HTMLElement; // (undocumented) product?: EditorProduct; } // @public (undocumented) type Props_4 = { visible: boolean; children?: React_2.ReactElement; }; export { QuickInsertItem }; export { QuickInsertProvider }; // @public (undocumented) type ReactComponents = ReactElement<any> | ReactElement<any>[]; export { setTextSelection }; // @public (undocumented) interface State {} export { TeamMentionResource }; // @public (undocumented) export function ToolbarFeedback(props: Props_3): jsx.JSX.Element; // @public (undocumented) export const ToolbarHelp: React_2.FC<WithIntlProps<Props_2 & WrappedComponentProps<'intl'>>> & { WrappedComponent: React_2.ComponentType<Props_2 & WrappedComponentProps<'intl'>>; }; export { TypeAheadItem }; // @public (undocumented) export type UpdateEvent = 'create' | 'delete' | 'resolve' | 'setselectedannotation' | 'unresolve'; // @public (undocumented) export const version: string; // @public (undocumented) type VisibilityCallback = (params: boolean) => void; // @public (undocumented) type VisibilityEvent = 'setvisibility'; // @public (undocumented) export class WithEditorActions extends React_2.Component<WithEditorActionsProps, any> { // (undocumented) componentDidMount(): void; // (undocumented) componentWillUnmount(): void; // (undocumented) context: { editorActions: EditorActions; }; // (undocumented) static contextTypes: { editorActions: PropTypes.Validator<object>; }; // (undocumented) render(): React_2.ReactElement<any, React_2.JSXElementConstructor<any> | string> | null; } // @public (undocumented) interface WithEditorActionsProps { // (undocumented) render(actions: EditorActions): React_2.ReactElement<any> | null; } // @public (undocumented) export class WithHelpTrigger extends React_2.Component<WithHelpTriggerProps, any> { // (undocumented) static contextTypes: { editorActions: PropTypes.Validator<object>; }; // (undocumented) openHelp: () => void; // (undocumented) render(): React_2.ReactNode; } // @public (undocumented) interface WithHelpTriggerProps { // (undocumented) render: (openHelp: () => void) => React_2.ReactNode; } // (No @packageDocumentation comment for this package) ``` <!--SECTION END: Main Entry Types--> ### Peer Dependencies <!--SECTION START: Peer Dependencies--> ```json { "@atlaskit/link-provider": "^1.6.2", "@atlaskit/media-core": "^34.1.2", "react": "^16.8.0", "react-dom": "^16.8.0", "react-intl-next": "npm:react-intl@^5.18.1" } ``` <!--SECTION END: Peer Dependencies-->