Skip to content

Commit

Permalink
Partial fix for localwiki#280, for images already on the page
Browse files Browse the repository at this point in the history
  • Loading branch information
mivanov committed Jun 7, 2012
1 parent f73ae26 commit c1a01b7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,13 @@ For licensing, see LICENSE.html or http://ckeditor.com/license
element.removeClass("image_right");
if ( value ) {
element.addClass("image_" + value);
// Move to top level in the DOM when floated
top_level = jQuery(element.$).parentsUntil('body,td,th').last();
if(top_level.length)
{
jQuery(element.$).remove();
top_level.before(jQuery(element.$));
}
}

if ( !internalCommit && type == IMAGE )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ CKEDITOR.plugins.add( 'simpleimage',
var oldHtml = oldFrame.length ? oldFrame.outerHTML() : img.outerHTML();
img.addClass('cke_moved');
oldFrame.addClass('cke_moved');
var floated = oldFrame.hasClass('image_right') || oldFrame.hasClass('image_left');
var moveImage = function(evt){
oldFrame.remove();
var moved_image = jQuery('img.cke_moved', editor.document.$);
Expand All @@ -160,7 +161,13 @@ CKEDITOR.plugins.add( 'simpleimage',
outerFrame.before(oldHtml);
else outerFrame.after(oldHtml);
} else {
moved_element.before(oldHtml);
where_to_drop = moved_element;
if(floated)
{
top_level = moved_element.parentsUntil('body,td,th').last();
where_to_drop = top_level;
}
where_to_drop.before(oldHtml);
}
// fix the cursor position
var selection = editor.getSelection();
Expand Down

0 comments on commit c1a01b7

Please sign in to comment.