@atlaskit/editor-core
Version:
A package contains Atlassian editor core functionality
51 lines (50 loc) • 1.54 kB
TypeScript
/// <reference types="react" />
import { ActivityProvider } from '@atlaskit/activity';
import { PureComponent } from 'react';
import { HyperlinkState } from '../../plugins/hyperlink';
import { EditorView } from '../../prosemirror';
export interface Props {
pluginState: HyperlinkState;
editorView: EditorView;
activityProvider?: Promise<ActivityProvider>;
popupsMountPoint?: HTMLElement;
popupsBoundariesElement?: HTMLElement;
}
export interface State {
target?: HTMLElement;
activeElement?: HTMLElement;
href?: string;
text?: string;
oldText?: string;
oldHref?: string;
unlinkable?: boolean;
textInputPlaceholder?: string;
textInputValue?: string;
editorFocused?: boolean;
inputActive?: boolean;
active?: boolean;
showToolbarPanel?: boolean;
}
export default class HyperlinkEdit extends PureComponent<Props, State> {
state: State;
componentDidMount(): void;
componentWillUnmount(): void;
setInputActive: () => void;
resetInputActive: () => void;
private getOffsetParent();
private getPopupTarget();
/**
* Dynamic offsets for hyperlink editing popup
* because we need to show it next to cursor even without clear target for popup.
*/
private adjustPosition;
render(): JSX.Element | null;
private renderInput();
private handleOnBlur;
private handleUnlink;
private handlePluginStateChange;
private updateHref;
private updateText;
private updateLinkText;
private updateLinkHref;
}