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.

25 lines
897 B

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