@dotcms/uve
Version:
Official JavaScript library for interacting with Universal Visual Editor (UVE)
31 lines (30 loc) • 1.1 kB
TypeScript
import { UVEState } from './types';
/**
* Gets the current state of the Universal Visual Editor (UVE).
*
* This function checks if the code is running inside the DotCMS Universal Visual Editor
* and returns information about its current state, including the editor mode.
*
* @export
* @return {UVEState | undefined} Returns the UVE state object if running inside the editor,
* undefined otherwise.
*
* The state includes:
* - mode: The current editor mode (preview, edit, live)
* - languageId: The language ID of the current page setted on the UVE
* - persona: The persona of the current page setted on the UVE
* - variantName: The name of the current variant
* - experimentId: The ID of the current experiment
* - publishDate: The publish date of the current page setted on the UVE
*
* @note The absence of any of these properties means that the value is the default one.
*
* @example
* ```ts
* const editorState = getUVEState();
* if (editorState?.mode === 'edit') {
* // Enable editing features
* }
* ```
*/
export declare function getUVEState(): UVEState | undefined;