|
123456789101112131415161718192021222324252627282930313233343536 |
-
- import "./form.scss"
-
-
- $(document).ready(function () {
- initFileManager();
- });
-
- $('.field-collection').bind('collection-add-item', function (){
- initFileManager();
- });
-
- function initFileManager() {
- $('.lc-filemanager-delete').off('click');
- $('.lc-filemanager-delete').on('click', function (e) {
- let $field = $(this);
- $('#' + $field.data('id')).val("");
- $('#' + $field.data('id') + '_preview').prop('src',"");
- });
- $('.lc-filemanager-open').off('click');
- $('.lc-filemanager-open').on('click', function (e) {
- let $field = $(this);
- $('#lc-filemanager-frame').off('load');
- $("#lc-filemanager-frame").on('load', function () {
- $('#lc-filemanager-frame').contents().on('click', '.select', function () {
- var path = $(this).attr('data-path')
- $('#' + $field.data('id')).val(path);
- $('#' + $field.data('id') + '_preview').prop('src',path);
- $('#lc-filemanager-modal').modal('hide');
- });
- });
- $("#lc-filemanager-frame").prop('src', $field.data('target'));
- $('#lc-filemanager-modal').modal('show');
- });
-
- }
|