BlogEngine.NET - Enabling image and media buttons in HTML editor

by Ben Hyrman Saturday, January 03, 2009

I was a little frustrated figuring out how to add media files to posts on our personal site... and going to the HTML editor to add images was a little tiring (and since my wife was the one writing the posts, it was in my best interests to figure out a workaround quickly Wink).

It turns out, all you need to do is fiddle with the TinyMCE options a bit. Open up the file tinyMCE.ascx in the admin folder of your website and modify the plugin and toolbar declarations.

First, the plugins. Find that section of code and change it to:


<%if (Request.UserAgent != null && Request.UserAgent.Contains("MSIE")){ %>
  plugins : "inlinepopups,fullscreen,contextmenu,cleanup,emotions,table,iespell,media,advimage",
<%}else{ %>
  plugins : "inlinepopups,fullscreen,contextmenu,cleanup,emotions,table,media,advimage",
<%} %>

(Note the addition of media and advimage above)

Next, declare the actual buttons to insert:

theme_advanced_buttons2_add : "image,media",

Note the comma at the end fo both lines that we've added. These are actually arguments being passed into the TinyMCE init method.

Also note, we're adding these two buttons to a previously unused toolbar just for simplicity sake. Obviously, you can add them anywhere on the toolbar you'd like.

Comments

Comments are closed
 
Awesome site design by Mike Evans | Some icons copyright FamFamFam | Social bookmark icons copyright FastIcon | Powered by BlogEngine.NET 1.4.5.0