-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix post tag input so it keeps the tag order
refs #5732 - patches ember-selectize to send the caret position to the create-item action handler - updates `addTag` method in PSM controller to insert new tag in the correct place
- Loading branch information
1 parent
79f1bd2
commit 06892cc
Showing
3 changed files
with
29 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Ember from 'ember'; | ||
import EmberSelectizeComponent from 'ember-cli-selectize/components/ember-selectize'; | ||
|
||
export default EmberSelectizeComponent.extend({ | ||
|
||
/** | ||
* Event callback that is triggered when user creates a tag | ||
* - modified to pass the caret position to the action | ||
*/ | ||
_create(input, callback) { | ||
var caret = this._selectize.caretPos; | ||
|
||
// Delete user entered text | ||
this._selectize.setTextboxValue(''); | ||
// Send create action | ||
|
||
// allow the observers and computed properties to run first | ||
Ember.run.schedule('actions', this, function () { | ||
this.sendAction('create-item', input, caret); | ||
}); | ||
// We cancel the creation here, so it's up to you to include the created element | ||
// in the content and selection property | ||
callback(null); | ||
} | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters