roopurt18 Posted May 14, 2007 Share Posted May 14, 2007 I'm playing around with creating a Javascript RTE control. I've got a bit more done on my local machine than what's visible here, but before I continued further development I needed to do some experimenting with the iframe. When the page loads, you should see a textarea on top and the iframe on the bottom. When the following events occur, they should update the contents of the textarea: mouseover, mouseout mousedown, mouseup click keydown, keyup, keypress select mousemove is turned off since it generates so much output so quickly and I don't feel like putting in a throttling mechanism. I'm still working out how to capture the change event. I've tried to write this to be cross-platform, so I'm really concerned if the events register correctly and if you're able to type in the iframe box. Simple test really, nothing fancy! The beta test: http://www.rbredlau.com/tutorials/richtext/part_ii/index.html Associated blog entry (aka shameless plug): http://www.rbredlau.com/drupal/node/7 Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/ Share on other sites More sharing options...
Daniel0 Posted May 14, 2007 Share Posted May 14, 2007 It works sort of slow. When typing I have to wait for it to catch up with me. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252717 Share on other sites More sharing options...
obsidian Posted May 14, 2007 Share Posted May 14, 2007 The idea is intriguing, but I agree that there seems to be so much going on that it takes a long time for the triggers to catch up to the content... and I'm not a super fast typist, either. Imagine you hand it off to someone with 70+ wpm speed as opposed to my 50-60. They would get very frustrated about having to wait that long for things to catch up on any length of text, I'm afraid. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252730 Share on other sites More sharing options...
roopurt18 Posted May 14, 2007 Author Share Posted May 14, 2007 To the best of my knowledge, string concatenation in Javascript isn't always the fastest operation. So doing something like reading the content of a textarea, appending to it, and rewriting to the control for each of keydown, keyup, and keypress, is going to bog it down. In reality, you want to put as little processing as possible in those event handlers and most of the time handling just one of them is sufficient. So my big concern is if everyone was able to type into it, which based on your responses you were. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252799 Share on other sites More sharing options...
obsidian Posted May 14, 2007 Share Posted May 14, 2007 So my big concern is if everyone was able to type into it, which based on your responses you were. Definitely able to type Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252834 Share on other sites More sharing options...
roopurt18 Posted May 14, 2007 Author Share Posted May 14, 2007 Just for reference, can you guys post which browser & OS you're using? Sorry I left that out of my original post. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252873 Share on other sites More sharing options...
utexas_pjm Posted May 14, 2007 Share Posted May 14, 2007 Seems to register all events on Ubuntu (Fesity) with FireFox 2.0. As others have mentioned, it becomes slower as the string gets longer, eventually becoming unusable. Using Konqueror the events register, but no text shows up in the iframe. I don't know if you really care about Kongueror as their market share is negligible but Safari is built on top of the same core code, so it might be worth having a look. Best, Patrick Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252875 Share on other sites More sharing options...
obsidian Posted May 14, 2007 Share Posted May 14, 2007 Just for reference, can you guys post which browser & OS you're using? Sorry I left that out of my original post. WinXP Pro SP2 Firefox 2.0.0.3 IE 6 Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-252903 Share on other sites More sharing options...
Daniel0 Posted May 14, 2007 Share Posted May 14, 2007 Alright, here is what I tested it on and the results: Windows Vista Home Premium: Internet Explorer 7.0.6000.16448: Seems to work fine. Firefox 2.0.0.3: Hangs. Unusable because it, when I hit random keys fast, eventually made Firefox unresponsive. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-253044 Share on other sites More sharing options...
roopurt18 Posted May 15, 2007 Author Share Posted May 15, 2007 Using Konqueror the events register, but no text shows up in the iframe. I don't know if you really care about Kongueror as their market share is negligible but Safari is built on top of the same core code, so it might be worth having a look. Well I just spent the last two hours testing and doing some research; it appears that Safari / Konqueror do not support the designMode property just yet. It is expected that Safari 2 will have support for this. I'm sort of glad as I was worried about how I could go about testing a graceful failure of the control. Related links: http://blog.solmetra.com/2007/02/22/safari-is-not-konqueror/ from what I’ve googled there’s no so called “designMode=on” functionality in Konqueror http://programmabilities.com/xml/?id=17 //enable designMode if the browser is not safari or konqueror. http://operawiki.info/TextAreaEditor Safari 2 supposedly will have rich text editing support, which means Konqueror most likely wil get it too. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-253203 Share on other sites More sharing options...
roopurt18 Posted May 15, 2007 Author Share Posted May 15, 2007 I threw in a quick hack that limits the length of the textarea's contents to 100 chars; the performance should be much improved. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-253207 Share on other sites More sharing options...
Daniel0 Posted May 15, 2007 Share Posted May 15, 2007 It works much better in Firefox now. Link to comment https://forums.phpfreaks.com/topic/51247-iframe-designmode-event-capturing/#findComment-253328 Share on other sites More sharing options...
Recommended Posts