Answer the question
In order to leave comments, you need to log in
How to change the CKEDITOR parameter?
Hello!
The form has a text box in which the user enters the URL and a text area that is filled using the CKEDITOR editor.
Here is how the editor is initiated:
CKEDITOR.replace('ae-textarea-text', {
filebrowserImageUploadUrl: '/Sites/UploadImgToSite?Site=' + $("#SiteName").val(),
height: 850,
width: 800
});
Answer the question
In order to leave comments, you need to log in
CKEDITOR has no way to change filebrowserImageUploadUrl dynamically.
The simplest solution:
$("#SiteName").change(function () {
setcookie('upload_site', $(this).val());
}).change();
function setcookie(name, value, expires, path, domain, secure) {
expires instanceof Date ? expires = expires.toGMTString() : typeof(expires) == 'number' && (expires = (new Date(+(new Date) + expires * 1e3)).toGMTString());
var r = [name + "=" + escape(value)], s, i;
for(i in s = {expires: expires, path: path, domain: domain}){
s[i] && r.push(i + "=" + s[i]);
}
return secure && r.push("secure"), document.cookie = r.join(";"), true;
}
Try like this:
var editor = CKEDITOR.replace('ae-textarea-text', {
filebrowserImageUploadUrl: '/Sites/UploadImgToSite',
height: 850,
width: 800
});
$('#SiteName').change(function() {
editor.config.filebrowserImageUploadUrl = '/Sites/UploadImgToSite?Site=' + $("#SiteName").val();
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question