@contentstack/utils
Version:
Contentstack utilities for Javascript
35 lines (34 loc) • 1.19 kB
TypeScript
import StyleType from '../embedded-types/style-type';
import TextNode from '../nodes/text-node';
export interface Metadata {
text: string;
attributes: Attributes;
itemUid: string | undefined;
itemType: 'entry' | 'asset' | undefined;
styleType: StyleType | undefined;
contentTypeUid: string | undefined;
}
export interface Attributes {
type?: 'entry' | 'asset';
class?: string;
id?: string;
[key: string]: any;
style?: styleObjType | string;
'sys-style-type'?: string;
}
export type styleObjType = {
[key: string]: any;
};
export interface EntryAttributes extends Attributes {
'data-sys-entry-uid': string;
'data-sys-entry-local': string;
'data-sys-content-type-uid': string;
}
export interface AssetAttributes extends Attributes {
'data-sys-asset-uid': string;
'data-sys-asset-filelink': string;
'data-sys-asset-contenttype': string;
}
export declare function createMetadata(attribute: Attributes): Metadata;
export declare function nodeToMetadata(attribute: Attributes, textNode: TextNode): Metadata;
export declare function attributeToString(attributes: Attributes): string;