From 86c6839115a17647019b3e3652201a39815c7448 Mon Sep 17 00:00:00 2001 From: Eric Forgy Date: Sat, 29 Dec 2018 22:41:44 +0800 Subject: [PATCH] Insert PlotlyJSDisplay just after REPL instead of pushing. (#258) --- src/PlotlyJS.jl | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/PlotlyJS.jl b/src/PlotlyJS.jl index 3ae0ed2e..212c5335 100644 --- a/src/PlotlyJS.jl +++ b/src/PlotlyJS.jl @@ -77,7 +77,15 @@ function __init__() @info("plotly.js javascript libary not found -- downloading now") include(joinpath(_pkg_root, "deps", "build.jl")) end - pushdisplay(PlotlyJSDisplay()) + + insert!(Base.Multimedia.displays, findlast(x -> x isa Base.TextDisplay || x isa REPL.REPLDisplay, Base.Multimedia.displays) + 1, PlotlyJSDisplay()) + + atreplinit(i -> begin + while PlotlyJSDisplay() in Base.Multimedia.displays + popdisplay(PlotlyJSDisplay()) + end + insert!(Base.Multimedia.displays, findlast(x -> x isa REPL.REPLDisplay, Base.Multimedia.displays) + 1, PlotlyJSDisplay()) + end) end end # module