kartik-v / bootstrap-fileinput

An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.
http://plugins.krajee.com/file-input
Other
5.36k stars 2.4k forks source link

Close preview button not working #1865

Open muramidaza opened 4 months ago

muramidaza commented 4 months ago

The widget works fine. The files are downloaded and displayed. But the Close preview window button does not work. That is, when I click on it, the modal preview window does not close. There are no errors in the console. Im using bootstrap 5

        $fileForm = $form->field($requestFilesForm, 'uploadFiles[]')->widget(FileInput::class, [
            'language' => 'ru',
            'options' => [
                'multiple' => true,
                'accept' => '',
            ],
            'pluginOptions' => [
                'previewFileType' => 'image',
                'deleteUrl' => Url::to(['delete-file'],true),
                'uploadUrl' => $model->id ? Url::to(['upload-files', 'id' => $model->id]) : null,
                'uploadExtraData' => [
                    'id' => $model->id,
                ],
                'overwriteInitial' => false,
                'showPreview' => true,
                'showClose' => false,
                'initialPreview' => $files,
                'initialPreviewFileType' => 'image',
                'initialPreviewAsData' =>true,
                'initialPreviewConfig' => $initialPreviewConfig,
                'pluginEvents' => [
                    "fileuploaded" => "function(event, data, previewId, index) { console.log(data) }",
                ],
                'maxFileSize' => 50000
            ],
        ])->label('Прикрепленные файлы');

This button has a click event from yii.js. As I understand it, it will float up to kvFileinputModal. But there is no click event on it, there is a mousedown from bootstrap.js and it seems that it is not intercepted

kartik-v commented 2 months ago

Not sure I can reproduce this. Can you check your console log for any javascript errors? Are you trying to have two bootstrap modals or something (like the fileinput widget inside another modal) which may conflict with the file input preview modal?