-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
simplify the settings for rich text fields in the TTW schema editor
- Loading branch information
Showing
3 changed files
with
31 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,32 @@ | ||
from zope.interface import Attribute | ||
from zope.schema import interfaces as schema_ifaces | ||
from zope import schema | ||
|
||
from plone.app.textfield import interfaces | ||
from plone.app.textfield import RichText | ||
from plone.schemaeditor.fields import FieldFactory | ||
|
||
try: | ||
import plone.app.vocabularies | ||
HAS_VOCABS = True | ||
except ImportError: | ||
HAS_VOCABS = False | ||
|
||
|
||
class IRichText(interfaces.IRichText, schema_ifaces.IFromUnicode): | ||
|
||
default = RichText( | ||
title=interfaces.IRichText['default'].title, | ||
description=interfaces.IRichText['default'].description, | ||
required=False) | ||
if HAS_VOCABS: | ||
default_mime_type = schema.Choice( | ||
title = u'Input format', | ||
vocabulary = 'plone.app.vocabularies.AllowedContentTypes', | ||
default = 'text/html', | ||
) | ||
else: | ||
default_mime_type = Attribute('') | ||
|
||
# prevent some settings from being included in the field edit form | ||
output_mime_type = Attribute('') | ||
allowed_mime_types = Attribute('') | ||
|
||
missing_value = RichText( | ||
title=interfaces.IRichText['missing_value'].title, | ||
description=interfaces.IRichText['missing_value'].description, | ||
required=False) | ||
|
||
RichTextFactory = FieldFactory(RichText, u'Rich Text') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters