Rich Text Editing in Movable Type

kurcula.com posted a hack to enable rich-text editing for Movable Type in Mozilla.

Maybe I was doing it wrong, but the part about adding the document.write table after the if/else didn't work for me, but the following did, when placed after that <script> block:


<TMPL_IF NAME=AGENT_MOZILLA>
<table border="0" cellspacing="0" cellpadding="0" width="107">
<tr>
<td width="24"><a href="javascript:wrapSelection('b')">
	<img src="<TMPL_VAR NAME=STATIC_URI>images/bold-button.gif" alt="bold" width="24" height="18" border="0"></a></td>
<td width="24"><a href="javascript:wrapSelection('i')">
	<img src="<TMPL_VAR NAME=STATIC_URI>images/italic-button.gif" alt="italic" width="24" height="18" border="0"></a></td>
<td width="24"><a href="javascript:wrapSelection('u')">
	<img src="<TMPL_VAR NAME=STATIC_URI>images/underline-button.gif" alt="underline" width="24" height="18" border="0"></a></td>
<td width="26"><a href="javascript:insertMozLink()">
	<img src="<TMPL_VAR NAME=STATIC_URI>images/url-button.gif" alt="link" width="26" height="18" border="0"></a></td>
</tr>
</table>
</TMPL_IF>

If you like, you can download this edit_entry.tmpl file where I have already made the changes, and upload it to MTPath/tmpl/cms/edit_entry.tmpl. You of course do so at your discretion.

[link via asa]

» posted by pinder on May 09, 2003 at 05:30 PM

Comments

The reason why I placed this piece of code inside <script> is that buttons won't be rendered if javascript is turned off.

# posted by Davor

Awesome. Thanks!

# posted by kevin

Doesn't seem to work with Mozilla Firebird? Did I implement the hack wrong?

# posted by Jonathan

works for me in phoenix, bu ti just downloaded the file and replaced.

# posted by scott

Just a note to Safari users.

It seems as though the buttons will show up while you're in Safari, but they don't work the same way.

For example, if I hit 'B' (the bold button), this shows up:

Jasmeet<b>Jasmeet</b>Jasmeet

Works fine without text if you hit 'B'(or whatever else), then type your text.

Just a work of caution.

# posted by Jasmeet

Very nice. I've added this to the bookmarklet template as well at http://kalsey.com/2003/05/mt_text_formatting_buttons_in_mozilla/

# posted by Adam Kalsey

Thanks for the hack! However, I'd recommend substituting strong and em for b and i beginning on line 426.

# posted by Joshua Kaufman

Just what I was looking for. Thanks very much.

# posted by Marie Carnes

I would recommend adding title attributes to each button's img tag, since Firebird/Mozilla won't display alt tooltips by default.

Thanks for posting this.

# posted by cobra libre

Is this working *perfectly* for most? It seems to blow up when I go to new lines or try to add formatting (or URLs) to text I am editting (as opposed to freshly writing).
It doesn't like to add the formatting to new lines - the formatting shows up on the first line only, however, with the correct offset from "column zero"

I'm using Mozilla 1.2.1 and MT 2.63

# posted by Dan

Dan, The Rich Text stuff for Mozilla was only recently added. So I think it will only work with Mozilla 1.3+

# posted by pinder

Yup, you're right... I upgraded to Mozilla 1.3.1 and it's working properly.

In addition, you might want to mention the hack for bm_entry.tmpl - which is for the "Post to MT..." bookmarklet. (It's at Adam Kalsey's site)

# posted by Dan

thanks you, getting Firebird close to perfect now.

# posted by William

Thanks very much for the great research and code work. Are Ben and Mena aware of this issue so they can fix it in the next release? I'm definately up to writing them an email if no one else has yet.

Thanks again.

# posted by Matthew

Totally rocks! Just did this for my Moz 1.5b on OS X 10.2.6 and works perfectly! Running MT 2.64

# posted by Jonathan Greene

excellent. works with safari and with windows netscape. thank you very much.

# posted by trey

Yep! Great job. Works with Galeon 1.2.7

# posted by Rutto

THANK YOU!!!!!!!!!!!!!!!!!!

# posted by madpoet

This does indeed work well with Firebird 0.7. Many thanks!

# posted by dennis

Well done.

# posted by Online Bingo

Great comments guys. Peter FDA

# posted by Peter

Rock! One more step toward making Firebird 0.7 my default browser.

# posted by churk

Perfect :)
It's working in Firebird 0.7

# posted by Otávio

Great! Thank you very much.

# posted by kazu

I was just wanted to ask if you had a very Merry Christmas / Holiday, and to wish you the very best for the New Year.

BTW, In saw something on another blog site I think it is a good idea to let as many people / bloggers know about. I was just organizing my vacation for later this year and stumbled across the above web site about Bali, where I was considering going. But just read what it says there and especially between the lines; unreal. A travel agent there Bali Discovery Tours of Sanur went to their friend the police chief and made trouble for someone visiting the island who had caught this travel agent offering unauthorized room rates on the Internet for the Hotel Santika Beach in Kuta, which is where I was going to stay, but thank God I am not now (I am not even going to Bali becuase of this) - seems to me like the hotel did not exactly help!

The poor guy was detained by the police for 4 days and had his passport illegally seized. He was not released until the British Embassy filed a formal complaint. Of course, there were no charges!! This is absolutely terrible. Please, please, please, join me in saying "Stuff Bali - I'm going somewhere where they treat people like guests, not enemies".

# posted by George

Post a Comment

This discussion has been closed.