diff options
Diffstat (limited to 'js/components/hintable.reel/hintable.js')
-rw-r--r-- | js/components/hintable.reel/hintable.js | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/js/components/hintable.reel/hintable.js b/js/components/hintable.reel/hintable.js index 5ed46b3c..6e3b2aaf 100644 --- a/js/components/hintable.reel/hintable.js +++ b/js/components/hintable.reel/hintable.js | |||
@@ -90,10 +90,10 @@ exports.Hintable = Montage.create(Editable, { | |||
90 | hintNext : { | 90 | hintNext : { |
91 | value : function(e) { | 91 | value : function(e) { |
92 | if(e) { e.preventDefault(); } | 92 | if(e) { e.preventDefault(); } |
93 | console.log('next1'); | 93 | //console.log('next1'); |
94 | 94 | ||
95 | if(this._matchIndex < this.matches.length - 1) { | 95 | if(this._matchIndex < this.matches.length - 1) { |
96 | console.log('next'); | 96 | //console.log('next'); |
97 | ++this._matchIndex; | 97 | ++this._matchIndex; |
98 | this.hint = this._getHintDifference(); | 98 | this.hint = this._getHintDifference(); |
99 | } | 99 | } |
@@ -102,9 +102,9 @@ exports.Hintable = Montage.create(Editable, { | |||
102 | hintPrev : { | 102 | hintPrev : { |
103 | value : function(e) { | 103 | value : function(e) { |
104 | if(e) { e.preventDefault(); } | 104 | if(e) { e.preventDefault(); } |
105 | console.log('prev1'); | 105 | //console.log('prev1'); |
106 | if(this._matchIndex !== 0) { | 106 | if(this._matchIndex !== 0) { |
107 | console.log('prev'); | 107 | //console.log('prev'); |
108 | --this._matchIndex; | 108 | --this._matchIndex; |
109 | this.hint = this._getHintDifference(); | 109 | this.hint = this._getHintDifference(); |
110 | } | 110 | } |
@@ -135,7 +135,7 @@ exports.Hintable = Montage.create(Editable, { | |||
135 | /// revert to old value | 135 | /// revert to old value |
136 | this.value = (this._preEditValue); | 136 | this.value = (this._preEditValue); |
137 | this._sendEvent('revert'); | 137 | this._sendEvent('revert'); |
138 | console.log('reverting'); | 138 | //console.log('reverting'); |
139 | 139 | ||
140 | } | 140 | } |
141 | } | 141 | } |
@@ -157,6 +157,14 @@ exports.Hintable = Montage.create(Editable, { | |||
157 | 157 | ||
158 | this._super(arguments); | 158 | this._super(arguments); |
159 | 159 | ||
160 | /// Remove the phantom "<BR>" element that is generated when | ||
161 | /// content editable element is empty | ||
162 | this._children(this._element, function(item) { | ||
163 | return item.nodeName === 'BR'; | ||
164 | }).forEach(function(item) { | ||
165 | this._element.removeChild(item); | ||
166 | }, this); | ||
167 | |||
160 | if(k === 39) { | 168 | if(k === 39) { |
161 | selection = window.getSelection(); | 169 | selection = window.getSelection(); |
162 | text = selection.baseNode.textContent; | 170 | text = selection.baseNode.textContent; |
@@ -180,7 +188,7 @@ exports.Hintable = Montage.create(Editable, { | |||
180 | 188 | ||
181 | var val = this.value, | 189 | var val = this.value, |
182 | matches, hint; | 190 | matches, hint; |
183 | console.log('val = "' + val + '"'); | 191 | //console.log('val = "' + val + '"'); |
184 | //// Handle auto-suggest if configured | 192 | //// Handle auto-suggest if configured |
185 | if(this.hints instanceof Array) { | 193 | if(this.hints instanceof Array) { |
186 | 194 | ||