From c361080be8e4275d4b74a79193f02e0cf25b0348 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Thu, 2 Mar 2017 14:20:03 +0100 Subject: [PATCH] Use monospace font for unhandled errors The browsers uses crude layout formatting that expects this. --- app/error-handler.js | 12 +----------- app/styles/base.css | 6 ++++-- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/app/error-handler.js b/app/error-handler.js index 30f7706..ecfb2b0 100644 --- a/app/error-handler.js +++ b/app/error-handler.js @@ -6,16 +6,6 @@ (function(){ "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 function handleError (event, err) { try { @@ -28,7 +18,7 @@ var div = document.createElement("div"); div.classList.add('noVNC_message'); - convertNewlines(event.message, div); + div.appendChild(document.createTextNode(event.message)); msg.appendChild(div); if (event.filename !== undefined && event.lineno !== undefined && event.colno !== undefined) { diff --git a/app/styles/base.css b/app/styles/base.css index 62a0628..f7c5de4 100644 --- a/app/styles/base.css +++ b/app/styles/base.css @@ -231,7 +231,6 @@ select:active { text-align: center; font-weight: bold; - word-wrap: break-word; color: #fff; border-radius: 10px; @@ -251,6 +250,8 @@ select:active { #noVNC_fallback_errormsg .noVNC_message { display: inline-block; text-align: left; + font-family: monospace; + white-space: pre-wrap; } #noVNC_fallback_error .noVNC_location { @@ -264,7 +265,8 @@ select:active { margin: 10px; font-size: 0.8em; text-align: left; - white-space: pre; + font-family: monospace; + white-space: pre-wrap; border: 1px solid rgba(0, 0, 0, 0.5); background: rgba(0, 0, 0, 0.2); } -- 2.39.5