From 14d1fa00697b6f821b491267b0d7c569378499c6 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 17 Mar 2015 16:11:05 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=89=E6=8B=A9=E6=96=87=E4=BB=B6=E5=90=8E?= =?UTF-8?q?=E5=B0=B1=E4=B8=8A=E4=BC=A0=E5=B9=B6=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../assets/kindeditor/plugins/image/image.js | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/public/assets/kindeditor/plugins/image/image.js b/public/assets/kindeditor/plugins/image/image.js index 69029eda5..fd7f5a501 100644 --- a/public/assets/kindeditor/plugins/image/image.js +++ b/public/assets/kindeditor/plugins/image/image.js @@ -215,7 +215,51 @@ KindEditor.plugin('image', function(K) { } }); uploadbutton.fileBox.change(function(e) { - localUrlBox.val(uploadbutton.fileBox.val()); + //localUrlBox.val(uploadbutton.fileBox.val()); + if (dialog.isLoading) { + return; + } + // insert local image + if (showLocal && showRemote && tabs && tabs.selectedIndex === 1 || !showRemote) { + if (uploadbutton.fileBox.val() == '') { + alert(self.lang('pleaseSelectFile')); + return; + } + dialog.showLoading(self.lang('uploadLoading')); + uploadbutton.submit(); + localUrlBox.val(''); + return; + } + // insert remote image + var url = K.trim(urlBox.val()), + width = widthBox.val(), + height = heightBox.val(), + title = titleBox.val(), + align = ''; + alignBox.each(function() { + if (this.checked) { + align = this.value; + return false; + } + }); + if (url == 'http://' || K.invalidUrl(url)) { + alert(self.lang('invalidUrl')); + urlBox[0].focus(); + return; + } + if (!/^\d*$/.test(width)) { + alert(self.lang('invalidWidth')); + widthBox[0].focus(); + return; + } + if (!/^\d*$/.test(height)) { + alert(self.lang('invalidHeight')); + heightBox[0].focus(); + return; + } + clickFn.call(self, url, title, width, height, 0, align); + + }); if (allowFileManager) { viewServerBtn.click(function(e) {