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

250
Vistas
Quill js Question :- When I make changes to the delta will it also do changes to DOM?

Problem :- So when I insert an image in quill js editor it uploads image as data base64 format. Which is very big to move around different pages.

Aim :- I want to make a program so that when an image is inserted in editor I download the image, through laravel backend and return image url to replace the img src in the dom. I have already done the downloading of image and url returning part of the code.

Main Question :- If I edit Delta of quill js will it change the img src in the dom too??

P.S. :- I don't have a code yet to submit I am just curious to know if delta changes will reflect in DOM or not. Please comment if you need more info, Thanks

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

So I figured it out I stored delta to a variable, then I made changes to that variable and then I setContents(delta) to the editor and that changed the data base 64 to url.

emailEditor.on('editor-change', function(eventName,args) {
 var delta = ( emailEditor.getContents() );
 if (eventName === 'text-change') {

 let arr = (args['ops']);
 if (args['ops'].length == 1 && !(arr[0].hasOwnProperty('delete'))){
   if (args['ops'][0]['insert']['image'] != null){
    for (let index = 0; index < delta['ops'].length; index++) {          
     if (delta['ops'][index]['insert'].hasOwnProperty('image') && args['ops'][0]['insert']['image'] == delta['ops'][index]['insert']['image']) {
      saveImage(index);
     }
    }
   }
  }
  else if (args['ops'].length == 2 && !(arr[1].hasOwnProperty('delete'))){
   if (args['ops'][1]['insert']['image'] != null){
    for (let index = 0; index < delta['ops'].length; index++) {          
     if (delta['ops'][index]['insert'].hasOwnProperty('image') && args['ops'][1]['insert']['image'] == delta['ops'][index]['insert']['image']) {
      saveImage(index);
     }
    }
   }
  }
 }

 function saveImage(key) {
  let imageURL = JSON.stringify(delta['ops'][key]['insert']['image']);
  $.ajax({
   headers: {
    'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
   },
   type: "POST",
   url: "url-to-backend",
   data: { "imageURL": imageURL },
   success: function (data) {
    delta['ops'][key]['insert']['image'] = (data);
    emailEditor.setContents(delta);
   },
   error: function (data) {
    alert("some Error");
   }
  });
 }
});

My code is not perfect, but it works for me, if you find this not suitable for community or if you want me to add comments on working let me know I will delete/edit the Question/Answer.

about 4 years ago · Juan Pablo Isaza Denunciar
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