Last active
March 12, 2019 23:47
-
-
Save geedelur/8172359 to your computer and use it in GitHub Desktop.
show/hide summernote toolbar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function summernoteLoad() { | |
var $summernoteTextAreas = $('[data-control="summernote"]'); | |
//cargar summernote | |
$summernoteTextAreas.summernote({ | |
onImageUpload: summernoteOnImageUpload, | |
onkeyup: function() { | |
syncSummernoteTextArea($summernoteTextAreas); | |
validate(false); | |
}, | |
onblur: function() { | |
syncSummernoteTextArea($summernoteTextAreas); | |
validate(false); | |
} | |
}); | |
//mostrar summernote toolbar on demand | |
var $summernotes = $('[data-control="summernote-container"]'); | |
$summernotes.find('.note-toolbar').hide(); | |
$summernotes.each(function(idx, element) { | |
var $snote = $(element); | |
$snote.on('focus', '.note-editable', function(e) { | |
if($snote.find('.note-toolbar').hasClass('active')) { | |
//ya está desplegado | |
} else { | |
$summernotes.find('.note-toolbar') | |
.removeClass('active') | |
.slideUp(); | |
$snote.find('.note-toolbar') | |
.addClass('active') | |
.slideDown(); | |
} | |
}); | |
}); | |
} |
Thank You. Examples should have provided this
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can use it ,if you want to hide the toolbar:
$('#summernote').summernote({
toolbar: []
});