0

我想使用 Aloha 来 WYSIWYG 编辑单行标题。

为此,我需要拦截 ENTER 按键(以防止换行)并触发自定义保存事件。

有没有办法做到这一点?

谢谢!

4

1 回答 1

0

这是在“修补程序”分支上对我有用的方法:

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;
    }
});

更多信息在这里:

https://github.com/alohaeditor/Aloha-Editor/issues/1502

于 2015-12-19T19:32:06.123 回答