YAET, a project I built using Xterm.js, has a WebviewAddon #5110
Replies: 2 comments 3 replies
-
Wow - interesting, that you got it working this way. The image addon is a bit tricky as a base here - it does real cell alignment & cropping, which would not work with an iframe that easy (you cannot simply render half of an iframe, would need offset tricks instead). Thats also the reason for the (hacky) bufferline type extension - I had to put the image tile info into the terminal buffer somehow to allow real inline images, that correctly move with the scrollbuffer. I see def. potential for such an addon, as I also strive for better document-based data handling in the terminal (see #4943 for a rough sketch). You also might want to have a look at DomTerm, imho @PerBothner already has built an HTML integration there. That being said, I also want to place a warning here - security. HTML itself brings several vectors to the table, so you might want to secure/seclude the iframe as much as possible. Furthermore opening a webpage on the terminal's user side imposes a risk - the client side can be identified/tracked. Thats a surprising behavior in a terminal context, as they are typically used to do all communications through the terminal connection. So this either needs a very big disclaimer to teach peeps, or even better - try to figure out, how to properly re-route the page loading through the terminal session (really hard one, and prolly only possible in electron context). |
Beta Was this translation helpful? Give feedback.
-
As @jerch mentioned, DomTerm has long supported embedded HTML (with sanitization, of course). The Features page and the Python tips page show some examples of what can be done. See Wire-protocol - specifically I have been working on HTML support for xterm.js in this branch.This builds on the BufferLine rewrite (PR #4928) branch. (Work on both has been very slow recently because I've been distracted by construction at my house.) I have enhanced DomTerm so it can experimentally and optionally use the xterm.js engine as opposed to DomTerm's native engine; I use this to test the xterm.js HTML branch. While native DomTerm supports inlne HTML chunks, I believe the priority is "block" content (e.g. |
Beta Was this translation helpful? Give feedback.
-
Hello everyone, recently I released a terminal emulator under the MIT license using Xterm.js called YAET. What sets it apart from other terminal emulators is that shell scripts and other programs can display iframes using custom OSC sequences. Special thanks to @jerch on #2300 who helped me iron out how I formatted those.
This is very experimental so I already know dozens of things that are wrong with it, but I'd love to here about some more as well.
I wrote an addon for Xterm.js to get this working. Although most of my project is written in vanilla javascript I wrote the addon in typescript to keep the same conventions/structure used in other Xterm.js addons. That said, my addon is still really rough around the edges and I may have done some things improperly (and I typed things as
any
a few times like a chump; I'd definitely like to fix that). I mostly looked at the image addon as a reference, which is how I figured out how to use cell attributes to determine when I should render the iframes.I've been asked about the usefulness of rendering webpages in the terminal. I'll explain briefly here. Once a postMessage API is added that can communicate back to the program running under the terminal, it will be possible to render rich UI components, fancy progress bars, and all sorts of things like that. Maybe not everyone's cup of tea, but I think it's very cool and it would not be possible without Xterm.js.
Beta Was this translation helpful? Give feedback.
All reactions