Revision: 27151
Updated Code
at May 25, 2010 10:19 by adhd360
Updated Code
<!-- ckeditor/config.js -->
function e(id){
return document.getElementById(id)
}
function getWindowHeight() {
var elem = (document.compatMode === "CSS1Compat") ? document.documentElement : document.body;
return elem.clientHeight;
}
function calculateOffsetTop(element, opt_top) {
var top = opt_top || null;
var offset = 0;
for(var elem = element; elem && elem != opt_top; elem = elem.offsetParent) {
offset += elem.offsetTop;
}
return offset;
}
function dynamicEditorHeight() {
var window_h = getWindowHeight();
var resizer_height = window_h - calculateOffsetTop(e(document.forms[0].id));
var title_field_h = e("content_title").offsetHeight || 20;
var toolbar_h = 62; // double line toolbar
var btm_grab_div_h = 21;
var submit_btn_h = (document.forms[0].commit) ? document.forms[0].commit.offsetHeight : 0;
var padding_h = 60;
resizer_height -= (title_field_h + toolbar_h + btm_grab_div_h + submit_btn_h + padding_h + 50); // extra buffer to avoid window scrollbar
return(resizer_height);
}
CKEDITOR.editorConfig = function( config ) {
config.height = dynamicEditorHeight();
};
Revision: 27150
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 25, 2010 10:14 by adhd360
Initial Code
<!-- application.js -->
function e(id){
return document.getElementById(id)
}
function getWindowHeight() {
var elem = (document.compatMode === "CSS1Compat") ? document.documentElement : document.body;
return elem.clientHeight;
}
function calculateOffsetTop(element, opt_top) {
var top = opt_top || null;
var offset = 0;
for(var elem = element; elem && elem != opt_top; elem = elem.offsetParent) {
offset += elem.offsetTop;
}
return offset;
}
function dynamicEditorHeight() {
var window_h = getWindowHeight();
var resizer_height = window_h - calculateOffsetTop(e(document.forms[0].id));
var title_field_h = e("content_title").offsetHeight || 20;
var toolbar_h = 62; // double line toolbar
var btm_grab_div_h = 21;
var submit_btn_h = (document.forms[0].commit) ? document.forms[0].commit.offsetHeight : 0;
var padding_h = 60;
resizer_height -= (title_field_h + toolbar_h + btm_grab_div_h + submit_btn_h + padding_h + 50); // extra buffer to avoid window scrollbar
return(resizer_height);
}
CKEDITOR.editorConfig = function( config ) {
config.height = dynamicEditorHeight();
};
Initial URL
Initial Description
Initial Title
CKEditor Dynamic Resize
Initial Tags
Initial Language
JavaScript