Opened 8 years ago

Last modified 7 years ago

#6143 confirmed Bug

Fakeobjects element inserted inside paragraph

Reported by: Richard Waite Owned by:
Priority: Normal Milestone:
Component: General Version: 3.0
Keywords: Cc:

Description

I'm using fakeobjects in a custom plugin. This plugin creates a div element, which is inserted as a fake element in the editor.

Problem is that the fake element is an image, so using 'editor.insertElement()' function inserts the element inside a paragraph, when it should be inserted outside the currently selected element.

Change History (1)

comment:1 Changed 7 years ago by Jakub Ś

Status: newconfirmed
Version: 3.0

To reproduce you can try the below code:

var editor = CKEDITOR.replace( 'editor1');
	editor.on( 'instanceReady', function( evt )
	{
		evt.editor.getCommand( 'undo' ).on( 'afterUndo', function(  )
		{
		var x = editor.createFakeElement( editor.document.createElement( 'div' ), 'cke_anchor', 'div' , false);						
		editor.insertElement(x);
		});
	});

When you press undo while inside paragraph, new div will be inserted into paragraph instead of splitting it in two.

Currently we don't have support for block-level fake elements.

@richardw - pagebreak plugin seems to do something similar to what you want\wanted to achieve. Perhaps you will find something useful there.
Another option would be adding "DOM structure awareness" to the plugin.

Note: See TracTickets for help on using tickets.
© 2003 – 2017 CKSource – Frederico Knabben. All rights reserved. | Terms of use | Privacy policy