plone / Products.CMFPlone

The core of the Plone content management system
https://plone.org
GNU General Public License v2.0
240 stars 183 forks source link

rich text fields do not respect the plone.default_type setting #3974

Open thet opened 3 weeks ago

thet commented 3 weeks ago

What I did

With this setting, where the default type is set to x-web-markdown:

<registry>
  <record name="plone.default_type">
    <value>text/x-web-markdown</value>
  </record>
  <record name="plone.allowed_types">
    <value>
      <element>text/html</element>
      <element>text/restructured</element>
      <element>text/x-web-markdown</element>
    </value>
  </record>
  <record name="plone.markdown_extensions">
    <value>
      <element>markdown.extensions.fenced_code</element>
      <element>markdown.extensions.nl2br</element>
      <element>markdown.extensions.extra</element>
      <element>markdown.extensions.codehilite</element>
      <element>mdx_linkify</element>
    </value>
  </record>
</registry>

Resp:

image

And form fields defined like so:

from plone.app.dexterity.textindexer import searchable
from plone.app.textfield import RichText as RichTextField
from plone.app.z3cform.widget import RichTextFieldWidget
from plone.autoform import directives as form
from plone.supermodel import model
from my.something import _

class ISomething(model.Schema):

    urls_published = RichTextField(
        title=_("label_urls_published", default="URLs published"),
        required=False,
    )
    form.widget("urls_published", RichTextFieldWidget)
    searchable("urls_published")

I get this in the edit/add forms:

image

What I expect

I would expect the form to automatically show the markdown mode. That is, no TinyMCE text editor.

Software versions

Plone 6.0.11.1