]> _ Git - fluidbook-toolbox.git/commitdiff
wait #7498 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 25 Apr 2025 09:53:58 +0000 (11:53 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 25 Apr 2025 09:53:58 +0000 (11:53 +0200)
app/SubForms/Link/Video.php
resources/linkeditor-stable/js/linkeditor.form.js

index 2edcb66d0b4ede6a2b1729e9c5297efde1db8b0a..4d6c4072cebd9246e482cb9fa17580129e72dd9f 100644 (file)
@@ -34,6 +34,6 @@ class Video extends Base
         $this->addMultimediaSizeFields();
 
         $this->addField('header_tracks', FormSection::class, __('Pistes de sous-titres, descriptions et chapitres'));
-        $this->addField('tracks', BunchOfFieldsMultiple::class, '', ['bunch' => VideoTrack::class, 'add_label' => __('Ajouter une piste'),'edit_label'=>'%kind : %label']);
+        $this->addField('tracks', BunchOfFieldsMultiple::class, '', ['bunch' => VideoTrack::class, 'add_label' => __('Ajouter une piste'), 'edit_label' => '%kind : %label', 'show_empty' => false]);
     }
 }
index 6b86813b31b0445d2f022689f4f8b48b0931d8a8..0951ed301f92e165832690698f5b264c33963113 100644 (file)
@@ -3,7 +3,7 @@ function LinkeditorForm(linkeditor) {
     this.loadingFields = {};
     this._maskChangeEvent = false;
     this._maskChangeEventTimeout = null;
-    this._saveFormDataAfterTextChangeTimeout=null;
+    this._saveFormDataAfterTextChangeTimeout = null;
     this.init();
 }
 
@@ -240,7 +240,7 @@ LinkeditorForm.prototype = {
             try {
                 $(this).select2('close');
                 $(this).select2('destroy');
-            }catch (e){
+            } catch (e) {
 
             }
         });
@@ -271,6 +271,7 @@ LinkeditorForm.prototype = {
         this.initSpectrum();
         $(".bunchmultiple").bunchmultiple();
 
+
         if ($(link).is('.new')) {
             this.focusAndSelectDestinationField();
         }
@@ -303,11 +304,21 @@ LinkeditorForm.prototype = {
             if (map[k] !== undefined) {
                 k = map[k];
             }
+            if (k.indexOf('bunchmultiple') === 0) {
+                return;
+            }
             v = $this.normalizeFormValue(k, v);
+
             if ($(form).find('[type="checkbox"][name=' + k + ']').length > 0) {
                 $(form).find('[type="checkbox"][name=' + k + ']').prop('checked', v === '1');
             } else {
-                $(form).find('[name=' + k + ']').val(v);
+                let f = $(form).find('[name=' + k + ']');
+                let bm = f.closest('.bunchmultiple');
+                if (bm.length > 0) {
+                    bm.data('values', JSON.parse(v));
+                } else {
+                    f.val(v);
+                }
             }
 
             if ($this.loadingFields[uid + '_' + k] === true) {