Zum Inhalt springen

RTE Div wird von p Tags umschlossen

Erstellt am 11. April 2009 · 1 Antwort · letzte Antwort am 11. April 2009

Tags: HTML & CSS, Frage

xTheTronx ·

Guten Morgen,

ich sitze nun schon seit vielen Stunden an einer kleinen, aber mittlerweile Kopfschmerzen verursachenden RTE Konfiguration.

Ich benutze im Backend den tinymce_rte, was soweit auch wunderbar funktioniert.
Dort habe ich eine Vorlage, die folgender Maßen aussieht:

<div class="drei-bilder-container">
	<p class="drei-bilder">
		<img src="../vorlagen/images/dummy-bild.gif" width="150" alt="" />
		Lorem ipsum ...
	</p>
	<p class="drei-bilder">
		<img src="../vorlagen/images/dummy-bild.gif" width="150" alt="" />
		Lorem ipsum ...
	</p>
	<p class="drei-bilder">
		<img src="../vorlagen/images/dummy-bild.gif" width="150" alt="" />
		Lorem ipsum ...
	</p>
</div>

Die wird auch so in die DB geschrieben, wie ich extra nachgeschaut habe.
Auf der Webseite wird aber sowas angezeigt.

<p />
<div class="drei-bilder-container">
  <p class="drei-bilder"><img width="150" alt="" src="../vorlagen/images/dummy-bild.gif" /> Lorem ipsum </p>
  <p><img width="150" alt="" src="../vorlagen/images/dummy-bild.gif" /> Lorem ipsum </p>
  <p />
  <p class="drei-bilder"><img width="150" alt="" src="../vorlagen/images/dummy-bild.gif" /> Lorem ipsum </p>
</div>

Mir unverständlich wird als erstes ein <p /> eingefügt, wo das schliessende "/" hinter dem "p" steht.
Das passiert auch innerhalb des divs und beim mittleren Bild wird die Klasse entfernt.

Das steht z.Z. in meinem TS-Setup

lib {
  parseFunc_RTE {
    #--- RTE Tuning
    nonTypoTagStdWrap.encapsLines {
      nonTypoTagStdWrap >
      addAttributes.DIV.class >
      remapTag.DIV = DIV 
      encapsTagList = div,p 
      addAttributes >  
      # Keine Klasse für Standardabsätze
      addAttributes.P.class =
      #addAttributes.P.class >
      # Keine Umwandlung von Tags
      remapTag >
      encapsLines >
      # HTML-Tags, die nicht mit einem zusätzlichen <p>wrap umgeben werden dürfen
      # DO NOT WRAP THOSE TAGS WITH <p>
      encapsTagList = br, cite, div, p, pre, hr, h1, h2, h3, h4, h5, h6, table      
    }
  
    # COPY ALLOW TAGS FROM PAGETS (WITHOUT b, i, link) sometimes there is a probblem with multiline so just use one line
    allowTags = script, a, abbr, acronym, address, blockquote, br, caption, cite, code, div, em, embed, h1, h2, h3, h4, h5, h6, hr, img, li, object, ol, p, param, pre, q, span, strong, sub, sup, table, tbody, td, th, tr, tt, ul
        
    # table handling
    table.stripNL = 1
    table.stdWrap.HTMLparser = 1
    table.callRecursive = 1
    table.callRecursive.tagStdWrap.HTMLparser = 1
    table.stdWrap.HTMLparser.keepNonMatchedTags = 1

    # Do NOT add any unwanted p elements in table cells, and do NOT remove any p-elements that have been added by authors!
    table.HTMLtableCells = 1
    table.HTMLtableCells.default.stdWrap.parseFunc =< lib.parseFunc  

    # avoid unwanted p-elements in th/td on the way to FE
    externalBlocks.table.HTMLtableCells.default >
    externalBlocks.table.HTMLtableCells.default.stdWrap.parseFunc =< lib.parseFunc
	
    # DO NOT ADD class="contenttable" TO EVERY TABLE => ALLOW COSTUM class
    externalBlocks.table.stdWrap.HTMLparser.tags.table.fixAttrib.class  >
	
    # DO NOT AUTOLINK EVERY STRING THAT STARTS WITH HTTP OR MAILTO
    # such strings in the content are assumed to be intentional
    # makelinks >
    # externalBlocks.ul.stdWrap.parseFunc.makelinks = 0
    # externalBlocks.ol.stdWrap.parseFunc.makelinks = 0
  }

  # function to allow custom link attributes
  parseFunc.tags.a = COA
  parseFunc.tags.a {
    // Parsing of A tag if not an anchor
    10 = TEXT
    10.current = 1
    10.required = 1	// Remove empty links
    10.typolink.parameter.data = parameters : allParams
    10.typolink.parameter.postUserFunc = user_tinymce_rte->getHref
    10.typolink.ATagParams.data = parameters : allParams
    10.typolink.ATagParams.postUserFunc = user_tinymce_rte->getATagParams
    10.if.isTrue.data = parameters : allParams
    10.if.isTrue.postUserFunc = user_tinymce_rte->isNotAnchor

    // Parsing of A tag if an anchor
    20 = TEXT
    20.current = 1
    20.dataWrap = <a parameters="" :="" allparams="">|</a>
    20.if.isTrue.data = parameters : allParams
    20.if.isTrue.postUserFunc = user_tinymce_rte->isNotAnchor
    20.if.negate = 1
  }
 
  parseFunc_RTE.tags.a < lib.parseFunc.tags.a

  // Remove empty links
  parseFunc.tags.link.required = 1
  parseFunc_RTE.tags.link.required = 1

  # allow all values in the FE
  parseFunc.denyTags =
  parseFunc_RTE.denyTags =  
}

Ich bin im Moment wirklich ratlos und würde mich über Hilfe freuen.

Vielen Dank

Gruß

Torsten

xTheTronx ·

Hab´s anscheinend gelöst bekommen.

Bin über diesen Post auf die Lösung gekommen.

http://www.typo3forum.net/forum/typo3-4-x-rich-text-editor/16890-p-tag-problem.html

Ich habe in der Datei typo3/sysext/css_styled/static/setup.txt

//remapTag.DIV = P
//nonWrappedTag = P

auskommentiert, cache geleert und schon geht es.
Was mich aber wundert, dass Typo3 das nicht über die lib-Einstellungen übernommen hat. #angry#

Ich kümmere mich jetzt erstmal um meine Kopfschmerzen. 8-)

Gruß

Torsten