window auto-resize
Status: Beta
Brought to you by:
fermads
The codepress window should be able to resize acording to the size of the window where it is shown...
The following (in codepress.html) works in firefox, but bugs in ie7:
function resizeEditor() {
var pDoc = window.parent.window.document;
var w = pDoc.body.parentNode.clientWidth + "px";
var h = pDoc.body.parentNode.clientHeight + "px";
var iframe = pDoc.getElementsByTagName("iframe").item(0);
iframe.style.width = w;
iframe.style.height = h;
document.body.parentNode.style.width = w;
document.body.parentNode.style.height = h;
}
window.parent.window.onresize = resizeEditor;
resizeEditor();
submitted by bobo (at) bitbob (dot) biz
Logged In: NO
one thing you forget... is that not everyone wants codepress to resize automatically - however the feature is nice
considder that you want CP to be a static editor within a static layout
considder if CP needs to have a fixed upper left corner, and have the bottom and right side change size dynamically
this solution is only relative to the whole window size -- maybe add support for a fixed upper left corner or fixed top... with an offset to (Y=0,X=0) or just (Y=0)
function resizeEditor() {
//get inputs dynamically
var offz_y = (attribute[0]) ? attribute[0] : 0;
var offz_x = (attribute[1]) ? attribute[1] : 0;
...
...
}