hyper-haskell icon indicating copy to clipboard operation
hyper-haskell copied to clipboard

Add URL cells

Open ggreif opened this issue 9 years ago • 5 comments

These can probably modeled just like text cells. I have no idea whether the JS part supports URL-loading, though.

In the meantime I found a stop-gap solution for showing locally stored html/svg files:

import qualified Data.Text.IO (readFile)
import System.IO.Unsafe (unsafePerformIO)

readSVG = html . unsafePerformIO . Data.Text.IO.readFile

Then in an evaluation cell you can put readSVG "my.svg". The bad thing is that I have to re-evaluate those cells after opening the worksheet.

ggreif avatar Nov 22 '16 14:11 ggreif

I am not sure I understand. Could you describe in more detail what you mean by "URL cell"? The closest comparison I know is Mathematica, and I have never seen this concept there before.

HeinrichApfelmus avatar Nov 22 '16 19:11 HeinrichApfelmus

You create an URL-cell, enter http://wikipedia.org/some.svg and it appears in the displayed part as an image. For e.g. illustration purposes.

ggreif avatar Nov 22 '16 19:11 ggreif

Browsing a bit gave me webview

ggreif avatar Nov 22 '16 20:11 ggreif

I tried this and it (almost) worked:

import Data.Text
html $ pack "<webview src='https://rawgit.com/ggreif/omega/wiki/Letrec.svg'/>"

Working on better integration now.

ggreif avatar Nov 22 '16 21:11 ggreif

ggreif@7070b9c7d98d28392f3d384563d76fef64e7433d contains a glimpse of what I am implementing. Still missing:

  • [ ] automatic loadURL when worksheet is loaded
  • [x] loading progress indicator
  • [x] use Quill instead of CodeMirror
  • [ ] svg auto-resizing
  • [ ] basic URL validation

ggreif avatar Nov 22 '16 22:11 ggreif