From: Vincent Vanwaelscappel Date: Fri, 25 Apr 2025 09:53:58 +0000 (+0200) Subject: wait #7498 @1 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=27c02a81f03250d34b609a56543101525c0ebd13;p=fluidbook-toolbox.git wait #7498 @1 --- diff --git a/app/SubForms/Link/Video.php b/app/SubForms/Link/Video.php index 2edcb66d0..4d6c4072c 100644 --- a/app/SubForms/Link/Video.php +++ b/app/SubForms/Link/Video.php @@ -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]); } } diff --git a/resources/linkeditor-stable/js/linkeditor.form.js b/resources/linkeditor-stable/js/linkeditor.form.js index 6b86813b3..0951ed301 100644 --- a/resources/linkeditor-stable/js/linkeditor.form.js +++ b/resources/linkeditor-stable/js/linkeditor.form.js @@ -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) {