Topic on Skin talk:Minerva Neue

Toggle desktop visual editor on Desktop mode

1
Summary by Ztiruam

I never get any help here... Oh well, I found it out myself and I'll share my little fix here. I know it is NEVER a good idea to edit sourcecode, but oh well... You'll just have to have a .txt of things to remember when upgrading.

So, I wanted to toggle the regular visual editor on desktop mode, and the mobile on mobile mode. My fix detects if the user is on a mobile or desktop and changes the edit link.

change the addEditButton function in MinervaNeue/resources/skins.minerva.editor/init.js to this:

 

function addEditButton( section, container ) {

if( navigator.userAgent.match(/Android/i)

|| navigator.userAgent.match(/webOS/i)

|| navigator.userAgent.match(/iPhone/i)

|| navigator.userAgent.match(/iPad/i)

|| navigator.userAgent.match(/iPod/i)

|| navigator.userAgent.match(/BlackBerry/i)

|| navigator.userAgent.match(/Windows Phone/i)

){

    var detectmob = true;

  }

else {

    var detectmob = false;

  }

                if (detectmob === false) {

                        return $( '<a class="edit-page">' )

                        .attr( {

                                href: window.location.href + '&veaction=edit&section=' + section,

                                title: $( container ).attr( 'title' )

                        } )

                        .text( mw.msg( 'mobile-frontend-editor-edit' ) )

                        .prependTo( container );

                }

               

    else if(detectmob === true) {

                        return $( '<a class="edit-page">' )

                        .attr( {

                                href: '#/editor/' + section,

                                title: $( container ).attr( 'title' )

                        } )

                        .text( mw.msg( 'mobile-frontend-editor-edit' ) )

                        .prependTo( container );

                }

        }

And there you go! A better way to do this is through an extension, I havent made one before and I needed a quick fix. I guess you maybe could fix this in LocalSettings.php in some way.

Ztiruam (talkcontribs)

Hello!

I want to toggle the desktop visual editor on desktop mode, is there some easy way to do this?

If I add "&veaction=edit" to the title, the desktop visual editor is toggled. How do I change the action when clicking the edit button on desktop mode?