Google Maps plugin tinyMce
A customer of mine requested a custom Google Maps plugin for his richtext editor. Since I could not find one for the TinyMce editor he was using, I decided to create my own. To get this plugin working, you need the three things:
1. API key
To get Google Maps appearing on your webpage, you need your very own API key from Google. You can obtain one here: http://code.google.com/apis/maps/signup.html
2. Coordinates
You can query the coordinates of the place you want to show by using the form below. Just enter your location as a comma or space seperated string and press “Go!”.
You will find your coordinates between parentheses just above the form.
Why not use the locationstring as a variable in a TinyMce dialog box, you say? The main reason is that once you have inserted the Google Map into your TinyMce textarea, it does not appear when in wysisyg-mode. You first need to save (or publish) the page in order for the map to appear.
The form above saves you the time of republishing over and over again, just to get your location right.
3. Download
You can download the plugin here.
Remember: it’s a very crude first version with much room for improvement. It comes with a readme.txt, in which I have tried to explain the steps I have taken.
Originally a Google Map needs a “onLoad” function in your body-tag. Since TinyMce is mainly used in content management systems, a user cannot access the body-tag. I added some extra Javascript that avoids the body-tag from being used (not my own, I found the code somewhere on the Internet).
SourceForge
Jeroen van der Stijl has picked up this project and created a SourceForge depository. Since my code was very crude, any improvements are more than welcome. Check out https://sourceforge.net/projects/mcegooglemap/
Hey, ik loop vast bij de stap:
19 June 2009 om 12:04Find your tinyMce init statement and add “googlemaps” to the “plugins” line and
add “googlemaps, googlemapsdel” to one of your button lines (like “theme_advanced_buttons3″).
Wáar vind ik dat bestand waar ik het aan moet passen…?
Henk,
ergens in je HTML roep je het volgende aan:
Dit is wat ik bedoel met het INIT statement.
Check http://tinymce.moxiecode.com/examples/full.php en klik op de “View source” tabjes om de achterliggende HTML te zien.
Als je dat gevonden, zie je ook een regel “theme_advanced_buttons1″ (en 2, 3 etc.) staan. In 1 van die regels moet je de plugins toevoegen.
19 June 2009 om 12:35Dan zit daar denk ik het probleem, want ik gebruik Pluck CMS, en daar is geen View Source knop….. :p
19 June 2009 om 13:41Kan ‘t daar niet ergens aangepast worden in de bestanden van TinyMce?
Sorry voor het spammen.
20 June 2009 om 18:26Hi,
good plugin. i modified it a bit. i hope it\’s ok for you. i will only post it on tinymce-forum if you say it\’s ok for you, cause it\’s your plugin
here you find my modified version. feel free to post it on the forums or what else. just needed it for a client
http://www.klmedien.de/googlemaps.zip
10 August 2009 om 01:26