|
@@ -5859,7 +5859,7 @@ _plugin('core', function(K) {
|
|
|
};
|
|
|
self.plugin.getSelectedImage = function() {
|
|
|
return _getImageFromRange(self.edit.cmd.range, function(img) {
|
|
|
- return !/^ke-\w+$/i.test(img[0].className);
|
|
|
+ return !/^ke-\w+$/i.test(img[0].className) && !img[0].getAttribute('data-key') && !img[0].getAttribute('data-applet') && !img[0].getAttribute('data-file');
|
|
|
});
|
|
|
};
|
|
|
self.plugin.getSelectedFlash = function() {
|
|
@@ -5869,7 +5869,12 @@ _plugin('core', function(K) {
|
|
|
};
|
|
|
self.plugin.getSelectedMedia = function() {
|
|
|
return _getImageFromRange(self.edit.cmd.range, function(img) {
|
|
|
- return img[0].className == 'ke-media' || img[0].className == 'ke-rm';
|
|
|
+ return img[0].className == 'ke-media' || img[0].className == 'ke-rm' || img[0].getAttribute('data-file');
|
|
|
+ });
|
|
|
+ };
|
|
|
+ self.plugin.getSelectedDiy = function() {
|
|
|
+ return _getImageFromRange(self.edit.cmd.range, function(img) {
|
|
|
+ return img[0].getAttribute('data-applet') || img[0].getAttribute('data-key');
|
|
|
});
|
|
|
};
|
|
|
self.plugin.getSelectedAnchor = function() {
|
|
@@ -5877,7 +5882,7 @@ _plugin('core', function(K) {
|
|
|
return img[0].className == 'ke-anchor';
|
|
|
});
|
|
|
};
|
|
|
- _each('link,image,flash,media,anchor'.split(','), function(i, name) {
|
|
|
+ _each('diy,link,image,flash,media,anchor'.split(','), function(i, name) {
|
|
|
var uName = name.charAt(0).toUpperCase() + name.substr(1);
|
|
|
_each('edit,delete'.split(','), function(j, val) {
|
|
|
self.addContextmenu({
|
|
@@ -7704,6 +7709,45 @@ KindEditor.plugin('image', function(K) {
|
|
|
self.clickToolbar(name, self.plugin.image.edit);
|
|
|
});
|
|
|
|
|
|
+
|
|
|
+KindEditor.plugin('diy', function(K) {
|
|
|
+ var self = this, name = 'diy';
|
|
|
+ self.plugin.diy = {
|
|
|
+ edit : function() {
|
|
|
+ var value = self.plugin.getSelectedDiy();
|
|
|
+ if (value.attr('data-applet')) {
|
|
|
+ $('.update_show_editor').each(function(i)
|
|
|
+ {
|
|
|
+ var key = $(this).attr('key');
|
|
|
+ if (key.indexOf('http://') > -1) {
|
|
|
+ $(this).attr('data-value', value.attr('data-applet'));
|
|
|
+ $(this).click();
|
|
|
+ $(this).attr('data-value', '');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else if (value.attr('data-key')) {
|
|
|
+ var data_key = value.attr('data-key');
|
|
|
+ $('.upload_show_editor').each(function(i)
|
|
|
+ {
|
|
|
+ var key = $(this).attr('key');
|
|
|
+ if (key == data_key) {
|
|
|
+ $(this).attr('data-value', value.attr('data-id'));
|
|
|
+ $(this).click();
|
|
|
+ $(this).attr('data-value', '');
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+ 'delete' : function() {
|
|
|
+ var target = self.plugin.getSelectedDiy();
|
|
|
+ if (target.parent().name == 'a') {
|
|
|
+ target = target.parent();
|
|
|
+ }
|
|
|
+ target.remove();
|
|
|
+ self.addBookmark();
|
|
|
+ }
|
|
|
+ };
|
|
|
+});
|
|
|
/*******************************************************************************
|
|
|
* KindEditor - WYSIWYG HTML Editor for Internet
|
|
|
* Copyright (C) 2006-2011 kindsoft.net
|
|
@@ -8206,13 +8250,13 @@ KindEditor.plugin('media', function(K) {
|
|
|
viewCoverServerBtn.click(function(e) {
|
|
|
|
|
|
var clickFn = function(url, title, id) {
|
|
|
- K('[name="cover_url"]', div).val(url);
|
|
|
+ coverUrlBox.val(url);
|
|
|
if (self.afterSelectFile) {
|
|
|
self.afterSelectFile.call(self, url);
|
|
|
}
|
|
|
};
|
|
|
|
|
|
- var cur = K('[name="cover_url"]', div).val();
|
|
|
+ var cur = coverUrlBox.val();
|
|
|
editorShowUpload(cur, self.uploadJson.replace('save.kindeditor', 'view.files'), '图库', clickFn, this);
|
|
|
|
|
|
/*
|
|
@@ -8236,11 +8280,19 @@ KindEditor.plugin('media', function(K) {
|
|
|
}
|
|
|
var img = self.plugin.getSelectedMedia();
|
|
|
if (img) {
|
|
|
- var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
|
|
|
- urlBox.val(attrs.src);
|
|
|
- widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
|
|
|
- heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
|
|
|
- autostartBox[0].checked = (attrs.autostart === 'true');
|
|
|
+ if (img.attr('data-file')) {
|
|
|
+ var temp = img.attr('data-file').split('||');
|
|
|
+ nameBox.val(temp[1]);
|
|
|
+ whBox.val(temp[2]);
|
|
|
+ urlBox.val(temp[0]);
|
|
|
+ coverUrlBox.val(img.attr('src'));
|
|
|
+ } else {
|
|
|
+ var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
|
|
|
+ urlBox.val(attrs.src);
|
|
|
+ widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
|
|
|
+ heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
|
|
|
+ autostartBox[0].checked = (attrs.autostart === 'true');
|
|
|
+ }
|
|
|
}
|
|
|
urlBox[0].focus();
|
|
|
urlBox[0].select();
|