We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4594
    • 74 Posts
    Hello to all,

    how can i turn off the feature of tinymce inserting empty p-tags (<p>&nbsp;</p>) automatically, when hitting the enter-key. I tried to disable "force_p_newlines : false" in the "tiny_mce.js", but nothing happend.

    Has anyone an idea?

    Thanks,

    captain
      • 5727
      • 160 Posts
      Hola Captain,

      The option is: forced_root_block

      This option enables you to make sure that any non block elements or text nodes are wrapped in block elements. For example <strong>something</strong> will result in output like: <p><strong>something</strong></p>. This option is set to false by default so set it to the block element you want to use as root elements.
      [edit]
      Example of usage of the forced_root_block option:

      tinyMCE.init({
      ...
      forced_root_block : ’p’
      });
        Olivier Deland
        Montreal, Canada - Web Developer
        • 4594
        • 74 Posts
        Thanks for your answer!

        But i think you misunderstood me (because of my bad english? sorry for that...).

        I want an option to turn OFF the automatic insertion of empty p-tags (or br-tags) by hitting the enter key. I want, that nothing happens in the code, when hitting the "enter" or "return"-key.

        Hope this is clearer now smiley
          • 5727
          • 160 Posts
          Oh! My bad, I misunderstood!

          I don’t think you can do what you want right out of the box with TinyMCE. There’s only two options available when pressing ’Enter’: Make a new <p> or create a
          . the latter being done with "force_br_newlines:true".

          If you want nothing to happen so that nobody can insert any newlines of any kind, I think you will have to create your own callback function to skip the ’return’ key action when it’s pressed. Have a look at the documentation (in english only unfortunatly)
          http://wiki.moxiecode.com/index.php/TinyMCE:Configuration/execcommand_callback
            Olivier Deland
            Montreal, Canada - Web Developer
            • 4594
            • 74 Posts
            I don’t think you can do what you want right out of the box with TinyMCE.

            i’ve feared that...

            thanks for the link. i’ll check it out. And it’s no problem for me, that it is in english. I can better understand than speak/write smiley

            greetings, captain