Webmaster Key - Discussion Forums


Welcome, Guest. Please login or register.
Did you miss your activation email?
February 09, 2012, 05:58:04 PM

Login with username, password and session length
Welceome to Forums!

Important information for guests and new members:

In order to understand the full benefits of becoming an active member of this forum, please review the following information on guest and new member restrictions. These forum changes have been prompted by an overwhelming and unreasonable amount of bot postings and incoherent guest spam messages. We wish to prevent these events from happening in the future and make our community a more comfortable place for all of our members.

For guests:

Guests are not allowed to open new topics, polls, or posts attachments.
If you wish to open up new discussions on this forum, we encourage you to register.

For new members:

New members with less than five posts are not allowed to modify additional profile information such as avatars, contact information, biographies, and signatures. However, new members are encouraged to post their own topics or reply to topics initiated by other members. Become active on the forums and 5 posts should be an easy task!

We are a diverse community with members from all over the world. We encourage new ideas and interesting conversation. Do not be afraid to post webmaster/computer-related questions or problems, as our active members are always willing to help when they are able. Interested? Join us.

+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ Lightweight WYSIWYG Javascript plugin for HTML Textarea
0 Members and 1 Guest are viewing this topic. « previous next »
Pages: [1] Go Down Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print
Author Topic: Lightweight WYSIWYG Javascript plugin for HTML Textarea  (Read 2216 times)
Andy
Administrator
Veteran
*****
Posts: 5 752



« on: June 23, 2008, 12:01:38 PM »

Before I used TinyMCE but it is anything but tiny with a huge number of files and megs of code. It actually takes several minutes to delete it on the server via FTP. But I appreciate that it is free software, thanks guys  Smiley

But today I found a truly lightweight alternative: Small, standards compliant, Javascript WYSIWYG HTML control This has just a handful of files and a small amount of javascript code.

I got it working with IE6 and Firefox 2.0

I had to do a couple of minor tweaks to the code. One was increasing the initialization delay to 600ms from 1 in the wysiwyg.js file.

This is to stop IE loading the current page HTML into the textarea. I actually discovered this fix by accident after inserting an alert box into the code to pause the flow (a handy testing technique).

The actual minimum time was about 280ms but I am testing on my local machine. But this may be because I am inserting text into the text area with PHP after the javascript file was loaded, which should not be a problem!

It is not great to tweak timings to make things work so I may re-visit this problem in the future to find a fail-safe solution.

The ugly way to fix this may be to insert the javascript into the footer of the page, inline with the body html rather than including the javascript external file in the header. So then, the browser cannot possibly execute the code before the PHP has done it's job. Yeah, this must be the fix  Cool

Also, my script uses mod rewrites for URLs which messed up the ability of this code to locate the wysiwyg.html file and hence the css that was applied to the text in the textarea. So I simply entered the absolute URL in the wysiwyg.js OK, this is a lazy solution but works.

It took me a long time to debug this problem but I solved it quickly once I realised that Firebug that I had installed with Firefox is a DOM explorer which I didn't realize DOH! It's the first time I used it!

This lets you inspect the structure of your document and find out what is going wrong in the URL references deep into the nested structure of the thing. It's also good for finding out exactly what class to apply to a deeply nested element for css purposes.

I used to use IE developer toolbar for this but it no longer seems to work with IE6. I tried all kinds of things to get it to work but even though it is enabled, the security settings look right and the icon is on the toolbar, it refuses to do anything. But it used to be a very cool tool.

Also, to spot errors in Javascript you can open the Javascript console in Firefox ( it's called Error Console in the drop-down tools menu ).

Have fun...

« Last Edit: June 23, 2008, 12:34:00 PM by Andy » Report to moderator   Logged

Andy
Administrator
Veteran
*****
Posts: 5 752



« Reply #1 on: June 30, 2008, 03:01:46 PM »

If anyone has any problems getting this script to work, please post.

I had some problems with the cursor not blinking in the text area which I fixed by inserting some text into the inner HTML. Also, I had to turn off Firebug. These simple issues wasted maybe 1 day of progress, but I am back on track now.
Report to moderator   Logged

Pages: [1] Go Up Stumble Upon! Digg It! del.icio.us! Add to Technorati! ReddIt!  Send this topic Print 
+ Webmaster Key Forums
|-+ Webmaster Corner
| |-+ Site Design and Web Authoring
| | |-+ Coding Talk
| | | |-+ Lightweight WYSIWYG Javascript plugin for HTML Textarea

Jump to:  
« previous next »


Our Partners
RelmaxTOP Ranking System Web Hosting RelmaxTOP Ranking System
Staff Sites
12Noon[12Noon Gallery] Andy[Urgentclick]
Tamuril[Tamuril's Digital Art Exhibit] Sensovision
Powered by MySQL Powered by PHP We are hosted by Relmax Inc. |Our Privacy Policy | Sitemap
Powered by SMF 1.1.9 | SMF © 2006-2009, Simple Machines LLC
Forum design by Tamuril © 2005.
Valid XHTML 1.0! Valid CSS!