diff --git a/bl-plugins/tinymce/tinymce/plugins/autoheight/plugin.min.js b/bl-plugins/tinymce/tinymce/plugins/autoheight/plugin.min.js new file mode 100644 index 00000000..8c263a6d --- /dev/null +++ b/bl-plugins/tinymce/tinymce/plugins/autoheight/plugin.min.js @@ -0,0 +1,41 @@ +tinymce.PluginManager.add('autoheight', function(editor) { + var editor_container; + var bars_height = 0; + + function resizeEditor(e) { + if (typeof(editor_container) === 'undefined') return; + + try { + var element_height = parseInt(window.getComputedStyle(editor_container).height); + /*calculate bar height only once*/ + if (bars_height === 0) { + var toolbars = editor_container.querySelectorAll('.mce-toolbar, .mce-statusbar, .mce-menubar'); + /*IE11 FIX*/ + var toolbarsLength = toolbars.length; + for (var i = 0; i < toolbarsLength; i++) { + var toolbar = toolbars[i]; + /*skip sidebar*/ + if (!toolbar.classList.contains('mce-sidebar-toolbar')) { + var bar_height = parseInt(window.getComputedStyle(toolbar).height); + bars_height += bar_height; + } + } + } + /*the extra 8 is for margin added between the toolbars*/ + new_height = element_height - bars_height - 8; + editor.theme.resizeTo('100%', new_height); + } catch (err) { + console.log(err); + } + } + + editor.on('ResizeWindow', resizeEditor); + editor.on("init", function() { + try { + editor_container = editor.getContainer().parentNode; + } catch (e) {} + setTimeout(function() { + resizeEditor(); + }, 10); + }); +}); diff --git a/install.php b/install.php index f0593e94..3b9cb0ee 100644 --- a/install.php +++ b/install.php @@ -517,7 +517,7 @@ function install($adminPassword, $timezone) 'position'=>1, 'toolbar1'=>'formatselect bold italic bullist numlist | blockquote alignleft aligncenter alignright | link unlink pagebreak image removeformat code', 'toolbar2'=>'', - 'plugins'=>'code autolink image link pagebreak advlist lists textcolor colorpicker textpattern' + 'plugins'=>'code autolink image link pagebreak advlist lists textcolor colorpicker textpattern autoheight' ), JSON_PRETTY_PRINT), LOCK_EX