Note that there are some explanatory texts on larger screens.

plurals
  1. POIn CkEditor 4.3 with Image2 plugin, what is the right way to change the image src?
    primarykey
    data
    text
    <p>As the title says, I'm using a version of <a href="http://ckeditor.com/download" rel="nofollow noreferrer">CkEditor 4.3</a>, based on the full package, that includes also the <a href="http://ckeditor.com/addon/image2" rel="nofollow noreferrer">Image2 plugin</a> (build with <a href="http://ckeditor.com/builder" rel="nofollow noreferrer">CkBuilder</a>, in order to automatically solve every dependency).</p> <p>What I need is to change programmatically (using, if needed, also jQuery) the <code>src</code> attribute of an image.</p> <p>With the classic <a href="http://ckeditor.com/addon/image" rel="nofollow noreferrer">Image plugin</a>, I did this with the following code:</p> <pre><code>var imgToBeReplaced = editor.document.findOne("img#myImg"); imgToBeReplaced.setAttribute("src", newSrc); </code></pre> <p>Because I need to be sure that the getData() method of the editor object returns the right data, I do also the following (read more about it: <a href="https://stackoverflow.com/questions/5593296/ckeditor-change-image-source">CKEditor - Change image source</a>):</p> <pre><code>$(imgToBeReplaced.$).attr("data-cke-saved-src", newSrc); </code></pre> <p>When I do this with the <a href="http://ckeditor.com/addon/image2" rel="nofollow noreferrer">Image2 plugin</a>, the image is correctly changed, but after that, I cannot resize it and I cannot access to the image properties (neither with double-click on the image, nor using the context menu that opens right-clicking on the image, because the option "properties" is no more present).</p> <p>So, the question is: how can I correctly change the <code>src</code> (and <code>data-cke-saved-src</code>) attribute(s), without losing the possibility of changing the image properties?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload