camwest / angular-ace

Ace Code Editor Directive for AngularJS
MIT License
17 stars 9 forks source link

Keybinding #1

Open SingaporeClouds opened 11 years ago

SingaporeClouds commented 11 years ago

Thanks for the module. Great code.

Do you have any recommendations on how to handle the keybindings? Popping up an alert is easy enough. Would it be possible to call a function on another controller somewhere? If so, how would you grab the correct scope?

editor.commands.addCommand({
  name: 'myCommand',
  bindKey: {win: 'Ctrl-Enter',  mac: 'Command-Enter'},
  exec: function(editor) {
        alert("How do we do something useful?");
    },

});
camwest commented 11 years ago

It would be cool to integrate key bindings. I don't really have any advice as I'm not sure he structure of your app. You could try adding attributes to the directive for the actions you want to support.

On Tuesday, February 5, 2013, Chris Boesch wrote:

Thanks for the module. Great code.

Do you have any recommendations on how to handle the keybindings? Popping up an alert is easy enough. Would it be possible to call a function on another controller somewhere? If so, how would you grab the correct scope?

editor.commands.addCommand({ name: 'myCommand', bindKey: {win: 'Ctrl-Enter', mac: 'Command-Enter'}, exec: function(editor) { alert("How do we do something useful?"); },

});

— Reply to this email directly or view it on GitHubhttps://github.com/camwest/angular-ace/issues/1.

Cameron Westland Vice-President, Products 647.887.8644 cameron@bigbangtechnology.com