diff --git a/CHANGES.md b/CHANGES.md
index 3af572b7f5d..442fe8a0a12 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -13,6 +13,7 @@ Fixed Issues:
* [#12489](http://dev.ckeditor.com/ticket/12423) and [#12491](http://dev.ckeditor.com/ticket/12423): Fixed: Various issues related to restoring selection after making operations on filler char. See the [fixed cases](http://dev.ckeditor.com/ticket/12491#comment:4).
* [#11647](http://dev.ckeditor.com/ticket/11647): Fixed: The [`editor.blur`](http://docs.ckeditor.com/#!/api/CKEDITOR.editor-event-blur) event is not fired on first blur after initializing the inline editor on already focused element.
* [#12601](http://dev.ckeditor.com/ticket/12601): Fixed: [Strikethrough](http://ckeditor.com/addon/basicstyles) button tooltip spelling.
+* [#12546](http://dev.ckeditor.com/ticket/12546): Fixed: Preview tab in docprops dialog is always disabled.
## CKEditor 4.4.5
diff --git a/plugins/docprops/dialogs/docprops.js b/plugins/docprops/dialogs/docprops.js
index b36fe4944aa..274e0f53ffe 100644
--- a/plugins/docprops/dialogs/docprops.js
+++ b/plugins/docprops/dialogs/docprops.js
@@ -583,14 +583,15 @@ CKEDITOR.dialog.add( 'docProps', function( editor ) {
{
type: 'html',
id: 'previewHtml',
- html: '',
+ html: '',
onLoad: function() {
+ var iframe = this.getElement();
+
this.getDialog().on( 'selectPage', function( ev ) {
if ( ev.data.page == 'preview' ) {
var self = this;
setTimeout( function() {
- var doc = CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getFrameDocument(),
+ var doc = iframe.getFrameDocument(),
html = doc.getElementsByTag( 'html' ).getItem( 0 ),
head = doc.getHead(),
body = doc.getBody();
@@ -598,7 +599,7 @@ CKEDITOR.dialog.add( 'docProps', function( editor ) {
}, 50 );
}
} );
- CKEDITOR.document.getById( 'cke_docProps_preview_iframe' ).getAscendant( 'table' ).setStyle( 'height', '100%' );
+ iframe.getAscendant( 'table' ).setStyle( 'height', '100%' );
}
}
]
diff --git a/tests/plugins/docprops/docprops.js b/tests/plugins/docprops/docprops.js
index a952d991624..95989b64c7a 100644
--- a/tests/plugins/docprops/docprops.js
+++ b/tests/plugins/docprops/docprops.js
@@ -39,5 +39,18 @@ bender.test( {
} );
tc.wait();
+ },
+
+ // #12546
+ 'test preview tab is available': function() {
+ var bot = this.editorBot;
+
+ bot.dialog( 'docProps', function( dialog ) {
+ var tabs = dialog.parts.tabs.getChildren();
+
+ assert.isTrue( !tabs.getItem( 3 ).hasClass( 'cke_dialog_tab_disabled' ), 'Tab preview should be enabled.' );
+
+ dialog.getButton( 'ok' ).click();
+ } );
}
} );
\ No newline at end of file