Zum Inhalt springen

RTE - Konfiguartion : userElements --> eigene Tags

Erstellt am 20. November 2004 · 12 Antworten · letzte Antwort am 13. Juli 2005

Tags: Frage

jenses ·

Hallo, ihr Schlauen !

Um für die Redakteure den Umgang mit der sg_glossary-Extension zu erleichtern, möchte ich einen special tag "<LEX> als userElement im RTE zur Verfügung stellen.
So muß der Redakteur nicht von Hand "<LEX>Zu wrappender Text</LEX>" eingeben,
sondern markiert "Zu wrappender Text", klickt auf das userElement,
und erhält letzendlich "<LEX>Zu wrappender Text</LEX>".
So weit die schöne Theorie.
Verwende ich statt meines LEX-tags z.B. "sub" oder so,
funktioniert das auch, nur nicht mit LEX oder irgendeinem anderen mytag.

Auf typo3org fand ich folgenden Thread :

Hi all,

I have a question with the RTE configuration :

I use the ts_css overrulemode, i think it gives good results.
The problem I have is : i can't use special typotags like
<linkpop></linkpop> or <MySpecialGoodList></MySpecialGoodList> in order to
make a popup (or special FE treatment ) because the RTE removes the tags.

What i want to do is create a RTE userElement who will wrap the text with my
specials tags, and then display the HTML i want in the FE (using the
parseHTML fonctions)

I have set the allowTags attribute for adding the "myTag" tag (is there a
way of just adding one tag to the list instead of retyping the entire list
of allowed tags with allowTags ?)
here is the allow tags in the pagetsconfig

RTE.default.proc.overruleMode = ts_css
RTE.default.proc.allowTags=mytag

RTE.default.proc.entryHTMLparser_db = 1
RTE.default.proc.entryHTMLparser_db {
allowTags = mytag
}

RTE.default.proc.entryHTMLparser_rte = 1
RTE.default.proc.entryHTMLparser_rte {
allowTags = mytag
}

RTE.default.proc.exitHTMLparser_db = 1
RTE.default.proc.exitHTMLparser_db {
allowTags = mytag
}

RTE.default.proc.exitHTMLparser_rte = 1
RTE.default.proc.exitHTMLparser_rte {
allowTags = mytag
}

In the pageTSConfig i also have :

RTE.default.userElements {
# Category with various elements
10 = Various elements | Diverse elements
10 {
# The text-selection is wrapped with <mytag> tags.
1 = Special tag
1.description = Selected text is wrapped in <mytag>-tags.
1.mode = wrap
1.content = <mytag>|</mytag>
)
}

when i use the user element on "my text", the result in the HTML source is :
"my text </mytag>" instead of "<mytag>my text</mytag>"... is there another
fonction to use ? have you a better way of doing that ? what can i do ?

Thanks in advance and sorry for my horrible english

Guillaume

[TOP] 06-11-2003 17:50 by Patrick Gaumond, patrick.gaumond(AT)fsa.ulaval.ca gaumondp

"Guillaume VANDENBROUCKE" <gvandenbroucke(at)kleegroup.com> a écrit dans le message de

> I have set the allowTags attribute for adding the "myTag" tag (is there a
> way of just adding one tag to the list instead of retyping the entire list
> of allowed tags with allowTags ?)
> here is the allow tags in the pagetsconfig
>
>
> RTE.default.proc.entryHTMLparser_db = 1
> RTE.default.proc.entryHTMLparser_db {
> allowTags = mytag
> }
>

> when i use the user element on "my text", the result in the HTML source is :
> "my text </mytag>" instead of "<mytag>my text</mytag>"... is there another
> fonction to use ? have you a better way of doing that ? what can i do ?

Salut Guillaume.

The trick we discovered THIS morning (after 2 months of frustration) is to add "htmlSpecialChars = -1"

RTE.default.proc.entryHTMLparser_db = 1
RTE.default.proc.entryHTMLparser_db {
htmlSpecialChars = -1
allowTags = mytag,table,tr,td,div,img,hr,b,i,u,a,br,pre,strong,em,li,ul,ol,h1,h2,h3,h4,h5,h6,span,p,b,th
}

REF: https://docs.typo3.org/m/typo3/reference-typoscript/main/en-us/Functions/Htmlparser.html

Please tell us if it works for you.

Patrick Gaumond
Québec

Also fügte ich "htmlSpecialChars = -1" ein,
das brachte aber leider nichts,
nach wie vor erhalte ich "Zu wrappender Text</LEX>"

Hat irgendwer von euch eine Lösung für mein Problem ??

viele Grüße
jenses

jenses ·

Ja, das "mytag" aus dem Typo3org-Post hab ich jeweils durch mein "lex" ersetzt.
Hier nochmal mein komplettes TSConfig :

RTE.default >

### Versuch, den <LEX>-Tag zum Laufen zu bringen - START
RTE.default.proc.overruleMode = ts_css
RTE.default.proc.allowTags=lex

RTE.default.proc.entryHTMLparser_db = 1
RTE.default.proc.entryHTMLparser_db {
htmlSpecialChars = -1
allowTags = lex,table,tr,td,div,img,hr,b,i,u,a,br,pre,strong,em,li,ul,ol,h1,h2,h3,h4,h5,h6,span,p,b,th
}


RTE.default.proc.entryHTMLparser_rte = 1
RTE.default.proc.entryHTMLparser_rte {
htmlSpecialChars = -1
allowTags = lex,table,tr,td,div,img,hr,b,i,u,a,br,pre,strong,em,li,ul,ol,h1,h2,h3,h4,h5,h6,span,p,b,th
}

RTE.default.proc.exitHTMLparser_db = 1
RTE.default.proc.exitHTMLparser_db {
htmlSpecialChars = -1
allowTags = lex,table,tr,td,div,img,hr,b,i,u,a,br,pre,strong,em,li,ul,ol,h1,h2,h3,h4,h5,h6,span,p,b,th
}


RTE.default.proc.exitHTMLparser_rte = 1
RTE.default.proc.exitHTMLparser_rte {
htmlSpecialChars = -1
allowTags = lex,table,tr,td,div,img,hr,b,i,u,a,br,pre,strong,em,li,ul,ol,h1,h2,h3,h4,h5,h6,span,p,b,th
}

RTE.default.userElements {
# Category with various elements
10 = Various elements | Diverse elements
10 {
# The text-selection is wrapped with <lex> tags.
1 = Special tag
1.description = Selected text is wrapped in <lex>-tags.
1.mode = wrap
1.content = <lex>|</lex>
}
}

### Versuch, den <LEX>-Tag zum Laufen zu bringen - ENDE

RTE.default {
  proc.dontConvBRtoParagraph = 1
  disableColorPicker = 1
  hidePStyleItems = h3,h4,h5,h6,pre
  mainStyleOverride = BODY {  border: 1px black solid; margin : 2 5 2 5; border-top: none; font-family:Verdana; font-size:10px; color:black; background-color:white; } H1 { font-size:14px; color:navy; text-decoration: underline; } H2 { font-size:11px; color:black; font-style: bold; }
  mainStyleOverride_add.H1 = font-size:14px; color:navy; text-decoration: underline;
  mainStyleOverride_add.H2 = font-size:11px; color:black; font-style: bold;
}


RTE.config.tt_content.bodytext.types.text { 
  showButtons=cut,copy,paste,formatblock,class,bold,italic,underline,left,center,right,orderedlist,unorderedlist,outdent,indent,link,user
  hideButtons = image
}
RTE.config.tt_content.bodytext.types.textpic { 
  showButtons=cut,copy,paste,formatblock,class,bold,italic,underline,left,center,right,orderedlist,unorderedlist,outdent,indent,link,user
  hideButtons = image
}

jenses

AndiB ·

Ich komm noch nicht mal soweit das mir die UserFunktion überhaupt angezeigt wird :-)
Der Button ist da und das PopUp geht auch auf, aber es ist leer, keine Funktion drin. Hab das Beispiel aus der TREF kopiert und wie es im Buch steht in das UserTSConf

options.RTEkeyList = cut, copy, paste, formatblock, class, fontsize, textcolor, bold, italic, underline, left, center, right, orderedlist, unorderedlist, link, image, line, user

RTE.default.userElements {
  10 = Various elements | Diverse elements
  10 {
      # The text-selection is wrapped with <sup> tags.
    2 = Subscript
    2.description = Selected text is wrapped in <sup>-tags.
    2.mode = wrap
    2.content = <sup>|</sup>
  }
}

RTE.default.showButtons = user
AndiB ·

Aha also definieren im PageTS und freigeben für die User im UserTS?

Mal testen, merci schonmal
Und ja CSS.S.C

birgitr ·

Definitin des RTE grundsätzlich im Page TS der Rootpage,

im User TS nur
showButtons, hideButtons und editPanel für die Usergroups definieren

AndiB ·

Ok also mein PageTS sieht nun so aus:

RTE.default.proc.dontConvBTtoParagraph = 1

RTE.default.userElements {
    10 = Glossar
    10 {
        1 = Glossareintrag
        1.description = Als Glossareintrag markieren Glossareintrag
        1.mode = wrap
        1.content = <glossar>|</glossar>
    }
}

RTE.default.proc.allowTags = glossar
RTE.default.showButtons = user
RTE.default.proc.preserveTables=1

Markiere ich in diesem Text: Das ist ein wort im Tag
'wort' und klick auf meinen UserButton dann kommt im Quelltext: Das ist ein wort</glossar> im Tag

Wieso schnibbelt der den ersten Tag weg ? ich versteh es nicht.

jenses ·

Genau dieses Problem ist ja der Grund,
weshalb ich diesen Thread eröffnet habe #giggle#

wer lesen kann, ist klar im Vorteil ...

AndiB ·

Das anscheinend die UserElements von NormalUsern wie uns nicht zu realisieren sind hab ich mich an eine Extension gewagt die selbstständig Tags um die Keywords wrappt.

Nun werden zwar alle Keyword mit den <glossar></glossar> umschlossen allerdings mit zwei Problemen.

1. Befindet sich z.B. das Wort "hallo" im Glossar dann wird jedes "hallo" durch <glossar>hallo</glossar> ersetzt. Eigentlich ja wie gewollt, aber: Bearbeitet man im RTE dieses Wort etwa mit bold und schreibt dann nach dem Wort weiter z.B. "hallo Freund" dann ensteht sowas -> <glossar>hallo Freund</glossar> und das wollen wir ja nicht.

Dafür gibt es eine Lösung: Bevor man nach keywords aus dem Glossar sucht werden alle glossar Tags wieder gelöscht und dann neu erzeugt damit sie wieder stimmen. Also aus "<glossar>hallo Freund</glossar>" wird erst "hallo Freund" und dann "<glossar>hallo</glossar> Freund"
Dasmit ist das gelöst.

Aber Problem 2 ist böse:

Der RTE ignoriert die Tags, nur normale Textfelder zeigen die Tags an und das kanns ja nicht sein. Wenn jemand hierfür eine Lösung hat oder weiß wie man vor der Anzeige in den Formularen an den Text kommt. soll sich melden.

dabjoern ·

Hi auch,
ich habe mal die RTE Konfiguration probiert wie oben beschrieben und auch im Typo Handbuch nochmal nachgeschlagen. Das habe ich im Root TSConfig eingetragen:

RTE.default.userElements {
  10 = Glossar
  10 {
    1 = Glossareintrag
    1.description = Als Glossareintrag markieren Glossareintrag
    1.mode = wrap
    1.content = <lex>|</lex>

    2 = Index
    2.description = Index tiefgestellt
    2.mode = wrap
    2.content = <sub>|</sub>
  }
}

RTE.default.showButtons = user

Also genau so, wie oben. Lustig ist, dass die Sache mit dem sub astrein funktioniert, das mit lex nicht - und das bei ein und demselben Code. Wie kann das sein? Habt ihr eine Lösung gefunden 😢

MfG
dabjoern