Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: RE: creating a text editor


Message #1 by "David Owens" <dwo@w...> on Tue, 6 Aug 2002 23:02:34
I did what you are looking using IFrames. I read the
article "Building a WYSIWYG HTML Editor":

http://www.devarticles.com/content.php?articleId=90&page=1

and I tuned my application by reading the discussion
forum he has in the article. After one day of setting
everything up I got a Great HMTL/text editor that now
I am using with all my developments (email, content
engine web applications, newsletters, etc)

Nestor

--- David Owens <dwo@w...> wrote:
> 
> I'm trying to do exactly this... and have found this
> and many great 
> examples showing how to edit HTML/text using
> contenteditable.  Very cool 
> stuff.
> 
> However, none of the examples show how to grab the
> resulting, editted text 
> for use in an application.
> 
> I'm using Visual Studio/ASP.net/VB and can add the
> <DIV 
> contentEditable=true>....   but I can't seem to get
> the resulting editted 
> text.
> 
> I'd use one of the many 3rd party controls out
> there, but I have a fairly 
> unique application-specific need for which they
> don't quite work.
> 
> Thanks in advance for any help,
> Dave
> 
> 
> > Try using MSHTML editing. i.e.,
> > 
> > <body>
> > <div id="TextEditArea" contentEditable="true"
> style="border=1 solid">
> > This is the area where the use can edit text
> > </div>
> > <p>
> > <button onClick="toggleBold()">Bold</button>
> > </body>
> > <script>
> > function toggleBold()
> > {
> > 	TextEditArea.focus()
> > 	document.focus()
> > 	var oSelection = document.selection.createRange()
> > 	document.execCommand("Bold")
> > }
> > </script>
> > 
> > You can add additional buttons for other
> operations, Italic, Underline,
> > etc...
> > http://msdn.microsoft.com/library/default.asp?
> url=/workshop/author/dhtml/ref
> > erence/methods/execCommand.asp
> > 
> > will get you started. Look for the command
> identifiers. You may want to 
> post
> > this to the MSHTML editing forums.
> > 
> > -----Original Message-----
> > From: vylarus@h...
> [mailto:vylarus@h...]
> > Sent: Monday, October 15, 2001 12:26 PM
> > To: javascript
> > Subject: [javascript] creating a text editor
> > 
> > 
> >  I want to a create a simple text editor for my
> newsletter so that the 
> > other people involved in my website can bold and
> under line things when 
> > they enter their articles.  
> >     the newsletter works with asp where someone
> enters info in a text 
> box 
> > and then that text is saved in a database.  then
> when we go to mail the 
> > info is put into a HTML/TEXT format email so all
> <b></b> appear as 
> bold.  
> > what I want to do is let people select some text,
> click a bold button, 
> and 
> > presto the high lighted word becomes
> <b>highlighted word</b>.  At the 
> > moment this works only if the selected word is
> unique.  I take the 
> > selected word with the var text 
> document.selection.createRange
> ().text , 
> > find it in the textarea.value and replace it. But
> if the word(s) appear 
> > any where before the selected word(s) it will
> replace the first one it 
> > finds.
> >     The solution seems to be find the exact
> location of the selected 
> > text.... but how?? 
> >     
> >     You've probable spent many frustrating hours
> like me... but have you 
> > found any solutions?I can't seem to get my head
> arounf microsoft's MSDN 
> > help files....
> >  
> > I greatly appreciate your help.
> 
> ---
> 
> Improve your web design skills with these new books
> from Glasshaus.
> 
> Usable Web Menus
>
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
>
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
>
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20


______________________________________________________________________ 
Post your ad for free now! http://personals.yahoo.ca

  Return to Index