[mod] auto focus on message input
Christian Fraß

Christian Fraß commited on 2021-11-20 19:04:25
Zeige 2 geänderte Dateien mit 16 Einfügungen und 14 Löschungen.

... ...
@@ -406,7 +406,7 @@ namespace ns_model
406 406
 		if ((user_name !== model.nickname) && (! model.queries.hasOwnProperty(user_name)))
407 407
 		{
408 408
 			model.queries[user_name] = {"entries": []};
409
-			notify(model, "spots_changed");
409
+			set_active(model, {"kind": "query", "name": user_name});
410 410
 		}
411 411
 		else
412 412
 		{
... ...
@@ -1,6 +1,19 @@
1 1
 namespace ns_view
2 2
 {
3 3
 	
4
+	/**
5
+	 * clears the content and focus on the message content input
6
+	 */
7
+	function clear_content
8
+	(
9
+	): void
10
+	{
11
+		let dom_content: HTMLInputElement = document.querySelector<HTMLInputElement>("#content");
12
+		dom_content.value = "";
13
+		dom_content.focus();
14
+	}
15
+	
16
+	
4 17
 	/**
5 18
 	 * updates the state (switches between login, connecting and regular "page")
6 19
 	 */
... ...
@@ -51,6 +64,8 @@ namespace ns_view
51 64
 		}
52 65
 		// meeh…
53 66
 		ns_control.setup(conf, model);
67
+		
68
+		clear_content();
54 69
 	}
55 70
 
56 71
 
... ...
@@ -207,19 +222,6 @@ namespace ns_view
207 222
 	}
208 223
 
209 224
 
210
-	/**
211
-	 * clears the content and focus on the message content input
212
-	 */
213
-	function clear_content
214
-	(
215
-	): void
216
-	{
217
-		let dom_content: HTMLInputElement = document.querySelector<HTMLInputElement>("#content");
218
-		dom_content.value = "";
219
-		dom_content.focus();
220
-	}
221
-
222
-
223 225
 	/**
224 226
 	 * sets up the view
225 227
 	 */
226 228