Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Button Codes for Primefaces' Text Editor

Primefaces has two text editors, the deprecated "editor" and more recent "text editor". For the prior I could find the code for specific buttons, but I cannot find any such code for the new one, and disappointingly the old codes don't seem to translate. For example:

controls="bold italic underline strikethrough subscript superscript 
font size style color highlight bullets numbering alignleft center 
alignright justify link unlink outdent indent"

works on the old editor, but only: bold, italic, underline, strikethrough, font, size, link, appear as buttons when added using HTML tags like:

<button class="ql-bold"></button>

What are the codes for the aforementioned buttons, and also for the remove formatting button? The documentation provided on the website is out of date.

like image 209
inappropriateCode Avatar asked Mar 08 '26 09:03

inappropriateCode


1 Answers

Here is the list. Either delete or set style="display: none;" the button you do not want to show.

<p:textEditor
    id="descriptionId"
    widgetVar="descriptionWidget"
    value="#{bean.model.description}">
    <f:facet name="toolbar">
        <span class="ql-formats">
            <select class="ql-font" />
            <select class="ql-size" />
        </span>
        <span class="ql-formats">
            <button class="ql-bold" />
            <button class="ql-italic" />
            <button class="ql-underline" />
            <button class="ql-strike" />
        </span>
        <span class="ql-formats">
            <select class="ql-color" />
            <select class="ql-background" />
        </span>
        <span class="ql-formats">
            <button class="ql-script" value="sub" />
            <button class="ql-script" value="super" />
        </span>
        <span class="ql-formats">
            <button class="ql-header" value="1" />
            <button class="ql-header" value="2" />
            <button class="ql-blockquote" />
            <button class="ql-code-block" />
        </span>
        <span class="ql-formats">
            <button class="ql-list" value="ordered" />
            <button class="ql-list" value="bullet" />
            <button class="ql-indent" value="-1" />
            <button class="ql-indent" value="+1" />
        </span>
        <span class="ql-formats">
            <button class="ql-direction" value="rtl" />
            <select class="ql-align" />
        </span>
        <span class="ql-formats">
            <button class="ql-link" />
            <button class="ql-image" />
            <button class="ql-video" />
            <button class="ql-formula" />
        </span>
        <span class="ql-formats">
            <button class="ql-clean" />
        </span>
    </f:facet>
</p:textEditor>
like image 114
Ahmet Avatar answered Mar 10 '26 00:03

Ahmet



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!