Jump to content

Archived

This topic is now archived and is closed to further replies.

Mutley

WYSIWYG Editor?

Recommended Posts

At the moment I input my text through a normal TEXT field in a form to the database.

How can I make this a WYSIWYG editor? I've looked but it seems you have to buy everyone, I would like to learn or get source code for free. All I would want to do is Bold/Italic/Underline and colour.

Share this post


Link to post
Share on other sites
anything out there can be built.  So build it, I would start with a text area field.
Then you can try adding some stuff, like an interface to read, and perform the bold, italics functions.
I would have to do a lot of thinking to come up with programming ideas bhind it, but that's all I can say, if I think of anything else I will let you nkow

Share this post


Link to post
Share on other sites
Would I need to use javascript to make it visually appear when I make text bold?

Share this post


Link to post
Share on other sites
Take a look at tinyMCE, it might work for what you need....

http://tinymce.moxiecode.com/

I am currently using it but, its not w/out its own issues.....

mike

Share this post


Link to post
Share on other sites
[quote author=mwmobley link=topic=110395.msg446152#msg446152 date=1159897705]
Take a look at tinyMCE, it might work for what you need....

http://tinymce.moxiecode.com/

I am currently using it but, its not w/out its own issues.....

mike
[/quote]

Thanks but there are waaaay too many un-needed options which just slows it right down. I'll see what I can do with it though.

EDIT: Nevermind, didn't see all the versions. :D

Share this post


Link to post
Share on other sites
Here's a simple sample
[code]
<html>
<head>
<meta name="generator" content="PhpED Version 4.5 (Build 4513)">
<title>wysiwyg sample</title>
<SCRIPT language='javascript'>
      function showText(txt) {
        while (txt.indexOf("[")>0) txt = txt.replace("[", "<");
        while (txt.indexOf("]")>0) txt = txt.replace("]", ">");
        while (txt.indexOf("\n")>0) txt = txt.replace("\n", "<br>");
        document.getElementById('wyg').innerHTML = txt;
      }
</SCRIPT>
</head>
<body>
<FORM>
Input (Use BB tags eg [b]=bold)<br/>
<textarea name="wysi" rows="10" cols="40" onkeyup="showText(this.value)"></textarea>
</FORM>
Preview
<DIV id='wyg' style='width:400; height: 200; border: 1px solid silver'></DIV>
</body>
</html>
[/code]

Share this post


Link to post
Share on other sites
I personally like TinyMCE that mwmobley suggested.

I found another this directory on Google: http://www.htmlarea.com/
It might help you to find one you like.

An alternative is of course to code your own.

Share this post


Link to post
Share on other sites
I've gone with TinyMCE, it's really impressive once you know how to alter the elements. Thanks for the code snippet Barand.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.