Selaa lähdekoodia

support newlines in event titles

Adam Shaw 15 vuotta sitten
vanhempi
sitoutus
c0c144569f
2 muutettua tiedostoa jossa 8 lisäystä ja 3 poistoa
  1. 3 3
      src/util.js
  2. 5 0
      tests/sources.html

+ 3 - 3
src/util.js

@@ -510,12 +510,12 @@ function smartProperty(obj, name) { // get a camel-cased/namespaced property of
 }
 
 function htmlEscape(s) {
-	return s
-		.replace(/&/g, '&')
+	return s.replace(/&/g, '&')
 		.replace(/</g, '&lt;')
 		.replace(/>/g, '&gt;')
 		.replace(/'/g, '&#039;')
-		.replace(/"/g, '&quot;');
+		.replace(/"/g, '&quot;')
+		.replace(/\n/g, '<br />');
 }
 
 

+ 5 - 0
tests/sources.html

@@ -25,6 +25,11 @@
 			start: new Date(y, m, d-5),
 			end: new Date(y, m, d-2)
 		},
+		{
+			title: 'Event with \n newline',
+			start: new Date(y, m, d),
+			end: new Date(y, m, d)
+		},
 		{
 			title: 'T event',
 			start: y + '-06-06T10:20:00',