Opened 9 years ago
Last modified 9 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
- 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'
}
},
} );
} );
- 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 9 years ago by
| Status: | new → confirmed |
|---|---|
| Version: | → 4.3 |
comment:2 Changed 9 years ago by
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>

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