yesod-form-richtext-0.1.0.2: Various rich-text WYSIWYG editors for Yesod forms.

Safe HaskellNone
LanguageHaskell2010

Yesod.Form.Summernote

Description

Provide the user with the Summernote rich text editor.

NOTES:

Editor fields have hidden textareas which are updated automatically when editor contents changes.

summerForm :: Form HtmlComment
summerForm = renderBootstrap3 BootstrapBasicForm $ HtmlComment
  <$> areq (snHtmlFieldCustomized "{toolbar:false}") "Title" Nothing
  <*> areq snHtmlField "Comment" Nothing

Synopsis

Documentation

class Yesod a => YesodSummernote a where Source #

Methods

urlBootstrapCss :: a -> Either (Route a) Text Source #

Bootstrap 3 CSS location.

urlBootstrapScript :: a -> Either (Route a) Text Source #

Bootstrap 3 library location.

urlJQueryScript :: a -> Either (Route a) Text Source #

JQuery library location.

urlSummernoteCss :: a -> Either (Route a) Text Source #

Summernote Editor CSS location.

urlSummernoteScript :: a -> Either (Route a) Text Source #

Summernote Editor library location.

summernoteLoadLibrariesAndCss :: a -> Bool Source #

Should required libraries and scripts be added in DOM tree? This property required to control script loading. In case if you load JQuery, Bootstrap, and Summernote libraries and CSS in head it is not necessary to load them second time, moreover this could bring some issues, for example if JQuery is loaded second time it could brake AJAX configuration from defaultCsrfMiddleware. Setting this to True could be useful in case you need single instance of editor on some pages only.

snHtmlField :: (YesodSummernote site, Monad m) => Field (HandlerT site m) Html Source #

Summernote editor field with default settings.

snHtmlFieldCustomized :: (YesodSummernote site, Monad m) => String -> Field (HandlerT site m) Html Source #

Customizable Summernote editor field.

cfg argument should be a JSON formatted string, it will be passed to $.summernote() call as first argument.

snHtmlFieldCustomized "{ height: 150, codemirror: { theme:monokai } }"