0

I've created a new plug in as I could not find one that actually "works", hoping that if I do it from scratch it might fire.

The plug-in simply wraps selected text with a mailto: link.

I've added the plug-in to the includes file, as per the following response on a previous question: http://bit.ly/vGyQlE however, it's not working.

I've gone into the localization directory, identified the Composite.Web.VisualEditor.en-us.xml as the file that handles the localization, added my entry under :

<string key="ToolBar.ToolTipMailTo" value="Mail To" />

But when I hover of the "blank" block where the menu item should appear, it returns (?). This is the first part where I picked up on something wierd. When you actually click on where the item should appear, nothing happens. So, I can't assume that the click event has got to do with an image, I re-wrote the command to return an alert, when clicked:

tinymce.create('tinymce.plugins.MailTo', {
    init : function(ed, url) {

        ed.addButton('mailto', {
            title : 'mailto.mailto_desc',
            cmd : 'mceMailTo',
            image : url + '/images/mailto.gif'
    });

    ed.addCommand('mceMailTo', function() {
    var selectedText = ed.selection.getContent({format : 'text'});
    var MailToLink = "alert(" + selectedText + ");";
    ed.execCommand('mceInsertContent', false, MailToLink);
});

I've added the "mailTo" element to visualeditor.js:

plugins : "...,paste,lists,mailto",

And ensured that the "mailto" plug-in is situated under the plug-ins directory for tiny_mce. I've gone as far as to clear my cache several times, but nothing? Can it be this difficult to add new plug-ins to tiny-mce in Composite?

JadedEric
  • 1,943
  • 2
  • 26
  • 49

1 Answers1

1

1) Composite C1 does not support internal tiny_mce buttons Do you add button to editor? In file Composite\content\misc\editors\visualeditor\includes\toolbarsimple.inc add

    <ui:toolbargroup>
            <ui:toolbarbutton cmd="mceMailTo" tooltip="Mail to" image="${icon:paste}" isdisabled="false" />
    </ui:toolbargroup>

2) Do you write valid plugin code?

(function () {
tinymce.create('tinymce.plugins.MailTo', {
    init: function (ed, url) {
        ed.addCommand('mceMailTo', function () {
            var selectedText = ed.selection.getContent({ format: 'text' });
            var MailToLink = "alert(" + selectedText + ");";
            ed.execCommand('mceInsertContent', false, MailToLink);
        });
    }
});
tinymce.PluginManager.add('mailto', tinymce.plugins.MailTo); })();
neexite
  • 11
  • 1