Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raptor.reisterUI(new Button(...)) Uncaught ReferenceError: Button is not defined #174

Open
yannick9906 opened this issue Feb 17, 2015 · 4 comments

Comments

@yannick9906
Copy link

I have tried to add a new button and I got this error. I used the Raptor Version with Expose API methods activated.

Here's my HTML Code:

                <link type="text/css" rel="stylesheet" href="raptor/raptor-front-end.css" />
                <script src="raptor/libraries/jquery.js"></script>
                <script src="raptor/libraries/jquery-ui.js"></script>
                <script src="raptor/raptor.min.js"></script>
                <script>
                    function a() {
                        document.addEventListener('keydown', function(e){
                            /*console.log('keydown');*/
                            var keys = [];
                            if(e.ctrlKey || e.shiftKey || e.altKey || e.metaKey) {
                                if(e.metaKey) {
                                    keys.push('Cmd');
                                }
                                if(e.shiftKey) {
                                    keys.push('Shift');
                                }
                                if(e.ctrlKey) {
                                    keys.push('Ctrl');
                                }
                                if(e.altKey) {
                                    keys.push('Alt');
                                }
                            }
                            if(e.which) {
                                /*console.log(e.which);*/
                                keys.push(String.fromCharCode(e.which));
                            }
                            /*console.log(keys.join('+'));*/
                            if(keys.length >= 2 && keys[keys.length-1] != '') {
                                window.postMessage({type: 'dolphin_shortcuts', keys:keys}, '*');
                            }
                        });
                    }a();
                </script>
                <script>
                    window.oncontextmenu = function(event) {
                        var target = event.target.getAttribute('obj_url');
                        window.postMessage({type: 'dolphin_clickTarget', target:target}, '*');
                    };
                </script>
                <script src="raptor/buttons.js"></script>
                <script>
                      $('.editable').raptor({
                        layouts: {
                            toolbar: {
                                uiOrder: [
                                    ['cancel', 'Freigeben']
                                ]
                            },
                            hoverPanel: {
                                uiOrder: [
                                    ['clickButtonToEdit']
                                ]
                            },
                        }
                    });
                </script>

and the code of "buttons.js"

Raptor.registerUi(new Button({
    name: 'Freigeben',

    action: function() {
        alert('Freigegeben');
    }
}));

I Hope you can help me - Google couldn't.

@Petah
Copy link
Contributor

Petah commented Feb 18, 2015

Sorry, what error did you get? I can't see a error message in the above.

@yannick9906
Copy link
Author

I got this error like in the title: Uncaught ReferenceError: Button is not defined(buttons.js:1)

@Petah
Copy link
Contributor

Petah commented Feb 18, 2015

Oh, sorry.

Try Raptor.Button

@yannick9906
Copy link
Author

The Error now disappeared, but I can't see the button anywhere in the UI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants