UNPKG

@blinkk/editor

Version:

Structured content editor with live previews.

195 lines (194 loc) 5.07 kB
import { DataStorage } from '../utility/dataStorage'; import { EditorConfig, GlobalConfig, TemplateResult } from '@blinkk/selective-edit'; import { LiveEditorApiComponent } from './api'; import { ContentPart } from './parts/content'; import { EditorState } from './state'; import { EmptyPart } from './parts/empty'; import { MenuPart } from './parts/menu'; import { ModalsPart } from './parts/modals'; import { NotificationsPart } from './parts/notifications'; import { OverviewPart } from './parts/overview'; import { PreviewPart } from './parts/preview'; import { ProjectTypeComponent } from '../projectType/projectType'; import { ToastsPart } from './parts/toasts'; /** * Global configuration used by the selective editor fields. * * Allows the fields to access the api. */ export interface LiveEditorGlobalConfig extends GlobalConfig { api: LiveEditorApiComponent; editor?: LiveEditor; labels: LiveEditorLabels; state: EditorState; } /** * Custom selective editor config. * * Customized to use the live editor global config interface. */ export interface LiveEditorSelectiveEditorConfig extends EditorConfig { global?: LiveEditorGlobalConfig; } /** * Configuration for the live editor. */ export interface LiveEditorConfig { /** * Api for working with the live editor project. */ api: LiveEditorApiComponent; /** * Custom UI labels for the editor UI. */ labels?: LiveEditorLabels; /** * Base configuration for the selective editor. */ selectiveConfig: LiveEditorSelectiveEditorConfig; /** * Editor state. */ state: EditorState; /** * Is the editor being used in a testing environment? * * For example: selenium or webdriver. */ isTest?: boolean; } export interface LiveEditorParts { content: ContentPart; empty: EmptyPart; menu: MenuPart; modals: ModalsPart; notifications: NotificationsPart; overview: OverviewPart; preview: PreviewPart; toasts: ToastsPart; } export declare class LiveEditor { config: LiveEditorConfig; container: HTMLElement; isPendingRender: boolean; isRendering: boolean; parts: LiveEditorParts; projectType?: ProjectTypeComponent; state: EditorState; storage: DataStorage; constructor(config: LiveEditorConfig, container: HTMLElement); classesForEditor(): Record<string, boolean>; render(): void; template(editor: LiveEditor): TemplateResult; templateContentStructure(editor: LiveEditor): TemplateResult; updateProjectType(projectType: ProjectTypeComponent): void; } /** * Custom labels for the editor UI. */ export interface LiveEditorLabels { /** * Label for content save action. */ contentSave?: string; /** * Label for content save action clean state. */ contentSaveClean?: string; /** * Label for content save action processing. */ contentSaveErrors?: string; /** * Label for content save action processing. */ contentSaveProcessing?: string; /** * Label for media field extra fields. */ fieldMediaExtra?: string; /** * Label for media field sub fields. */ fieldMediaFields?: string; /** * Label for media field label. */ fieldMediaLabel?: string; /** * Label for media field path. */ fieldMediaPath?: string; /** * Label for media field preview. */ fieldMediaPreview?: string; /** * Label for the file. */ file?: string; /** * Label for action to create new file. */ fileNew?: string; /** * Label for the files structure. */ files?: string; /** * Label for the site section of the menu. */ menuSite?: string; /** * Label for the users section of the menu. */ menuUsers?: string; /** * Label for the workspaces section of the menu. */ menuWorkspaces?: string; /** * Label for publishing when a publish has been completed. */ publishComplete?: string; /** * Label for publishing when a publish has failed. */ publishFailure?: string; /** * Submit button label for the publish modal window. */ publishModalSubmit?: string; /** * Title for the publish modal window. */ publishModalTitle?: string; /** * Label for publishing when there are not changes to publish. */ publishNoChanges?: string; /** * Label for publishing when a publish is not allowed. */ publishNotAllowed?: string; /** * Label for publishing when a publish has not been started. */ publishNotStarted?: string; /** * Label for publishing when a publish is in progress. */ publishPending?: string; /** * Label for the workspace. */ workspace?: string; /** * Label for the action to create a new workspace. */ workspaceNew?: string; /** * Label for the workspace. */ workspaces?: string; }