Skip to content

Instantly share code, notes, and snippets.

@TrywaR
Created January 30, 2020 14:44
Show Gist options
  • Save TrywaR/95e0ce58079704a6cc19d045b707c469 to your computer and use it in GitHub Desktop.
Save TrywaR/95e0ce58079704a6cc19d045b707c469 to your computer and use it in GitHub Desktop.
[ Tinymce | Fancybox > Добавление визуального текстового редактора для полей форм, textarea ]
// После открытия окна, запускаем tinyMCE, с сейвом данных когда теряется фокус с поля
$(document).on('afterShow.fb', function( e, instance, slide ) {
if ( $(this).find('textarea').length > 0 )
tinyMCE.init({
'selector':'textarea',
'setup' : function (editor) {
editor.on('change', function () {
tinymce.triggerSave()
})
}
})
})
// После закрытия окна, изнечтожаем tinyMCE, он сделал своё дело...
$(document).on('beforeClose.fb', function( e, instance, slide ) {
if ( tinyMCE.get() )
tinyMCE.remove()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment