Skip to content

Commit

Permalink
get toolbars from registry
Browse files Browse the repository at this point in the history
  • Loading branch information
gotcha committed Mar 11, 2016
1 parent 2477e99 commit 6c4aa83
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/collective/ckeditor/browser/ckeditorview.py
Expand Up @@ -17,6 +17,9 @@
from collective.ckeditor.config import CKEDITOR_FULL_TOOLBAR
from collective.ckeditor.config import CKEDITOR_SUPPORTED_LANGUAGE_CODES
from collective.ckeditor import siteMessageFactory as _
from zope.component import getUtility
from plone.registry.interfaces import IRegistry


import demjson
demjson.dumps = demjson.encode
Expand Down Expand Up @@ -274,9 +277,17 @@ def cke_params(self):
params['filebrowserFlashBrowseUrl'] = flash_url
# the basehref must be set in wysiwyg template
# params['baseHref'] = self.cke_basehref

params.update(self.cke_toolbars())
return params

def cke_toolbars(self):
registry = getUtility(IRegistry)
toolbars = registry['collective.ckeditor.toolbars']
result = dict()
for name, toolbar in toolbars.items():
result['toolbar_{0}'.format(name)] = toolbar
return result

def getCK_plone_config(self):
"""
return config for ckeditor
Expand Down
16 changes: 16 additions & 0 deletions src/collective/ckeditor/profiles/default/registry.xml
@@ -0,0 +1,16 @@
<?xml version="1.0"?>
<registry>
<record name="collective.ckeditor.toolbars">
<field type="plone.registry.field.Dict">
<title>CKEditor toolbars</title>
<key_type type="plone.registry.field.TextLine" />
<value_type type="plone.registry.field.Text" />
</field>
<value>
<!--element key="header">[
['Bold', 'Italic', '-', 'NumberedList', 'BulletedList', '-',
'Link', 'Unlink','-','About']
]</element-->
</value>
</record>
</registry>

0 comments on commit 6c4aa83

Please sign in to comment.