-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Various rich-text WYSIWYG editors for Yesod forms.
--   
--   Please see README.md
@package yesod-form-richtext
@version 0.1.0.1


-- | Provide the user with the Summernote rich text editor.
--   
--   <i>NOTES:</i>
--   
--   Editor fields have hidden textareas which are updated automatically
--   when editor contents changes.
--   
--   <pre>
--   summerForm :: Form HtmlComment
--   summerForm = renderBootstrap3 BootstrapBasicForm $ HtmlComment
--     &lt;$&gt; areq (snHtmlFieldCustomized "{toolbar:false}") "Title" Nothing
--     &lt;*&gt; areq snHtmlField "Comment" Nothing
--   </pre>
module Yesod.Form.Summernote
class Yesod a => YesodSummernote a where urlBootstrapCss _ = Right "http://netdna.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.css" urlBootstrapScript _ = Right "http://netdna.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.js" urlJQueryScript _ = Right "http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js" urlSummernoteCss _ = Right "http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.0/summernote.css" urlSummernoteScript _ = Right "http://cdnjs.cloudflare.com/ajax/libs/summernote/0.8.0/summernote.js" summernoteLoadLibrariesAndCss _ = False

-- | Bootstrap 3 CSS location.
urlBootstrapCss :: YesodSummernote a => a -> Either (Route a) Text

-- | Bootstrap 3 library location.
urlBootstrapScript :: YesodSummernote a => a -> Either (Route a) Text

-- | JQuery library location.
urlJQueryScript :: YesodSummernote a => a -> Either (Route a) Text

-- | Summernote Editor CSS location.
urlSummernoteCss :: YesodSummernote a => a -> Either (Route a) Text

-- | Summernote Editor library location.
urlSummernoteScript :: YesodSummernote a => a -> Either (Route a) Text

-- | 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
--   <tt><a>head</a></tt> 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
--   <a>defaultCsrfMiddleware</a>. Setting this to <tt>True</tt> could be
--   useful in case you need single instance of editor on some pages only.
summernoteLoadLibrariesAndCss :: YesodSummernote a => a -> Bool

-- | Summernote editor field with default settings.
snHtmlField :: (YesodSummernote site, MonadHandler m) => Field (HandlerT site m) Html

-- | Customizable Summernote editor field.
--   
--   <tt>cfg</tt> argument should be a JSON formatted string, it will be
--   passed to <tt>$.summernote()</tt> call as first argument.
--   
--   <pre>
--   snHtmlFieldCustomized "{ height: 150, codemirror: { theme:<tt>monokai</tt> } }"
--   </pre>
snHtmlFieldCustomized :: (YesodSummernote site, MonadHandler m) => String -> Field (HandlerT site m) Html
