Custom Plugin for JCE - Joomla! Forum - community, help and support


i using special icon @ end of of content om site, , want make button jce automatically places icon. want insert html code:

code: select all

<a href="/index.php"><img src="/images/stories/imagonem_i_.png" border="0" alt="imagonem_i_" title="imagonem_i_" hspace="5" vspace="0" width="16" height="16" align="middle" /></a>


how do this?

create new folder in plugins folder name of plugin example: myplugin

using kind of editor, need create javascript file called editor_plugin.js these contents:

code: select all

/* import plugin specific language pack */
tinymce.importpluginlanguagepack('myplugin', tinymce.getparam('lang_list'));

var tinymce_myplugin = {
    getcontrolhtml : function(cn) {
      switch (cn) {
         case "myplugin":
            return tinymce.getbuttonhtml(cn, 'lang_myplugin_desc', '{$pluginurl}/images/myplugin.gif', 'mcemyplugin');
      }

      return "";
   },
    execcommand : function(editor_id, element, command, user_interface, value) {
      // handle commands
      switch (command) {
         case "mcemyplugin":
                var html = '<a href="/index.php"><img src="/images/stories/imagonem_i_.png" border="0" alt="imagonem_i_" title="imagonem_i_" hspace="5" vspace="0" width="16" height="16" align="middle" /></a>';
                tinymce.execcommand(mceinsertcontent, false, html);
         return true;
      }
        return false;
    }
};

tinymce.addplugin("myplugin", tinymce_myplugin);


then need images folder containing plugin icon, same name plugin itself, , langs folder containing @ least en.js file following contents:

code: select all

tinymce.addtolang('myplugin',{
desc : 'my new plugin'
});


for install jce, must have xml file, plugin this:

code: select all

<?xml version="1.0" ?>
<mosinstall version="1.0.0" type="jceplugin" plugin="myplugin">
   <name>my plugin</name>
   <version>1.0.0</version>
   <creationdate>2006</creationdate>
   <author>joe schmo</author>
   <authoremail>joe@schmo.com</authoremail>
   <authorurl>http://someurl.com</authorurl>
   <copyright>joe schmo</copyright>
   <license>gpl</license>
   <description></description>
   <icon>myplugin</icon>
   <layout_icon>myplugin</layout_icon>
   <elements></elements>
   <files>
        <filename plugin="myplugin">editor_plugin.js</filename>
        <filename>langs/en.js</filename>
        <filename>images/myplugin.gif</filename>
    </files>
</mosinstall>


zip create install package.

hope helps. take @ other plugins more info.





Comments

Popular posts from this blog

Thread: PKI Client 5.00 install (for eToken Pro)

ATmega2560-Arduino Pin Mapping

Crossfader Arduino Tutorial