Skip to content

Instantly share code, notes, and snippets.

@geedelur
Last active March 12, 2019 23:47
Show Gist options
  • Save geedelur/8172359 to your computer and use it in GitHub Desktop.
Save geedelur/8172359 to your computer and use it in GitHub Desktop.
show/hide summernote toolbar
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();
}
});
});
}
@catsincars
Copy link

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