Prevent font_DDD classes from being added to rich text?

Is there a way to stop the font_DDD classes from being added to rich text? It’s changing my HTML. I’m trying to set color based on a database value in a repeater and if my rich text includes a list then the

    tag always gets a ‘font_DDD’ class added to it, which overrides the color from the database.

    $w ( "#sidebarContainer" ). style.backgroundColor  =  `# ${ currentClass.accentColor } ` ; 
    **if** ( sidebar  &&  sidebar.items.length  >  0 ){ 
        $w ( "#sidebarContainer" ). style.foregroundColor  =  `# ${ currentClass.textColor } ` ; 
        $w ( "#sidebarTitle" ). html = `<h2 class='font_2' style='color: # ${ currentClass.textColor }  !important'> ${ sidebar.items [ 0 ]. title } </h2>` ; 
        **const**  text  =  sidebar.items [ 0 ]. text . replace (/<ul\s+class\s*=\s*["'][^"']*["']>/,  "<ul>" ) 
        console . log ( 'text' ,  text ) 
        $w ( "#sidebarParagraph" ). html = `<div style='font: var(--font_8); color: # ${ currentClass.textColor }  !important'> ${ text } </div>` ; 
    } 

Is being rendered as

Sidebar #1

  • Useful for lists

As you can see, the title got set correctly, but the body was modified despite trying to remove the class from the UL element.

This was written to console.

text


  • Useful for lists

I figured out a solution. Before saving the rich text to the collection, I stub in the style attribute on the

    :

    function setTags ( html ){
    return html . replace ( “

      ” , “
        ” );
        }

        Then, when rendering the repeater, I substitute #textColor# with the color from the database. Even though the class is still added, the correct color is displayed.