");
var currentNumber=thisobj.val().length;
limit.addClass("text-right");
if(maxLength==-1){
limit.html('Characters : '+currentNumber);
}else{
limit.html('Characters : '+currentNumber+' of '+maxLength).css('color', '');;
}
limit.addClass("app-edittor-limit-text");
var imgurl=thisobj.data("image-up-path");
var toolbarselected=thisobj.data("no-image")?toolbar_without_image:toolbar_image;
$(this).after(limit);
$(this).addClass("added-ck").summernote({
height:height,
minHeight: minheight,
toolbar:toolbarselected,
buttons: {
fullscreen2: FullScreenButton,
image: function() {
if(imgurl){
var ui = $.summernote.ui;
var button = ui.button({
contents: '
',
tooltip: "Image manager",
click: function () {
$('#modal-image').remove();
$.ajax({
url: imgurl,
dataType: 'html',
beforeSend:function(){
ShowWait(true,"Loading");
},
success: function(html) {
$('body').append('
' + html + '
');
$('#modal-image').modal('show');
setCurrentSummernoteEdittor(thisobj);
},
complete:function(){
ShowWait(false,"Loading");
}
});
}
});
return button.render();
}else{
//alert("Image upload may be disabled");
}
}
},
callbacks: {
onImageUpload: function(image) {
uploadImage(image[0],imgurl,$(this));
},
onKeyup: function(e) {
countCharacter(e,$(this),limit,maxLength,thisobj);
},
onChange:function(e){
countCharacter(e,$(this),limit,maxLength,thisobj);
},
onResize:function(e){
//gcl($(this));
},
onChange:function(e){
var code=$(this).summernote('code');
var ptrn = new RegExp('
|<\\s*[a-z]+ (on[a-z]+=)[^>]*>(.*?)<\\s*/\\s*[a-z]+>','gi');
if(code.match(ptrn)){
code=code.replace(ptrn,"removed");
$(this).summernote('code',code);
}
}
}
});
});
}catch(e){
gcl(e.message);
}
}
function uploadImage(image,url,thisobj) {
if(!url || url==""){
return ;
}
var data = new FormData();
data.append("image",image);
$.ajax ({
data: set_csrf_param(data),
type: "POST",
url: url,// this file uploads the picture and
cache: false,
contentType: false,
processData: false,
success: function(url) {
thisobj.summernote("insertImage", url);
}
});
}
$(function(){
set_summernote_init();
AddOnLoadPopupMethod(set_summernote_init);
});
function countCharacter(e, thisobj,limitObj,maxLength,mainobj){
var num = thisobj.summernote('code').length;
if(maxLength!=-1){
if (num