@@ -56,7 +56,7 @@ function isEmpty(textarea) {
56
56
}
57
57
58
58
function prepareText ( text ) {
59
- return text || String . fromCharCode ( 160 ) ; // non breaking space, like
59
+ return text . replaceAll ( " " , " " ) ;
60
60
}
61
61
62
62
function getDimensions ( math , callback ) {
@@ -97,7 +97,6 @@ function translateDOMElement(element, svg) {
97
97
if ( element . nodeType === 3 ) {
98
98
return document . createTextNode ( element . nodeValue ) ;
99
99
}
100
-
101
100
const nodeName = element . nodeName ;
102
101
103
102
let dom = null ;
@@ -261,7 +260,6 @@ function translateDOMElement(element, svg) {
261
260
function createLine ( value ) {
262
261
const container = document . createElement ( 'div' ) ;
263
262
container . innerHTML = value ;
264
-
265
263
if ( container ?. firstElementChild ?. tagName === 'math' ) {
266
264
return translateDOMElement ( container . firstChild ) ;
267
265
} else if ( container ?. firstElementChild ?. tagName === 'GRAPHICS3D' ) {
@@ -287,18 +285,20 @@ function createLine(value) {
287
285
return container ;
288
286
} else {
289
287
const lines = container . innerText . split ( '\n' ) ;
290
-
291
288
const p = document . createElement ( 'p' ) ;
292
289
p . className = 'string' ;
290
+ if ( lines . length > 1 ) {
291
+ p . style . textAlign = 'justify' ;
292
+ }
293
293
294
294
for ( let i = 0 ; i < lines . length ; i ++ ) {
295
- p . innerText += prepareText ( lines [ i ] ) ;
295
+ newline = prepareText ( lines [ i ] ) ;
296
+ p . innerHTML += newline ;
296
297
297
298
if ( i < lines . length - 1 ) {
298
299
p . appendChild ( document . createElement ( 'br' ) ) ;
299
300
}
300
301
}
301
-
302
302
return p ;
303
303
}
304
304
}
@@ -477,7 +477,7 @@ function setResult(list, results) {
477
477
li . innerText += out . prefix + ': ' ;
478
478
}
479
479
480
- li . appendChild ( createLine ( out . text ) ) ;
480
+ li . appendChild ( createLine ( out . text . slice ( 1 , - 1 ) ) ) ;
481
481
482
482
resultList . appendChild ( li ) ;
483
483
} ) ;
0 commit comments