Fix rendering issues in MathML mode

Force display:none on a hidden MathML rendering to avoid generating
focusable node highlights.
Move adding of class to setup to ensure it persists after render.

Bug: T87007
Change-Id: I5fc21afa61ccc07e9d2126846cf29ee898182a7c
This commit is contained in:
Ed Sanders 2014-11-12 18:46:46 +00:00 committed by Physikerwelt
parent 6d4912f6f4
commit da0e6cab16
4 changed files with 24 additions and 6 deletions

View file

@ -513,6 +513,7 @@ $wgResourceModules['ext.math.visualEditor'] = array(
'VisualEditor/ve.ui.MWMathInspectorTool.js',
),
'styles' => array(
'VisualEditor/ve.ce.MWMathNode.css',
'VisualEditor/ve.ui.MWMathIcons.css',
'VisualEditor/ve.ui.MWMathInspector.css',
),

View file

@ -0,0 +1,11 @@
/**
* Hide math tag completely to avoid extra bounding boxes for Chrome, Safari, Android...
* Browser-specific hacks are bad but let's use that for now...
* See http://browserhacks.com
*/
@media screen and (-webkit-min-device-pixel-ratio:0) {
.ve-ce-mwMathNode .mwe-math-mathml-a11y {
display: none !important;
}
}

View file

@ -17,12 +17,9 @@
* @param {ve.dm.MWMathNode} model Model to observe
* @param {Object} [config] Configuration options
*/
ve.ce.MWMathNode = function VeCeMWMathNode( model, config ) {
ve.ce.MWMathNode = function VeCeMWMathNode() {
// Parent constructor
ve.ce.MWInlineExtensionNode.call( this, model, config );
// DOM changes
this.$element.addClass( 've-ce-mwMathNode' );
ve.ce.MWMathNode.super.apply( this, arguments );
};
/* Inheritance */
@ -37,6 +34,15 @@ ve.ce.MWMathNode.static.primaryCommandName = 'math';
/* Methods */
/** */
ve.ce.MWMathNode.prototype.onSetup = function () {
// Parent method
ve.ce.MWMathNode.super.prototype.onSetup.call( this );
// DOM changes
this.$element.addClass( 've-ce-mwMathNode' );
};
/** */
ve.ce.MWMathNode.prototype.onParseSuccess = function ( deferred, response ) {
var data = response.visualeditor, contentNodes = this.$( data.content ).get();

View file

@ -18,7 +18,7 @@
*/
ve.dm.MWMathNode = function VeDmMWMathNode() {
// Parent constructor
ve.dm.MWInlineExtensionNode.apply( this, arguments );
ve.dm.MWMathNode.super.apply( this, arguments );
};
/* Inheritance */