@atlaskit/editor-plugin-hyperlink
Version:
Hyperlink plugin for @atlaskit/editor-core
127 lines (102 loc) • 3.83 kB
Markdown
<!-- API Report Version: 2.3 -->
## API Report File for "@atlaskit/editor-plugin-hyperlink"
> 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
import type { AnalyticsPlugin } from '/editor-plugin-analytics';
import type { Command } from '/editor-common/types';
import type { EditorCommand } from '/editor-common/types';
import type { EditorState } from '/editor-prosemirror/state';
import type { EditorView } from '/editor-prosemirror/view';
import type { FeatureFlagsPlugin } from '/editor-plugin-feature-flags';
import type { FloatingToolbarItem } from '/editor-common/types';
import type { HyperlinkPluginOptions } from '/editor-common/types';
import type { HyperlinkState } from '/editor-common/link';
import { INPUT_METHOD } from '/editor-common/analytics';
import type { IntlShape } from 'react-intl';
import type { LinkInputType } from '/editor-common/types';
import type { NextEditorPlugin } from '/editor-common/types';
import type { OptionalPlugin } from '/editor-common/types';
import type { ProviderFactory } from '/editor-common/provider-factory';
import type { QueueCardsFromTransactionAction } from '/editor-common/card';
import type { Transaction } from '/editor-prosemirror/state';
import type { UIAnalyticsEvent } from '/analytics-next';
// @public (undocumented)
type GetToolbarItems = (
state: EditorState,
intl: IntlShape,
providerFactory: ProviderFactory,
link: string,
) => FloatingToolbarItem<any>[];
// @public (undocumented)
export type HideLinkToolbar = (tr: Transaction) => Transaction;
// @public (undocumented)
export type HyperlinkPlugin = NextEditorPlugin<
'hyperlink',
{
pluginConfiguration: HyperlinkPluginOptions | undefined;
dependencies: [OptionalPlugin<FeatureFlagsPlugin>, OptionalPlugin<AnalyticsPlugin>];
actions: {
prependToolbarButtons: PrependToolbarButtons;
hideLinkToolbar: HideLinkToolbar;
insertLink: InsertLink;
updateLink: UpdateLink;
};
commands: {
showLinkToolbar: ShowLinkToolbar;
};
sharedState: HyperlinkState | undefined;
}
>;
// @public
export const hyperlinkPlugin: HyperlinkPlugin;
// @public (undocumented)
type HyperlinkToolbarItemsState = {
items: GetToolbarItems;
};
// @public (undocumented)
type InputMethod =
| INPUT_METHOD.INSERT_MENU
| INPUT_METHOD.QUICK_INSERT
| INPUT_METHOD.SHORTCUT
| INPUT_METHOD.TOOLBAR;
// @public (undocumented)
export type InsertLink = (
inputMethod: LinkInputType,
from: number,
to: number,
href: string,
title?: string,
displayText?: string,
cardsAvailable?: boolean,
sourceEvent?: UIAnalyticsEvent | null | undefined,
) => Command;
// @public (undocumented)
export type PrependToolbarButtons = (props: PrependToolbarButtonsProps) => void;
// @public (undocumented)
interface PrependToolbarButtonsProps extends HyperlinkToolbarItemsState {
// (undocumented)
view: EditorView;
}
// @public (undocumented)
export type ShowLinkToolbar = (inputMethod: InputMethod) => EditorCommand;
// @public (undocumented)
export type UpdateLink = (href: string, text: string, pos: number, to?: number) => Command;
// (No @packageDocumentation comment for this package)
```
<!--SECTION END: Main Entry Types-->
### Peer Dependencies
<!--SECTION START: Peer Dependencies-->
```json
{
"react": "^16.8.0",
"react-intl": "npm:react-intl@^5.18.1"
}
```
<!--SECTION END: Peer Dependencies-->