view examples/ckedit.ur @ 34:2d195bee1efa

CKeditor wrapper
author Adam Chlipala <adam@chlipala.net>
date Thu, 21 Nov 2013 18:19:02 -0500
parents
children
line wrap: on
line source
open Ckeditor

fun make1 () =
    editor <- editor {Width = DefaultSize,
                      Height = DefaultSize,
                      ToolbarSet = DefaultToolbarSet};
    return <xml>
      {show editor}
      <hr/>
      <button onclick={fn _ => s <- content editor; alert s}/>
    </xml>

fun make2 () =
    editor <- editor {Width = Percent 50,
                      Height = Pixels 500,
                      ToolbarSet = Custom (
                      Bar {Nam = Some "bloop", Buttons = Cut :: Separator :: Paste :: []}
                          :: Newline
                          :: Bar {Nam = None, Buttons = Bold :: []}
                          :: [])};
    return <xml>
      {show editor}
      <hr/>
      <button onclick={fn _ => s <- content editor; alert s}/>
    </xml>

fun main () =
    spot1 <- source <xml/>;
    spot2 <- source <xml/>;
    return <xml><body onload={x1 <- make1 (); set spot1 x1;
                              x2 <- make2 (); set spot2 x2}>
      <dyn signal={signal spot1}/>
      <hr/>
      <dyn signal={signal spot2}/>
    </body></xml>