From 0db311de0e5b98e3499cfe33cb45529c72df42c9 Mon Sep 17 00:00:00 2001 From: Swling Date: Wed, 24 Aug 2022 09:33:56 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=EF=BC=9A=E7=BC=96=E8=BE=91?= =?UTF-8?q?=E5=99=A8=E4=B8=8A=E4=BC=A0=E5=9B=BE=E7=89=87=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/editor/tinymce/plugins/wndimage/plugin.js | 2 +- static/editor/tinymce/plugins/wndimage/plugin.min.js | 2 +- wnd-frontend.php | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/static/editor/tinymce/plugins/wndimage/plugin.js b/static/editor/tinymce/plugins/wndimage/plugin.js index e08ba57f..bb8c487d 100644 --- a/static/editor/tinymce/plugins/wndimage/plugin.js +++ b/static/editor/tinymce/plugins/wndimage/plugin.js @@ -89,7 +89,7 @@ tinymce.PluginManager.add('wndimage', function(editor, url) { alert(res.data.msg); return ''; } else { - return res.data[0].data; + return res.data.data[0]; } }).catch(err => { console.log(err); diff --git a/static/editor/tinymce/plugins/wndimage/plugin.min.js b/static/editor/tinymce/plugins/wndimage/plugin.min.js index f8df50cd..7e71e533 100644 --- a/static/editor/tinymce/plugins/wndimage/plugin.min.js +++ b/static/editor/tinymce/plugins/wndimage/plugin.min.js @@ -1 +1 @@ -tinymce.PluginManager.add("wndimage",function(t,e){let n=t.getParam("wnd_config");var i=function(){async function e(t){let e=axios({url:n.upload_url,method:"POST",data:t}).then(t=>t.data.status<=0?(alert(t.data.msg),""):t.data[0].data).catch(t=>{console.log(t)});return e}return t.windowManager.open({title:"",body:{type:"panel",items:[{type:"dropzone",name:"fileinput"},{type:"htmlpanel",html:'
'},{type:"input",name:"title",label:"Title"}]},buttons:[{type:"cancel",text:"Close"},{type:"submit",text:"Insert",primary:!0}],img:{},onSubmit:function(e){let n=e.getData();n.title&&(img.alt=n.title),img.removeAttribute("id"),img.removeAttribute("style"),t.insertContent(img.outerHTML),e.close()},onChange:async function(t,i){if("fileinput"!==i.name)return!1;img=document.querySelector("#wnd-single-img");let a=t.getData(),o=a.fileinput[0];if(n.oss_direct_upload){let t={post_parent:n.post_parent},e=await wnd_upload_to_oss(o,t);e&&(img.src=e.url,img.dataset.id=e.id)}else{let t=new FormData;t.append("wnd_file[]",o),t.append("post_parent",n.post_parent);let i=await e(t);i&&(img.src=i.url,img.dataset.id=i.id)}}})};return t.ui.registry.addButton("wndimage",{icon:"image",onAction:function(){i()}}),t.ui.registry.addMenuItem("wndimage",{text:"Wnd Image",onAction:function(){i()}}),{getMetadata:function(){return{name:"Wnd Image",url:"https://wndwp.com"}}}}); \ No newline at end of file +tinymce.PluginManager.add("wndimage",function(t,e){let n=t.getParam("wnd_config");var i=function(){async function e(t){let e=axios({url:n.upload_url,method:"POST",data:t}).then(t=>t.data.status<=0?(alert(t.data.msg),""):t.data.data[0]).catch(t=>{console.log(t)});return e}return t.windowManager.open({title:"",body:{type:"panel",items:[{type:"dropzone",name:"fileinput"},{type:"htmlpanel",html:'
'},{type:"input",name:"title",label:"Title"}]},buttons:[{type:"cancel",text:"Close"},{type:"submit",text:"Insert",primary:!0}],img:{},onSubmit:function(e){let n=e.getData();n.title&&(img.alt=n.title),img.removeAttribute("id"),img.removeAttribute("style"),t.insertContent(img.outerHTML),e.close()},onChange:async function(t,i){if("fileinput"!==i.name)return!1;img=document.querySelector("#wnd-single-img");let a=t.getData(),o=a.fileinput[0];if(n.oss_direct_upload){let t={post_parent:n.post_parent},e=await wnd_upload_to_oss(o,t);e&&(img.src=e.url,img.dataset.id=e.id)}else{let t=new FormData;t.append("wnd_file[]",o),t.append("post_parent",n.post_parent);let i=await e(t);i&&(img.src=i.url,img.dataset.id=i.id)}}})};return t.ui.registry.addButton("wndimage",{icon:"image",onAction:function(){i()}}),t.ui.registry.addMenuItem("wndimage",{text:"Wnd Image",onAction:function(){i()}}),{getMetadata:function(){return{name:"Wnd Image",url:"https://wndwp.com"}}}}); \ No newline at end of file diff --git a/wnd-frontend.php b/wnd-frontend.php index a2af2eab..054053e1 100644 --- a/wnd-frontend.php +++ b/wnd-frontend.php @@ -3,7 +3,7 @@ * Plugin Name: Wnd-Frontend * Plugin URI: https://github.com/swling/wnd-frontend * Description: Wnd-Frontend 是一套基于 ajax 交互逻辑的 WordPress 前端基础框架。商业用途需购买授权。更新日志 - * Version: 0.9.58.6 + * Version: 0.9.58.7 * Author: swling * Author URI: https://wndwp.com * Requires PHP: 7.3 @@ -26,7 +26,7 @@ use Wnd\Model\Wnd_Init; // 版本 -define('WND_VER', '0.9.58.6'); +define('WND_VER', '0.9.58.7'); // 定义插件网址路径 define('WND_URL', plugin_dir_url(__FILE__));