本文整理汇总了Python中wagtail.admin.rich_text.HalloRichTextArea.render_js_init方法的典型用法代码示例。如果您正苦于以下问题:Python HalloRichTextArea.render_js_init方法的具体用法?Python HalloRichTextArea.render_js_init怎么用?Python HalloRichTextArea.render_js_init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wagtail.admin.rich_text.HalloRichTextArea
的用法示例。
在下文中一共展示了HalloRichTextArea.render_js_init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_heading_order
# 需要导入模块: from wagtail.admin.rich_text import HalloRichTextArea [as 别名]
# 或者: from wagtail.admin.rich_text.HalloRichTextArea import render_js_init [as 别名]
def test_heading_order(self):
# Using the `register_rich_text_features` doesn't work here,
# probably because the features have already been scanned at that point.
# Extending the registry directly instead.
feature_registry.default_features.extend(['h1', 'h5', 'h6'])
widget = HalloRichTextArea()
js_init = widget.render_js_init('the_id', 'the_name', '<p>the value</p>')
expected_options = (
'"halloheadings": {"formatBlocks": ["p", "h1", "h2", "h3", "h4", "h5", "h6"]}'
)
self.assertIn(expected_options, js_init)