From 468820c9feae2c2c03d0b5b81046318963787945 Mon Sep 17 00:00:00 2001 From: ghassan Date: Fri, 2 Oct 2026 12:18:35 +0300 Subject: [PATCH] Unify upload/edit modal track-form + fix slide cropper hang & reorder loss Track-form unification: the "Add Language Track" dialog in the edit modal now clones the same #um-track-form-template partial that the create modal uses, so future tweaks to markup/CSS/behaviour show up in both flows automatically. Added window.cloneTrackFormTemplate() + window.initTrackFormNode() as the shared cloner+init. updateTrackCard() writes to both um-tc-*-{id} and edit-tc-*-{id} ids so one helper serves both modals. Dropped the dead #edit-extra-track-tpl and the custom editHandleTrackAudio (handleTrackAudio auto-fills title identically). Cover slides cropper fixes (both modals): - Second batch no longer hangs. _slidesCropLoadNext now calls openCropperModal_* BEFORE tcPreload_*; previously preloading first measured canvas.clientWidth=0 against a display:none overlay and left _st.ready false so Save silently returned. - Reorder no longer loses thumbnails. Create flow stored raw Files and spawned a FileReader per slide per render; under memory pressure some readers failed silently. Now stores {file, url} with URL.createObjectURL called once per slide, and renderSlidesStrip assigns img.src = url directly. Removal revokes the URL; clear revokes everything it drops. - Reset .value on the slides input after processing so re-selecting the same filename still fires change. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../components/track-editor-form.blade.php | 2 +- .../partials/edit-video-modal.blade.php | 126 +++---- .../layouts/partials/upload-modal.blade.php | 311 ++++++++++-------- 3 files changed, 243 insertions(+), 196 deletions(-) diff --git a/resources/views/components/track-editor-form.blade.php b/resources/views/components/track-editor-form.blade.php index 73d128d..bd0abf0 100644 --- a/resources/views/components/track-editor-form.blade.php +++ b/resources/views/components/track-editor-form.blade.php @@ -306,7 +306,7 @@ @if($embedAudioInput) + onchange="editHandleTrackAudio(this, '{{ $p }}', '{{ $titleId }}')"> @endif diff --git a/resources/views/layouts/partials/edit-video-modal.blade.php b/resources/views/layouts/partials/edit-video-modal.blade.php index 7c93933..c611b04 100644 --- a/resources/views/layouts/partials/edit-video-modal.blade.php +++ b/resources/views/layouts/partials/edit-video-modal.blade.php @@ -178,22 +178,9 @@ -{{-- ── Secondary track form template (cloned by JS for each extra track) ──── --}} - +{{-- Secondary tracks in this modal are cloned from the SHARED + #um-track-form-template defined in layouts.partials.upload-modal. One + template → identical UX in both the create (upload) modal and this modal. --}}