© TYPO3 Association, typo.org

Eine für die meisten Standard Use Cases passende Konfiguration für den bei TYPO3 mitgelieferten Rich Text Editor htmlarea.

Inklusive der passenden processing rules und Unerstützung von DAM (auch in tt_news).

 

Ich erweitere hier, im Gegensatz zur früheren Konfiguration, die bei htmlarea mitgelieferte Standard Konfiguration.

Beide Snippets müssen ins Page TS. Die processing rules sollten vor den htmlarea Einstellungen platziert werden.

 


Im Extension Manager müssen idealerweise die folgenden Einstellungen getroffen werden:

 

HtmlArea

  • Default configuration settings [defaultConfiguration] auf "Typical" einstellen
  • Enable images in the RTE [enableImages] aktivieren wenn benötigt
  • Enable additional inline elements [enableInlineElements] deaktivieren

 

DAM

  • media tag [mediatag] aktivieren
  • htmlArea RTE integration [htmlAreaBrowser] aktivieren

 

 

Ggf. müssen noch die erlaubten tags (allowTags) in den Constants erweitert werden (siehe letztes Snippet), zum Beispiel wenn attr als tag benutzt werden soll.

 

# ***************************************************************************************
# TYPO3 htmlArea RTE configuration
# 
# Author: 		Felix Nagel for Paints Multimedia GmbH, http://www.paints.de
# Info & DL: 	http://www.felixnagel.com/blog/kategorie/typo3/
# ***************************************************************************************

# we need to include default parsing rules
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/templates/skin_standard/typoscript/system/tsconfig_rte_proc_rules.ts">

# Define labels and styles to be applied to class selectors in the interface of the RTE
RTE.classes >
# this class needs to be added to you CSS file (contentCSS)
RTE.classes.special-text {
  name = Abgesetzter Text
}

# Anchor classes configuration for use by the anchor accesibility feature (htmlArea RTE only)
RTE.classesAnchor >

# Default RTE configuration
RTE.default {

	# add CSS file for rte
	contentCSS = fileadmin/templates/css/rte.css
	
	# disable right click
	disableRightClick = 1
	
	# acronym sys folder (id, not needed for admins as webmount is used)
	# buttons.acronym.pages = 306
	# buttons.lockBEUserToDBmounts = 1
	
	# image in RTE relevant
	# please note you need to enable images in the EM and add width and height to RTE.default.proc.entryHTMLparser_db.tags.img.allowedAttribs
	# media_ prefix when using DAM, see http://bugs.typo3.org/bug_view_advanced_page.php?bug_id=13902
	buttons.image.options.removeItems = dragdrop, media_dragdrop, magic, media_magic
	buttons.image.options.plain.maxWidth = 960
	buttons.image.options.plain.maxHeight = 1000
	buttons.image.properties.removeItems = align, border, float, paddingTop, paddingRight, paddingBottom, paddingLeft, clickenlarge
	
	# clean out crap
	removeComments = 1
	enableWordClean = 1
	
	# removed strike and u tag from default config
	removeTags = center, font, o:p, sdfield
	
	 # modified showButtons array (should be sufficient in most use cases)
	# row 1: text styles and tools
	# row 2: standard buttons
	# row 3: table operations
	showButtons (
		blockstyle, formatblock, bar, copy, cut, paste, pastebehaviour, pastetoggle, findreplace, bar, undo, redo, bar, linebreak, 
		link, image, bar, bold, italic, underline, strikethrough, bar, subscript, superscript, bar, orderedlist, unorderedlist, acronym, insertcharacter, line, bar, removeformat, chMode
	)
	# need to use one line! Just copy showButtons into one line!
	toolbarOrder = blockstyle, formatblock, copy, cut, paste, pastebehaviour, pastetoggle, findreplace, bar, undo, redo, bar, linebreak, link, image, bar, bold, italic, underline, strikethrough, bar, subscript, superscript, bar, orderedlist, unorderedlist, acronym, insertcharacter, line, bar, removeformat, chMode

	# added div element to default config
	hidePStyleItems = pre,address,div
	
	# Use stylesheet file rather than the above mainStyleOverride and inlineStyle properties to style the contents (htmlArea RTE only).
	# ignoreMainStyleOverride = 1
	
	# List all class selectors that are allowed on the way to the database
	proc.allowedClasses (
		more, 
		pdf, 
		external-link,
		lightbox,
		special-text
	)		
	
	# Configuration of the anchor accessibility feature (htmlArea RTE only)
	# These classes should also be in the list of allowedClasses.
	classesAnchor = more, more-button, external-link, modalbox, modalbox-big, company, exploration, oilgas
	classesAnchor.default {
		page = 
		url = 
		file = 
		mail = 
	}
	
}

# needed, otherwise enableWordClean wont work, regression, see http://forge.typo3.org/issues/19697
RTE.default.showButtons := addToList(cleanword)
RTE.default.toolbarOrder := addToList(cleanword)
# Use same processing as on entry to database to clean content pasted into the editor
RTE.default.enableWordClean.HTMLparser < RTE.default.proc.entryHTMLparser_db
# remove all classes so we have a clean start after pasting (allowed classed wont work on enableWordClean)
RTE.default.enableWordClean.HTMLparser.tags.p.fixAttrib.class.unset = 1

# make DAM usable in tt_news entries
RTE.config.tt_news.bodytext.proc.overruleMode = ts_css,txdam_media
TYPO3 htmlArea RTE configuration
# ***************************************************************************************
# TYPO3 RTE processing rules for htmlArea RTE
# 
# Author: 		Felix Nagel for Paints Multimedia GmbH, http://www.paints.de
# Info & DL: 	http://www.felixnagel.com/blog/kategorie/typo3/
# ***************************************************************************************

# Default RTE processing rules
RTE.default.proc {

	# TRANSFORMATION METHOD
	# We assume that CSS Styled Content and DAM is used.
	overruleMode = ts_css, txdam_media

		# TAGS ALLOWED OUTSIDE P & DIV
		# add some more standard elements
	allowTagsOutside = hr, address, ul, ol, li, img, table, object, embed, code, pre

	entryHTMLparser_db {
		tags {
		
			# IMAGE TAGS (Extension Manager must be enabled, too)
			img.allowedAttribs = style,class,id,src,width,height
			img.rmTagIfNoAttrib = 1
			# disable above and enable below to remove all images
			# img.allowedAttribs = 0 
			
			# try to clean up Word crap (advise users to use clean copy button!)
			# id is needed for RTE internal reasons
			span.allowedAttribs = id
			span.rmTagIfNoAttrib = 1
			div.rmTagIfNoAttrib = 1
			
			# add acronym
			acronym.allowedAttribs = id, title, dir, lang, xml:lang, class
		}

		# REMOVE OPEN OFFICE META DATA TAGS, WORD 2003 TAGS, LINK, META, STYLE AND TITLE TAGS, AND DEPRECATED HTML TAGS
		# We use this rule instead of the denyTags rule so that we can protect custom tags without protecting these unwanted tags.
		# modify default config
		removeTags = center, font, link, meta, o:p, sdfield, style, title, big, small
	}

	exitHTMLparser_db {
		# remap some old tags
		tags {
			b.remap = strong
			i.remap = em
			s.remap = strike
		}
	}
}

# Make sure we use ts_css transformation
# add DAM
RTE.config.tt_content.bodytext.proc.overruleMode = ts_css, txdam_media
RTE.config.tt_content.bodytext.types.text.proc.overruleMode = ts_css, txdam_media
RTE.config.tt_content.bodytext.types.textpic.proc.overruleMode = ts_css, txdam_media

# needed for DAM media tag within tt_news
RTE.config.tt_news.bodytext.proc.overruleMode = ts_css, txdam_media
TYPO3 RTE processing rules for htmlArea RTE
# Add tags to constants
styles.content.links.allowTags := addToList(abbr, acronym)
TYPO3 add tags to constants

Die Kommentarfunktion ist für diesen Artikel deaktiviert.

0 Kommentare