Include autoheight plugin for Tinymce
This commit is contained in:
parent
7227b85086
commit
47412a651d
41
bl-plugins/tinymce/tinymce/plugins/autoheight/plugin.min.js
vendored
Normal file
41
bl-plugins/tinymce/tinymce/plugins/autoheight/plugin.min.js
vendored
Normal file
@ -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);
|
||||
});
|
||||
});
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user