As the title says, I'm using a version of CkEditor 4.3, based on the full package, that includes also the Image2 plugin (build with CkBuilder, in order to automatically solve every dependency).
What I need is to change programmatically (using, if needed, also jQuery) the src
attribute of an image.
With the classic Image plugin, I did this with the following code:
var imgToBeReplaced = editor.document.findOne("img#myImg");
imgToBeReplaced.setAttribute("src", newSrc);
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: CKEditor - Change image source):
$(imgToBeReplaced.$).attr("data-cke-saved-src", newSrc);
When I do this with the Image2 plugin, 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).
So, the question is: how can I correctly change the src
(and data-cke-saved-src
) attribute(s), without losing the possibility of changing the image properties?