Skip to content

Commit

Permalink
Merge pull request #47 from Laravel-Backpack/ckeditor-browse-files
Browse files Browse the repository at this point in the history
Re-add the ability to use elfinder in ckeditor5
  • Loading branch information
pxpm authored May 24, 2024
2 parents 507e4ea + 050ec86 commit 8940b51
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
8 changes: 4 additions & 4 deletions resources/views/common_scripts.blade.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{-- jQuery (REQUIRED) --}}
@if (!isset ($jquery) || (isset($jquery) && $jquery == true))
@basset('https://unpkg.com/[email protected].4/dist/jquery.min.js')
@basset('https://unpkg.com/[email protected].1/dist/jquery.min.js')
@endif

{{-- jQuery UI and Smoothness theme --}}
Expand All @@ -9,12 +9,12 @@
@basset('jquery-ui-1.13.2/jquery-ui-1.13.2/dist/jquery-ui.min.js')

{{-- elFinder JS (REQUIRED) --}}
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.62.tar.gz', 'elfinder-2.1.62')
@basset('elfinder-2.1.62/elFinder-2.1.62/js/elfinder.min.js')
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.64.tar.gz', 'elfinder-2.1.64')
@basset('elfinder-2.1.64/elFinder-2.1.64/js/elfinder.min.js')

{{-- elFinder translation (OPTIONAL) --}}
@if($locale)
@basset('https://cdnjs.cloudflare.com/ajax/libs/elfinder/2.1.62/js/i18n/elfinder.'.$locale.'.min.js')
@basset('https://cdnjs.cloudflare.com/ajax/libs/elfinder/2.1.64/js/i18n/elfinder.'.$locale.'.min.js')
@endif

{{-- elFinder sounds --}}
Expand Down
8 changes: 4 additions & 4 deletions resources/views/common_styles.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
@php
$themeStylesheetVersion = '3.0.0';
@endphp
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.62.tar.gz', 'elfinder-2.1.62')
@basset('elfinder-2.1.62/elFinder-2.1.62/css/elfinder.min.css')
@bassetArchive('https://github.com/Studio-42/elFinder/archive/refs/tags/2.1.64.tar.gz', 'elfinder-2.1.64')
@basset('elfinder-2.1.64/elFinder-2.1.64/css/elfinder.min.css')
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/css/theme.min.css')
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/images/loading.svg', false)
@basset('https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme@'.$themeStylesheetVersion.'/Material/font/material.eot', false)
Expand Down Expand Up @@ -62,8 +62,8 @@ function addElfinderLightStylesheet() {
if(colorMode) {
let colorModeClass = window.parent.colorMode ?? window.colorMode;
colorModeClass.onChange(function(scheme) {
let styleSheetType = scheme === 'dark' ? false : true;
let selectedLinkElement = getElfinderStyleSheet(styleSheetType);
let getMainStylesheet = scheme === 'dark' ? false : true;
let selectedLinkElement = getElfinderStyleSheet(getMainStylesheet);
if (! selectedLinkElement) {
return true;
Expand Down
10 changes: 4 additions & 6 deletions resources/views/standalonepopup.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
},
url: '{{ route("elfinder.connector") }}', // connector URL
soundPath: '{{ Basset::getUrl(base_path("vendor/studio-42/elfinder/sounds")) }}',
dialog: {width: 900, modal: true, title: 'Select a file'},
resizable: false,
onlyMimes: @json(unserialize(urldecode(request('mimes'))), JSON_UNESCAPED_SLASHES),
commandsOptions: {
Expand All @@ -40,20 +39,19 @@
oncomplete: 'destroy'
}
},
getFileCallback: function (file) {
getFileCallback: (file) => {
@if (request()->has('multiple') && request()->input('multiple') == 1)
window.parent.processSelectedMultipleFiles(file, '{{ $input_id }}');
@else
window.parent.processSelectedFile(file.path, '{{ $input_id }}');
@endif
window.parent.jQuery.colorbox.close();
},
};
let elfinderOptions = window.parent.elfinderOptions ?? {};
var elf = $('#elfinder').elfinder({...elfinderConfig, ...elfinderOptions}).elfinder('instance');
var elf = $('#elfinder').elfinder(elfinderConfig);
document.getElementById('elfinder').style.opacity = 1;
document.getElementById('elfinder').style.opacity = 1;
});
</script>
</head>
Expand Down

0 comments on commit 8940b51

Please sign in to comment.