You are not logged in.
I have a problem automatically setting the div style of the first text line in the editor.
This is because the first line of text in the editor is not "wrapped" in <div> tags until after ENTER is pressed.
More precisely it is not an element by itself (but rather part of the body tag) until ENTER is pressed.
Where in the code is this backwards wrapping of the first line in div tags done?
Next lines don't have that problem because after each ENTER a new <div> </div> is created in which the following text is wrapped automatically.
I am asking because for my development it is important to set style attributes to the standard div tag (such as direction) and I want this to be applied to the first line the moment it gets wrapped in div when you hit enter.
In other words I would like the default div tags that wrap the first line, have a direction style already in them.
Any ideas?
Offline
I've seen this before, basically when I create the editor then if the contents will be blank I insert some tags '<p> </p>' into the area so that xinha starts off with those.
e.g.
<textarea id="mycontent" name="mycontent"><p> </p></textarea>
Offline
Thanks Steveo. However, I've tried the   tags in the past. At first it seemed that would do the job, but then I found out it has a serious backfall too.
If the editor starts with a space, the unknowing user has two possibilities: to place the cursor before or after the space. If he happens to place it after - all's fine.
But if the user places the cursor at the very beginning of the text (i.e. before the space) then when you make a bulleted or numbered list, you can't get out of it (pressing Enter on a new bullet or number does not move you out of the list but just keeps on creating more bullets/numbers. That's too serious a bug and I can't let my users get into those situations.
That's why I would prefer they start typing the regular way, but after pressing Enter, when the first line gets wrapped in tags, have those tags equipped with the attributes I want (like direction).
That's why I am trying to find out where in the script the wrapping of the first line takes place, since that's where maybe I could make the wrapping happen with the tag attributes I want.
I would appreciate any other ideas.
Yossi.
By the way I just found out the same bug exists in the example Xinha on their site. If you wipe out the "Lipsum" text and delete it, and then toggle the <> (text/HTML) button, you automatically get <div> </div>. If you then place your cursor in the very beginning, before the space, you also get stuck in bulleted or numbered lists......
Last edited by yosibeck (2006-04-15 16:32:43)
Offline