Help - Search - Members - Calendar
Full Version: More Entry Edit Buttons
Movable Type Community Forum > Additional Resources > Tips and Tricks
pixelsintime
Thank you, Tim! I used the code modifications you made to add the ability insert:
* <
* >
* —
* a URL link with target="_blank"

The fix you made to the B, I and U buttons to insert the tags if there is no selection works great too.

Thanks again!
timmorgan
I've made another update to the edit_entry template since this post was originally made. Now, when you type <b> MT automatically types </b> for you. The same with <i>, <u>, <a>, and <p>.

Copy the file to your MT setup for a quick upgrade!

(only works in IE5+)
timmorgan
I have some improvements for the edit_entry template, including some new buttons. I added some buttons that simply insert the character entities for "real" quotes and an em-dash. I also added a button that inserts the href for a link to Bible Gateway (a verse lookup service that I use on a regular basis on my blog) and a button that will lookup the selected word at Dictionary.com.



If you'd like to add these buttons to your Movable Type setup, copy
this file to /mt/tmpl/cms/ and copy these images to /mt/images/:

em-dash button

left single quote button

right double quote button


I also made some improvements to the way MT gets the cursor position within the textareas. These improvements should eliminate the visual bug that occurs when one of the formatting buttons is pushed without there being any text selected.

Hope this helps someone! God bless.

-Tim Morgan
http://timmorgan.info
madmanz123
Thanks for the code, I implimented it with my own tweaks, have a peak here.
deanpeters
Your edit_entry.tmpl hacks are perfect for what I do over at blogs4God.com and HealYourChurchWebSite.com!

Only problem is ... I downloaded your latest and greatest and I'm not sure it's the latest hack?

Tanx
girlie
Looking at the last link Tim provided, it doesn't look any different from the default edit_entry.tmpl - unless my eyes are fooling me!
timmorgan
I apologize: edit_entry.tmpl got overwritten when I upgraded awhile back.

I've re-updated the file, though, and you can use the links in the original post here to use this mod.
raynebair
Thanks. I used some of the code from the template for my smiley bar. It works perfect...thank you so much...this has been frustrating me to no end!
markn
QUOTE
I have some improvements for the edit_entry template, including some new buttons. I added some buttons that simply insert the character entities for "real" quotes and an em-dash. I also added a button that inserts the href for a link to Bible Gateway (a verse lookup service that I use on a regular basis on my blog) and a button that will lookup the selected word at Dictionary.com.



If you'd like to add these buttons to your Movable Type setup, copy





I also made some improvements to the way MT gets the cursor position within the textareas. These improvements should eliminate the visual bug that occurs when one of the formatting buttons is pushed without there being any text selected.

Hope this helps someone! God bless.

-Tim Morgan
http/....gt;http

I love the bible verse look up, I use that site all the time...
Would that pop up a new window then?

Also, will your tmpl file work with my MT 2.51 upgrade?
CyberOasen
pixelsintime:
QUOTE
I used the code modifications you made to add the ability insert:
* a URL link with target="_blank"


Would you like to share it with  me?  tongue.gif

Then I wonder if anyone would like to help me to hack the file even more?

I'd love to have buttons for

å Å ä Ä ö Ö - swedish letters, so I won't have to handcode them everytime!

CODE
& aring; & Aring; & auml; & Auml; & ouml; & Ouml;
(without the extra space that I just added so you guys can see the actual code!

Anyone up for it?  tongue.gif
nolageek
Great set of hacks!  I hope you don't mind, but I took the liberty of removing the bible verse lookup for us non-religious types....  get it here.  (Right click and "save as".)
say
Is that link still working? I click on the link to get the files and it looks like it may be dead...

I'd love to have the spell-check feature!!
YrAlterEgo
In case anybody is interested I edited the source a bit to point to Merrian Webster's dictionary instead of Dictionary.com as MW is soo much better. I also added a Theasarus button to the mix which points to the m-w theasarus.

If anybody cares you can get the button for the Theasarus here and the new (minus the bible link) code here.

Cheers.
stereoworld
i have modified my edit_entry.tmpl file so that it asks me for the links title attribute as well as url:

CODE
function insertLink () {
   if (!document.selection) return;
   var str = document.selection.createRange().text;
   if (!str) return;
   var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
   if (my_link != null)
   var my_title = prompt('<MT_TRANS phrase="Enter Title:">', '');
   if (my_title != null)
       document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}
skemper
Most (all?) of the above links appear to be broken. Can someone post the code and pictures to use the above hacks?

Thanks!
Steve
kadyellebee
It looks like the links to Tim Morgan's sites are working . . . does that help? There may be more recent threads you could look at, also - this one is from February, so its not as new of info as it could be.

Kristine
shogun
QUOTE
Thank you, Tim! I used the code modifications you made to add the ability insert:
* <
* >
* —
* a URL link with target="_blank"


How did you add að URL link with target="_blank"? Could you show me the code?

Thanks!
shogun
*BUMP*
diagonalwalls
I took the liberty too...

I've redone Tim's EXCELLENT template to include all the buttons except the "Bible Verse" URL and button - I've left those out.

I've edited the Insert link bit so that when you use the normal URL button you get a "Title" attribute prompt and I've added a second Insert link snippet so that when you use the URL_ button (you have to obviously upload the new button and edit the template wink.gif ) you get a prompt for the target attribute *and then* a prompt for the title attribute.

I also added in the code and button image file for "blockquote" and added a little piece for the short cut (which Tim also created smile.gif ) to make it so that in addition to Tim's shortcuts, when you type:
CODE
<blockquote> (in the new entry form field) the closing </blockquote>
is automatically appended.

The blockquote snippet and button are courtesy of:
Richard at MovableBLOG

You can download the whole shebang (buttons & code) in a zip file here:
Yet another edit_entry_tmpl mod

You CAN just save your current edit_entry_tmpl file and then rename the one in the zip to edit_entry_tmpl - but I wanted to add a 2 to the name so you'd know which one you had open ohmy.gif

It's pretty basic stuff, especially since Tim and Richard actually did all the work tongue.gif but feel free to email me if you need help with it!

Have fun!

biggrin.gif

KW
diagonalwalls
QUOTE
How did you add að URL link with target="_blank"? Could you show me the code?


I added this to mine:
CODE
function insertLink2 () {
  if (!document.selection) return;
  var str = document.selection.createRange().text;
  if (!str) return;
  var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
  if (my_link != null)
  var my_target = prompt('<MT_TRANS phrase="Enter Target:">', '_');
  if (my_target != null)
  var my_title = prompt('<MT_TRANS phrase="Enter Title:">', '');
  if (my_title != null)
      document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}


along with this:
CODE
document.write('<td width="33"><a href="javascript:insertLink2()"><img src="<TMPL_VAR NAME=STATIC_URI>images/url-button2.gif" alt="link2" width="33" height="18" border="0"></a></td>');

for the button to display on my toolbar, as I don't ALWAYS use _blank. The button for it is in the zip file in the post before this one.

Now - you could *also* simply change this:
CODE
function insertLink () {
  if (!document.selection) return;
  var str = document.selection.createRange().text;
  if (!str) return;
  var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
  if (my_link != null)
      document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}


to this:
CODE
function insertLink () {
  if (!document.selection) return;
  var str = document.selection.createRange().text;
  if (!str) return;
  var my_link = prompt('<MT_TRANS phrase="Enter URL:">', 'http://');
  if (my_link != null)
  var my_target = prompt('<MT_TRANS phrase="Enter Target:">', '_');
  if (my_target != null)
      document.selection.createRange().text = '<a href="' + my_link + '" target="_blank" title="' + my_title + '">' + str + '</a>';
}


and that would do it. This code will prompt you for a target when you click your URL button but it doesn't include any of the other stuff in the zip file in my other post.

I added the _ mostly for my own convenience, but you can leave that out.

I guess that's it! biggrin.gif
KW
empey
Well, I'm skunked. I uploaded the edit_entry file to the correct directory, and the images to the same directory where all the other mt images reside, but none of the new buttons show up. Also, now I've lost my Textile option.
diagonalwalls
OK:

1.) Did you change the name of the file? You have to remove the 2 at the end of the file name, for one.

2.) Did you upload the tmpl file in ASCII and the images in BINARY?

3.) Regarding Textile: It's easy to re-add.

You can email me backchannel if you like smile.gif

kimberly @ diagonalwalls dot com

(Remove the spaces and change the dot to a .)

biggrin.gif

KW
SimpleMan46
I'd love to use diagonalwalls new template, but I can't get it to work in Opera. It works fine in IE, but in Opera the template appears exactly like the original one.

Can anybody help me with this? Any ideas? wink.gif
kadyellebee
I'm not sure, do any of the formatting buttons work in Opera? If you don't currently see the Bold, Italic, and Link buttons, then you probably can't add other buttons because the browser may not support document.select to apply a format to a selection.

Kristine
maddy
No, I played a few weeks ago, and noticed that the code is applied in the same way as the current format buttons - if document.selection isn't supported (and it's not in Opera), you don't see the buttons. I didn't look closely to see if the buttons themselves work, however. smile.gif
kadyellebee
Cool deal, thanks Maddy - I was hoping you'd come along to this thread... because I was too lazy to actually start up Opera to find out myself ;-) Hee hee...
dbcooper
So does someone have a listing of browsers for which the little formatting buttons appear and those for which they don't? I'm really bummed if all of my Mac-using, non-techie users will have to bother with href's when they try to link.
maddy
You mean the default ones? They are IE for Windows only, though I believe there is a fix floating around for Mozilla.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.