import { Controller } from '@hotwired/stimulus'; import {GridStack} from "../vendor/gridstack/gridstack.index.js"; /* * The following line makes this controller "lazy": it won't be downloaded until needed * See https://symfony.com/bundles/StimulusBundle/current/index.html#lazy-stimulus-controllers */ /* stimulusFetch: 'lazy' */ export default class extends Controller { grid; initialize() { } connect() { this.grid = GridStack.init({ column: 2, alwaysShowResizeHandle: true, margin: "2rem", resizable: { handles: 'e,se,s,sw,w' } }); this.grid.load(); } // Add custom controller actions here // fooBar() { this.fooTarget.classList.toggle(this.bazClass) } disconnect() { // Called anytime its element is disconnected from the DOM // (on page change, when it's removed from or moved in the DOM, etc.) // Here you should remove all event listeners added in "connect()" // this.fooTarget.removeEventListener('click', this._fooBar) } }