Skip to content

Commit

Permalink
simplify the settings for rich text fields in the TTW schema editor
Browse files Browse the repository at this point in the history
  • Loading branch information
davisagli committed Dec 31, 2011
1 parent 5c157af commit 1956192
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
11 changes: 9 additions & 2 deletions docs/HISTORY.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
Changelog
=========

1.0.3 - unreleased
------------------
1.1 - unreleased
----------------

* Provide a version of the RichText field schema for use with
plone.schemaeditor. Only the ``default_mime_type`` field is exposed for
editing through-the-web, with a vocabulary of mimetypes derived from
the ``AllowedContentTypes`` vocabulary in ``plone.app.vocabularies``
(which can be adjusted via Plone's markup control panel).
[davisagli]

1.0.2 - 2011-11-26
------------------
Expand Down
29 changes: 21 additions & 8 deletions plone/app/textfield/editor.py
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')
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from setuptools import setup, find_packages
import os

version = '1.0.3dev'
version = '1.1dev'

setup(name='plone.app.textfield',
version=version,
Expand Down

0 comments on commit 1956192

Please sign in to comment.