Skip to content

Commit

Permalink
Merge branch 'release/v2.4.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
alexusmai committed Aug 24, 2019
2 parents 241cc69 + e77bbf2 commit c5a132e
Show file tree
Hide file tree
Showing 9 changed files with 138 additions and 14 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
* Integration with WYSIWYG Editors:
* CKEditor 4
* TinyMCE 4
* TinyMCE 5
* SummerNote
* Standalone button
* ACL - access control list
Expand All @@ -62,7 +63,7 @@
* Events (v2.2)
* Thumbnails lazy load
* Dynamic configuration (v2.4)
* Supported locales : ru, en, ar, sr
* Supported locales : ru, en, ar, sr, cs

## In a new version 2.4

Expand Down Expand Up @@ -117,5 +118,6 @@ If you use the ACL, now you don't need to add the acl middleware to configuratio
* Khalid Bj [D34DlyM4N](https://github.com/D34DlyM4N)
* NeoSon [lkloon123](https://github.com/lkloon123)
* Aleksandar Stevanović [aleks989](https://github.com/aleks989)
* Aleš Nejdr [mige](https://github.com/mige)


25 changes: 25 additions & 0 deletions docs/integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,31 @@ tinymce.init({
});
```

### TinyMCE 5

Add to TinyMCE 5 configuration

```js
tinymce.init({
selector: '#my-textarea',
// ...
file_picker_callback (callback, value, meta) {
let x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth
let y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight

tinymce.activeEditor.windowManager.openUrl({
url : '/file-manager/tinymce5',
title : 'Laravel File manager',
width : x * 0.8,
height : y * 0.8,
onMessage: (api, message) => {
callback(message.content)
}
})
}
});
```

### SummerNote

Create and add new button
Expand Down
6 changes: 3 additions & 3 deletions resources/assets/css/file-manager.css

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions resources/assets/js/file-manager.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion resources/assets/js/file-manager.js.map

Large diffs are not rendered by default.

29 changes: 29 additions & 0 deletions resources/lang/cs/response.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?php

return [
'noConfig' => 'Konfigurace nebyla nalezena!',
'notFound' => 'Nenalezeno!',
'diskNotFound' => 'Disk nebyla nalezen!',
'pathNotFound' => 'Cesta nebyla nalezena!',
'diskSelected' => 'Disk byl vybrán!',
// files
'fileExist' => 'Soubor již existuje!',
'fileCreated' => 'Soubor byl vytvořen!',
'fileUpdated' => 'Soubor byl aktualizován!',
'fileNotFound' => 'Soubor nebyl nalezen!',
// directories
'dirExist' => 'Složka již existuje!',
'dirCreated' => 'Složka byla vytvořena!',
'dirNotFound' => 'Složka nebyla nalezena',
// actions
'uploaded' => 'Všechny soubory byly nahrány!',
'notAllUploaded' => 'Některé soubory nebyly nahrány!',
'delNotFound' => 'Některé položky nebyly nalezeny!',
'deleted' => 'Smazáno!',
'renamed' => 'Přejmenováno!',
'copied' => 'Úspěšně zkopírováno!',
// zip
'zipError' => 'Chyba při vytváření archivu!',
// acl
'aclError' => 'Přístup odepřen!',
];
55 changes: 55 additions & 0 deletions resources/views/tinymce5.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

<title>{{ config('app.name', 'File Manager') }}</title>

<!-- Styles -->
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.0/css/all.css">
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
<link href="{{ asset('vendor/file-manager/css/file-manager.css') }}" rel="stylesheet">
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12" id="fm-main-block">
<div id="fm"></div>
</div>
</div>
</div>

<!-- File manager -->
<script src="{{ asset('vendor/file-manager/js/file-manager.js') }}"></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
// set fm height
document.getElementById('fm-main-block').setAttribute('style', 'height:' + window.innerHeight + 'px');
const FileBrowserDialogue = {
init: function() {
// Here goes your code for setting your custom things onLoad.
},
mySubmit: function (URL) {
// pass selected file path to TinyMCE
parent.postMessage({
mceAction: 'insert',
content: URL
})
// close popup window
parent.postMessage({ mceAction: 'close' });
}
};
// Add callback to file manager
fm.$store.commit('fm/setFileCallBack', function(fileUrl) {
FileBrowserDialogue.mySubmit(fileUrl);
});
});
</script>
</body>
</html>
10 changes: 10 additions & 0 deletions src/Controllers/FileManagerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,16 @@ public function tinymce()
return view('file-manager::tinymce');
}

/**
* Integration with TinyMCE v5
*
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
*/
public function tinymce5()
{
return view('file-manager::tinymce5');
}

/**
* Integration with SummerNote
*
Expand Down
3 changes: 3 additions & 0 deletions src/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@
Route::get('tinymce', 'FileManagerController@tinymce')
->name('fm.tinymce');

Route::get('tinymce5', 'FileManagerController@tinymce5')
->name('fm.tinymce5');

Route::get('summernote', 'FileManagerController@summernote')
->name('fm.summernote');

Expand Down

0 comments on commit c5a132e

Please sign in to comment.