默认情况下,如何将 'apostrophe-rich-text' 值包装在 p 以外的标签中?

How to wrap 'apostrophe-rich-text' value in tags other than p by default?

我想要做的是拥有一个可编辑的 h3,但不能更改样式。我试过以下方法:

<div class="wrapper">
{{ apos.singleton(data.widget, 'name', 'apostrophe-rich-text', {
   toolbar: ['Styles'],
   styles: [
     { name: 'Title', element: 'h3', attributes: {class: 'profileTitle'} }
   ],
   controls: {
     movable: false
   }
}) }}
</div>

我想做的是删除 toolbar: ['Styles'] 选项,这样 ui 就不会呈现样式下拉列表,而只会在 h3 标签内呈现文本。

<div class="wrapper"><h3 class="profileTitle">User Input Text</h3></div>

如果您根本不需要富文本编辑器,您可以添加自定义架构字段(键入 string)并让用户在模式中编辑文本。

请参阅 How to enter non-rich-text? 以获取相关问题及其答案。正如答案所述,这在上下文编辑中(目前)是不可能的。

另一种方法可能是将 autoParagraphenterMode 传递给 CKEditor,请参阅 https://docs-old.ckeditor.com/ckeditor_api/symbols/CKEDITOR.config.html#.enterMode

希望对您有所帮助!