KindEditor.plugin('govimage', function (K) {
var self = this, name = 'govimage';
self.loadPlugin('userimage', function () {
self.plugin.image = {
edit: editimg,
'delete': function () {
var target = self.plugin.getSelectedImage();
if (target.parent().name == 'a') {
target = target.parent();
}
target.remove();
}
};
});
var editimg=function() {
var img = self.plugin.getSelectedImage();
self.plugin.imageDialog({
imageUrl: img ? img.attr('data-ke-src') : 'http://',
imageWidth: img ? img.width() : '',
imageHeight: img ? img.height() : '',
imageTitle: img ? img.attr('title') : '',
imageAlign: img ? img.attr('align') : '',
showRemote: true,
dir: 'govimage',
clickFn: function (url, title, width, height, border, align) {
self.exec('insertimage', url, title, width, height, border, align);
// Bugfix: [Firefox] 上传图片后,总是出现正在加载的样式,需要延迟执行hideDialog
setTimeout(function () {
self.hideDialog().focus();
}, 0);
}
});
}
self.clickToolbar(name, editimg);
});
我现在是这样写的,但第一次的时候需要点两次才能出来上传的框,可以不用整个框重写吗?