Replies: 2 comments 3 replies
-
What do you mean by "a terminal on the browser" and "canvas/webgl"? Like you want to use the underlying terminal session for data transport, and render the images outside of the terminal yourself? Thats possible by doing these steps:
You can also have a look at https://github.com/jerch/xterm-addon-image, which supports sixel images for terminal inline printing. Other formats are not supported currently, but could be added by other format handlers. In https://github.com/jerch/xterm-addon-image/blob/a53916f327902bd2a0f77fcdef2756a3cdd2124c/src/SixelHandler.ts#L101 you see how to construct a canvas object, that you can pass over to your output system (skipping the |
Beta Was this translation helpful? Give feedback.
-
Thanks @jerch , I realize that I may be asking really rookie JS questions - I'd appreciate your patience :) The output I am going for is something like this - prompt> command 1 What I am struggling with is the ability to "import ImageAddon" After trying some, I figured that I would have to try the HTML with a server to get rid of some of the CORS issues. Even so, I cant seem to figure out how to use the image addon. My JS is in "main.js" that I src in from the HTML with the "type=module" and then I have the following import statement in main.js import { ImageAddon } from './node_modules/xterm-addon-image/lib/xterm-addon-image.js' I get the "ambiguous indirect export: ImageAddon". I also note that I did not have to do any of this to use "Terminal" - I simply scripit src'ed xterm.js and did a new Terminal. Perhaps the working sample for the screenshot at /node_modules/xterm-addon-image/lib/xterm-addon-image.js may help. |
Beta Was this translation helpful? Give feedback.
-
I am looking to build a demo that would be a terminal on the browser that will allow people to write commands that can output images (canvas/webgl). I looked for them but I could not really find it.
What would be awesome would be a standalone HTML sample that uses the published xterm.js and other addons. I'd really appreciate any pointers here.
Beta Was this translation helpful? Give feedback.
All reactions