Use monospace font for unhandled errors

The browsers uses crude layout formatting that expects this.
This commit is contained in:
Pierre Ossman 2017-03-02 14:20:03 +01:00
parent 5abbdf5a51
commit c361080be8
2 changed files with 5 additions and 13 deletions

View File

@ -6,16 +6,6 @@
(function(){ (function(){
"use strict"; "use strict";
function convertNewlines(msg, parentElem) {
const lines = msg.split("\n");
lines.forEach(function (line) {
parentElem.appendChild(document.createElement("br"));
parentElem.appendChild(document.createTextNode(line));
});
parentElem.removeChild(parentElem.firstChild);
return parentElem;
}
// Fallback for all uncought errors // Fallback for all uncought errors
function handleError (event, err) { function handleError (event, err) {
try { try {
@ -28,7 +18,7 @@
var div = document.createElement("div"); var div = document.createElement("div");
div.classList.add('noVNC_message'); div.classList.add('noVNC_message');
convertNewlines(event.message, div); div.appendChild(document.createTextNode(event.message));
msg.appendChild(div); msg.appendChild(div);
if (event.filename !== undefined && event.lineno !== undefined && event.colno !== undefined) { if (event.filename !== undefined && event.lineno !== undefined && event.colno !== undefined) {

View File

@ -231,7 +231,6 @@ select:active {
text-align: center; text-align: center;
font-weight: bold; font-weight: bold;
word-wrap: break-word;
color: #fff; color: #fff;
border-radius: 10px; border-radius: 10px;
@ -251,6 +250,8 @@ select:active {
#noVNC_fallback_errormsg .noVNC_message { #noVNC_fallback_errormsg .noVNC_message {
display: inline-block; display: inline-block;
text-align: left; text-align: left;
font-family: monospace;
white-space: pre-wrap;
} }
#noVNC_fallback_error .noVNC_location { #noVNC_fallback_error .noVNC_location {
@ -264,7 +265,8 @@ select:active {
margin: 10px; margin: 10px;
font-size: 0.8em; font-size: 0.8em;
text-align: left; text-align: left;
white-space: pre; font-family: monospace;
white-space: pre-wrap;
border: 1px solid rgba(0, 0, 0, 0.5); border: 1px solid rgba(0, 0, 0, 0.5);
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
} }