kindeditor图片上传改为一次弹框
This commit is contained in:
parent
0de5ddd14c
commit
3b99c97617
|
@ -257,10 +257,10 @@ K.options = {
|
|||
minHeight : 100,
|
||||
minChangeSize : 50,
|
||||
zIndex : 811213,
|
||||
items : ['emoticons',
|
||||
items : ['emoticons','imagedirectupload',
|
||||
'source','plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist', '|',
|
||||
'formatblock', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
|
||||
'italic', 'underline', 'removeformat', '|', 'image', 'table', 'link', '|', 'fullscreen'
|
||||
'italic', 'underline', 'removeformat', '|','table', 'link', '|', 'fullscreen'
|
||||
],
|
||||
noDisableItems : ['source', 'fullscreen'],
|
||||
colorTable : [
|
||||
|
@ -3523,6 +3523,7 @@ var html, _direction = '';
|
|||
if ((html = document.getElementsByTagName('html'))) {
|
||||
_direction = html[0].dir;
|
||||
}
|
||||
|
||||
function _getInitHtml(themesPath, bodyClass, cssPath, cssData) {
|
||||
var arr = [
|
||||
(_direction === '' ? '<html>' : '<html dir="' + _direction + '">'),
|
||||
|
@ -5552,7 +5553,39 @@ _plugin('core', function(K) {
|
|||
self.clickToolbar('fullscreen', function() {
|
||||
self.fullscreen();
|
||||
});
|
||||
if (self.fullscreenShortcut) {
|
||||
inputObj = document.createElement("input");
|
||||
inputObj.setAttribute('id', 'jUploadFile_ef');
|
||||
inputObj.setAttribute('type', 'button');
|
||||
inputObj.setAttribute('style', 'visibility:hidden');
|
||||
document.body.appendChild(inputObj);
|
||||
window.uploadButton = K.uploadbutton({
|
||||
button: inputObj,
|
||||
fieldName:'imgFile',
|
||||
url:K.addParam('/kindeditor/upload', 'dir=image'),
|
||||
afterUpload : function(data) {
|
||||
if (data.error === 0) {
|
||||
var url = K.formatUrl(data.url, 'absolute');
|
||||
self.exec('insertimage', url, 'image','','','1','left');
|
||||
var asset_id = data.asset_id;
|
||||
if ( asset_id != "" && parent.document.getElementById('asset_id') != null ) {
|
||||
parent.document.getElementById('asset_id').value += asset_id.toString();
|
||||
parent.document.getElementById('asset_id').value += ",";
|
||||
}else{
|
||||
//TODO 暂时什么也不做
|
||||
}
|
||||
} else {
|
||||
alert(data.message);
|
||||
}
|
||||
},
|
||||
afterError : function(str) {
|
||||
alert('error: ' + str);
|
||||
}
|
||||
});
|
||||
uploadButton.fileBox.change(function(e) {
|
||||
uploadButton.submit();
|
||||
});
|
||||
|
||||
if (self.fullscreenShortcut) {
|
||||
var loaded = false;
|
||||
self.afterCreate(function() {
|
||||
K(self.edit.doc, self.edit.textarea).keyup(function(e) {
|
||||
|
@ -5585,6 +5618,10 @@ _plugin('core', function(K) {
|
|||
self[name]();
|
||||
});
|
||||
});
|
||||
self.clickToolbar('imagedirectupload', function() {
|
||||
$('.ke-upload-file').focus().trigger('click');
|
||||
|
||||
});
|
||||
self.clickToolbar('formatblock', function() {
|
||||
var blocks = self.lang('formatblock.formatBlock'),
|
||||
heights = {
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
*******************************************************************************/
|
||||
|
||||
KindEditor.lang({
|
||||
imagedirectupload:'本地图片',
|
||||
source : 'HTML代码',
|
||||
preview : '预览',
|
||||
undo : '后退(Ctrl+Z)',
|
||||
|
|
|
@ -413,6 +413,13 @@
|
|||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
|
||||
.ke-icon-imagedirectupload
|
||||
{
|
||||
background-position: 0px -1232px;
|
||||
width: 16px;
|
||||
height: 16px;
|
||||
}
|
||||
/* container */
|
||||
.ke-container {
|
||||
display: block;
|
||||
|
|
Loading…
Reference in New Issue