Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
AoA,
I have made a simple text editor using javascript and html, it is same as the text editor of codeproject, which shows preview and a textarea,
Is it possible to make a text editor which changes the text in the textarea i.e if I write 'something' it bold the text automatically within the texteditor or is there any other thing I can do?

In short, i want to make something like a document or word processor!

Is it possible or not?

Any help?
Posted
Comments
[no name] 21-Sep-13 13:12pm    
Yes it is possible thanks for asking though.
saad_lah 21-Sep-13 13:25pm    
hehehe....
tell me should I update the question with "how can I do this" or you are telling me?
ZurdoDev 21-Sep-13 13:23pm    
There is lots of help here but for specific questions. I would recommend getting a control that already does this. You'll find this is a big project.
saad_lah 21-Sep-13 13:26pm    
how? Any help?
ZurdoDev 21-Sep-13 13:27pm    
Search google for 3rd party controls that already do this.

For others, who want the solution to this problem

Quote:

<html>
<head>
<script type="text/javascript">
function design(){
document.designMode = arguments[0];
}
</script>
</head>
<body>
<button onclick="design('on');">Enable Design Mode</button>
<button onclick="design('off');">Disable Design Mode</button>

I am a heading... edit me


I am a paragraph... edit me



  • List item
  • List item
  • List item

</body>
</html>


P.S: Copied & Paste

use the document.designMode or element.designMode to change the text of paragraph or body.
If you want user to change the text inside the textarea, alternatively you can use iframe tag with designMode Enabled
 
Share this answer
 
You can get a good idea on how to do it if you learn how one of existing editors work. Try to look at such a good one as TinyMCE, for example:
http://en.wikipedia.org/wiki/TinyMCE[^],
http://www.tinymce.com/[^].

On the title page of the product you can try it out immediately.

—SA
 
Share this answer
 
Comments
saad_lah 23-Sep-13 10:12am    
thanks for the reply, but I have found another way(I just wanted the starter idea) :)
Sergey Alexandrovich Kryukov 23-Sep-13 10:18am    
You are welcome. Found or not, will you accept this answer formally? I think it was a good idea.
—SA
saad_lah 23-Sep-13 10:41am    
done :)
Sergey Alexandrovich Kryukov 23-Sep-13 11:07am    
Great, thank you.
Good luck, call again.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900