The toolbar is familiar from programs such as Word or OpenOffice, so that editors can quickly find their way around.
The editor is part of the TYPO3 source code as a system extension, so it always matches the respective version. Alternatively, other editors can also be used in TYPO3. However, when updating the TYPO3 version, it is usually necessary to wait until the respective alternative editor has also been adapted for the new version. We therefore recommend using the 'Standard' editor.
The appearance and functions can be configured individually. The instructions on this page show the possibilities.
Configure the "Insert as simple text" button
As we have also described in our video guide for TYPO3 editors on the RTE, problems often occur when you want to use text from Word documents or other websites via copy & paste in the RTE, for example. This is because unwanted text formatting can be adopted, which in the worst case can even destroy the layout of a page.
However, you can add an additional button in the RTE for users of the TYPO3 backend, which allows you to insert texts directly without formatting. This button can also be set to Active by default.
The following lines of Typoscript must be copied into the TSconfig field of the root page:
# add pastetoggle button to RTE toolbar
RTE.default.showButtons := addToList (pastetoggle)
RTE.default.buttons.pastetoggle.setActiveOnRteOpen = 1
Prevent automatic linking
The PRE tag can be used to display a code on the website. Unfortunately, URLs inserted in the RTE, such as http:// jweiland.net, are automatically converted into a real link. In this case, however, you do not want this. You can generally prevent this for all links inserted in the RTE as follows:
lib.parseFunc_RTE.makelinks >
However, this does not make sense, as automatic linking does take some work off the editor's hands.
Instead, you can customize the output without automatic linking only for this one day PRE in which no linking should normally occur. If you still want to set a link, you can still create it manually.
lib.parseFunc_RTE.externalBlocks := addToList(pre)
lib.parseFunc_RTE.externalBlocks {
pre.stripNL=1
pre.stdWrap.parseFunc = < lib.parseFunc
pre.stdWrap.parseFunc.makelinks = 0
}
Remove attributes in the RTE table
To avoid this, you must enter the following in PageTSconfig:
RTE.default.proc.entryHTMLparser_db.tags.table {
fixAttrib.style.unset = 1
fixAttrib.width.unset = 1
fixAttrib.height.unset = 1
}
This is how:
<table class="contenttable" style="width:400px; height:240px">...
the following:
<table class="contenttable">...
This also works in the same way for <tr> and <td> tags:
RTE.default.proc.entryHTMLparser_db.tags.tr {
fixAttrib.style.unset = 1
fixAttrib.width.unset = 1
fixAttrib.height.unset = 1
}
RTE.default.proc.entryHTMLparser_db.tags.td {
fixAttrib.style.unset = 1
fixAttrib.width.unset = 1
fixAttrib.height.unset = 1
}
Customize RTE for additional CSS classes
RTE.default {
#save customized CSS file in fileadmin
contentCSS = fileadmin/../default.css
}
## add classes
RTE.default.proc.allowedClasses := addToList(error, small, arrowlink)
RTE.default.buttons {
blockstyle.tags.div.allowedClasses := addToList(error, small)
textstyle.tags.span.allowedClasses := addToList(small)
link.properties.class.allowedClasses := addToList(arrowlink)
}
## remove unneeded classes
RTE.default.proc.allowedClasses := removeFromList(csc-frame-frame1, csc-frame-frame2, important, name-of-person, detail)
RTE.default.buttons {
blockstyle.tags.div.allowedClasses := removeFromList(csc-frame-frame1, csc-frame-frame2) }
RTE.classes := removeFromList(csc-frame-frame1, csc-frame-frame2, important, name-of-person, detail)
## Define classes for the RTE selection fields
RTE.classes.error {
name = Error in Red
value = color: #FF0000;
font-weight: bold;
background-color: #ffff00;
}
RTE.classes.small {
name = Small Font
value = font-size: 80%;
}
RTE.classesAnchor.arrowlink {
name = Link with an Arrow
value = background: url(fileadmin/../arrow1.gif) no-repeat 100% 0%;
}
Add CSS classes for tables
If you create tables in the RTE (Rich Text Editor), these tables are assigned the CSS class contenttable by default. In the table properties, you can also assign a class with a yellow or gray background to the table. In this case, the table is assigned the CSS class csc-frame-frame1 or csc-frame-frame2.
In this tutorial, we will now show you how to assign your own CSS classes to a table.
All options available in the RTE are integrated with the help of a CSS file. For example, you can write the following in a CSS file: p.myClass {border: 1px solid green;}. The system behind the RTE knows that "p" is a block element and adds the class myClass to the option list for the block elements. This also works in the same way for the tables.
By default, the RTE loads the options from the CSS file: typo3/sysext/rtehtmlarea/res/contentcss/default.css. To add your own values, this file should be copied to fileadmin/.
The file can now be edited. Now add the new class somewhere in this file:
table.newclass {border: 1px solid green;}
The CSS specifications given here do not affect the frontend. These specifications only style the result within the RTE itself.
After the file has been saved, a few changes need to be written to the pageTSconfig.
PageTSconfig:
# Load our copied and revised RTE-default CSS file
RTE.default.contentCSS = fileadmin/default.css
# The RTE may assign the "newclass" class to a table
RTE.default.buttons.blockstyle.tags.table.allowedClasses := addToList(newclass)
# The "newclass" class may be retained when saving
RTE.default.proc.allowedClasses := addToList(newclass)
# Only if you also want to style the option within the selection list:
RTE.classes.newclass {
name = This is my new class with a green border
value = border: 3px solid green;
}
Our new CSS class must also be allowed for output in the frontend. This is because only CSS classes that are in this list are also transferred to the frontend.
TypoScript Setup:
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list := addToList(newclass)
After these steps, the new CSS class can be assigned to the table. This new class can now be styled using a CSS file that you have created for the frontend.
Configure CSS classes for striped tables
If table rows in the RTE are to have alternating row colors, formatting is possible if you can create different CSS classes for even and odd rows. This is possible with the following settings:
PageTSconfig:
RTE.default.contentCSS = fileadmin/rte.css
RTE.classes.stripedtable {
name = Striped Table
alternating.rows {
# 0 = even, 1 = odd
startAt = 1
oddClass = row-odd
evenClass = row-even
oddHeaderClass = row-odd
evenHeaderClass = row-even
}
}
RTE.mutuallyExclusiveClasses = row-odd,row-even
RTE.default.buttons.blockstyle.tags {
table.allowedClasses := addToList (stripedtable)
tr.allowedClasses := addToList (row-odd, row-even)
}
RTE.default.proc.allowedClasses := addToList (row-even,row-odd,stripedtable)
The definitions for the classes in the RTE are stored in rte.css. For the frontend, classes must be defined in the corresponding CSS files.
Setup:
lib.parseFunc_RTE.externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class.list = contenttable, stripedtable
Enable predefined text colors for editors
You can make certain text colors available in the RTE from which it can then choose. One option is to offer a selection via the text color button:
##Show text color button
RTE.default.showButtons := addToList (textcolor)
##Hide color picker
RTE.default.disableColorPicker = 1
RTE.default.colors = color1, color2, color3
RTE.colors {
color1 {
name = darkblue
value = #100959
}
color2 {
name = green
value = #19730C
}
color3 {
name = terra
value = #B24716
}
}
However, if the editor knows a hexadecimal value for a color, he can still use this color.
Second option: provide the editor with color classes
##Enable global classes
RTE.default.buttons.textstyle.showTagFreeClasses = 1
RTE.default.contentCSS = fileadmin/.../rte.css
RTE.default.proc.allowedClasses := addToList(darkblue,green,terra)
RTE.default.buttons.textstyle.tags.span.allowedClasses := addToList(darkblue,green,terra)
RTE.classes.darkblue {
name = darkblue
value = color: #100959;
}
RTE.classes.green {
name = Green
value = color: #19730C;
}
RTE.classes.terra{
name = Terra
value = color: #B24716;
}
The classes still need to be defined in rte.css and in the CSS file for the output.
.darkblue { color: #100959;}
.green { color: #19730C;}
.terra{ color: #B24716;}