@bonniernews/abbe-api-utils
Version:
Utilities for converting to Abbe article format
101 lines (100 loc) • 2.1 kB
TypeScript
import { UUID } from "../../types/Article";
export declare enum BlockType {
FACTBOX = "atomic",
HEADLINE = "header-two",
IMAGE = "atomic",
IMAGE_COLLECTION = "atomic",
EMBED = "atomic",
PREAMBLE = "header-five",
QUOTE = "blockquote",
TITLE = "header-one",
UNSTYLED = "unstyled"
}
interface EntityRange {
offset: number;
length: number;
key: number;
}
export interface ImageData {
type: "image";
blockKey: string;
caption: string;
mediaPath: string;
photoAuthors: string;
imageUuid: UUID;
softCrops?: SoftCrops;
}
export interface ImageCollectionData {
type: "mediaCollection";
blockKey: string;
mediaCollection: ImageData[];
}
interface FactboxData {
type: "factbox-plugin";
blockKey: string;
factbox: {
blocks: Block[];
entityMap: EntityMap;
};
}
interface EmbedData {
type: "embed-plugin";
blockKey: string;
externalId: String;
embedUuid: String;
}
export interface Block {
key: string;
text: string;
type: BlockType;
depth: 0;
inlineStyleRanges: any[];
entityRanges: EntityRange[];
data: Record<string, never> | ImageData | FactboxData | ImageCollectionData | EmbedData;
}
export declare enum Style {
BOLD = "BOLD",
ITALIC = "ITALIC",
LINK = "LINK"
}
export interface StylePosition {
offset: number;
length: number;
}
export interface BlockStyle {
style: Style;
position: StylePosition;
url?: string;
}
export interface EntityMap {
}
export interface ArticleContent {
blocks: Block[];
entityMap: EntityMap;
}
export interface Article {
}
interface CropData {
x: number;
y: number;
width?: number;
height?: number;
}
interface SoftCrops {
"16x9": CropData;
"4x3": CropData;
"1x1": CropData;
"2x1"?: CropData;
"3x4"?: CropData;
}
export interface CreateImageFnParams {
uuid: UUID;
photoAuthor?: string;
caption?: string;
softCrops?: SoftCrops;
}
export interface CreateEmbedFnParams {
embedUuid: String;
externalId: String;
}
export {};