Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Lovely in-browser HTML Editor

Lovely in-browser HTML Editor
Thread Tools
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jan 9, 2005, 05:14 PM
 
Hi everyone,

A quick heads-up for anyone who's interested in implementing an in-browser HTML Editor for a CMS (or whatever) - http://tinymce.moxiecode.com

It's open-source.
It's well-written.
It's damn quick.
It's extensible.
It's IE/Mozilla (incl. Firefox) compatible.

And it's very easy to implement/upgrade.

Hope this comes in handy for someone! I've also re-written the image browser (based on the iBrowser plugin) to make it more php 4 friendly and also written a file browser that allows you to upload and link to documents (PDFs, Word, etc)

Cheers
Computer thez nohhh...
     
Forum Regular
Join Date: Sep 2004
Status: Offline
Reply With Quote
Jan 22, 2005, 12:02 AM
 
but.... doesn't seem to work in Safai
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jan 24, 2005, 04:05 AM
 
Originally posted by zzarg:
but.... doesn't seem to work in Safai
It will... It will... try again in Q2, 2005...
Computer thez nohhh...
     
Forum Regular
Join Date: Sep 2004
Status: Offline
Reply With Quote
Jan 25, 2005, 06:22 AM
 

saw the promise on the Surfin' Safair blog just today (catching up on some long neglected reading) about support for ContentEditable.
Now just got to avoid chewing my own arm off waiting for Tiger
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jan 25, 2005, 07:35 AM
 
Originally posted by zzarg:

saw the promise on the Surfin' Safair blog just today (catching up on some long neglected reading) about support for ContentEditable.
Now just got to avoid chewing my own arm off waiting for Tiger
Here's the problem, though: contentEditable isn't a standard. Neither is designMode, but at least it's implemented relatively widely (IE and Gecko, versus only IE). This is going to make implementation of a cross-browser editor very difficult.

I sincerely hope that if they must implement contentEditable that they at least implement designMode alongside it, so that sanity might prevail.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Jan 27, 2005, 04:38 PM
 
Great work! And it actually just shows a normal text input if it isn't supported (unlike some other html textarea editors I know of that refuse to do this)

I have one question... I am running a few different themes for different areas. On one particular theme, if it is a new input (i.e, the textarea is blank - not editing previous information), is there any way to set the theme to use a <p> tag when the user starts typing?

As it is now, starting with a blank input just starts the text and then hitting enter once sets 2 blank "<p>&nbsp;</p>" lines

There are some textareas that all of the content should be in <p> tags, and was wondering if this was possible upon starting to type? Otherwise, I must hit enter, and then backspace twice to get the content to go in a <p> tag, and even then there is an extra <br /> before the <p> begins.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
Clinically Insane
Join Date: Nov 1999
Status: Offline
Reply With Quote
Jan 27, 2005, 04:48 PM
 
Originally posted by madmacgames:
I have one question... I am running a few different themes for different areas. On one particular theme, if it is a new input (i.e, the textarea is blank - not editing previous information), is there any way to set the theme to use a <p> tag when the user starts typing?

As it is now, starting with a blank input just starts the text and then hitting enter once sets 2 blank "<p>&nbsp;</p>" lines
A <p> tag isn't a blank line. <p> tags enclose paragraphs; they don't cause linebreaks. You can change paragraph spacing with CSS.

Unfortunately, though, it's not even that simple. Although Netscape and IE support the same API for rich-text editors, they use very different code under the hood. In particular, IE actually produces mostly semantic code (P, EM, STRONG, and such) with its RTE, while Gecko uses presentational code (paired BR tags, I, B, and such). It's a strange reversal of situations; usually Netscape is the better Web citizen, but IE wins in this one case. Unfortunately, there is no way to configure either browser to match the behavior of the other.
You are in Soviet Russia. It is dark. Grue is likely to be eaten by YOU!
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Jan 27, 2005, 05:01 PM
 
Originally posted by Millennium:
A <p> tag isn't a blank line. <p> tags enclose paragraphs; they don't cause linebreaks. You can change paragraph spacing with CSS.
I think you misunderstood what I was saying.

Say I have a blank input and start typing in 2 paragraphs in the HTML editor:
This is my first sentence & paragraph.

This is the 2nd one.
The HTML code should be:
Code:
<p>This is my first sentence &amp; paragraph.</p> <p>This is the 2nd one.&nbsp;</p>
But instead, it does this in Firefox:
Code:
This is my first sentence &amp; paragraph. <p>&nbsp;</p> <p>This is the 2nd one.&nbsp;</p>
I only hit enter once and it acts like I hit it twice, and doesn't even encapsulate the first paragraph in <p> tags.

That's what i mean by blank "<p></p>" lines. A <p> tag with nothing - or space - in it is empty, but more the point, should not even be there because I just hit enter one time, not twice.

I know what HTML is and how it works, thank you very much.

*Edit* This appears to be a bug with TinyMCE in firefox. I looked around the TinyMCE site and see others reporting it in firefox too, but not other browsers. Testing a little, it does the same trick in Netscape 7.1 and Mozilla 1.7 and will not even let me type anything in Camino.

If you goto the site in firefox and look at the demos, clear one out and start typing 2 paragraphs, you will see what I mean.
(Last edited by madmacgames; Jan 27, 2005 at 05:09 PM. )
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
Grizzled Veteran
Join Date: Jun 2001
Location: Melbourne, Australia
Status: Offline
Reply With Quote
Jan 28, 2005, 04:37 PM
 
Originally posted by madmacgames:
I think you misunderstood what I was saying.

Say I have a blank input and start typing in 2 paragraphs in the HTML editor:


The HTML code should be:
Code:
<p>This is my first sentence &amp; paragraph.</p> <p>This is the 2nd one.&nbsp;</p>
.....
Yep, it's a known bug (I filed it just after Christmas). They've been updating the editor pretty regularly so hang out for another week or so.
Computer thez nohhh...
     
Grizzled Veteran
Join Date: Oct 2003
Status: Offline
Reply With Quote
Jan 28, 2005, 06:16 PM
 
Originally posted by Simon Mundy:
Yep, it's a known bug (I filed it just after Christmas). They've been updating the editor pretty regularly so hang out for another week or so.
Yeah. As a work around for now, if it is a blank input, I just pre-fill it with "<p>Type Content Here</p>" and then strip it back out on submit if it is still there, since it works fine if there is already paragraph content.
The only thing necessary for evil to flourish is for good men to do nothing
- Edmund Burke
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 09:04 AM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2