Cannot choose text style in RTE

流过昼夜 提交于 2019-12-12 01:45:29

问题


In the Page TSConfig on the root page I have the following code:

/////////////////////////////////////////////////////////////
//    RTE
///////////////////////////////////////////////////////////// 
RTE.classes{
  highlight{
      name = highlight
      value = color:#636466; font-size:15px;
  } 
  brown{
      name = braun
      value = color:#9A3811;
  }
}

RTE.default{
  ignoreMainStyleOverride = 1 
  useCSS = 1
  contentCSS = fileadmin/templates/css/rte.css
  classesCharacter := addToList(highlight, brown)
  classesParagraph := addToList(highlight, brown)
  proc.allowedClasses := addToList(highlight, brown)
  showTagFreeClasses = 1
}

In my rte.css I have this:

/* content of rte.css */

.highlighthighlight {
    font-size: 15px;
    color: #636466;
}

.brown {
    color: #9A3811;
}

The same style is in style.css for the frontend. If I'm in the editor I cannot choose a text style. It is always disabled. I want to mark some words in a paragraph. I tried to use different browsers (IE, FF, Opera ...) but in all of them text style is disabled. What can I do?

I have Typo3 4.7.5

EDIT

The problem was due to deprecated properties (see here)). My current code looks like

/////////////////////////////////////////////////////////////
//    RTE
///////////////////////////////////////////////////////////// 
RTE.default{
  ignoreMainStyleOverride = 1 
  useCSS = 1
  contentCSS = fileadmin/templates/css/rte.css
  proc.allowedClasses := addToList(highlight, brown)
  buttons {
    blockstyle.tags.div.allowedClasses := addToList(highlight, brown)
    textstyle.tags.span.allowedClasses := addToList(highlight, brown)
  }
  showTagFreeClasses = 1
}

RTE.classes{
  highlight{
      name = highlight
      value = color:#636466; font-size:15px;
  } 
  brown{
      name = braun
      value = color:#9A3811;
  }
}

Now I can choose a text style, but only one of them. Also the name of one block style is wrong ...


回答1:


I had an error in my rte.css. This seems to work.

rte.css

div.highlight, span.highlight, p.highlight, .brown {
    font-size: 15px;
    color: #636466;
}

div.brown, span.brown, p.brown, .brown {
    color: #9A3811;
}

Page TSConfig

/////////////////////////////////////////////////////////////
//    RTE
///////////////////////////////////////////////////////////// 
RTE.classes{
  highlight{
      name = highlight
      value = color:#636466; font-size:15px;
  } 
  brown{
      name = braun
      value = color:#9A3811;
  }
}

RTE.default{
  ignoreMainStyleOverride = 1 
  useCSS = 1
  showTagFreeClasses = 1
  contentCSS = fileadmin/templates/css/rte.css
  buttons {
    blockstyle.tags.div.allowedClasses := addToList(highlight, brown)
    blockstyle.tags.p.allowedClasses := addToList(highlight, brown)
    textstyle.tags.span.allowedClasses := addToList(highlight, brown)
  }
  proc.allowedClasses := addToList(highlight, brown)
}



回答2:


Useful for TYPO3 Version 7.6.X

Put following TS Configuration in Page TSConfig (In root of your site), This will add class as a option in block style as well as text style.

RTE {
    default {
        proc.allowedClasses >
        proc.allowedClasses = btn, btn-default, infoRow
        buttons {
            blockstyle.tags {
                div.allowedClasses = btn, btn-default, infoRow
            }
            textstyle.tags {
                span.allowedClasses = btn, btn-default
            }
        }
        contentCSS = fileadmin/templates/rte.css
        showTagFreeClasses = 0
        enableWordClean = 1
        useCSS = 0
    }
}

RTE.default.FE < RTE.default
RTE.default.FE.FE >
RTE.config.tt_content.bodytext
RTE.config.tt_content.bodytext.proc.allowedClasses = btn, btn-default, infoRow

Create CSS file at mentioned path i.e. fileadmin/templates/rte.css, and it will contain following code

p.btn-default, span.btn-default{
    color:green;
    background-color:yellow ;
}
p.btn, span.btn{

}
p.infoRow{
    color:grey;
}


来源:https://stackoverflow.com/questions/13050092/cannot-choose-text-style-in-rte

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!