diff --git a/src/js/controller/write.js b/src/js/controller/write.js index b9b4e9e..3b0f532 100644 --- a/src/js/controller/write.js +++ b/src/js/controller/write.js @@ -5,7 +5,6 @@ define(function(require) { _ = require('underscore'), appController = require('js/app-controller'), axe = require('axe'), - aes = require('js/crypto/aes-gcm'), util = require('js/crypto/util'), str = require('js/app-config').string, pgp, emailDao, outbox, keychainDao, auth; @@ -37,7 +36,6 @@ define(function(require) { // fill fields depending on replyTo fillFields(replyTo, replyAll, forward); - $scope.updatePreview(); $scope.verify($scope.to[0]); }, @@ -61,7 +59,6 @@ define(function(require) { $scope.bcc = []; $scope.subject = ''; $scope.body = ''; - $scope.ciphertextPreview = ''; $scope.attachments = []; $scope.addressBookCache = undefined; } @@ -321,21 +318,6 @@ define(function(require) { // Editing email body // - // generate key,iv for encryption preview - var key = util.random(128), - iv = util.random(128); - - $scope.updatePreview = function() { - if (!$scope.sendBtnSecure || !$scope.body.trim()) { - $scope.ciphertextPreview = undefined; - return; - } - - // Although this does encrypt live using AES, this is just for show. The plaintext is encrypted seperately before sending the email. - $scope.ciphertextPreview = aes.encrypt($scope.body, key, iv); - }; - $scope.$watch('sendBtnSecure', $scope.updatePreview); - $scope.sendToOutbox = function() { var email; @@ -466,27 +448,6 @@ define(function(require) { // var ngModule = angular.module('write', []); - ngModule.directive('contenteditable', function() { - return { - require: 'ngModel', - link: function(scope, elm, attrs, ctrl) { - // view -> model - elm.on('keyup keydown', function() { - // set model - ctrl.$setViewValue(elm[0].innerText); - scope.$digest(); - }); - - // model -> view - ctrl.$render = function() { - elm[0].innerText = ctrl.$viewValue; - }; - - // load init value from DOM - ctrl.$setViewValue(elm[0].innerText); - } - }; - }); ngModule.directive('focusMe', function($timeout, $parse) { return { @@ -496,7 +457,12 @@ define(function(require) { scope.$watch(model, function(value) { if (value === true) { $timeout(function() { - element[0].focus(); + var el = element[0]; + el.focus(); + if (typeof el.selectionStart !== 'undefined' && typeof el.selectionEnd !== 'undefined') { + el.selectionStart = 0; + el.selectionEnd = 0; + } }, 100); } }); @@ -504,17 +470,6 @@ define(function(require) { }; }); - ngModule.directive('focusChild', function() { - return { - //scope: true, // optionally create a child scope - link: function(scope, element) { - element.on('click', function() { - element[0].children[0].focus(); - }); - } - }; - }); - ngModule.directive('focusInput', function($timeout, $parse) { return { //scope: true, // optionally create a child scope diff --git a/src/sass/views/_write.scss b/src/sass/views/_write.scss index 14fbb94..c95d2c5 100644 --- a/src/sass/views/_write.scss +++ b/src/sass/views/_write.scss @@ -65,7 +65,7 @@ .subject-box { flex-shrink: 0; position: relative; - margin: 20px 0 7px 0; + margin: 20px 0; input[type=file] { visibility: hidden; @@ -146,33 +146,18 @@ } } - .body { + textarea { flex-grow: 1; + width: 100%; + border: none; + outline: none; + color: $color-grey-dark; line-height: 1.5em; - user-select: text; - overflow-y: scroll; + overflow-y: auto; // allow scrolling on iOS -webkit-overflow-scrolling: touch; // put layer on GPU transform: translatez(0); - - *[contentEditable] { - outline: 0px; - cursor: text; - } - - .encrypt-preview { - font-size: 0.9em; - margin-top: 3em; - font-family: monospace; - color: $color-grey-light; - word-wrap: break-word; - transition: opacity 0.5s; - } - - .invisible { - opacity: 0; - } } .send-control { diff --git a/src/tpl/write.html b/src/tpl/write.html index 2baa4a9..e8ef6a5 100644 --- a/src/tpl/write.html +++ b/src/tpl/write.html @@ -58,13 +58,7 @@ -
-----BEGIN ENCRYPTED PREVIEW-----
{{ciphertextPreview}}
-----END ENCRYPTED PREVIEW-----