MediaWiki:Common.js: различия между версиями

Материал из melioration.space
Строка 1: Строка 1:
 
mw.hook( 've.activationComplete' ).add( function() {
 
mw.hook( 've.activationComplete' ).add( function() {
 
console.log("Назначение");
 
console.log("Назначение");
 +
MathJax.typeset();
 
     var view =ve.init.target.getSurface().getView();
 
     var view =ve.init.target.getSurface().getView();
 
     var doc = view.getDocument();
 
     var doc = view.getDocument();
Строка 9: Строка 10:
 
         try
 
         try
 
         {
 
         {
            var selection = model.getSelection().getRange(),
+
        MathJax.typeset();
                node = selection && doc.getBranchNodeFromOffset( selection.start ),
+
console.log("Попытка обновить формулы");
                originalSelection;
 
            if ( !( node instanceof ve.ce.ContentBranchNode ) ) {
 
                return;
 
            }
 
            //remove spell errors from current node
 
            $( node.$element[0] ).find('.spellError').contents().unwrap();
 
            //view.surfaceObserver.disable();
 
            checkSpells( $( node.$element[0] ) );
 
            //reset selection
 
                selection = model.getSelection().getRange();
 
                originalSelection = view.getSelectionState( new ve.Range(selection.to, selection.to) );
 
           
 
            setTimeout( function () {
 
                view.showSelectionState( originalSelection );
 
            } );
 
 
         } catch(err){
 
         } catch(err){
 
             console.log('Error in Gadget-Rechtschreibpruefung.js:documentUpdate');
 
             console.log('Error in Gadget-Rechtschreibpruefung.js:documentUpdate');

Версия 19:20, 25 декабря 2020

mw.hook( 've.activationComplete' ).add( function() {
	console.log("Назначение");
	MathJax.typeset();
    var view =ve.init.target.getSurface().getView();
    var doc = view.getDocument();
    var model = ve.init.target.getSurface().getModel();
    //while editing - only on current node
    model.on( 'documentUpdate', function () {
    	console.log("Обновление");
        try
        {
        	MathJax.typeset();
			console.log("Попытка обновить формулы");
        } catch(err){
            console.log('Error in Gadget-Rechtschreibpruefung.js:documentUpdate');
            console.log(err);
        }
    } );
});