@atlaskit/adf-schema
Version:
Shared package that contains the ADF-schema (json) and ProseMirror node/mark specs
69 lines (68 loc) • 2.06 kB
TypeScript
import type { AttributeSpec, NodeSpec } from '@atlaskit/editor-prosemirror/model';
import type { AnnotationMarkDefinition } from '../marks/annotation';
import type { BorderMarkDefinition } from '../marks/border';
import type { LinkDefinition } from '../marks/link';
export type MediaType = 'file' | 'link' | 'external';
export type DisplayType = 'file' | 'thumbnail';
export type DefaultAttributes<T> = {
[P in keyof T]: {
default?: T[P] | null;
};
};
/**
* @name media_node
*/
export interface MediaDefinition {
/**
* Minimum item: 1
*/
attrs: MediaADFAttrs;
marks?: Array<LinkDefinition | BorderMarkDefinition | AnnotationMarkDefinition>;
type: 'media';
}
export interface MediaBaseAttributes {
__contextId?: string | null;
__displayType?: DisplayType | null;
__external?: boolean;
__fileMimeType?: string | null;
__fileName?: string | null;
__fileSize?: number | null;
__mediaTraceId?: string | null;
alt?: string;
collection: string;
height?: number;
/**
* Minimum length: 1
*/
id: string;
localId?: string;
/**
* Occurrence key (minimum length: 1)
*/
occurrenceKey?: string;
width?: number;
}
export interface MediaAttributes extends MediaBaseAttributes {
type: 'file' | 'link';
}
export interface ExternalMediaAttributes {
__external?: boolean;
alt?: string;
height?: number;
localId?: string;
type: 'external';
url: string;
width?: number;
}
export type MediaADFAttrs = MediaAttributes | ExternalMediaAttributes;
export declare const defaultAttrs: {
[name: string]: AttributeSpec;
} | undefined;
export interface MutableMediaAttributes extends MediaAttributes {
[key: string]: string | number | undefined | null | boolean;
}
export declare const media: NodeSpec;
export declare const mediaWithLocalId: NodeSpec;
export { camelCaseToKebabCase } from './camel-case-to-kebab-case';
export { copyPrivateAttributes } from './copy-private-attributes';
export { toJSON } from './to-json-2';