ace2_inner: when atext.text is "", replace with "\n"

The server is fine with atext.text being an empty string, but the front end is
not, and crashes.

It is not clear if this is a problem in the server or in the client code, and
this is a client-side hack fix. The underlying problem needs to be
investigated.

See for reference:
- https://github.com/ether/etherpad-lite/issues/3861
pull/3906/head
John McLear 2020-04-13 18:16:33 +00:00 committed by muxator
parent 70990afd66
commit 51e40ddbc9
1 changed files with 16 additions and 0 deletions

View File

@ -737,6 +737,22 @@ function Ace2Inner(){
function setDocAText(atext)
{
if (atext.text === "") {
/*
* The server is fine with atext.text being an empty string, but the front
* end is not, and crashes.
*
* It is not clear if this is a problem in the server or in the client
* code, and this is a client-side hack fix. The underlying problem needs
* to be investigated.
*
* See for reference:
* - https://github.com/ether/etherpad-lite/issues/3861
*/
console.warn('atext.text is an empty string(""). Replacing with "\\n". See issue #3861.');
atext.text = "\n";
}
fastIncorp(8);
var oldLen = rep.lines.totalWidth();