Skip to content

Commit

Permalink
Focus compose area on quoting a text (#342)
Browse files Browse the repository at this point in the history
Fixes #251
  • Loading branch information
sillych authored and dbrgn committed Sep 14, 2017
1 parent c2772dc commit 42ec03b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/directives/compose_area.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,15 @@ export default [
'$mdDialog',
'$filter',
'$log',
'$rootScope',
function(browserService: BrowserService,
stringService: StringService,
$window, $timeout: ng.ITimeoutService,
$translate: ng.translate.ITranslateService,
$mdDialog: ng.material.IDialogService,
$filter: ng.IFilterService,
$log: ng.ILogService) {
$log: ng.ILogService,
$rootScope: ng.IRootScopeService) {
return {
restrict: 'EA',
scope: {
Expand Down Expand Up @@ -656,6 +658,10 @@ export default [
sendTrigger.on('click', onSendTrigger);

updateView();

$rootScope.$on('onQuoted', (event: ng.IAngularEvent, args: any) => {
composeDiv[0].focus();
});
},
// tslint:disable:max-line-length
template: `
Expand Down
10 changes: 8 additions & 2 deletions src/services/webclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1303,10 +1303,16 @@ export class WebClientService {
}

if (quoteText !== undefined) {
this.drafts.setQuote(receiver, {
let quote = {
identity: message.isOutbox ? this.me.id : message.partnerId,
text: quoteText,
} as threema.Quote);
} as threema.Quote;

this.drafts.setQuote(receiver, quote);
this.$rootScope.$broadcast('onQuoted', {
receiver: receiver,
quote: quote,
});
}
}
}
Expand Down

0 comments on commit 42ec03b

Please sign in to comment.