var editor;
var editor_name='editor';
_ini();
if(!KindEditor){setTimeout("_ini()",100);}
function _ini(){
KindEditor.ready(function(K) {
editor = K.create('textarea[name=""]', {
newlineTag:'br',
urlType:'relative',
Notice: Undefined index: language in /d/PHPnow/vhosts/xmx.monxin.net/editor/create.php on line 43
items : ['source', '|', 'undo', 'redo', '|', 'preview', 'print', 'template', 'code', 'cut', 'copy', 'paste',
'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'image',
'media', 'insertfile', 'table', 'hr', 'emoticons', 'baidumap', 'pagebreak',
'anchor', 'link', 'unlink', '|'], langType : 'en',
extraFileUploadParams : {
program :""
},
afterCreate:function(){
var doc = this.edit.doc;
var cmd = this.edit.cmd;
contextPath='';
$(doc.body).bind('paste',function(ev){
console.log('editor paste');
var $this = $(this);
var dataItem = ev.originalEvent.clipboardData.items[0];
if(dataItem){
var file = dataItem.getAsFile();
if(file){
var reader = new FileReader();
reader.onload = function(evt) {
var imageDataBase64 = evt.target.result;
show_loading();
$.post(contextPath + "./editor/php/base64.php",{"imageDataBase64":imageDataBase64},function(resp){
console.log(resp);
hide_loading();
v=JSON.parse(resp);
if(v.state=='success'){
if($("div[up_click='1'] input[type='file']").attr('id')){
if(!$("div[up_click='1'] input[type='file']").attr('multiple')){
$("div[up_click='1'] input[type='hidden']").val(t[1]);
input_id=$("div[up_click='1'] input[type='hidden']").attr('id');
$("div[up_click='1'] #"+input_id+"_span").html("
");
}else{
$("div[up_click='1'] input[type='hidden']").val($("div[up_click='1'] input[type='hidden']").val()+'|'+t[1]);
input_id=$("div[up_click='1'] input[type='hidden']").attr('id');
$("div[up_click='1'] #"+input_id+"_up_info").css('display','block');
$("div[up_click='1'] #"+input_id+"_fieldset_succeedList").css('display','block');
$("div[up_click='1'] #"+input_id+"_fieldset_succeedList").css('display','block');
$("div[up_click='1'] #"+input_id+"_fieldset_succeedList").html($("div[up_click='1'] #"+input_id+"_fieldset_succeedList").html()+"
");
}
try{submit_hidden(input_id);}catch(e){}
}else{
var html = '
';
cmd.inserthtml(html);
temp=editor.html().replace(/
]*?src=["']data:image[^'"]+["'][^>]+>/gm, "");
editor.html(temp);
}
}else{
}
});
};
reader.readAsDataURL(file);
}
}
});
}
});
});
}