Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

165
Vistas
Change default text color in TinyMCE after loading initial content from DB

I have a simple HTML page which is loading content (from a database) into a TinyMCE v5 textarea upon initialisation. I'd like to switch the default text color or highlight after the content has loaded so that any changes the user makes are discernable from the original text. If possible, I'd like to lock the option to change further formatting. The idea is basically a poor-man's track changes.

My current code looks like this:

<script>
  var txtcontent = '{!! str_replace(["\r", "\n"], "", $examQuestionInstance->question) !!}';
  tinymce.init({
    selector: 'textarea#answer_given_text',
    toolbar: 'undo redo | forecolor strikethrough',
    custom_colors: false,
    color_map: ['FF0000', 'Red', '000000', 'Black',],
    content_style: '.correction { color: red; }',
    statusbar: false,
    menubar: false,
    setup: function (editor) {
      editor.on('init', function (e) {
        editor.setContent(txtcontent);
      });
      editor.on('change', function (e) {
        @this.set('examQuestionInstance.answer_given_text', editor.getContent());
      });
    }
  });
</script>

I'd really appreciate thoughts and ideas on how to best handle this. Thanks!

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda