Skip to content

Commit

Permalink
Merge pull request django-cms#1528 from Raumkraut/develop
Browse files Browse the repository at this point in the history
Only add cmsplugins to TinyMCE toolbar if absent
  • Loading branch information
digi604 committed Nov 24, 2012
2 parents 65c0293 + 40b1bb2 commit a75fde9
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion cms/plugins/text/widgets/tinymce_widget.py
Expand Up @@ -68,7 +68,18 @@ def render(self, name, value, attrs=None):
mce_config['plugins'] = plugins
if mce_config['theme'] == "simple":
mce_config['theme'] = "advanced"
mce_config['theme_advanced_buttons1_add_before'] = "cmsplugins,cmspluginsedit"
# Add cmsplugin to first toolbar, if not already present
all_tools = []
idx = 0
while True:
idx += 1
buttons = mce_config.get('theme_advanced_buttons%d' % (idx,), None)
if buttons is None:
break
all_tools.extend(buttons.split(','))
if 'cmsplugins' not in all_tools and 'cmspluginsedit' not in all_tools:
mce_config['theme_advanced_buttons1_add_before'] = "cmsplugins,cmspluginsedit"

json = simplejson.dumps(mce_config)
html = [u'<textarea%s>%s</textarea>' % (flatatt(final_attrs), escape(value))]
if tinymce.settings.USE_COMPRESSOR:
Expand Down

0 comments on commit a75fde9

Please sign in to comment.