Computing.Net > Forums > Web Development > Javascript xhtml markup editor

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Javascript xhtml markup editor

Reply to Message Icon

Name: pellek
Date: September 16, 2005 at 21:41:56 Pacific
OS: windows xp
CPU/Ram: xp1800+, 512mb
Comment:

Hi.
I'm pretty tired right now, but i will try to explain my problem as thouroghly as possible...
I have very little experince with JavaScript, though some programming experince in PHP. I have great respect for w3c standards.
I'm currently building a cms using PHP, and i have come to the conclusion JavaScript will serve the purpose of creating (that is building the content (articles and the like), not displaying it, that will be handled by PHP inside the content div).
designMode, ie Midas/MSHTML, is doing a crappy job as they are not really standardised yet, and also spit out ugly code.
My approach to this a little hazy at the moment, and i would really like to hear ANY suggestions. The idea is to KeepItSimple. text-alignment/placement and other behaviours through div tags with class attributes, and also some standard xhtml tags like ul em i and so on. Nothing fancy.
Some ideas of min was:
edit the text in textarea. pass it to an iframe. style it here. can this be done if designmode is readonly? why? - i dont want text input possible here (remember designMode crap html). If it cant be done - use iframe and the DOM to markup the selected areas (this would require checking that the selection keeps inside the parent element in most, if not all cases.
As all text should (preferably) be contained within

tags, so before post/send this content, Javascript will also markup first textnode without a tag, and next whitespace within p tags...
Does this approach sound reasonable to you?

The tricky part will be editing this content at a later time though. I dont want designMode mess up my html. Maybe if one could make it behave (Firefox does </br> when hitting enter, ie contains it in a paragraph and </br> when hitting shift+enter!!) this could be an alternative. But i still would style it with my javascript approach.
The other way would be to use a textarea to edit the text, and preferably update an iframe in realtime with the edits. this could be pretty CPU intesive though. And it would need som way to compare cursor position in the textarea with the correct position in the iframe html. This i really need som idea on how to accomplish!
If this can't be done, then i guess you could examine what text is left, and new text inside those elements, and also what text had been added and add that for later styling if needed.

Man, thats a long post :)
Suggestions, ideas and snippets would be greatly appriciated.



Sponsored Link
Ads by Google

Response Number 1
Name: anonproxy
Date: September 17, 2005 at 00:17:17 Pacific
Reply:

FCKEditor is a nice tool. There are over 2 dozen similar applications that I have seen. I usually cut down on the features.


0

Response Number 2
Name: pellek
Date: September 17, 2005 at 06:30:11 Pacific
Reply:

I appriciate your reply. But i must point out this editor (and probably all of the dozen others) rely on designMode to do html. I have tried most of them out, and they generally do what i dont like (diffrent markup on diffrent platforms). But anyway, Thanks...


0

Response Number 3
Name: Doleks
Date: September 19, 2005 at 02:30:11 Pacific
Reply:

Hello!

Maybe you need not to build your own CMS. There dozen of CMS. Everyone can find he like more. You can build your own CMS only to study PHP not for real job. For example I use Mambo CMS. I can change editors ten times a day through admin panel and select what I want. Writing your own CMS is like writing your own text editor. 


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Javascript xhtml markup editor

website review www.computing.net/answers/webdevel/website-review/1973.html

Comments about this Web Site www.computing.net/answers/webdevel/comments-about-this-web-site/836.html

xhtml validation errors using www.computing.net/answers/webdevel/xhtml-validation-errors-using-/1695.html