Jump to content

How can I add extra buttons to unihtmlmemo toolbar


emin

Recommended Posts

Hi 
I need extra button in htmlmemo toolbar. I found a script that allows to add a new button to the toolbar. But I need more than that. How can I add the following functions to the new button.
- add an image to the button
- adding the button in the desired order. this script adds the button at the end

 

Quote
function beforeInit(sender, config)
{
  config.listeners = {
    render: function(editor) {
              editor.getToolbar().add({
                 xtype: 'button',
                 text: 'imageUpload',
                 handler: function() {
                   ajaxRequest(sender, 'uploadImage', [])   
                 }
              });
             }
    }
}

 

Link to comment
Share on other sites

Hi

I tried many thinks but none of them worked. Where do I need to add index position and how. 

  config.listeners = {
    render: function(editor) {
              editor.getToolbar().insert({

       
                 xtype: 'button',
                 text: 'Kaydet',
                 handler: function() {
                   ajaxRequest(sender, 'Kaydet', [])   
                 }
              });
             }
    }

Link to comment
Share on other sites

I tried this way but it doesn't work. Can you please write the full code, and how add an image to new button. Thanks

Quote

function beforeInit(sender, config)
{
  config.listeners = {
    render: function(editor) {
              editor.getToolbar().insert(position, {2})      

                {                 
                 xtype: 'button',
                 text: 'imageUpload',
                 handler: function() {
                   ajaxRequest(sender, 'uploadImage', [])   
                 }
              });
             }
    }
}

 

Link to comment
Share on other sites

editor.getToolbar().insert(position, {2})      

                {                 
                 xtype: 'button',
                 text: 'imageUpload',
                 handler: function() {
                   ajaxRequest(sender, 'uploadImage', [])   
                 }
              });
             }

 

 

editor.getToolbar().insert(2, {
    xtype: 'button',
    text: 'imageUpload',
    handler: function() {
        ajaxRequest(sender, 'uploadImage', [])
    }
})

 

Link to comment
Share on other sites

Hello,

9 minutes ago, emin said:

If I want to add more than one button. What would be the correct script

For example like this:

function beforeInit(sender, config) 
{
    var indx = 0;
    config.listeners = {
        render: function(editor) {
            editor.getToolbar().insert(indx, {
                xtype: 'button',
                text: 'imageUpload1',
                handler: function() {
                    ajaxRequest(sender, 'uploadImage', [])
                }
            });

            indx = +1;
            editor.getToolbar().insert(indx, {
                xtype: 'button',
                text: 'imageUpload2',
                handler: function() {
                    ajaxRequest(sender, 'uploadImage2', [])
                }
            });
        }
    }
}

 

Link to comment
Share on other sites

  • 1 month later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...