x-editable-rails 1.5.1 → 1.5.5.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -72,9 +72,12 @@ $(function(){
72
72
 
73
73
  return deferred.promise();
74
74
  },
75
+
76
+ valueIsEncoded: true,
75
77
 
76
78
  value2html: function(value, element) {
77
79
  $(element).html(value);
80
+ this.valueIsEncoded = false;
78
81
  },
79
82
 
80
83
  html2value: function(html) {
@@ -82,8 +85,13 @@ $(function(){
82
85
  },
83
86
 
84
87
  value2input: function(value) {
88
+ value = (this.valueIsEncoded ? this.base65decode(value) : value);
85
89
  this.$input.data("wysihtml5").editor.setValue(value, true);
86
- },
90
+ },
91
+
92
+ base65decode: function(value) {
93
+ return decodeURIComponent( escape( atob( value.replace(/\s/g, ''))));
94
+ },
87
95
 
88
96
  activate: function() {
89
97
  this.$input.data("wysihtml5").editor.focus();