Last modified: 2013-06-10 03:03:30 UTC

Wikimedia Bugzilla is closed!

Wikimedia has migrated from Bugzilla to Phabricator. Bug reports should be created and updated in Wikimedia Phabricator instead. Please create an account in Phabricator and add your Bugzilla email address to it.
Wikimedia Bugzilla is read-only. If you try to edit or create any bug report in Bugzilla you will be shown an intentional error message.
In order to access the Phabricator task corresponding to a Bugzilla report, just remove "static-" from its URL.
You could still run searches in Bugzilla or access your list of votes but bug reports will obviously not be up-to-date in Bugzilla.
Bug 11957 - mwCustomEditButtons does not handle newlines in tagClose correctly
mwCustomEditButtons does not handle newlines in tagClose correctly
Status: RESOLVED WORKSFORME
Product: MediaWiki
Classification: Unclassified
Page editing (Other open bugs)
1.12.x
All All
: Low minor (vote)
: ---
Assigned To: Nobody - You can work on this!
: javascript
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-11-12 22:44 UTC by Michael Holzt
Modified: 2013-06-10 03:03 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Michael Holzt 2007-11-12 22:44:41 UTC
Actually this bug is against version 1.12alpha (r26409) as installed on de.wikinews.org but i could not choose that version.

I believe i have found a bug in the handling of the JavaScript mwCustomEditButtons variable. I have added this code to MediaWiki:Common.js:

function addCustomButton(imageFile, speedTip, tagOpen, tagClose, sampleText)
{
 mwCustomEditButtons[mwCustomEditButtons.length] =
 {"imageFile": imageFile,
  "speedTip": speedTip,
  "tagOpen": tagOpen,
  "tagClose": tagClose,
  "sampleText": sampleText};
}


I use this function to add custom buttons to the edit bar. Now MediaWiki seems to be intended to place the cursor between the output of "tagOpen" and "tagClose". When i add a button like this...

addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/bb/Button_ébauche.png','test',
"foo","bar","");

...it works without a flaw and places the cursor between 'foo' and 'bar'. When i however add a button like this...

addCustomButton('http://upload.wikimedia.org/wikipedia/commons/b/bb/Button_ébauche.png','test',
"foo","bar\nbaz\n","");

...it does not work correct, but places the cursor after the 'a' of the word 'bar'. What triggers the bug seems to be the newlines (\n) in the tagClose text. It looks like the correct position for the cursor is counted from the end of the text but the newlines are not considered in this, therefore placing the cursor two positions too far to the end of the text (because the tagClose text contains two newlines).
Comment 1 Quim Gil 2013-04-16 06:11:41 UTC
Is this problem still happening? Still relevant?

Sorry, it's not simple for me to test.
Comment 2 Krinkle 2013-06-10 03:03:30 UTC
A lot has changed since 2007.

mwCustomEditButtons is no longer supported. Please migrate to mw.toolbar.

If the issue can be reproduced in MediaWiki 1.20 or later and using the following syntax:

> if ( mw.toolbar ) {
>     mw.toolbar.addButton( {
>        imageFile: 'http:// ... ',
>        speedTip: 'test',
>        etc.
>     } );
> }

Then please re-open this report and be sure to mention "mw.toolbar" in the title.

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links