import { StudioLayouts } from '.'; import type { StudioLayoutBasePropsConfig } from './StudioBaseSchema'; export interface StudioPanelEditCodeEditableState { /** * The selected page for which the code should be loaded. */ page?: object; /** * The current HTML/MJML code. */ code?: string; /** * The current CSS code. */ codeStyle?: string; } export interface StudioLayoutPanelEditCodeConfig extends Omit { /** * Type of the layout component. */ type: `${StudioLayouts.panelEditCode}`; /** * Override the initial editable state of the component. * @examples * state: ({ editor }) => ({ * page: editor.Pages.getSelected() * }) */ state?: '__fn__'; /** * Custom layout rendered before the code fields. * Receives `editor`, `state`, `setState`, and `update`. * @examples * layoutBefore: ({ state, update }) => ({ * type: 'button', * label: 'Update', * disabled: !state.hasChanges, * onClick: () => update() * }) */ layoutBefore?: '__fn__'; /** * Custom layout rendered after the code fields. * When provided, the default footer is disabled. * Receives `editor`, `state`, `setState`, and `update`. * @examples * layoutAfter: ({ setState }) => ({ * type: 'button', * label: 'Set custom code', * onClick: () => setState({ code: '
Custom
' }) * }) */ layoutAfter?: '__fn__'; }