@@ -4,6 +4,7 @@ using Artifacts: @artifact_str
4
4
using Downloads: download
5
5
using Random: randstring
6
6
using Dates
7
+ using REPL: REPLDisplay
7
8
8
9
using JSON3: JSON3
9
10
using EasyConfig: Config
@@ -13,15 +14,6 @@ using Cobweb: Cobweb, h, IFrame, Node
13
14
export Config, preset, Plot, plot
14
15
15
16
# -----------------------------------------------------------------------------# __init__
16
- function __init__ ()
17
- # Hack since extensions with REPL are wonky
18
- for M in Base. loaded_modules_order
19
- if Symbol (M) == :REPL
20
- @eval Base. display (:: $M.REPLDisplay , o:: Plot ) = Cobweb. preview (html_page (o))
21
- end
22
- end
23
- end
24
-
25
17
include (" json.jl" )
26
18
27
19
artifact (x... ) = joinpath (artifact " plotly_artifacts" , x... )
133
125
rand_id () = " plotlyx-" * join (rand (' a' :' z' , 10 ))
134
126
135
127
function html_div (o:: Plot , id= rand_id ())
136
- h. div (class= " plotlylight-parent" , settings. src, settings . src_inject... , settings. div (; id), NewPlotScript (o, settings, id))
128
+ h. div (class= " plotlylight-parent" , settings. src_inject... , settings . src , settings. div (; id), NewPlotScript (o, settings, id))
137
129
end
138
130
139
131
function html_page (o:: Plot , id= rand_id ())
@@ -165,6 +157,9 @@ function Base.show(io::IO, ::MIME"text/html", o::Plot)
165
157
end
166
158
Base. show (io:: IO , :: MIME"juliavscode/html" , o) = show (io, MIME (" text/html" ), o)
167
159
160
+ Base. display (:: REPLDisplay , o:: Plot ) = Cobweb. preview (html_page (o), reuse= settings. reuse_preview)
161
+
162
+
168
163
# -----------------------------------------------------------------------------# preset
169
164
# `preset_template_<X>` overwrites `settings.layout.template`
170
165
# `preset_src_<X>` overwrites `settings.src`
0 commit comments