Forum Moderators: open

Message Too Old, No Replies

Editable iframe problems

         

banaax

6:45 pm on Sep 20, 2006 (gmt 0)

10+ Year Member



I'm trying to make an advanced text editor on the web, I think my best option is an iframe (a text area like this forum uses isn't sufficient since you can't decorate text within the textarea). I'm working with something very simililar to the editor on Mozilla's DevEdge.

My problem (also a problem on site above), when you type something in IE and click outside of what you typed (like the middle of the iframe), the cursor goes to the end of the text, exactly what I want, this doesn't happen in mozilla, you have to click next to the text to get the cursor to move to the end of the text. One solution I was thinking about is adding an onclick event to the area of the iframe that moves the cursor to the end of the text, but since the iframe is not an html element (something like that) you can't add javascript functions, and since the iframe is in designMode any javascript I add in the iframe source doesn't work that (does when designMode is off).

I'd also like to use javascript functions within the IFrame to make features like with tabs being able to hit the left arrow to go back 4 spaces. With the link above, tabbing in IE causes the iframe to lose focus, in mozilla a tab is inserted buy you have to click left 4 times to get back.

Another problem is that it barely works at on in safari, you can type in the iframe but all of the decorations don't work. I would really like this to be cross browser.

Any help is apprechiated.

[edited by: DrDoc at 10:30 pm (utc) on Sep. 23, 2006]
[edit reason] broken link [/edit]

banaax

4:42 am on Sep 21, 2006 (gmt 0)

10+ Year Member



Okay I figured out my click problem, the solution was to add a textarea inside the iframe with height and width of 100%, I still need to use javascript within the iframe though. For example I want to syncronize the iframe scroll with a div outside of the iframe (a ms word like ruler for setting margins), also the easy tab I mentioned in my previous post.

banaax

10:57 pm on Sep 22, 2006 (gmt 0)

10+ Year Member



Nevermind, solved it on my own