Fix url encoding
This commit is contained in:
committed by
Arsen Melikyan
parent
db57fd405f
commit
e1aec710aa
@ -46,27 +46,27 @@ window.common = (function(global) {
|
|||||||
break;
|
break;
|
||||||
case common.challengeTypes.JS:
|
case common.challengeTypes.JS:
|
||||||
case common.challengeTypes.BONFIRE:
|
case common.challengeTypes.BONFIRE:
|
||||||
type = 'javascript';
|
type = 'js';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
type = '';
|
type = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
var returnValue = '';
|
var returnValue = '';
|
||||||
if (trigger.id === 'markdown') {
|
switch (trigger.id) {
|
||||||
returnValue = '```' + type + '\n' + editor.getSelection() + '\n```';
|
case 'markdown':
|
||||||
editor.replaceSelection(editor.getSelection());
|
returnValue = '```' + type + '\n' + editor.getSelection() + '\n```';
|
||||||
return returnValue;
|
editor.replaceSelection(editor.getSelection());
|
||||||
} else if (trigger.id === 'plain') {
|
return returnValue;
|
||||||
returnValue = editor.getSelection();
|
case 'plain':
|
||||||
editor.replaceSelection(editor.getSelection());
|
returnValue = editor.getSelection();
|
||||||
return returnValue;
|
editor.replaceSelection(editor.getSelection());
|
||||||
} else if (trigger.id === 'link') {
|
return returnValue;
|
||||||
editor.replaceSelection(editor.getSelection());
|
case 'link':
|
||||||
return ('[Challenge - ' + common.challengeName +
|
editor.replaceSelection(editor.getSelection());
|
||||||
(common.username ? ' (' + common.username + '\'s solution)' : '')
|
return '[Challenge - ' + common.challengeName +
|
||||||
+ '](' + window.location + ')')
|
(common.username ? ' (' + common.username + '\'s solution)' : '')
|
||||||
.replace(/\)/g, '%29').replace(/%29\]/g, ')]') + ')';
|
+ '](' + String(window.location).replace(/\)/g, '%29') + ')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user