Wagtail client-side components
    Preparing search index...

    Sends a form's data to the server for autosaving.

    Can also be used for an indicator component to show the current autosave state.

    Dispatches the following events.

    w-autosave:save - before saving, cancelable.

    w-autosave:hydrate - to hydrate a create view into an edit view.

    w-autosave:success - on successful save and any UI updates.

    w-autosave:deactivated - when autosave is deactivated due to an unrecoverable error.

    w-autosave:error - on save error, e.g. due to validation errors.

    Hierarchy

    Index

    Constructors

    • Parameters

      • context: Context

      Returns AutosaveController

    Properties

    activeValue: boolean

    Whether autosave is active.

    Autosave may be deactivated when there is an unrecoverable error, e.g. a newer revision is detected.

    context: Context
    hasPartialsTarget: boolean
    intervalValue: number

    The debounce interval between autosave calls, in milliseconds.

    partialsTarget: HTMLDivElement

    The target element for partial HTML updates.

    revisionIdValue: number

    The current revision ID of the form being edited.

    stateValue: AutosaveState

    The current state of the autosave process.

    This is only set when the controller is used as an indicator component, not when controlling a form.

    submit: DebouncibleFunction<
        (event: CustomEvent<AutosaveSaveDetail>) => Promise<void>,
    > = ...

    Handles the submission of the autosave form. Debouncible based on the interval value.

    The save event containing the form data to submit. If the event's default is prevented, no action is taken.

    blessings: (<T>(constructor: Constructor<T>) => any)[]
    outlets: string[]
    targets: string[] = ...
    values: {
        active: { default: boolean; type: BooleanConstructor };
        interval: { default: number; type: NumberConstructor };
        revisionId: { default: number; type: NumberConstructor };
        state: { default: AutosaveState; type: StringConstructor };
    } = ...

    Accessors

    • get application(): Application

      Returns Application

    • get classes(): ClassMap

      Returns ClassMap

    • get data(): DataMap

      Returns DataMap

    • get element(): ElementType

      Returns ElementType

    • get identifier(): string

      Returns string

    • get outlets(): OutletSet

      Returns OutletSet

    • get scope(): Scope

      Returns Scope

    • get targets(): TargetSet

      Returns TargetSet

    • get shouldLoad(): boolean

      Returns boolean

    Methods

    • Returns void

    • Returns void

    • Parameters

      • eventName: string
      • Optional__namedParameters: Partial<
            {
                bubbles: boolean;
                cancelable: boolean;
                detail: Object;
                prefix: string;
                target: Element
                | Window
                | Document;
            },
        >

      Returns CustomEvent<Object>

    • Applies the new debounce interval to the submit function.

      Parameters

      • newInterval: number

      Returns void

    • Prepares a save request by gathering the form data, adding additional data (e.g. revision ID to overwrite), and dispatching a save event.

      Does not do anything if autosave is not active or the element is not a form.

      Parameters

      Returns Promise<void>

    • Parameters

      • _identifier: string
      • _application: Application

      Returns void