Topic on Extension talk:PreToClip

extension not working in MW 1.40.0

5
213.233.108.192 (talkcontribs)

Hello and thank you for this wonderful extension. However, on my MW 1.40.0 website it doesn't really work. It's rather strange – it is always visible and functional when previewing pages with PRE tags, and also visible right after submitting the edit. In any other circumstances, the pageloader merely ignores it – there is no HTML of it in the code. Any idea ? I've tried both the 1.39 (not at al functional) and master version. Thank you, 213.233.108.192 08:12, 20 October 2023 (UTC)

217.133.38.27 (talkcontribs)

It does't work

Oetterer (talkcontribs)

I have the same problem, using MW1_39. The copy button does only appear right after an edit. On subsequent page calls, no buttons are shown. A look in the javascript console showed the following error:

Uncaught ReferenceError: OO is not defined
    createPreToClipButton https://<host>/extensions/PreToClip/resources/ext.preToClip.js?4b2c4:23
    <anonymous> https://<host>/extensions/PreToClip/resources/ext.preToClip.js?4b2c4:11
    <anonymous> https://<host>/extensions/PreToClip/resources/ext.preToClip.js?4b2c4:42
ext.preToClip.js:23:20

After getting a little bit aquainted with the OOUI Library I added a line to the extension's extension.json:

{
    "ResourceModules": {
        "ext.preToClip": {
            "localBasePath": "resources",
            "remoteExtPath": "PreToClip/resources",
            "scripts": [
                "ext.preToClip.js"
            ],
            "styles": [
                "ext.preToClip.css"
            ],
            "dependencies": [
                "mediawiki.ui.button",
                "oojs-ui-core",
                "oojs-ui.styles.icons-editing-advanced"
            ],
            "messages": [
                "pretoclip-button-tooltip",
                "pretoclip-button-notification-text"
            ]
        }
    }
}

And now it works fine.

PS: I would like to have submitted a gerrit patch, alas I'm a github user and digging into gerrit-manuals was too much a strain on my time. Sorry.

Oetterer (talkcontribs)
Osnard (talkcontribs)

I have merged and released this fix as version 1.0.5. @Oetterer Thanks for the contribution.

Reply to "extension not working in MW 1.40.0"