You are not logged in.
Pages: 1
Hi,
I'm using xinha and it works very nicely.
But I want to resize the textarea turned into xinha. My function works if it's turned off but not if it's turned on.
This is my code :
function resizePlus() {
var rows = document.getElementById('myTextArea').rows;
rows += 3;
document.getElementById('myTextArea').rows = rows;
}
function resizeLess() {
var rows = document.getElementById('myTextArea').rows;
rows -= 3;
document.getElementById('myTextArea').rows = rows;
}
Thank you for your help.
Offline
You can resize Xinha simply by resizing the text area with CSS ...
<div>
<textarea id="myTextArea" name="myTextArea" rows="25" cols="50" style="width: 800px; height:500px">Is my text here</textarea>
</div>
Offline
thank you for your help, butt I want to make my textearea larger/smaller on a button push with javascript. And it does not work if the textarea is turned into xinha.
Does someone have a solution?
Offline
You code looks OK to me so I guess the problem will be that Xinha ignores the changes if it's already built.
I guess you could modify the 'full screen' js ... but I don't know enough js to help you with that.
Offline
I spent a while fiddling with this on 0.95 - resizing the editor involves resizing the iframe, textarea, re-calculating all the panels, etc. Fortunately there's a method to set the size of the editor, so all you need to do is call sizeEditor(width,height), e.g.
xinha_editors.myEditor.sizeEditor("500px", "250px");
It's pretty hacky now but I have a couple helper functions to resize up/down by 75px with min/max height allowances:
function xinhaHeightUp(myEditor)
{
e = document.getElementById(myEditor).style.height;
e = parseInt(e.replace("px",""));
if (isNaN(e)) {
e = 250;
}
if (e < 625) {
e += 75;
xinha_editors.pg_contents.sizeEditor(document.getElementById(myEditor).style.width, e + "px");
}
}
function xinhaHeightDown(myEditor)
{
e = document.getElementById(myEditor).style.height;
e = parseInt(e.replace("px",""));
if (isNaN(e)) {
e = 250;
}
if (e > 250) {
e -= 75;
xinha_editors.pg_contents.sizeEditor(document.getElementById(myEditor).style.width, e + "px");
}
}
You would call this with the ID of your textarea:
xinhaHeightUp("mytextarea");
Personally I hacked up XinhaCore.js to create a control bar below the editor with up/down arrows. You can call the functions from within XinhaCore.js with the reference to the textarea ID as such:
xinhaHeightDown(this._textArea.id)
Offline
Pages: 1