1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-26 19:02:20 -05:00

focus on editor when clicking on body element

This commit is contained in:
Tankred Hase 2013-11-27 11:57:15 +01:00
parent 6f34ec0f44
commit e316a89d24
3 changed files with 15 additions and 3 deletions

View File

@ -124,7 +124,7 @@ define(function(require) {
iv = util.random(128);
$scope.updatePreview = function() {
var body = $scope.body;
var body = $scope.body.trim();
// Although this does encrypt live using AES, this is just for show. The plaintext is encrypted seperately before sending the email.
$scope.ciphertextPreview = (body) ? aes.encrypt(body, key, iv) : '';
@ -236,6 +236,17 @@ define(function(require) {
};
});
ngModule.directive('focusChild', function() {
return {
//scope: true, // optionally create a child scope
link: function(scope, element) {
element[0].onclick = function() {
element[0].children[0].focus();
};
}
};
});
ngModule.directive('autoSize', function($parse) {
return {
require: 'ngModel',

View File

@ -65,6 +65,7 @@
.body {
line-height: 1.5em;
cursor: text;
@include respond-to(desktop) {
height: 445px;

View File

@ -26,10 +26,10 @@
</button>
</div><!--/.subject-box-->
<div class="body">
<div class="body" focus-child>
<p ng-model="body" contentEditable="true" ng-change="updatePreview()" tabindex="4" focus-me="state.writer.open && writerTitle === 'Reply'"></p>
<div class="encrypt-preview" ng-class="{'invisible': !body}">
<div class="encrypt-preview" ng-class="{'invisible': !ciphertextPreview}">
<p>-----BEGIN ENCRYPTED PREVIEW-----<br>{{ciphertextPreview}}<br>-----END ENCRYPTED PREVIEW-----</p>
<br>
<p>{{signature}}</p>