The front-end (in this case TinyMCE) is not responsible for the default value, it's the form beneath.
Plone 5 uses Dexterity types with z3c forms.
EDIT: This is how your doing this the old school way - I mean the plone directives way -
Sry for misleading you. I still use plone.directives
, which supports this kind of default value adapter.
The default content type Document
of plone.app.contenttypes is using plone.supermodel. This has a different concept.
If you are still willing to create your own Richtext behavior you may follow those instructions: http://docs.plone.org/external/plone.app.dexterity/docs/advanced/defaults.html
In your case:
def richtext_default_value(**kwargs):
return RichTextValue('<p>Some text</p>')
@provider(IFormFieldProvider)
class IRichText(model.Schema):
text = RichTextField(
title=_(u'Text'),
description=u"",
required=False,
defaultFactory=richtext_default_value,
)
model.primary('text')
You can add a defaultFactory
to the text field.
If you hack those lines on your egg, it will work.
Here's some information about setting a default value programmatically:
So in your case this may look something like this:
from plone.directives.form import default_value
from plone.app.contenttypes.behaviors.richtext import IRichText
from plone.app.textfield.value import RichTextValue
@default_value(field = IRichText['text'])
def richtext_default_value(data):
return RichTextValue('<p>Some text</p>')
You may extend the default_value decorator by context
parameter to be more specific: @default_value(field = IRichText['text'], context=my.package.content.interfaces.IMyType)
BUT since we have the concept of behaviors it's may be better to implement your own Richtext behavior with a default value:
- Creating a behavior --> http://docs.plone.org/external/plone.app.dexterity/docs/behaviors/creating-and-registering-behaviors.html AND the plone default richtext behavior as template for your own -> https://github.com/plone/plone.app.contenttypes/blob/1.2.16/plone/app/contenttypes/behaviors/richtext.py
- Remove the ´plone.app.contenttypes.behaviors.richtext.IRichText` Behavior from your content type (Document) thru ZMI (portal_types -> Document)
- Add your own Richtext behavior, this may be something like
my.package.behaviors.richtext.IRichtextWithDefaultValue
.