Render rich text widget manually in plone custom p

2019-02-20 11:22发布

I have a custom edit (browser page) for my dexterity content type. In template I have defined a form using Bootstrap and added some Angular JS code for form behavior. It is working. :)

I need to replace a simple textarea with rich text widget. So how can I render in my template the rich text widget (one that is normally used in dexterity)?

2条回答
三岁会撩人
2楼-- · 2019-02-20 12:12

It should suffice to apply the class mceEditor on the textarea.

If that shouldn't work, include the initialization in your template:

tinyMCE.init({
    elements : "id-of-textarea",
}); 
查看更多
做自己的国王
3楼-- · 2019-02-20 12:27

If you are using Mockup (not sure if anybody use it on Plone 4) you can find tips there: Obtaining the "default" mockup TinyMCE configuration on Plone 5

Otherwise (the Plone 4.3 version of TinyMCE) it's only a matter of CSS classes and configurations.

 <textarea name="..."
     class="pat-tinymce mce_editable"
     data-mce-config JSONCONFIGURATION_HERE">
 </textarea>

I've an add-ons that enable TinyMCE on simple forms; look at the cose to find how to obtain the JSON configuration: See rt.zptformfield.

I've also a blogpost about the approach I used there but it's in italian :-) - http://blog.redturtle.it/usare-widget-plone-in-semplici-template-html

查看更多
登录 后发表回答