我想同时使用表情编辑器textarea添加emojione和at.js(自动完成)。表情符号可以正常工作,但是at.js无法正常工作。
版本: froala_editor v3.1.0 EmojioneArea v3.1.5 at.js-1.5.3
这是我的摘录:
// Define data source for At.JS.
var datasource = ["Jacob", "Isabella", "Ethan", "Emma", "Michael", "Olivia" ];
// Build data to be used in At.JS config.
var names = $.map(datasource, function (value, i) {
return {
'id': i, 'name': value, 'email': value + "@email.com"
};
});
// Define config for At.JS.
var config = {
at: "@",
data: names,
displayTpl: '<li>${name} <small>${email}</small></li>',
limit: 200
}
$('#froala-editor').emojioneArea({
autocomplete: false,
pickerPosition: "top",
tonesStyle: "bullet",
saveEmojisAs: "unicode"
});
// Initialize editor.
$('#froala-editor')
.on('froalaEditor.initialized', function (e, editor) {
editor.$el.atwho(config);
editor.events.on('keydown', function (e) {
if (e.which == $.FroalaEditor.KEYCODE.ENTER && editor.$el.atwho('isSelecting')) {
return false;
}
}, true);
})
.froalaEditor()
<div id="froala-editor">
</div>
答案 0 :(得分:1)
您似乎正在使用V2语法初始化Froala。 尝试像这样初始化它:
// Initialize editor.
var editor = new FroalaEditor('#froala-editor', {
events: {
initialized: function() {
$(editor.el).atwho(config);
editor.events.on('keydown', function (e) {
if (e.which == FroalaEditor.KEYCODE.ENTER && $(editor.el).atwho('isSelecting')) {
return false;
}
}, true); }
}
});