FIX: Autocomplete wasn't properly updating d-editor

This commit is contained in:
Robin Ward 2016-03-01 15:16:58 -05:00
parent 8349669f8e
commit 08e43588f6
3 changed files with 9 additions and 0 deletions

View File

@ -301,6 +301,9 @@ export default Ember.Component.extend({
$editorInput.autocomplete({
template: template,
key: ":",
afterComplete(text) {
self.set('value', text);
},
transformComplete(v) {
if (v.code) {

View File

@ -146,6 +146,10 @@ export default function(options) {
text = text.substring(0, completeStart) + (options.key || "") + term + ' ' + text.substring(completeEnd + 1, text.length);
me.val(text);
Discourse.Utilities.setCaretPosition(me[0], completeStart + 1 + term.length);
if (options && options.afterComplete) {
options.afterComplete(text);
}
}
}
}

View File

@ -27,3 +27,5 @@
</div>
</div>
</div>
{{plugin-outlet "discovery-below"}}