posit-dev / positron

Positron, a next-generation data science IDE
Other
2.2k stars 65 forks source link

Should the viewer pane display the page title? #3693

Open seeM opened 1 month ago

seeM commented 1 month ago

Here's what it currently looks like:

image

Perhaps we could use a similar treatment to the help pane – although without the history navigation?

image
nstrayer commented 1 month ago

Do you mean adding a small header that has the title of the page? Or replacing the URL?

seeM commented 1 month ago

I think the URL is helpful too, so maybe a small header below that. What do you think?

nstrayer commented 1 month ago

Im mildly weary of taking up more vertical space, but I guess it works fine for help. Another alternative would be the title displaying over the url bar which then on hover, hides to give the user access to the url bar functionality.

seeM commented 1 month ago

Yeah it's not unusual in Positron/VSCode to have two action bars taking vertical space. I think I'd start to get worried at 3 though.

jmcphers commented 3 weeks ago

In #4151 I added some plumbing to show the page title instead of the URL. Here's a page with a <title>ggplot2 demo</title>:

image

However, we currently only show this for HTML files / widgets, since those don't have a meaningful URL and 95% of the file paths are randomly named temp files in the temp dir.

We also need to cheat a little to read the title, since security policy ordinarily would prevent us from being able to read the title inside the <iframe>; the cheat in this case is using the Electron APIs to inject some JavaScript on the page that fires a did-load-window postmessage from inside the iframe to let the parent know what its title is.