serendipity_editor.js.tpl: escapeBrackets(str)
This commit is contained in:
@ -174,8 +174,7 @@ function choose_media(id) {
|
|||||||
|
|
||||||
// "Transfer" value from media db popup to form element, used for example for selecting a category-icon
|
// "Transfer" value from media db popup to form element, used for example for selecting a category-icon
|
||||||
function serendipity_imageSelector_addToElement (str, id) {
|
function serendipity_imageSelector_addToElement (str, id) {
|
||||||
id = id.replace(/\[/g, "\\["); // jQuery fails to select the input when the selector contains unescaped [ or ]
|
id = escapeBrackets(str);
|
||||||
id = id.replace(/\]/g, "\\]");
|
|
||||||
var $input = $('#'+id);
|
var $input = $('#'+id);
|
||||||
$input.val(str);
|
$input.val(str);
|
||||||
|
|
||||||
@ -187,6 +186,14 @@ function serendipity_imageSelector_addToElement (str, id) {
|
|||||||
$input.change();
|
$input.change();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Escape an id with [ in it to be able to be used as selector
|
||||||
|
// jQuery fails to select the input when the selector contains unescaped [ or ]
|
||||||
|
function escapeBrackets(str) {
|
||||||
|
str = str.replace(/\[/g, "\\[");
|
||||||
|
str = str.replace(/\]/g, "\\]");
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
// Add another (image) keyword
|
// Add another (image) keyword
|
||||||
function AddKeyword(keyword) {
|
function AddKeyword(keyword) {
|
||||||
s = document.getElementById('keyword_input').value;
|
s = document.getElementById('keyword_input').value;
|
||||||
|
Reference in New Issue
Block a user