insert line break instead of

in TinyMCE

前端 未结 8 1790
难免孤独
难免孤独 2021-02-04 07:55

I have initialised TinyMCE as follows. I want to force line breaks when user presses enter and not the paragraphs. I\'m trying following, but not working. I\'m using TinyMCE ve

8条回答
  •  清歌不尽
    2021-02-04 08:18

    I faced the same situation with TinyMCE 4. All my "Enter" (keyboard) resulted in a new

     

    injected.

    I didn't want to use forced_root_block : false so I figured something out in the tinymce.init function (each empty paragraph will be cleaned directly):

    setup : function(editor) {
    
                editor.on('PostProcess', function(ed) {
                    // we are cleaning empty paragraphs
                    ed.content = ed.content.replace(/(

     <\/p>)/gi,'
    '); }); }

    https://www.tinymce.com/docs/configure/integration-and-setup/#setup https://www.tinymce.com/docs/api/class/tinymce.editor/#postprocess

提交回复
热议问题