|
1210 | 1210 | {:keys [hider-bars]
|
1211 | 1211 | :as print-options} :print-options
|
1212 | 1212 | editor-reset-ref :editor-reset
|
1213 |
| - visr-run-ref :visr-run}]] |
| 1213 | + visr-run-ref :visr-run |
| 1214 | + visual-syntax :visual-syntax}]] |
1214 | 1215 | (let [edit (atom nil)
|
1215 | 1216 | visrs (atom {})
|
1216 | 1217 | key (random-uuid)
|
|
1253 | 1254 | (reset! visrs {})
|
1254 | 1255 | (when editor-reset-ref
|
1255 | 1256 | (reset! editor-reset-ref true))
|
1256 |
| - (env/reset-editors! @input set-text edit visrs cache |
1257 |
| - (codemirror-options) db #() |
1258 |
| - {:for-print for-print |
1259 |
| - :hider-bars hider-bars |
1260 |
| - :visr-run visr-run-ref})))) |
| 1257 | + (when visual-syntax |
| 1258 | + (env/reset-editors! @input set-text edit visrs cache |
| 1259 | + (codemirror-options) db #() |
| 1260 | + {:for-print for-print |
| 1261 | + :hider-bars hider-bars |
| 1262 | + :visr-run visr-run-ref}))))) |
1261 | 1263 | (add-watch cache ::set-running?
|
1262 | 1264 | (fn [k r o n]
|
1263 | 1265 | (when (and editor-reset-ref (empty? (:queue n)))
|
|
1280 | 1282 | hider-bars :hider-bars
|
1281 | 1283 | :theme "neat"
|
1282 | 1284 | :as print-options} :print-options
|
| 1285 | + visual-syntax :visual-syntax |
1283 | 1286 | editor-reset-ref :editor-reset
|
1284 | 1287 | visr-run-ref :visr-run}]]
|
1285 | 1288 | @current-file
|
|
1299 | 1302 | (reset! input value)
|
1300 | 1303 | (when editor-reset-ref
|
1301 | 1304 | (reset! editor-reset-ref true))
|
1302 |
| - (env/reset-editors! @input set-text edit visrs |
1303 |
| - cache (codemirror-options) db |
1304 |
| - #() {:for-print for-print |
1305 |
| - :hider-bars hider-bars |
1306 |
| - :visr-run visr-run-ref})) |
| 1305 | + (when visual-syntax |
| 1306 | + (env/reset-editors! @input set-text edit visrs |
| 1307 | + cache (codemirror-options) db |
| 1308 | + #() {:for-print for-print |
| 1309 | + :hider-bars hider-bars |
| 1310 | + :visr-run visr-run-ref}))) |
1307 | 1311 | :onCursor (fn [editor data]
|
1308 | 1312 | (reset! cursor data))
|
1309 | 1313 | :onScroll (fn [editor data]
|
|
1337 | 1341 | (reset! editor-ref e))
|
1338 | 1342 | (when editor-reset-ref
|
1339 | 1343 | (reset! editor-reset-ref true))
|
1340 |
| - (env/reset-editors! @input set-text edit visrs |
1341 |
| - cache (codemirror-options) db |
1342 |
| - #(reset! mounted? true) |
1343 |
| - {:for-print for-print |
1344 |
| - :hider-bars hider-bars |
1345 |
| - :visr-run visr-run-ref}))}] |
| 1344 | + (when visual-syntax |
| 1345 | + (env/reset-editors! @input set-text edit visrs |
| 1346 | + cache (codemirror-options) db |
| 1347 | + #(reset! mounted? true) |
| 1348 | + {:for-print for-print |
| 1349 | + :hider-bars hider-bars |
| 1350 | + :visr-run visr-run-ref})))}] |
1346 | 1351 | (when for-print
|
1347 | 1352 | [:style {:type "text/css" :media "print"}
|
1348 | 1353 | (css [:.CodeMirror-linenumber
|
|
1354 | 1359 |
|
1355 | 1360 | (defn result-view [{:keys [output options]
|
1356 | 1361 | :as db}
|
1357 |
| - & [repl-ref]] |
| 1362 | + & [{repl-ref :editor |
| 1363 | + visual-syntax :visual-syntax}]] |
1358 | 1364 | (let [edit (atom nil)
|
1359 | 1365 | cache (env/make-reset-editors-cache)
|
1360 | 1366 | instances (atom [])
|
|
1397 | 1403 | (add-watch output ::result-view watch-updater)
|
1398 | 1404 | (fn [{:keys [output options]
|
1399 | 1405 | :as db}
|
1400 |
| - & [repl-ref]] |
| 1406 | + & [{repl-ref :editor |
| 1407 | + visual-syntax :visual-syntax}]] |
1401 | 1408 | [:> cm/UnControlled
|
1402 | 1409 | {:value (string/join "\n" (filter string? @output))
|
1403 | 1410 | :options (conj (env/codemirror-options db)
|
|
1467 | 1474 | editor-reset-ref :editor-reset
|
1468 | 1475 | repl-ref :repl
|
1469 | 1476 | visr-run-ref :visr-run
|
| 1477 | + visual-syntax :visual-syntax |
1470 | 1478 | :as opts}]]
|
1471 | 1479 | (let [search (js/URLSearchParams. js/window.location.search)]
|
1472 | 1480 | (chonky/setChonkyDefaults
|
|
1537 | 1545 | :style {:height "100%"}}
|
1538 | 1546 | [editor-view db {:editor-reset editor-reset-ref
|
1539 | 1547 | :editor editor-ref
|
1540 |
| - :visr-run visr-run-ref}]] |
| 1548 | + :visr-run visr-run-ref |
| 1549 | + :visual-syntax visual-syntax}]] |
1541 | 1550 | (if @app-pane
|
1542 | 1551 | [:> SplitPane {:split (utils/swap-orientation @orientation)}
|
1543 | 1552 | [:> Pane {:initialSize 1}
|
1544 |
| - [result-view db repl-ref]] |
| 1553 | + [result-view db {:editor repl-ref |
| 1554 | + :visual-syntax visual-syntax}]] |
1545 | 1555 | @app-pane]
|
1546 |
| - [result-view db repl-ref])]] |
| 1556 | + [result-view db {:editor repl-ref |
| 1557 | + :visual-syntax visual-syntax}])]] |
1547 | 1558 | [:div {:style {:flex "1 1 auto"
|
1548 | 1559 | :overflow "auto"
|
1549 | 1560 | :height "100%"
|
|
1555 | 1566 | [:> SplitPane {:split @orientation}
|
1556 | 1567 | [editor-view db {:editor-reset editor-reset-ref
|
1557 | 1568 | :editor editor-ref
|
1558 |
| - :visr-run visr-run-ref}] |
| 1569 | + :visr-run visr-run-ref |
| 1570 | + :visual-syntax visual-syntax}] |
1559 | 1571 | [result-view db repl-ref]]]]])]))
|
1560 | 1572 |
|
1561 | 1573 | ;; -------------------------
|
|
1718 | 1730 | :gutters
|
1719 | 1731 | #js ["CodeMirror-linenumbers"]
|
1720 | 1732 | :foldGutter false}}]
|
1721 |
| - (.getElementById js/document "app")), |
| 1733 | + (.getElementById js/document "app")), |
1722 | 1734 | fullscreen? (utils/render [editor-view db]
|
1723 |
| - (.getElementById js/document "app")), |
1724 |
| - :else (utils/render [home-page db (when embedded? |
1725 |
| - {:editor-reset editor-reset-ref})] |
1726 |
| - (.getElementById js/document "app"))))))) |
| 1735 | + (.getElementById js/document "app")), |
| 1736 | + :else (utils/render |
| 1737 | + [home-page db |
| 1738 | + (if embedded? |
| 1739 | + {:editor-reset editor-reset-ref} |
| 1740 | + {:visual-syntax (not= visual-syntax "false")})] |
| 1741 | + (.getElementById js/document "app"))))))) |
1727 | 1742 |
|
1728 | 1743 | (defn init! [& [opts]]
|
1729 | 1744 | (mount-root opts))
|
|
0 commit comments