Clicking on popup menu options should refocus on selected text.

This commit is contained in:
Guo Xiang Tan 2016-06-16 21:23:58 +08:00
parent 5d9e6d2395
commit 95a58b80d7
No known key found for this signature in database
GPG Key ID: 19C321C8952B0F72
2 changed files with 4 additions and 0 deletions

View File

@ -388,6 +388,9 @@ export default Ember.Component.extend({
left = replyWidth - popupWidth - 40;
}
const selected = toolbarEvent.selected;
toolbarEvent.selectText(selected.start, selected.end - selected.start);
this.sendAction('showOptions', toolbarEvent,
{ position: "absolute", left, top });
},

View File

@ -507,6 +507,7 @@ export default Ember.Component.extend({
const selected = this._getSelected(button.trimLeading);
const toolbarEvent = {
selected,
selectText: (from, length) => this._selectText(from, length),
applySurround: (head, tail, exampleKey) => this._applySurround(selected, head, tail, exampleKey),
applyList: (head, exampleKey) => this._applyList(selected, head, exampleKey),
addText: text => this._addText(selected, text),