Sha256: cb9428e57629b5a77209e3d4b48584d77a89c70195f63fbcea831d360dc4d785

Contents?: true

Size: 430 Bytes

Versions: 8

Compression:

Stored size: 430 Bytes

Contents

import { Controller } from "stimulus";

export default class EditPageController extends Controller {
  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

8 entries across 8 versions & 1 rubygems

Version Path
pages_core-3.10.1 app/javascript/controllers/EditPageController.js
pages_core-3.9.2 app/javascript/controllers/EditPageController.js
pages_core-3.9.1 app/javascript/controllers/EditPageController.js
pages_core-3.9.0 app/javascript/controllers/EditPageController.js
pages_core-3.8.3 app/javascript/controllers/EditPageController.js
pages_core-3.8.2 app/javascript/controllers/EditPageController.js
pages_core-3.8.1 app/javascript/controllers/EditPageController.js
pages_core-3.8.0 app/javascript/controllers/EditPageController.js