diff --git a/CHANGES.md b/CHANGES.md
index 61ba76dc423..75c334f0774 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -5,6 +5,14 @@ CKEditor 4 Changelog
New Features:
+* [#10937](http://dev.ckeditor.com/ticket/10937): MathJax widget improvements:
+ * loading indicator,
+ * IE8 support,
+ * apply paragraph changes (like font color change) to iframe,
+ * FF and IE9 clipboard fixes,
+ * fix same origin policy issue,
+ * fix undo bug,
+ * fix minor bugs,
* [#10028](http://dev.ckeditor.com/ticket/10028): New [`config.dialog_noConfirmCancel`](http://docs.ckeditor.com/#!/api/CKEDITOR.config-cfg-dialog_noConfirmCancel) configuration option that eliminates the need to confirm closing of a dialog window when the user changed any of its fields.
Fixed Issues:
diff --git a/core/htmlparser/fragment.js b/core/htmlparser/fragment.js
index 769db2b7856..f76b4e9c2f0 100644
--- a/core/htmlparser/fragment.js
+++ b/core/htmlparser/fragment.js
@@ -45,6 +45,10 @@ CKEDITOR.htmlParser.fragment = function() {
var rootDtd = CKEDITOR.tools.extend( {}, { html:1 }, CKEDITOR.dtd.html, CKEDITOR.dtd.body, CKEDITOR.dtd.head, { style:1,script:1 } );
function isRemoveEmpty( node ) {
+ // Keep marked element event if it is empty.
+ if ( node.attributes[ 'data-cke-survive' ] )
+ return false;
+
// Empty link is to be removed when empty but not anchor. (#7894)
return node.name == 'a' && node.attributes.href || CKEDITOR.dtd.$removeEmpty[ node.name ];
}
diff --git a/plugins/mathjax/dev/mathjax.html b/plugins/mathjax/dev/mathjax.html
index b24aef54592..b520a07aadd 100644
--- a/plugins/mathjax/dev/mathjax.html
+++ b/plugins/mathjax/dev/mathjax.html
@@ -15,6 +15,7 @@
diff --git a/plugins/mathjax/dialogs/mathjax.js b/plugins/mathjax/dialogs/mathjax.js
index a4b66ad4f20..5b064268ceb 100644
--- a/plugins/mathjax/dialogs/mathjax.js
+++ b/plugins/mathjax/dialogs/mathjax.js
@@ -60,7 +60,7 @@ CKEDITOR.dialog.add( 'mathjax', function( editor ) {
type: 'html',
html:
'' +
- '' +
+ '' +
'
',
onLoad: function( widget ) {
diff --git a/plugins/mathjax/images/loader.gif b/plugins/mathjax/images/loader.gif
new file mode 100644
index 00000000000..88d5bb7fdbf
Binary files /dev/null and b/plugins/mathjax/images/loader.gif differ
diff --git a/plugins/mathjax/lang/en.js b/plugins/mathjax/lang/en.js
index 18597030081..b6661d0dfd4 100644
--- a/plugins/mathjax/lang/en.js
+++ b/plugins/mathjax/lang/en.js
@@ -7,5 +7,6 @@ CKEDITOR.plugins.setLang( 'mathjax', 'en', {
button: 'Math',
dialogInput: 'Write you TeX here',
docUrl: 'http://en.wikibooks.org/wiki/LaTeX/Mathematics',
- docLabel: 'TeX documentation'
+ docLabel: 'TeX documentation',
+ loading: 'loading...'
} );
\ No newline at end of file
diff --git a/plugins/mathjax/plugin.js b/plugins/mathjax/plugin.js
index bb5f4b80c69..3d43dd112a9 100644
--- a/plugins/mathjax/plugin.js
+++ b/plugins/mathjax/plugin.js
@@ -29,13 +29,10 @@
mask: true,
allowedContent: 'span(!' + cls + ')',
- template:
- '' +
- '' +
- '',
+ template: '',
parts: {
- iframe: 'iframe'
+ span: 'span'
},
defaults: {
@@ -43,11 +40,31 @@
},
init: function() {
+ var iframe = this.parts.span.getChild( 0 );
+
+ // Check if span contains iframe and create it otherwise.
+ if ( !iframe || iframe.type != CKEDITOR.NODE_ELEMENT || !iframe.is( 'iframe' ) ) {
+ iframe = new CKEDITOR.dom.element( 'iframe' );
+ iframe.setAttributes( {
+ style: 'border:0;width:0;height:0',
+ scrolling: 'no',
+ frameborder: 0,
+ allowTransparency: true,
+ src: CKEDITOR.plugins.mathjax.fixSrc
+ } );
+ this.parts.span.append( iframe );
+ }
+
// Wait for ready because on some browsers iFrame will not
// have document element until it is put into document.
// This is a problem when you crate widget using dialog.
this.once( 'ready', function() {
- this.frameWrapper = new CKEDITOR.plugins.mathjax.frameWrapper( this.parts.iframe, editor );
+ // Src attribute must be recreated to fix custom domain error after undo
+ // (see iFrame.removeAttribute( 'src' ) in frameWrapper.load).
+ if ( CKEDITOR.env.ie )
+ iframe.setAttribute( 'src', CKEDITOR.plugins.mathjax.fixSrc );
+
+ this.frameWrapper = new CKEDITOR.plugins.mathjax.frameWrapper( iframe, editor );
this.frameWrapper.setValue( this.data.math );
} );
},
@@ -68,17 +85,16 @@
// Add style display:inline-block to have proper height of widget wrapper and mask.
var attrs = el.attributes;
+
if ( attrs.style )
attrs.style += ';display:inline-block';
else
attrs.style = 'display:inline-block';
- el.children[ 0 ].replaceWith( new CKEDITOR.htmlParser.element( 'iframe', {
- style: 'border:0;width:0;height:0',
- scrolling: 'no',
- frameborder: 0,
- allowTransparency: true
- } ) );
+ // Add attribute to prevent deleting empty span in data processing.
+ attrs[ 'data-cke-survive' ] = 1;
+
+ el.children[ 0 ].remove();
return el;
},
@@ -104,11 +120,46 @@
evt.data.dataValue = evt.data.dataValue.replace( /<\/head>/,
'' +
+
+ // Load MathJax lib.
+ '' +
+ '' +
+ '' +
+ '' +
+
+ // Render everything here and after that copy it to the preview.
+ '' +
+ '' +
+ '