Commit de4cc11e authored by Klaus Wölfel's avatar Klaus Wölfel Committed by Kirill Smelkov

Choose codemirror mode depending on web portal type

Makes syntax highlighting work with codemirror for Web Page, Web
Script and Web Style portal types.

/reviewed-by @jerome  (on !20)
parent 5535af92
......@@ -122,12 +122,20 @@ class EditorWidget(Widget.TextAreaWidget):
elif text_editor == 'codemirror':
code_mirror_support = getattr(here, 'code_mirror_support', None)
if code_mirror_support is not None:
mode = "python"
portal_type = here.getPortalType()
if portal_type == "Web Page":
mode = "htmlmixed"
elif portal_type == "Web Script":
mode = "javascript"
elif portal_type == "Web Style":
mode = "css"
site_root = here.getWebSiteValue() or here.getPortalObject()
return code_mirror_support(field=field,
content=value,
field_id=key,
portal_url=site_root.absolute_url(),
mode='python')
mode=mode)
elif text_editor != 'text_area':
return here.fckeditor_wysiwyg_support.pt_render(
extra_context= {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment