Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!