Skip to content
This repository has been archived by the owner on Oct 23, 2021. It is now read-only.

Commit

Permalink
Refactor processing TinyMCE widget configuration
Browse files Browse the repository at this point in the history
This should address #55, because now the spellchecker config is created only
if it's missing from the main TinyMCE config.
  • Loading branch information
romanvm committed Apr 27, 2019
1 parent 3b9221d commit eda2cea
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tinymce/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,10 +173,11 @@ class TinyMCE(Textarea):
"""
def __init__(self, attrs=None, mce_attrs=None, profile=None):
super(TinyMCE, self).__init__(attrs)
self.mce_attrs = mce_attrs or {}
self.profile = get_spellcheck_config()
default_profile = profile or mce_settings.CONFIG.copy()
self.profile.update(default_profile)
mce_attrs = mce_attrs or {}
self.profile = profile or mce_settings.CONFIG.copy()
self.profile.update(mce_attrs)
if 'spellchecker_languages' not in self.profile:
self.profile.update(get_spellcheck_config())

def build_attrs(self, base_attrs, extra_attrs=None, **kwargs):
attributes = dict(base_attrs, **kwargs)
Expand All @@ -192,7 +193,6 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs['name'] = name
final_attrs['class'] = (final_attrs.get('class', '') + ' tinymce4-editor').lstrip()
mce_config = self.profile.copy()
mce_config.update(self.mce_attrs)
if 'language' not in mce_config:
mce_config.update(get_language_config())
if mce_config.get('inline'):
Expand Down

0 comments on commit eda2cea

Please sign in to comment.