Skip to content

Commit e1a31e2

Browse files
authored
Merge pull request #990 from Neoglyph/update/tinymce5-integration-documentation
Update/tinymce5 integration documentation
2 parents 582b6ee + fbc988a commit e1a31e2

File tree

1 file changed

+48
-2
lines changed

1 file changed

+48
-2
lines changed

docs/integration.md

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,54 @@ Check `vendor/unisharp/laravel-filemanager/src/views/demo.blade.php`, which alre
3434
$('textarea.my-editor').ckeditor(options);
3535
</script>
3636
```
37+
38+
### Option 2: TinyMCE5
3739

38-
### Option 2: TinyMCE4
40+
```html
41+
<script src="/path-to-your-tinymce/tinymce.min.js"></script>
42+
<textarea name="content" class="form-control my-editor">{!! old('content', $content) !!}</textarea>
43+
<script>
44+
var editor_config = {
45+
path_absolute : "/",
46+
selector: 'textarea.my-editor',
47+
relative_urls: false,
48+
plugins: [
49+
"advlist autolink lists link image charmap print preview hr anchor pagebreak",
50+
"searchreplace wordcount visualblocks visualchars code fullscreen",
51+
"insertdatetime media nonbreaking save table directionality",
52+
"emoticons template paste textpattern"
53+
],
54+
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image media",
55+
file_picker_callback : function(callback, value, meta) {
56+
var x = window.innerWidth || document.documentElement.clientWidth || document.getElementsByTagName('body')[0].clientWidth;
57+
var y = window.innerHeight|| document.documentElement.clientHeight|| document.getElementsByTagName('body')[0].clientHeight;
58+
59+
var cmsURL = editor_config.path_absolute + 'laravel-filemanager?editor=' + meta.fieldname;
60+
if (meta.filetype == 'image') {
61+
cmsURL = cmsURL + "&type=Images";
62+
} else {
63+
cmsURL = cmsURL + "&type=Files";
64+
}
65+
66+
tinyMCE.activeEditor.windowManager.openUrl({
67+
url : cmsURL,
68+
title : 'Filemanager',
69+
width : x * 0.8,
70+
height : y * 0.8,
71+
resizable : "yes",
72+
close_previous : "no",
73+
onMessage: (api, message) => {
74+
callback(message.content);
75+
}
76+
});
77+
}
78+
};
79+
80+
tinymce.init(editor_config);
81+
</script>
82+
```
83+
84+
### Option 3: TinyMCE4
3985

4086
```html
4187
<script src="//cdn.tinymce.com/4/tinymce.min.js"></script>
@@ -78,7 +124,7 @@ Check `vendor/unisharp/laravel-filemanager/src/views/demo.blade.php`, which alre
78124
</script>
79125
```
80126

81-
### Option 3: Summernote
127+
### Option 4: Summernote
82128

83129
```html
84130
<!-- dependencies (Summernote depends on Bootstrap & jQuery) -->

0 commit comments

Comments
 (0)