Skip to content

Commit accb03d

Browse files
committed
fix #51
1 parent 4d5604b commit accb03d

File tree

3 files changed

+9
-17
lines changed

3 files changed

+9
-17
lines changed

Project.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "PlotlyLight"
22
uuid = "ca7969ec-10b3-423e-8d99-40f33abb42bf"
33
authors = ["joshday <[email protected]>"]
4-
version = "0.11.0"
4+
version = "0.11.1"
55

66
[deps]
77
Artifacts = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
@@ -10,6 +10,7 @@ Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
1010
Downloads = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
1111
EasyConfig = "acab07b0-f158-46d4-8913-50acef6d41fe"
1212
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
13+
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
1314
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
1415

1516
[compat]
@@ -20,6 +21,7 @@ Dates = "1.11.0"
2021
Downloads = "1.6"
2122
EasyConfig = "0.1"
2223
JSON3 = "1.14"
24+
REPL = "1.11.0"
2325
julia = "1.7"
2426

2527
[extras]

src/PlotlyLight.jl

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ using Artifacts: @artifact_str
44
using Downloads: download
55
using Random: randstring
66
using Dates
7+
using REPL: REPLDisplay
78

89
using JSON3: JSON3
910
using EasyConfig: Config
@@ -13,15 +14,6 @@ using Cobweb: Cobweb, h, IFrame, Node
1314
export Config, preset, Plot, plot
1415

1516
#-----------------------------------------------------------------------------# __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-
2517
include("json.jl")
2618

2719
artifact(x...) = joinpath(artifact"plotly_artifacts", x...)
@@ -133,7 +125,7 @@ end
133125
rand_id() = "plotlyx-" * join(rand('a':'z', 10))
134126

135127
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))
137129
end
138130

139131
function html_page(o::Plot, id=rand_id())
@@ -165,6 +157,9 @@ function Base.show(io::IO, ::MIME"text/html", o::Plot)
165157
end
166158
Base.show(io::IO, ::MIME"juliavscode/html", o) = show(io, MIME("text/html"), o)
167159

160+
Base.display(::REPLDisplay, o::Plot) = Cobweb.preview(html_page(o), reuse=settings.reuse_preview)
161+
162+
168163
#-----------------------------------------------------------------------------# preset
169164
# `preset_template_<X>` overwrites `settings.layout.template`
170165
# `preset_src_<X>` overwrites `settings.src`

test/runtests.jl

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
using PlotlyLight
1+
using PlotlyLight, Cobweb, Test, Aqua, Dates, JSON3
22
using PlotlyLight: settings, Plot, json
3-
using Cobweb
4-
using Cobweb: h
5-
using JSON3: JSON3
6-
using Test
7-
using Aqua
83

94
html(x) = repr("text/html", x)
105

0 commit comments

Comments
 (0)