javascript - 小MCE4 : How to change Enter key functionality to Shift + Enter key?

标签 javascript tinymce tinymce-4

在 TinyMCE4 中按 Enter 时,会创建一个新段落。有什么方法可以更改 TinymCE4 的配置,以便 Enter 应该像 Shift+Enter 一样工作?

Enter键后,我想要一个<br/>标签而不是 <p>标签。

最佳答案

是的,有一个选项。这是forced_root_block .

来自docs :

This option enables you to make sure that any non block elements or text nodes are wrapped in block elements. For example something will result in output like: <p><strong>something</strong></p>. This option is enabled by default as of 3.0a1.

If you set this option to false it will never produce p tags on enter or automatically it will instead produce br elements and Shift+Enter will produce a p.

不过,您还应该注意文档中的警告:

Note that not using p elements as root block can severely cripple the functionality of the editor.

关于javascript - 小MCE4 : How to change Enter key functionality to Shift + Enter key?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49140515/

相关文章:

javascript - 使用 JavaScript 写入 CRM 页脚

python - django-tinymce 无法正确显示小部件

php - 表单提交时tinyMCE错误

python - Django:在管理界面中使用 TinyMCE 4

javascript - 无法将动态添加的文本区域呈现为 TinyMCE 4.1.8

javascript - 无法使用 jQuery 和 React.js 加载 data.json 文件

javascript - 运行 node.js 文件和 selenium 时找不到模块 'glob'

javascript - react : The `value` prop supplied to <select> must be a scalar value if `multiple` is false

javascript - TinyMCE 使用 Javascript 动态更改语言?

jquery - 使用jquery将内容与tinymce中的rtl对齐