[TYPO3-english] RTE : Add custom block format

Thomas Crenn totocrenn at gmail.com
Thu Feb 23 15:17:59 CET 2017


Hi,

I want to create a custom block format with the RTE of Typo3 8.5 but i can't manage to achieve this.
On the RTE there is a list where you can choose a style to your text, as 'Paragraphe', 'Heading 1', 'Heading 2' ....

What i want is tu add a choice called 'chapeau' wich enclose the text between <p class='chapeau'>     </p>

To achieve that i changed the Page TSConfig with that :

RTE.classes {
    chapeau {
        name = chapeau
    }
}

RTE.default {
	enableWordClean.HTMLparser.tags.div.fixAttrib.class.list := addToList(chapeau)
	proc.entryHTMLparser_db.tags.div.allowedAttribs = class
	proc.allowedClasses := addToList(chapeau)
	proc.entryHTMLparser_db.tags.div.fixAttrib.class.list := addToList(chapeau)
	proc.entryHTMLparser_db.tags.div.allowedAttribs = class

	contentCSS {
		file1 = /var/typo3/sites/S1.www.lorient-agglo.fr/fileadmin/templates/Public/Css/RTE/rte.css
		file2 = /var/typo3/sites/S1.www.lorient-agglo.fr/fileadmin/templates/LA/css/style.css
	}

	buttons.blockstyle.showTagFreeClasses = 1
	buttons.textstyle.showTagFreeClasses = 1

	buttons.formatblock.addItems = chapeau
	buttons.formatblock.items.chapeau.label = chapeau
	buttons.formatblock.items.chapeau.addClass = chapeau
	buttons.formatblock.items.chapeau.tagName = div
}

But when i choose chapeau on the RTE I got <div class='chapeau'><p>    </p></div> instead of just <div class='chapeau'>   </div>
It don't remove the paragraphe block format.

Any ideas to fix this problem ?


More information about the TYPO3-english mailing list