Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / JScript / June 2005

Tip: Looking for answers? Try searching our database.

Editor Question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
kishor - 07 Jun 2005 08:20 GMT
Hi,
I have a java script Editor I mean a RTF kind of editor, which is coded
using JavaScript.
This kind of editor is available on hotmail.com or India times.com
I have a small problem with it whenever I type some content in that control
and press enter for next line I get double Line spacing and for single line
spacing I need to type shift+enter. Can some one tell me how to disable this
feature.

Regards,
Kishor Pise
Kpise Hotmail
Serge Baltic - 07 Jun 2005 14:33 GMT
k> I have a small problem with it whenever I type some content in that
k> control
k> and press enter for next line I get double Line spacing and for
k> single line
k> spacing I need to type shift+enter.

By default, Enter does paragraph formatting (<p> </p>) — ends the current
paragraph and starts a new one, while Shift+Enter just inserts a line break
(<br/>). In most cases, the first is preferrable.

The paragraph tag has large margins above and below by default. Add a stylesheet
that sets margins for the <p/> tag to zero.

Also, if there are DIVs in the content being edited, then <div/> tags are
inserted instead of <p/>, which may also fit as they have no stock padding
or margins.

(H) Serge
kishor - 08 Jun 2005 07:18 GMT
Hi Serge,
I understand what you are saying.. but still I am not able to apply a
style. I am confused here .. dont know where to apply style. I have a div tag
only .. and user can author anything could be paragraph(s) or <Br>.. I just
want to do it for paragrph..
It will be nice if you can just paste here example...

Regards,
Kishor

> k> I have a small problem with it whenever I type some content in that
> k> control
[quoted text clipped - 14 lines]
>
> (H) Serge
Serge Baltic - 08 Jun 2005 10:32 GMT
k> I understand what you are saying.. but still I am not able to apply
k> a
k> style. I am confused here .. dont know where to apply style. I have a
k> div tag
k> only .. and user can author anything could be paragraph(s) or <Br>..
k> I just
k> want to do it for paragrph..
k> It will be nice if you can just paste here example...

Try something like this:

<html>
<head>
<style>
p { margin: 0px; padding: 0px; }
</style>
</head>
<body>
<div contenteditable="true"></div>
</body>
</html>

(I don't remember exactly a proper value for the contenteditable attribute,
take yours)

(H) Serge
kishor - 08 Jun 2005 11:05 GMT
Hi,
This is fine ..actually .. to apply style for a  paragraph you need to write
like this
<P style=......> but the problem here is I dont know .. what he will typing
inside the editable div content. so in that case I need to visit each and
every inner tag of div and check whether it is a <P> and apply style. this
could be a slower solution as on every enter it will go in loop.

It will be very nice if we apply style at once somewhere....dont know how to
achieve.

Kishor
kpise hotmail

> k> I understand what you are saying.. but still I am not able to apply
> k> a
[quoted text clipped - 22 lines]
>
> (H) Serge
Serge Baltic - 08 Jun 2005 19:29 GMT
k> This is fine ..actually .. to apply style for a  paragraph you need
k> to write
k> like this
k> <P style=......>

Hmm … Have you noticed the sample in my message? It applies a GLOBAL style
to ALL the paragraphs in the document. Including ones within the editable
DIV.

k> but the problem here is I dont know .. what he will
k> typing
k> inside the editable div content. so in that case I need to visit each
k> and
k> every inner tag of div and check whether it is a <P> and apply style.

This exactly is done by the browser itself, due to the P stylesheet entry.

Aye, it actually applies to the runtimerStyle property instead of style in
this case, but who cares?

(H) Serge
kishor - 09 Jun 2005 07:51 GMT
Thanxs .. solved problem

> k> This is fine ..actually .. to apply style for a  paragraph you need
> k> to write
[quoted text clipped - 17 lines]
>
> (H) Serge

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.