1
誰かがエースエディタのカスタムオートコンプリート方法を教えてくれますか?オートコンプリートエースエディタにhtmlを追加するには?
このエディタは、私のためにうまく機能ですが、私はオートコンプリートの結果に絵文字画像を挿入する必要があります。 は、私は以下のようにemoji images
などを表示する必要があります。
var editor = ace.edit('editor');
editor.setTheme('ace/theme/github');
editor.getSession().setMode('ace/mode/markdown');
editor.$blockScrolling = Infinity; //prevents ace from logging annoying warnings
editor.getSession().on('change', function() {
draceditor.val(editor.getSession().getValue());
});
editor.setOptions({
enableBasicAutocompletion: true,
enableSnippets: true,
enableLiveAutocompletion: true
});
// Ace autocomplete
var emojiWordCompleter = {
getCompletions: function(editor, session, pos, prefix, callback) {
var wordList = emojis; // list emojis from `atwho/emojis.min.js`
var obj = editor.getSession().getTokenAt(pos.row, pos.column.count);
var curTokens = obj.value.split(/\s+/);
var lastToken = curTokens[curTokens.length-1];
if (lastToken[0] == ':') {
console.log(lastToken);
callback(null, wordList.map(function(word) {
return {
caption: word,
value: word.replace(':', '') + ' ',
meta: 'emoji' // this should return as text only.
};
}));
}
}
}
editor.completers = [emojiWordCompleter]
私の悪い考えでは、私はこのmeta: '<img src="/path/to/emoji.png">'
と試みるが、もちろんそれは、仕事することはできません。
これを解決する方法はありますか?あまり前にありがとう..
ありがとうございましたあなたの提案に感謝します...私は見てみましょう.. –