import { ActionType } from '../../_contract-src/action-payloads/action-type'; import { postToHost } from './post-to-host'; /** * Asks the Struct PIM host to refresh the editor that is currently * hosting this extension iframe. The host re-fetches the editor model, * breadcrumbs and thumbnail without a page reload. * * If the user has unsaved changes, the host will prompt them to confirm * before discarding their work. If they cancel, no refresh happens and * the action completes silently. * * Only available for extension points that live inside an editor — * `Tab`, `Section`, `Property`, `SidebarWidget`. The host will reject * the action with `ACTION_REJECTED` for any other extension point type. * * @example * ```ts * // After your extension performs a server-side mutation: * struct.actions.refreshEditor(); * ``` */ export function refreshEditor() { postToHost({ actionType: ActionType.RefreshEditor, payload: {} }); }