@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
41 lines (40 loc) • 1.52 kB
TypeScript
/**
* This file has been partially duplicated in packages/linking-platform/linking-common/src/url.ts
* Any changes made here should be mirrored there.
* Ticket for dedeplication: https://product-fabric.atlassian.net/browse/EDM-7138
* Ticket for fixing linkification of filename-like urls: https://product-fabric.atlassian.net/browse/EDM-7190
*/
import LinkifyIt from 'linkify-it';
/**
* Please notify the Editor Mobile team (Slack: #help-mobilekit) if the logic for this changes.
*/
export declare const isSafeUrl: (url: string) => boolean;
export interface Match {
schema: any;
index: number;
lastIndex: number;
raw: string;
text: string;
url: string;
length?: number;
input?: string;
}
export declare const linkify: LinkifyIt.LinkifyIt;
export declare const LINK_REGEXP: RegExp;
/** Attempt to find a link match using a regex string defining a URL */
export declare const linkifyMatch: (text: string) => Match[];
/**
* Attempt to find a link match. Tries to use our regex search first.
* If this doesn't match (e.g. no protocol), try using linkify-it library.
* Returns null if url string empty or no string given, or if no match found.
*/
export declare function getLinkMatch(str?: string): Match | null;
/**
* Adds protocol to url if needed.
* Returns empty string if no url given or if no link match found.
*/
export declare function normalizeUrl(url?: string): string;
/**
* checks if root relative link
*/
export declare function isRootRelative(url: string): boolean;