Sha256: b239bc478cc6ce1da58cb9c69544b714dfb84d7a7b379252933a3953d2dbad93

Contents?: true

Size: 506 Bytes

Versions: 4

Compression:

Stored size: 506 Bytes

Contents

import { Controller } from "@hotwired/stimulus";

export default class EditPageController extends Controller<HTMLFormElement> {
  declare readonly formTarget: HTMLFormElement;

  static get targets() {
    return ["form"];
  }

  preview() {
    const form = this.formTarget;
    const prevAction = form.action;
    const prevTarget = form.target;

    form.target = "_blank";
    form.action = form.dataset.previewUrl;
    form.submit();

    form.action = prevAction;
    form.target = prevTarget;
  }
}

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
pages_core-3.14.0 app/javascript/controllers/EditPageController.ts
pages_core-3.13.0 app/javascript/controllers/EditPageController.ts
pages_core-3.12.7 app/javascript/controllers/EditPageController.ts
pages_core-3.12.6 app/javascript/controllers/EditPageController.ts