Add autosize call for all external textarea value changes
This commit is contained in:
		
					parent
					
						
							
								5c3abe0ca6
							
						
					
				
			
			
				commit
				
					
						f15bb6c516
					
				
			
		
					 5 changed files with 12 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -65,7 +65,7 @@ ACL.prototype.add_mention = function(id) {
 | 
			
		|||
	if (this.element.val().indexOf( searchText) >= 0 ) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
	this.element.val(searchText + this.element.val());
 | 
			
		||||
	this.element.val(searchText + this.element.val()).trigger('change');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
ACL.prototype.on_submit = function(){
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -166,7 +166,7 @@ function listNewLineAutocomplete(id) {
 | 
			
		|||
	if (word != null) {
 | 
			
		||||
		var textBefore = text.value.substring(0, caretPos);
 | 
			
		||||
		var textAfter  = text.value.substring(caretPos, text.length);
 | 
			
		||||
		$('#' + id).val(textBefore + '\r\n[*] ' + textAfter);
 | 
			
		||||
		$('#' + id).val(textBefore + '\r\n[*] ' + textAfter).trigger('change');
 | 
			
		||||
		setCaretPosition(text, caretPos + 5);
 | 
			
		||||
		return true;
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -101,6 +101,7 @@
 | 
			
		|||
			var start = textarea.selectionStart;
 | 
			
		||||
			var end = textarea.selectionEnd;
 | 
			
		||||
			textarea.value = textarea.value.substring(0, start) + bbcode + textarea.value.substring(end, textarea.value.length);
 | 
			
		||||
			$(textarea).trigger('change');
 | 
			
		||||
		});
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -30,6 +30,8 @@ function insertFormatting(BBcode,id) {
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	$(textarea).trigger('change');
 | 
			
		||||
 | 
			
		||||
	return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -300,6 +300,13 @@ $(document).ready(function(){
 | 
			
		|||
		});
 | 
			
		||||
	});
 | 
			
		||||
 | 
			
		||||
	/*
 | 
			
		||||
	 * This event listeners ensures that the textarea size is updated event if the
 | 
			
		||||
	 * value is changed externally (textcomplete, insertFormatting, fbrowser...)
 | 
			
		||||
	 */
 | 
			
		||||
	$(document).on('change', 'textarea', function(event) {
 | 
			
		||||
		autosize.update(event.target);
 | 
			
		||||
	});
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function openClose(theID) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue