Forum closed. New forum available at http://community.wymeditor.org/

better way of solving autoresizing wymeditor window?

Discuss features, code, contributions, ideas, suggestions, ...
For bugs, patches and feature requests, please post on the Trac:
http://trac.wymeditor.org/

better way of solving autoresizing wymeditor window?

Postby furtivefelon on Tue Oct 20, 2009 10:12 pm

Hi all, I recently came up with a pretty crude hack to auto grow the wymeditor window as the content becomes longer, here is a simple version assuming everything is default:

Code: Select all
setInterval(function(){
   outter = $('iframe');
   inner = $('iframe').contents().find('body');
   if(outter.height() < inner.height() + 10){
      outter.height(outter.height()+50);
   }
}, 100);


Ideally it would work as needed, not based on a timer. For example, when a enter key is pressed, it would check whether the height grown or not, and act accordingly, similarly binding to all other events (ideally it would just be on change, which jquery has such an event, not sure how to go about using that).

Anyone have any idea how to accomplish my ideallys?

Thanks a lot!
furtivefelon
 
Posts: 3
Joined: Fri Aug 07, 2009 3:24 pm

Re: better way of solving autoresizing wymeditor window?

Postby mr_lundis on Tue Oct 27, 2009 11:24 pm

Hello!
The jQuery change event wont work as the editor area aren't really a form field but an iframe. Listening to any key event should work fine though, as long as you listen inside the iframe as event occuring inside the iframe won't bubble up outside the iframe document (i.e. to the parent document).

Cheers! ;)
Jonatan Lundin - designer, developer and forum moderator. You should follow me on Twitter!
mr_lundis
 
Posts: 335
Joined: Sun Dec 02, 2007 10:59 am
Location: Sweden

Re: better way of solving autoresizing wymeditor window?

Postby christracy123 on Tue May 18, 2010 8:51 am

Wow this is great!! Hmmm thanks for the codes furtivefelon!!
Being stressed out and overweight may not be YOUR fault! It's true, a mysterious condition might be to blame. An estimated 70-80% are suffering from this condition, and don't even know it!

http://www.howtocurecandida.com/survey/
christracy123
 
Posts: 6
Joined: Sat Jan 23, 2010 6:04 am

Re: better way of solving autoresizing wymeditor window?

Postby arkiller on Fri Jun 11, 2010 9:52 am

Great code, but has bugs. If the iframe grows up to x, it goes out of the main div. And if you erase code after growing the iframe it doesnt turn smaller. If you fix this, this code will be usable!!
If you do, share with us!!
arkiller
 
Posts: 3
Joined: Thu Jun 03, 2010 2:17 pm


Return to Developers

Who is online

Users browsing this forum: No registered users and 1 guest