Announcement

Do not use the forums to submit bug reports, feature requests or patches, submit a New Ticket instead.

#1 2008-06-17 04:48:22

vasilov
New member
Registered: 2008-06-17
Posts: 2

resize the textearea

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

#2 2008-06-17 05:30:33

Pioden
Xinha Community Member
From: Bangor, Wales
Registered: 2008-06-06
Posts: 39
Website

Re: resize the textearea

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

#3 2008-06-17 06:00:03

vasilov
New member
Registered: 2008-06-17
Posts: 2

Re: resize the textearea

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

#4 2008-06-17 06:55:45

Pioden
Xinha Community Member
From: Bangor, Wales
Registered: 2008-06-06
Posts: 39
Website

Re: resize the textearea

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

#5 2009-02-15 06:38:37

Tekime
New member
Registered: 2009-02-15
Posts: 1

Re: resize the textearea

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

Board footer

Powered by FluxBB