Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Use div tag as a default instead of paragraph in tinymce

I'm new at joomla and currently using Joomla version 3.6. Is there a way to set the tinymce editor to use div tag as a default instead of paragraph? Any answer would be appreciated, Thanks a lot.

like image 879
Monkey D. Luffy Avatar asked Dec 15 '16 08:12

Monkey D. Luffy


People also ask

Can I use DIV for paragraph?

The <div> tag can NOT be inside <p> tag, because the paragraph will be broken at the point, where the <div> tag is entered. To apply styles inside a paragraph use <span> tag, which is used with inline elements.

How do I set HTML content in TinyMCE?

The TinyMCE getContent and setContent methods You can do this using the getContent() API method. Let's say you have initialized the editor on a textarea with id=”myTextarea”. This will return the content in the editor marked up as HTML.

How do I change the default font in TinyMCE editor?

To change the default font family, size, or color in the TinyMCE editor, we recommend using content_css or content_style (or a combination of both) depending on your use case. TinyMCE is shipped with a default CSS that determines what the font and everything else looks like in the editor itself.

Does TinyMCE support markdown?

By default, it has basic markdown patterns. There are three types of patterns: inline , block , and replacement patterns. Inline patterns have a start and an end text pattern whereas the block and replacement patterns only have a start .


1 Answers

You have to init tinymce with forced-root-block: 'div'.

tinymce.init({
  // ...
  forced_root_block : 'div'
});

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. — documentation

like image 117
Marvin Avatar answered Sep 28 '22 13:09

Marvin