mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/WikiEditor
synced 2024-11-24 00:06:49 +00:00
Revert "Support colon link escapes for categories and files"
This reverts commit e76eba6b96
.
Bug: T290818
Change-Id: I88f86935f0686b98105ddb49ede4b773d5e6de54
This commit is contained in:
parent
6a9a559794
commit
2affca03b3
|
@ -357,18 +357,6 @@
|
||||||
'wikieditor-toolbar-tool-link-insert': function () {
|
'wikieditor-toolbar-tool-link-insert': function () {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
function escapeInternalTarget( s ) {
|
|
||||||
var fileTitle = mw.Title.newFromText( s );
|
|
||||||
if ( fileTitle === null ) {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
var namespaceId = fileTitle.getNamespaceId();
|
|
||||||
if ( namespaceId === 6 || namespaceId === 14 ) {
|
|
||||||
return ':' + s;
|
|
||||||
} else {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
function escapeInternalText( s ) {
|
function escapeInternalText( s ) {
|
||||||
return s.replace( /(\]{2,})/g, '<nowiki>$1</nowiki>' );
|
return s.replace( /(\]{2,})/g, '<nowiki>$1</nowiki>' );
|
||||||
}
|
}
|
||||||
|
@ -406,9 +394,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( target === text || !text.length ) {
|
if ( target === text || !text.length ) {
|
||||||
insertText = '[[' + escapeInternalTarget( target ) + ']]';
|
insertText = '[[' + target + ']]';
|
||||||
} else {
|
} else {
|
||||||
insertText = '[[' + escapeInternalTarget( target ) + '|' + escapeInternalText( text ) + ']]';
|
insertText = '[[' + target + '|' + escapeInternalText( text ) + ']]';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
target = target.trim();
|
target = target.trim();
|
||||||
|
@ -491,7 +479,7 @@
|
||||||
$( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
|
$( '#wikieditor-toolbar-link-dialog' ).data( 'whitespace', [ '', '' ] );
|
||||||
if ( selection !== '' ) {
|
if ( selection !== '' ) {
|
||||||
var matches, target, text, type;
|
var matches, target, text, type;
|
||||||
if ( ( matches = selection.match( /^(\s*):?\[\[([^\]|]+)(\|([^\]|]*))?\]\](\s*)$/ ) ) ) {
|
if ( ( matches = selection.match( /^(\s*)\[\[([^\]|]+)(\|([^\]|]*))?\]\](\s*)$/ ) ) ) {
|
||||||
// [[foo|bar]] or [[foo]]
|
// [[foo|bar]] or [[foo]]
|
||||||
target = matches[ 2 ];
|
target = matches[ 2 ];
|
||||||
text = ( matches[ 4 ] ? matches[ 4 ] : matches[ 2 ] );
|
text = ( matches[ 4 ] ? matches[ 4 ] : matches[ 2 ] );
|
||||||
|
|
Loading…
Reference in a new issue