embeddable_html (#3559)

This commit is contained in:
Fons van der Plas 2021-06-09 09:01:40 +02:00 committed by GitHub
parent 019a742c84
commit 203af856cd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -986,7 +986,7 @@ end
function _show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend}) function _show(io::IO, ::MIME"text/html", plt::Plot{PlotlyBackend})
write(io, standalone_html(plt)) write(io, embeddable_html(plt))
end end

View File

@ -34,7 +34,7 @@ _show(io::IO, mime::MIME"application/vnd.plotly.v1+json", plt::Plot{PlotlyJSBack
html_head(plt::Plot{PlotlyJSBackend}) = plotly_html_head(plt) html_head(plt::Plot{PlotlyJSBackend}) = plotly_html_head(plt)
html_body(plt::Plot{PlotlyJSBackend}) = plotly_html_body(plt) html_body(plt::Plot{PlotlyJSBackend}) = plotly_html_body(plt)
_show(io::IO, ::MIME"text/html", plt::Plot{PlotlyJSBackend}) = write(io, standalone_html(plt)) _show(io::IO, ::MIME"text/html", plt::Plot{PlotlyJSBackend}) = write(io, embeddable_html(plt))
_display(plt::Plot{PlotlyJSBackend}) = display(plotlyjs_syncplot(plt)) _display(plt::Plot{PlotlyJSBackend}) = display(plotlyjs_syncplot(plt))

View File

@ -19,6 +19,10 @@ function standalone_html(plt::AbstractPlot; title::AbstractString = get(plt.attr
""" """
end end
function embeddable_html(plt::AbstractPlot)
html_head(plt) * html_body(plt)
end
function open_browser_window(filename::AbstractString) function open_browser_window(filename::AbstractString)
@static if Sys.isapple() @static if Sys.isapple()
return run(`open $(filename)`) return run(`open $(filename)`)