Page 1 of 1

Resizable standard editor

Posted: Mon Feb 11, 2008 12:50 am
by ahe123
Hi,

some time ago I added two buttons to templates/default/admin/entries.tpl which allow to resize the body and extended field. Since they use JavaScript the change is not persisted and the textareas take the default size the moment you press preview or save the entry.

I'd just like to know if it was the right file to make this change to and if there isn't a plugin that already provides this functionality that I don't know of.

If there is any interest I could also provide a patch and improve it so that the new size gets persisted.


Regards,

ahe

Re: Resizable standard editor

Posted: Mon Feb 11, 2008 4:06 pm
by garvinhicking
Hi!

Yes, that was the perfect fine place for that. It might be better for you though to create your own template and put the modified version in there. This way you can preserve your entries.tpl change after an upgrade.

You could also create a plugin for that, it doesn't exist yet, though.

Best regards,
Garvin

Re: Resizable standard editor

Posted: Mon Feb 11, 2008 5:24 pm
by ahe123
Hi,

is there any chance to get this change into the main code base?

I think I will make an ajax call to a server side script with every resize to persist it in the config table. Maybe I will also save the cursor position in the entryproperties table because I use the preview and save buttons very often I don't like to search for the last position every time.


Regards,

ahe

Re: Resizable standard editor

Posted: Mon Feb 11, 2008 7:02 pm
by garvinhicking
Hi!
is there any chance to get this change into the main code base?
Sure, if it works well! :)

However I'm not so fond of the ajax call, actually. I'd rather store it in a cookie on submit/preview, so then it can be different forthe same author on different browsers or computer screen resolutions.

Regards,
Garvin

Re: Resizable standard editor

Posted: Tue Feb 12, 2008 12:19 am
by ahe123
OK I'll use cookies. Now that I think about it I think there's no strong reason to put it into the database.

As I already saw there is a SetCookie() function in serendipity_admin.php. Is there a GetCookie() function somewhere? Wouldn't it make sense to put it in a global JavaScript library file instead of serendipity_admin.php?

Re: Resizable standard editor

Posted: Tue Feb 12, 2008 10:00 am
by garvinhicking
Hi!

No, you can access cookies through $serendipity['COOKIE']['variable'] easily. :)
As I already saw there is a SetCookie() function in serendipity_admin.php. Is there a GetCookie() function somewhere? Wouldn't it make sense to put it in a global JavaScript library file instead of serendipity_admin.php?
Currently there's no need for that, if it every becomes a need we can think about it. But currently the s9y frontend does not need any javascript libraries, only the backend.

Regards,
Garvin

Re: Resizable standard editor

Posted: Wed Feb 13, 2008 9:28 pm
by ahe123
Thanks for the advise. It works now :D

The size of the text field can be changed and is saved to a cookie. I tested it with Firefox 2, Opera 9.2 and IE 7. Getting the cursor positon with JavaScript seems to be less trivial so I will try to implement this in the next days.

I made changes to templates/default/admin/enties.tpl and includes/functions_entries_admin.inc.php.

You can get the patches from here:

http://www.zockblog.org/entries.patch
http://www.zockblog.org/functions_entries_admin.patch


Regards,

ahe

Re: Resizable standard editor

Posted: Thu Feb 14, 2008 12:24 pm
by garvinhicking
Hi!

Oh, I don't really like those +/- buttons *g*

! I thought you were talking about textarea resizing through a vertical mouse grip at the bottom right of textareas like you get when using that firefox resize addon? I find that way sexier...having two more buttons on screen is IMHO too cluttering for the interface.

In this case I would suggest enhancing a plugin like serendipity_event_typesetbuttons to add those buttons to the output, then you also wouldn't need to modify any template files?

Regards,
Garvin