Skip to content

Commit 86ce33d

Browse files
author
Willem Leuverink
authored
Update integration.md
Added integration instructions for summernote WYSIWYG editor
1 parent 0d90b0f commit 86ce33d

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

docs/integration.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,63 @@ Check `vendor/unisharp/laravel-filemanager/src/views/demo.blade.php`, which alre
7878
</script>
7979
```
8080

81+
### Option 3: Summernote
82+
83+
```html
84+
<!-- dependencies (Summernote depends on Bootstrap & jQuery) -->
85+
<link href="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" rel="stylesheet">
86+
<script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script>
87+
<script src="http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js"></script>
88+
89+
<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.3/summernote.css" rel="stylesheet">
90+
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.3/summernote.js"></script>
91+
92+
<!-- markup -->
93+
<textarea id="summernote-editor" name="content">{!! old('content', $content) !!}</textarea>
94+
95+
<!-- summernote config -->
96+
<script>
97+
$(document).ready(function(){
98+
99+
// Define function to open filemanager window
100+
var lfm = function(options, cb) {
101+
var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager';
102+
window.open(route_prefix + '?type=' + options.type || 'file', 'FileManager', 'width=900,height=600');
103+
window.SetUrl = cb;
104+
};
105+
106+
// Define LFM summernote button
107+
var LFMButton = function(context) {
108+
var ui = $.summernote.ui;
109+
var button = ui.button({
110+
contents: '<i class="note-icon-picture"></i> ',
111+
tooltip: 'Insert image with filemanager',
112+
click: function() {
113+
114+
lfm({type: 'image', prefix: '/file-manager'}, function(url, path) {
115+
context.invoke('insertImage', url);
116+
});
117+
118+
}
119+
});
120+
return button.render();
121+
};
122+
123+
// Initialize summernote with LFM button in the popover button group
124+
// Please note that you can add this button to any other button group you'd like
125+
$('#summernote-editor').summernote({
126+
toolbar: [
127+
['popovers', ['lfm']],
128+
],
129+
buttons: {
130+
lfm: LFMButton
131+
}
132+
})
133+
134+
});
135+
</script>
136+
```
137+
81138
## Standalone button
82139
If you are going to use filemanager independently, meaning set the value of an input to selected photo/file url, follow this structure:
83140

0 commit comments

Comments
 (0)