本文整理匯總了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)