Skip to content
This repository has been archived by the owner on Jun 20, 2018. It is now read-only.

Commit

Permalink
Merge pull request #46 from nhsuk/simplemde-cleanup
Browse files Browse the repository at this point in the history
Remove md spell checker, preview and placeholder
  • Loading branch information
marcofucci committed Jan 27, 2017
2 parents a9b9868 + 0d35813 commit 12f40bf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 11 additions & 1 deletion nhsuk/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,17 @@

WAGTAILADMIN_RICH_TEXT_EDITORS = {
'default': {
'WIDGET': 'wagtailmarkdown.rich_text.SimpleMDETextArea'
'WIDGET': 'wagtailmarkdown.rich_text.SimpleMDETextArea',
'OPTIONS': {
'spellChecker': False,
'placeholder': ' ',
'toolbar': [
"bold", "italic", "heading", "|",
"quote", "unordered-list", "ordered-list", "|",
"link", "|",
"guide"
],
}
},
}

Expand Down
7 changes: 3 additions & 4 deletions wagtailmarkdown/rich_text.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ def getDefaultArgs(cls):

def __init__(self, attrs=None, **kwargs):
super(SimpleMDETextArea, self).__init__(attrs)
self.kwargs = dict(self.getDefaultArgs())
if kwargs is not None:
self.kwargs.update(kwargs)
self.options = dict(self.getDefaultArgs())
self.options.update(kwargs.get('options', {}))

def get_panel(self):
return RichTextFieldPanel

def render_js_init(self, id_, name, value):
return "initSimpleMDE({0}, {1});".format(json.dumps(id_), json.dumps(self.kwargs))
return "initSimpleMDE({0}, {1});".format(json.dumps(id_), json.dumps(self.options))

0 comments on commit 12f40bf

Please sign in to comment.