Skip to content

Commit c985b8f

Browse files
committed
wip
1 parent 8d6c9cf commit c985b8f

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

resources/views/ckeditor5.blade.php

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
<!DOCTYPE html>
2+
<html lang="{{ app()->getLocale() }}">
3+
<head>
4+
5+
@include('vendor.elfinder.common_scripts')
6+
@include('vendor.elfinder.common_styles')
7+
8+
<!-- elFinder initialization (REQUIRED) -->
9+
<script type="text/javascript" charset="utf-8">
10+
// Helper function to get parameters from the query string.
11+
function getUrlParam(paramName) {
12+
var reParam = new RegExp('(?:[\?&]|&amp;)' + paramName + '=([^&]+)', 'i') ;
13+
var match = window.location.search.match(reParam) ;
14+
15+
return (match && match.length > 1) ? match[1] : '' ;
16+
}
17+
18+
$().ready(function() {
19+
var funcNum = getUrlParam('CKEditorFuncNum');
20+
var theme = 'default';
21+
22+
var elf = $('#elfinder').elfinder({
23+
// set your elFinder options here
24+
@if($locale)
25+
lang: '{{ $locale }}', // locale
26+
@endif
27+
customData: {
28+
_token: '{{ csrf_token() }}'
29+
},
30+
url: '{{ route("elfinder.connector") }}', // connector URL
31+
soundPath: '{{ Basset::getUrl(base_path("vendor/studio-42/elfinder/sounds")) }}',
32+
getFileCallback : function(file) {
33+
window.opener.CKEDITOR.tools.callFunction(funcNum, file.url);
34+
window.close();
35+
},
36+
themes: {
37+
default : 'https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-gray.json',
38+
dark : 'https://cdn.jsdelivr.net/gh/RobiNN1/elFinder-Material-Theme/manifests/material-default.json',
39+
},
40+
theme: theme
41+
},
42+
function(fm, extraObj) {
43+
fm.bind('open', function() {
44+
setElFinderColorMode();
45+
});
46+
}).elfinder('instance');
47+
48+
function isElfinderInDarkMode() {
49+
return typeof window.parent?.colorMode !== 'undefined' && window.parent.colorMode.result === 'dark';
50+
}
51+
52+
function setElFinderColorMode() {
53+
theme = isElfinderInDarkMode() ? 'dark' : 'default';
54+
55+
let instance = $('#elfinder').elfinder('instance');
56+
instance.changeTheme(theme).storage('theme', theme);
57+
}
58+
});
59+
</script>
60+
</head>
61+
<body>
62+
63+
<!-- Element where elFinder will be created (REQUIRED) -->
64+
<div id="elfinder"></div>
65+
66+
</body>
67+
</html>

0 commit comments

Comments
 (0)