获得“默认"信息. Plone 5上的样机TinyMCE配置 [英] Obtaining the "default" mockup TinyMCE configuration on Plone 5
问题描述
我正在尝试在Plone 5模板中配置TinyMCE(因此:不是z3c.form小部件类型).
I'm trying to configure TinyMCE inside Plone 5 template (so: not the z3c.form widget type).
使用 TinyMCE Mockup模式,您可以快速学习如何显示基本内容TinyMCE配置(不支持任何i18n). 但是,当为默认内容类型(例如Plone页面)加载TinyMCE时,如何才能将其应用到TinyMCE?
Using the TinyMCE Mockup patter you quickly learn how to display a rudimentary TinyMCE configuration (without any i18n support). But how I can get the "default" configuration applied to TinyMCE when it's loaded for default content types like a Plone page?
我正在寻找一种方法来获取data-pat-tinymce
HTML属性的正确值.
What I'm looking for a way to get the right value for the data-pat-tinymce
HTML attribute.
推荐答案
我认为您要的是做这样的事情...
I think what you're asking for is to do something like this...
首先,获取默认的tinymce模式配置:
First, get the default tinymce pattern configuration:
from zope.component import getMultiAdapter
import json
pattern_options = getMultiAdapter(
(context, request, None),
name="plone_settings").tinymce()['data-pat-tinymce']
tiny_options = json.loads(pattern_options)
然后,操作tiny_options
字典并根据需要进行自定义,并使用json.dumps将其提供给data-pat-tinymce属性.
Then, manipulate the tiny_options
dictionary and customize to your needs and provide it to your data-pat-tinymce attribute with json.dumps.
这篇关于获得“默认"信息. Plone 5上的样机TinyMCE配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!