You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
880 B

  1. odoo.define('mail_recovery', function (require) {
  2. var composer = require('mail.composer');
  3. composer.BasicComposer.include({
  4. init: function(){
  5. this._super.apply(this, arguments);
  6. this.events['focus .o_composer_input textarea'] = 'on_focus_textarea';
  7. this.events['keyup .o_composer_input textarea'] = 'on_keyup_textarea';
  8. },
  9. on_focus_textarea: function(event) {
  10. var $input = $(event.target);
  11. if (!$input.val()) {
  12. $input.val(window.localStorage.message_storage);
  13. }
  14. },
  15. on_keyup_textarea: function(event) {
  16. window.localStorage.message_storage = $(event.target).val();
  17. },
  18. send_message: function (event) {
  19. window.localStorage.message_storage = '';
  20. return this._super(event);
  21. },
  22. });
  23. });