What is the right configuration for the RTE to show my own CSS classes as selection?

元气小坏坏 提交于 2019-12-06 05:49:39

Here is the configuration file which I use in my t3bootstrap.de Template

RTE.classes {
    # lists
    checklist {
        name = Checkliste
    }

    # tables
    table {
        name = Normale Tabelle
    }

    table-condensed {
        name = Verkürzte Tabelle
    }

    table-bordered {
        name = Tabelle mit Rahmen
    }

    table-styled {
        name = Tabelle mit anderem Design
    }

    # aligns
    align-justify {
        name = LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_tooltips.xlf:justifyfull
    }

    align-left {
        name = LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_tooltips.xlf:justifyleft
        value = text-align: left;
    }

    align-center {
        name = LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_tooltips.xlf:justifycenter
        value = text-align: center;
    }

    align-right {
        name = LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_tooltips.xlf:justifyright
        value = text-align: right;
    }

    text-lowercase {
        name = Kleinbuchstaben
    }

    text-uppercase {
        name = Großbuchstaben
    }

    style1 {
        name = Stil 1
    }

    htmlCode {
        name = HTML Code
    }

    phpCode {
        name = PHP Code
    }
}

RTE.classesAnchor {
    internalLinkInNewWindow {
        class = internal-link-new-window
        type = page
        titleText = LLL:EXT:rtehtmlarea/res/accessibilityicons/locallang.xml:internal_link_new_window_titleText
    }

    download {
        class = download
        type = file
        titleText = LLL:EXT:rtehtmlarea/res/accessibilityicons/locallang.xml:download_titleText
    }

    mail {
        class = mail
        type = mail
        titleText = LLL:EXT:rtehtmlarea/res/accessibilityicons/locallang.xml:mail_titleText
    }

    more-link {
        class = more-link
        type = page
        titleText = LLL:EXT:demotemplate/Resources/Private/Language/locallang.xml:more_link_titleText
        altText = LLL:EXT:demotemplate/Resources/Private/Language/locallang.xml:more_link_altText
    }

    button-link {
        class = btn
        type = page
        titleText = LLL:EXT:demotemplate/Resources/Private/Language/locallang.xml:more_link_titleText
        altText = LLL:EXT:demotemplate/Resources/Private/Language/locallang.xml:more_link_altText
    }

}

RTE.default {
    showButtons = blockstylelabel, blockstyle, textstylelabel, textstyle, left, center, right, justifyfull
    showButtons := addToList(formatblock, bold, italic, subscript, superscript)
    showButtons := addToList(orderedlist, unorderedlist, outdent, indent, textindicator,abbreviation)
    showButtons := addToList(insertcharacter, link, unlink, table, findreplace, chMode, removeformat, copy, cut, paste, pastetoggle, pastebehaviour, undo, redo)
    showButtons := addToList(toggleborders, tableproperties)
    showButtons := addToList(rowproperties, rowinsertabove, rowinsertunder, rowdelete, rowsplit)
    showButtons := addToList(columninsertbefore, columninsertafter, columndelete, columnsplit)
    showButtons := addToList(cellproperties, cellinsertbefore, cellinsertafter, celldelete, cellsplit, cellmerge)

    defaultContentLanguage = de

    buttons.textstyle.tags.span.allowedClasses = label,label-default,label-primary,label-danger,label-success,label-info,label-warning,important,detail,underline,mono,file,directory,oneclass
    buttons.textstyle.tags.REInlineTags >
    buttons.textstyle.REInlineTags >
    buttons.blockstyle.tags.table.allowedClasses = table,table-condensed,table-bordered,table-striped
    buttons.blockstyle.tags.p.allowedClasses = text-muted,text-primary,text-dimmed,text-warning,text-danger,text-success,text-info,bg-primary,bg-success,bg-info,bg-warning,bg-danger,box
    buttons.blockstyle.tags.p.allowedClasses := addToList(align-left,align-center,align-right,align-justify)
    buttons.blockstyle.tags.p.allowedClasses := addToList(text-capitalize,text-uppercase,text-lowercase)

    contentCSS = EXT:demotemplate/Resources/Public/CSS/rte.css

    buttons.link.relAttribute.enabled = 1

    // Make rtehtmlarea resizable
    rteResize = 1

    proc {
        allowedClasses := addToList( table,table-condensed,table-bordered,table-striped,table-hover,table-styled )
        allowedClasses := addToList( text-uppercase,text-lowercase,text-capitalize,text-muted,text-primary,text-dimmed,text-warning,text-danger,text-success,text-info,bg-primary,bg-success,bg-info,bg-warning,bg-danger )

        allowTagsOutside := addToList( pre )

        allowTags := addToList( pre )

        // Tags allowed in Typolists
        allowTagsInTypolists = br,font,b,i,u,a,img,span

        // Keep unknown tags
        dontRemoveUnknownTags_db = 1

        // Allow tables
        preserveTables = 1

        entryHTMLparser_db = 1
        entryHTMLparser_db {
            // Tags allowed
            allowTags < RTE.default.proc.allowTags

            // Tags denied
            #denyTags >

            // HTML special characters
            htmlSpecialChars = 0

            // Allow IMG tags
            #tags.img >

            // Additionnal attributes for P & DIV
            tags.div.allowedAttribs = class,style,align
            tags.p.allowedAttribs = class,style,align

            // Tags to remove
            removeTags = center, font, o:p, sdfield, strike, u

            // Keep non matched tags
            keepNonMatchedTags = protect
        }

        // HTML parser
        HTMLparser_db {
            // Strip attributes
            noAttrib = br

            // XHTML compliance
            xhtml_cleaning = 1
        }

        // Exit HTML parser
        exitHTMLparser_db = 1
        exitHTMLparser_db {
            // Remap bold and italic
            tags.b.remap = strong
            tags.i.remap = em

            // Keep non matched tags
            keepNonMatchedTags = 1

            // HTML special character
            htmlSpecialChars = 0
        }
    }
}

RTE.default.FE < RTE.default

You can find an example here. As far as i remeber, this one reads the classes from the given css file.

https://github.com/Ecodev/speciality/blob/master/Configuration/PageTS/rte.txt#L101

contentCSS = EXT:speciality/Resources/Public/StyleSheets/rte.css

Hope it helps.

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