@atlaskit/editor-common
Version:
A package that contains common classes and components for editor and renderer
34 lines (33 loc) • 1.61 kB
TypeScript
import type { Schema, Slice } from '@atlaskit/editor-prosemirror/model';
import type { EditorState } from '@atlaskit/editor-prosemirror/state';
import type { AnalyticsEventPayload } from '../analytics/types/events';
import type { InputMethodInsertLink } from '../analytics/types/insert-events';
export declare const FILEPATH_REGEXP: RegExp;
export declare const DONTLINKIFY_REGEXP: RegExp;
/**
* Instance of class LinkMatcher are used in autoformatting in place of Regex.
* Hence it has been made similar to regex with an exec method.
* Extending it directly from class Regex was introducing some issues, thus that has been avoided.
*/
export declare class LinkMatcher {
static create(): RegExp;
}
/**
* Adds protocol to url if needed.
*/
export declare function normalizeUrl(url?: string | null): string;
/**
* Linkify content in a slice (eg. after a rich text paste)
*/
export declare function linkifyContent(schema: Schema): (slice: Slice) => Slice;
export declare function getLinkDomain(url: string): string;
export declare function isFromCurrentDomain(url: string): boolean;
interface filepathMatch {
endIndex: number;
startIndex: number;
}
export declare const findFilepaths: (text: string, offset?: number) => Array<filepathMatch>;
export declare const isLinkInMatches: (linkStart: number, matchesList: Array<filepathMatch>) => boolean;
export declare function getLinkCreationAnalyticsEvent(inputMethod: InputMethodInsertLink, url: string): AnalyticsEventPayload;
export declare const canLinkBeCreatedInRange: (from: number, to: number) => (state: EditorState) => boolean;
export {};