Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
How to retrieve data from CKEDITOR property popup

I need to retrieve the width from CKEDITOR image property popup when i add the image.

The reason i need to get the width is that i am using CKEDITOR to construct campaign mails.

CKEDITOR sets the prpoerties in a style tag. That is a problem for Outlook because Outlook wats the width of an image as an attribute.

I am pretty new to js and CKEDITOR, but i have found some code that could edit how CKEDITOR inserts the image element. But i still want to be able to set an image size in the CKEDITOR property window.

CKEDITOR.on('dialogDefinition', function(ev) {
  var dialogName = ev.data.name;
  var dialogDefinition = ev.data.definition;
  var editor = ev.editor;
    
  if (dialogName == 'image') {
      dialogDefinition.onOk = function(e) {
                var width = e.sender.originalElement.$.width;
                console.log(width);
                if (width >= 600) {
                    console.log("in");
                    width = "100%";
                } else {
                    width = width + "px";
                }
        var imageSrcUrl = e.sender.originalElement.$.src;
        var imgHtml = CKEDITOR.dom.element.createFromHtml("<img src=" + imageSrcUrl + " alt='' width='100%' style='width: " + width + "'/> " );
        editor.insertElement(imgHtml);
      };
  }
});

So i want to be able to retrieve the width insrted in the property window when the image is inserted. Can anyone help?

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda