From 43c3d706acfcf13009e09724c96712a839901ebb Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Thu, 30 May 2024 12:25:32 +0200 Subject: [PATCH] chore(js): lazy load lightbox and tiptap --- .../controllers/{ => lazy}/lightbox_controller.ts | 4 ++-- .../controllers/{ => lazy}/tiptap_controller.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) rename app/javascript/controllers/{ => lazy}/lightbox_controller.ts (92%) rename app/javascript/controllers/{ => lazy}/tiptap_controller.ts (92%) diff --git a/app/javascript/controllers/lightbox_controller.ts b/app/javascript/controllers/lazy/lightbox_controller.ts similarity index 92% rename from app/javascript/controllers/lightbox_controller.ts rename to app/javascript/controllers/lazy/lightbox_controller.ts index 1c671fa16..2820c8a35 100644 --- a/app/javascript/controllers/lightbox_controller.ts +++ b/app/javascript/controllers/lazy/lightbox_controller.ts @@ -1,4 +1,4 @@ -import { Controller } from '@hotwired/stimulus'; +import { ApplicationController } from '../application_controller'; import lightGallery from 'lightgallery'; import { LightGallery } from 'lightgallery/lightgallery'; import lgThumbnail from 'lightgallery/plugins/thumbnail'; @@ -7,7 +7,7 @@ import lgRotate from 'lightgallery/plugins/rotate'; import lgHash from 'lightgallery/plugins/hash'; import 'lightgallery/css/lightgallery-bundle.css'; -export default class extends Controller { +export default class extends ApplicationController { lightGallery?: LightGallery; connect(): void { diff --git a/app/javascript/controllers/tiptap_controller.ts b/app/javascript/controllers/lazy/tiptap_controller.ts similarity index 92% rename from app/javascript/controllers/tiptap_controller.ts rename to app/javascript/controllers/lazy/tiptap_controller.ts index caf7c4a66..e80d2e599 100644 --- a/app/javascript/controllers/tiptap_controller.ts +++ b/app/javascript/controllers/lazy/tiptap_controller.ts @@ -2,10 +2,10 @@ import { Editor, type JSONContent } from '@tiptap/core'; import { isButtonElement, isHTMLElement } from '@coldwired/utils'; import { z } from 'zod'; -import { ApplicationController } from './application_controller'; -import { getAction } from '../shared/tiptap/actions'; -import { tagSchema, type TagSchema } from '../shared/tiptap/tags'; -import { createEditor } from '../shared/tiptap/editor'; +import { ApplicationController } from '../application_controller'; +import { getAction } from '../../shared/tiptap/actions'; +import { tagSchema, type TagSchema } from '../../shared/tiptap/tags'; +import { createEditor } from '../../shared/tiptap/editor'; export class TiptapController extends ApplicationController { static targets = ['editor', 'input', 'button', 'tag'];