PANmedia / raptor-editor

Raptor, an HTML5 WYSIWYG content editor!
www.raptor-editor.com
GNU General Public License v3.0
533 stars 136 forks source link

How to add button to default layout? #185

Open jfmdev opened 9 years ago

jfmdev commented 9 years ago

Hi, I have successfully followed the tutorial Creating a basic Raptor Button.

However, when using this code:

      $('.editable').raptor({
        layouts: {
            toolbar: {
                uiOrder: [
                    ['cancel', 'custom-button']
                ]
            },
            hoverPanel: {
                uiOrder: [
                    ['clickButtonToEdit']
                ]
            },
        }
    });

All buttons disappears from Raptor Editor, except the Cancel button and the Custom button. And if I do not define the toolbal parameter:

      $('.editable').raptor({

    });

Then all the standard buttons appears, except the Custom button.

Is there a way of adding a new custom button and display it along with the default buttons?

deeknow commented 8 years ago

Hey @jfmdev yes you can do what you are asking. Take a look at the following example.. https://github.com/PANmedia/raptor-example/blob/master/examples/custom-button/example.php

You'll notice that the custom button is added to the left side of the toolbar (ie the zero-th button group, and using unshift to add to the beginning of the button array). If you want to add it to another group just enter it's index in uiOrder[index-here] and if you want to add it to the end of a button group use push() instead of unshift()

Hope that helps. Please let us know if it does and we'll close this ticket.