Skip to content

Commit 52cea4f

Browse files
committed
add summernote to demo page
1 parent 68be0d7 commit 52cea4f

File tree

1 file changed

+52
-2
lines changed

1 file changed

+52
-2
lines changed

src/views/demo.blade.php

Lines changed: 52 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@
2121
</div>
2222
</div>
2323
<div class="row">
24-
<div class="col-md-6 col-md-offset-3">
24+
<div class="col-md-6">
25+
<h2>Summernote</h2>
26+
<textarea id="summernote-editor" name="content"></textarea>
27+
</div>
28+
<div class="col-md-6">
2529
<h2>Standalone Button</h2>
2630
<div class="input-group">
2731
<span class="input-group-btn">
@@ -44,7 +48,6 @@
4448

4549
<!-- CKEditor init -->
4650
<script src="//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.5.11/ckeditor.js"></script>
47-
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
4851
<script src="//cdnjs.cloudflare.com/ajax/libs/ckeditor/4.5.11/adapters/jquery.js"></script>
4952
<script>
5053
$('textarea[name=ce]').ckeditor({
@@ -98,5 +101,52 @@
98101
<script>
99102
$('#lfm').filemanager('image', {prefix: route_prefix});
100103
</script>
104+
105+
<link href="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.4/summernote.css" rel="stylesheet">
106+
<script src="http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.4/summernote.js"></script>
107+
<script>
108+
$(document).ready(function() {
109+
$('#summernote').summernote();
110+
});
111+
</script>
112+
<script>
113+
$(document).ready(function(){
114+
115+
// Define function to open filemanager window
116+
var lfm = function(options, cb) {
117+
var route_prefix = (options && options.prefix) ? options.prefix : '/laravel-filemanager';
118+
window.open(route_prefix + '?type=' + options.type || 'file', 'FileManager', 'width=900,height=600');
119+
window.SetUrl = cb;
120+
};
121+
122+
// Define LFM summernote button
123+
var LFMButton = function(context) {
124+
var ui = $.summernote.ui;
125+
var button = ui.button({
126+
contents: '<i class="note-icon-picture"></i> ',
127+
tooltip: 'Insert image with filemanager',
128+
click: function() {
129+
130+
lfm({type: 'image', prefix: '/laravel-filemanager'}, function(url, path) {
131+
context.invoke('insertImage', url);
132+
});
133+
134+
}
135+
});
136+
return button.render();
137+
};
138+
139+
// Initialize summernote with LFM button in the popover button group
140+
// Please note that you can add this button to any other button group you'd like
141+
$('#summernote-editor').summernote({
142+
toolbar: [
143+
['popovers', ['lfm']],
144+
],
145+
buttons: {
146+
lfm: LFMButton
147+
}
148+
})
149+
});
150+
</script>
101151
</body>
102152
</html>

0 commit comments

Comments
 (0)