Update line endings
* Ensure that both textbox's heights are updated properly after typing over 140 characters in the first box * Normalize line endings on text before storing it in the database. To update the database, I also ran: for t in Thought.objects.all(): t.extended_text = t.extended_text.replace("\r\n", "\n") t.text = t.text.replace("\r\n", "\n") t.save()
This commit is contained in:
parent
be2bcf2770
commit
9d548ef55f
|
@ -77,11 +77,11 @@
|
|||
textEl.selectionStart = startPos;
|
||||
textEl.selectionEnd = endPos;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Auto-set width of short text box
|
||||
//textEl.style.width = "auto";
|
||||
//textEl.style.width = textEl.scrollWidth + "px";
|
||||
//Resize both text boxes
|
||||
updateBoxHeight(textExtEl);
|
||||
updateBoxHeight(textEl);
|
||||
}
|
||||
});
|
||||
|
||||
const textboxes = document.getElementsByClassName("thought");
|
||||
|
|
|
@ -64,12 +64,13 @@ def post(request):
|
|||
if len(request.POST["text"].strip()) == 0:
|
||||
return HttpResponse("Need some text.", status=400)
|
||||
|
||||
if len(request.POST["text"]) > 140:
|
||||
text = request.POST["text"].replace("\r\n", "\n")
|
||||
if len(text) > 140:
|
||||
return HttpResponse("Content too long", status=400)
|
||||
|
||||
thought = Thought(
|
||||
text=request.POST["text"],
|
||||
extended_text=request.POST["extended_text"],
|
||||
text=text,
|
||||
extended_text=request.POST["extended_text"].replace("\r\n", "\n"),
|
||||
timezone_offset=request.POST["timezone_offset"]
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in New Issue