Opened 8 years ago

Last modified 8 years ago

#14905 confirmed Bug

Initiating widget can add blank space

Reported by: Mark Wade Owned by:
Priority: Normal Milestone:
Component: General Version: 4.3
Keywords: Cc:

Description

Steps to reproduce

  1. Create a plugin which uses a widget - a simplified version of plugin I am experiencing this issue on is:
CKEDITOR.plugins.add( 'ipsquote', {
    requires: 'widget',
    icons: 'ipsquote',
    hidpi: true,
    allowedContent: 'blockquote',
    init: function( editor ) {
	    editor.widgets.add( 'ipsquote', {
			/* Basic Widget definition */
			button: "Quote",
	        template: "<blockquote class='ipsQuote' data-ipsQuote><div class='ipsQuote_citation'>Quote</div><div class='ipsQuote_contents ipsClearfix'></div></blockquote>",
	        editables: {
		        content: {
		            selector: '.ipsQuote_contents'
		        }
		    },
		} );
} );
  1. Insert content into the editor using insertElement() which mates the format of the widget created and includes code in <pre> tags. Then initiate the widget on that element. A simplified version of plugin I am experiencing this issue on is:
					var quote = "<blockquote class='ipsQuote' data-ipsQuote><div class='ipsQuote_citation'>Quote</div><div class='ipsQuote_contents ipsClearfix'><pre class='ipsCode'>Some code</pre></div></blockquote>";
					var element = CKEDITOR.dom.element.createFromHtml( quote );
					instance.insertElement( element );
					instance.widgets.initOn( element, 'ipsquote' );

Expected result

The provided content is inserted into the editor with the contents of the <pre> tags unmodified

Actual result

A blank line is inserted at the beginning of the <pre> tag

Other details (browser, OS, CKEditor version, installed plugins)

Change History (2)

comment:1 Changed 8 years ago by Tade0

Status: newconfirmed
Version: 4.3

This error indeed occurs, but to reproduce it one has to, after the widget is inserted, switch to source mode and back.

comment:2 Changed 8 years ago by Jakub Ś

I confirm this. When you switch to source mode and back extra line is added after starting pre tag <pre class='ipsCode'>Some code</pre>

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy