From 61d47190a8f15bd3355dca57b87c0ce87df4a25c Mon Sep 17 00:00:00 2001 From: Otto Chrons Date: Mon, 2 Apr 2018 21:01:51 +0300 Subject: [PATCH] Change default font in output panel to non-monospace and use monospace explicitly in println. --- page/src/main/scala/fiddle/Fiddle.scala | 4 +-- router/src/main/resources/common.css | 9 +++++++ router/src/main/resources/libraries.json | 25 ++++++++++++++++--- .../scalafiddle/router/frontend/Static.scala | 2 +- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/page/src/main/scala/fiddle/Fiddle.scala b/page/src/main/scala/fiddle/Fiddle.scala index 3870766..14d6418 100644 --- a/page/src/main/scala/fiddle/Fiddle.scala +++ b/page/src/main/scala/fiddle/Fiddle.scala @@ -38,11 +38,11 @@ object Fiddle { def println(ss: Any) = { ss match { case null => - print(div(cls := "", "null")) + print(div(cls := "monospace", "null")) case m: Modifier @unchecked => print(div(m)) case _ => - print(div(ss.toString)) + print(div(cls := "monospace", ss.toString)) } } diff --git a/router/src/main/resources/common.css b/router/src/main/resources/common.css index d7a3ddb..6b27111 100644 --- a/router/src/main/resources/common.css +++ b/router/src/main/resources/common.css @@ -202,6 +202,9 @@ select { padding-top: 0.2em; box-sizing: border-box; font-size: 14px; +} + +.monospace { font-family: Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace; text-rendering: optimizeLegibility; white-space: pre; @@ -213,6 +216,12 @@ body, pre { color: #878787; } +pre { + font-family: Monaco, Menlo, 'Ubuntu Mono', Consolas, source-code-pro, monospace; + text-rendering: optimizeLegibility; + white-space: pre; +} + pre.error { color: #822; } diff --git a/router/src/main/resources/libraries.json b/router/src/main/resources/libraries.json index 35ae129..37c75ac 100644 --- a/router/src/main/resources/libraries.json +++ b/router/src/main/resources/libraries.json @@ -11,9 +11,12 @@ { "version": "1.2.0", "scalaVersions": ["2.11", "2.12"], + "extraDeps": [ + "com.github.japgolly.scalajs-react %%% extra % 1.2.0" + ], "jsDeps": [ - "react % 16.2.0 % https://unpkg.com/react@16/umd/react.development.js", - "react-dom % 16.2.0 % https://unpkg.com/react-dom@16/umd/react-dom.development.js" + "react % 16.3.0 % https://cdnjs.cloudflare.com/ajax/libs/react/16.3.0/umd/react.development.js", + "react-dom % 16.3.0 % https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.3.0/umd/react-dom.development.js" ] }, { @@ -31,7 +34,7 @@ "compileTimeOnly": false }, { - "name": "Scala.js React Components", + "name": "React Components", "organization": "com.olvind", "artifact": "scalajs-react-components", "doc": "chandu0101/scalajs-react-components", @@ -52,6 +55,22 @@ ], "compileTimeOnly": false }, + { + "name": "D3", + "organization": "org.singlespaced", + "artifact": "scalajs-d3", + "doc": "spaced/scala-js-d3", + "versions": [ + { + "version": "0.3.4", + "scalaVersions": ["2.11", "2.12"], + "jsDeps": [ + "d3js % 3.5.17 % https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js" + ] + } + ], + "compileTimeOnly": false + }, { "name": "Diode", "organization": "io.suzaku", diff --git a/router/src/main/scala/scalafiddle/router/frontend/Static.scala b/router/src/main/scala/scalafiddle/router/frontend/Static.scala index 5c4d6f6..e6d6773 100644 --- a/router/src/main/scala/scalafiddle/router/frontend/Static.scala +++ b/router/src/main/scala/scalafiddle/router/frontend/Static.scala @@ -300,7 +300,7 @@ object Static { | loads.then(function() { | try { | eval(code); - | eval("var sf = ScalaFiddle;if(typeof sf === 'function' && typeof sf().main === 'function') sf().main();"); + | eval("var sf = ScalaFiddle;if(typeof sf === 'function') { if(typeof sf().main === 'function') sf().main() } else if(typeof sf.main === 'function') sf.main()"); | } catch(ex) { | panel.insertAdjacentHTML('beforeend', '
ERROR: ' + ex.message + '\n' + ex.stack + '
') | } finally {