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

[NFR] Give implementer ability to suppress certain keys and fire custom events. #1502

Open
temuri416 opened this issue Dec 19, 2015 · 1 comment

Comments

@temuri416
Copy link

Hi,

I'd like to use Aloha to WYSIWYG-edit single-line headlines. For that I need to intercept ENTER keypress (to prevent line-break) and fire custom save event.

Thoughts?

Thanks!

@temuri416
Copy link
Author

Here's what worked for me:

Aloha.bind('aloha-smart-content-changed', function(e, data) {
    value = data.editable.getContents();
    // save it to database.
});
Aloha.bind('aloha-command-will-execute', function(e, data) {
    if (data.commandId == 'insertlinebreak') {
        data.preventDefault = true;
    }
});

Can you confirm this is the right approach?

Cheers!

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

1 participant