@ajaxjs/ui 1.5.2 → 1.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ajaxjs-ui.cjs.js +1 -1
- package/dist/ajaxjs-ui.es.js +303 -191
- package/dist/ajaxjs-ui.umd.js +1 -1
- package/dist/types/index.d.ts +11 -0
- package/dist/ui.css +1 -1
- package/package.json +1 -1
package/dist/ajaxjs-ui.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),C={},m=(e,t)=>{const l=e.__vccOpts||e;for(const[r,n]of t)l[r]=n;return l};function y(e,t,l,r,n,s){return o.openBlock(),o.createElementBlock("button",null,"hihi")}const p=m(C,[["render",y]]),g=o.defineComponent({name:"HtmlEditor",props:{modelValue:String,uploadImageActionUrl:String,isIonicons:Boolean},emits:["update:modelValue","onchange"],data(){return{isShowCode:!1,iframeEl:null,sourceEditor:null}},mounted(){this.iframeEl=this.$el.querySelector("iframe"),this.sourceEditor=this.$el.querySelector("textarea"),this.iframeEl.contentWindow.onload=e=>{this.iframeDoc=this.iframeEl.contentWindow.document,this.iframeDoc.designMode="on",this.iframeDoc.addEventListener("paste",k.bind(this)),new MutationObserver((t,l)=>{this.isShowCode||(this.sourceEditor.value=this.iframeDoc.body.innerHTML,this.$emit("onchange",this.sourceEditor.value)),this.$emit("update:modelValue",this.iframeDoc.body.innerHTML)}).observe(this.iframeDoc.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},this.sourceEditor.oninput=e=>{this.isShowCode&&this.sourceEditor.value&&(this.setIframeBody(this.sourceEditor.value),this.$emit("onchange",this.sourceEditor.value))}},methods:{setIframeBody(e){this.iframeDoc&&this.iframeDoc.body&&(this.iframeDoc.body.innerHTML=e)},getValue(e,t){let l=this.iframeDoc.body.innerHTML;return e&&(l=E(l)),t&&(l=encodeURIComponent(l)),l},createLink(){const e=prompt("请输入 URL 地址");e&&this.format("createLink",e)},insertImage(){window.isCreate?alert("请保存记录后再上传图片。"):this.uploadImgMgr.show(e=>{e&&e.isOk&&this.format("insertImage",e.fullUrl)})},cleanHTML(){this.setIframeBody(HtmlSanitizer.SanitizeHtml(this.iframeDoc.body.innerHTML))},saveRemoteImage2Local(){const e=this.iframeDoc.querySelectorAll("img"),t=new Array,l=[];for(let r=0,n=e.length;r<n;r++){const s=e[r],i=s.getAttribute("src");i!=null&&/^http/.test(i)&&(t.push(s),l.push(i))}l.length||console.log("未发现有远程图片")},onCmdClk(e){const t=e.target,l=t.className.split(" ").shift();this.format(l)},format(e,t){t?this.iframeDoc.execCommand(e,!1,t):this.iframeDoc.execCommand(e,!1)},onFontsizeChoserClk(e){const t=e.target,l=e.currentTarget.children;let r,n;for(r=0,n=l.length;r<n&&t!=l[r];r++);this.format("fontsize",r+"")},onFontfamilyChoserClk(e){const t=e.target;this.format("fontname",t.innerHTML);const l=t.parentNode;l.style.display="none",setTimeout(()=>l.style.display="",300)},createColorPickerHTML(){const e=["00","33","66","99","CC","FF"];let t,l,r,n;const s=['<div class="colorhead"><span class="colortitle">颜色选择</span></div><div class="colorbody"><table cellspaci="0" cellpadding="0"><tr>'];for(let i=0;i<6;++i){s.push('<td><table class="colorpanel" cellspacing="0" cellpadding="0">');for(let a=0,f=e[i];a<6;++a){s.push("<tr>");for(let d=0,u=e[a];d<6;++d)t=e[d],r=d==5&&i!=2&&i!=5?";border-right:none;":"",n=a==5&&i<3?";border-bottom:none":"",l="#"+f+t+u,s.push('<td unselectable="on" style="background-color: '+l+r+n+'" title="'+l+'"></td>');s.push("</tr>")}s.push("</table></td>"),e[i]=="66"&&s.push("</tr><tr>")}return s.push("</tr></table></div>"),s.join("")}},watch:{modelValue(e,t){t||this.setIframeBody(e)},isShowCode(e){e?(this.iframeEl.classList.add("hide"),this.sourceEditor.classList.add("show"),c.call(this,!0)):(this.iframeEl.classList.remove("hide"),this.sourceEditor.classList.remove("show"),c.call(this,!1))}}});function k(e){if(!this.uploadImageActionUrl){alert("未提供图片上传地址");return}const t=e.clipboardData&&e.clipboardData.items;if(!t||!t.length)return;let l=null;for(let s=0;s<t.length;s++){const i=t[s];if(i.type.indexOf("image")!==-1){l=i.getAsFile();break}}if(!l)return;e.preventDefault();const r=new FormData;r.append("file",l,l.name);const n=new XMLHttpRequest;n.addEventListener("load",s=>{if(n.status>=200&&n.status<300){const i=JSON.parse(n.responseText);console.log("Success:",i),this.format("insertImage",i.data.url)}else console.error("Upload failed with status:",n.status),alert("Upload failed!")}),n.addEventListener("error",function(s){console.error("Network error during upload:",s),alert("Upload failed due to a network error!")}),n.open("POST",this.uploadImageActionUrl),n.send(r)}function c(e){this.$el.querySelectorAll(".toolbar i").forEach(t=>{t.className.indexOf("switchMode")==-1&&(t.style.color=e?"lightgray":"")})}function E(e){return e=e.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi,""),e=e.replace(/(class|style|type|start)=("(.*?)"|(\w*))/gi,""),e=e.replace(/<style(.*?)style>/gi,""),e=e.replace(/<script(.*?)script>/gi,""),e=e.replace(/<!--(.*?)-->/gi,""),e}const h={class:"aj-form-html-editor"},v={class:"toolbar"},N={class:"dorpdown"},V={class:"dorpdown"},w={class:"dorpdown"},b=["innerHTML"],I={class:"dorpdown"},L=["innerHTML"];function A(e,t,l,r,n,s){return o.openBlock(),o.createElementBlock("div",h,[o.createElementVNode("ul",v,[o.createElementVNode("li",N,[t[20]||(t[20]=o.createElementVNode("i",{title:"字体",class:"text-icon"},"A",-1)),o.createElementVNode("div",{class:"fontfamilyChoser",onClick:t[0]||(t[0]=(...i)=>e.onFontfamilyChoserClk&&e.onFontfamilyChoserClk(...i))},[...t[19]||(t[19]=[o.createStaticVNode('<a style="font-family:'宋体';">宋体</a><a style="font-family:'黑体';">黑体</a><a style="font-family:'楷体';">楷体</a><a style="font-family:'隶书';">隶书</a><a style="font-family:'幼圆';">幼圆</a><a style="font-family:'Microsoft YaHei';">Microsoft YaHei</a><a style="font-family:Arial;">Arial</a><a style="font-family:'Arial Narrow';">Arial Narrow</a><a style="font-family:'Arial Black';">Arial Black</a><a style="font-family:'Comic Sans MS';">Comic Sans MS</a><a style="font-family:Courier;">Courier</a><a style="font-family:System;">System</a><a style="font-family:'Times New Roman';">Times New Roman</a><a style="font-family:Verdana;">Verdana</a>',14)])])]),o.createElementVNode("li",V,[t[22]||(t[22]=o.createElementVNode("i",{title:"字号",class:"text-icon"},"H",-1)),o.createElementVNode("div",{class:"fontsizeChoser",onClick:t[1]||(t[1]=(...i)=>e.onFontsizeChoserClk&&e.onFontsizeChoserClk(...i))},[...t[21]||(t[21]=[o.createStaticVNode('<a style="font-size:xx-small;">极小</a><a style="font-size:x-small;">特小</a><a style="font-size:small;">小</a><a style="font-size:medium;">中</a><a style="font-size:large;">大</a><a style="font-size:x-large;">特大</a><a style="font-size:xx-large;line-height:140%;">极大</a>',7)])])]),o.createElementVNode("li",{onClick:t[2]||(t[2]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[...t[23]||(t[23]=[o.createElementVNode("i",{title:"加粗",class:"bold text-icon"},"B",-1)])]),o.createElementVNode("li",{onClick:t[3]||(t[3]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[...t[24]||(t[24]=[o.createElementVNode("i",{title:"斜体",class:"italic text-icon",style:{"font-style":"italic"}},"I",-1)])]),o.createElementVNode("li",{onClick:t[4]||(t[4]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[...t[25]||(t[25]=[o.createElementVNode("i",{title:"下划线",class:"underline text-icon",style:{"text-decoration":"underline"}},"U",-1)])]),o.createElementVNode("li",{onClick:t[5]||(t[5]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"左对齐",class:o.normalizeClass("justifyleft "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-fold":"fontAwesome fa-align-left"))},null,2)]),o.createElementVNode("li",{onClick:t[6]||(t[6]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"中间对齐",class:o.normalizeClass("justifycenter "+(e.isIonicons?"ivu-icon ivu-icon-md-menu":"fontAwesome fa-align-center"))},null,2)]),o.createElementVNode("li",{onClick:t[7]||(t[7]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"右对齐",class:o.normalizeClass("justifyright "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-unfold":"fontAwesome fa-align-right"))},null,2)]),o.createElementVNode("li",{onClick:t[8]||(t[8]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"数字编号",class:o.normalizeClass("insertorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-md-list":"fontAwesome fa-list-ol"))},null,2)]),o.createElementVNode("li",{onClick:t[9]||(t[9]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"项目编号",class:o.normalizeClass("insertunorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-ios-list":"fontAwesome fa-list-ul"))},null,2)]),o.createElementVNode("li",{onClick:t[10]||(t[10]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"增加缩进",class:o.normalizeClass("outdent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-left":"fontAwesome fa-outdent"))},null,2)]),o.createElementVNode("li",{onClick:t[11]||(t[11]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"减少缩进",class:o.normalizeClass("indent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-right":"fontAwesome fa-indent"))},null,2)]),o.createElementVNode("li",w,[o.createElementVNode("i",{title:"字体颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-brush":"fontAwesome fa-paint-brush")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[12]||(t[12]=i=>e.format("foreColor",i.target.title))},null,8,b)]),o.createElementVNode("li",I,[o.createElementVNode("i",{title:"背景颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-brush-outline":"fontAwesome fa-pencil")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[13]||(t[13]=i=>e.format("backColor",i.target.title))},null,8,L)]),o.createElementVNode("li",{onClick:t[14]||(t[14]=(...i)=>e.createLink&&e.createLink(...i))},[o.createElementVNode("i",{title:"增加链接",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-link":"fontAwesome fa-link")},null,2)]),o.createElementVNode("li",{onClick:t[15]||(t[15]=(...i)=>e.insertImage&&e.insertImage(...i))},[o.createElementVNode("i",{title:"增加图片",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-images":"fontAwesome fa-regular fa-image")},null,2)]),o.createElementVNode("li",{onClick:t[16]||(t[16]=(...i)=>e.saveRemoteImage2Local&&e.saveRemoteImage2Local(...i))},[o.createElementVNode("i",{title:"一键存图",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-photos":"fontAwesome fa-camera")},null,2)]),o.createElementVNode("li",{onClick:t[17]||(t[17]=(...i)=>e.cleanHTML&&e.cleanHTML(...i))},[o.createElementVNode("i",{title:"清理 HTML",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-done-all":"fontAwesome fa-eraser")},null,2)]),o.createElementVNode("li",{onClick:t[18]||(t[18]=i=>e.isShowCode=!e.isShowCode)},[o.createElementVNode("i",{title:"切换到代码",class:o.normalizeClass((e.isIonicons?"ivu-icon ivu-icon-md-code":"fontAwesome fa-code")+" switchMode")},null,2)])]),t[26]||(t[26]=o.createElementVNode("div",{class:"editorBody"},[o.createElementVNode("iframe",{srcdoc:"<html><body></body></html>"}),o.createElementVNode("textarea")],-1))])}const M=m(g,[["render",A]]);function z(e,t){const r=(t?parent.location:window.location).search.substring(1).split("&");for(let n=0;n<r.length;n++){const s=r[n].split("=");if(s[0]==e)return s[1]}return null}const H={};function S(e,t){return o.openBlock(),o.createElementBlock("div",null,"hi")}const T=m(H,[["render",S]]),D={HomePage:T};exports.HtmlEditor=M;exports.MyButton=p;exports.admin=D;exports.getQueryParam=z;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("vue"),g={},c=(e,t)=>{const i=e.__vccOpts||e;for(const[s,l]of t)i[s]=l;return i};function y(e,t,i,s,l,r){return o.openBlock(),o.createElementBlock("button",null,"hihi")}const h=c(g,[["render",y]]),E=o.defineComponent({name:"HtmlEditor",props:{modelValue:String,uploadImageActionUrl:String,isIonicons:Boolean},emits:["update:modelValue","onchange"],data(){return{isShowCode:!1,iframeEl:null,sourceEditor:null}},mounted(){this.iframeEl=this.$el.querySelector("iframe"),this.sourceEditor=this.$el.querySelector("textarea"),this.iframeEl.contentWindow.onload=e=>{this.iframeDoc=this.iframeEl.contentWindow.document,this.iframeDoc.designMode="on",this.iframeDoc.addEventListener("paste",k.bind(this)),new MutationObserver((t,i)=>{this.isShowCode||(this.sourceEditor.value=this.iframeDoc.body.innerHTML,this.$emit("onchange",this.sourceEditor.value)),this.$emit("update:modelValue",this.iframeDoc.body.innerHTML)}).observe(this.iframeDoc.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},this.sourceEditor.oninput=e=>{this.isShowCode&&this.sourceEditor.value&&(this.setIframeBody(this.sourceEditor.value),this.$emit("onchange",this.sourceEditor.value))}},methods:{setIframeBody(e){this.iframeDoc&&this.iframeDoc.body&&(this.iframeDoc.body.innerHTML=e)},getValue(e,t){let i=this.iframeDoc.body.innerHTML;return e&&(i=v(i)),t&&(i=encodeURIComponent(i)),i},createLink(){const e=prompt("请输入 URL 地址");e&&this.format("createLink",e)},insertImage(){window.isCreate?alert("请保存记录后再上传图片。"):this.uploadImgMgr.show(e=>{e&&e.isOk&&this.format("insertImage",e.fullUrl)})},cleanHTML(){this.setIframeBody(HtmlSanitizer.SanitizeHtml(this.iframeDoc.body.innerHTML))},saveRemoteImage2Local(){const e=this.iframeDoc.querySelectorAll("img"),t=new Array,i=[];for(let s=0,l=e.length;s<l;s++){const r=e[s],n=r.getAttribute("src");n!=null&&/^http/.test(n)&&(t.push(r),i.push(n))}i.length||console.log("未发现有远程图片")},onCmdClk(e){const t=e.target,i=t.className.split(" ").shift();this.format(i)},format(e,t){t?this.iframeDoc.execCommand(e,!1,t):this.iframeDoc.execCommand(e,!1)},onFontsizeChoserClk(e){const t=e.target,i=e.currentTarget.children;let s,l;for(s=0,l=i.length;s<l&&t!=i[s];s++);this.format("fontsize",s+"")},onFontfamilyChoserClk(e){const t=e.target;this.format("fontname",t.innerHTML);const i=t.parentNode;i.style.display="none",setTimeout(()=>i.style.display="",300)},createColorPickerHTML(){const e=["00","33","66","99","CC","FF"];let t,i,s,l;const r=['<div class="colorhead"><span class="colortitle">颜色选择</span></div><div class="colorbody"><table cellspaci="0" cellpadding="0"><tr>'];for(let n=0;n<6;++n){r.push('<td><table class="colorpanel" cellspacing="0" cellpadding="0">');for(let a=0,u=e[n];a<6;++a){r.push("<tr>");for(let m=0,f=e[a];m<6;++m)t=e[m],s=m==5&&n!=2&&n!=5?";border-right:none;":"",l=a==5&&n<3?";border-bottom:none":"",i="#"+u+t+f,r.push('<td unselectable="on" style="background-color: '+i+s+l+'" title="'+i+'"></td>');r.push("</tr>")}r.push("</table></td>"),e[n]=="66"&&r.push("</tr><tr>")}return r.push("</tr></table></div>"),r.join("")}},watch:{modelValue(e,t){t||this.setIframeBody(e)},isShowCode(e){e?(this.iframeEl.classList.add("hide"),this.sourceEditor.classList.add("show"),p.call(this,!0)):(this.iframeEl.classList.remove("hide"),this.sourceEditor.classList.remove("show"),p.call(this,!1))}}});function k(e){if(!this.uploadImageActionUrl){alert("未提供图片上传地址");return}const t=e.clipboardData&&e.clipboardData.items;if(!t||!t.length)return;let i=null;for(let r=0;r<t.length;r++){const n=t[r];if(n.type.indexOf("image")!==-1){i=n.getAsFile();break}}if(!i)return;e.preventDefault();const s=new FormData;s.append("file",i,i.name);const l=new XMLHttpRequest;l.addEventListener("load",r=>{if(l.status>=200&&l.status<300){const n=JSON.parse(l.responseText);console.log("Success:",n),this.format("insertImage",n.data.url)}else console.error("Upload failed with status:",l.status),alert("Upload failed!")}),l.addEventListener("error",function(r){console.error("Network error during upload:",r),alert("Upload failed due to a network error!")}),l.open("POST",this.uploadImageActionUrl),l.send(s)}function p(e){this.$el.querySelectorAll(".toolbar i").forEach(t=>{t.className.indexOf("switchMode")==-1&&(t.style.color=e?"lightgray":"")})}function v(e){return e=e.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi,""),e=e.replace(/(class|style|type|start)=("(.*?)"|(\w*))/gi,""),e=e.replace(/<style(.*?)style>/gi,""),e=e.replace(/<script(.*?)script>/gi,""),e=e.replace(/<!--(.*?)-->/gi,""),e}const w={class:"aj-form-html-editor"},N={class:"toolbar"},V={class:"dorpdown"},b={class:"dorpdown"},I={class:"dorpdown"},S=["innerHTML"],L={class:"dorpdown"},T=["innerHTML"];function $(e,t,i,s,l,r){return o.openBlock(),o.createElementBlock("div",w,[o.createElementVNode("ul",N,[o.createElementVNode("li",V,[t[20]||(t[20]=o.createElementVNode("i",{title:"字体",class:"text-icon"},"A",-1)),o.createElementVNode("div",{class:"fontfamilyChoser",onClick:t[0]||(t[0]=(...n)=>e.onFontfamilyChoserClk&&e.onFontfamilyChoserClk(...n))},[...t[19]||(t[19]=[o.createStaticVNode('<a style="font-family:'宋体';">宋体</a><a style="font-family:'黑体';">黑体</a><a style="font-family:'楷体';">楷体</a><a style="font-family:'隶书';">隶书</a><a style="font-family:'幼圆';">幼圆</a><a style="font-family:'Microsoft YaHei';">Microsoft YaHei</a><a style="font-family:Arial;">Arial</a><a style="font-family:'Arial Narrow';">Arial Narrow</a><a style="font-family:'Arial Black';">Arial Black</a><a style="font-family:'Comic Sans MS';">Comic Sans MS</a><a style="font-family:Courier;">Courier</a><a style="font-family:System;">System</a><a style="font-family:'Times New Roman';">Times New Roman</a><a style="font-family:Verdana;">Verdana</a>',14)])])]),o.createElementVNode("li",b,[t[22]||(t[22]=o.createElementVNode("i",{title:"字号",class:"text-icon"},"H",-1)),o.createElementVNode("div",{class:"fontsizeChoser",onClick:t[1]||(t[1]=(...n)=>e.onFontsizeChoserClk&&e.onFontsizeChoserClk(...n))},[...t[21]||(t[21]=[o.createStaticVNode('<a style="font-size:xx-small;">极小</a><a style="font-size:x-small;">特小</a><a style="font-size:small;">小</a><a style="font-size:medium;">中</a><a style="font-size:large;">大</a><a style="font-size:x-large;">特大</a><a style="font-size:xx-large;line-height:140%;">极大</a>',7)])])]),o.createElementVNode("li",{onClick:t[2]||(t[2]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[...t[23]||(t[23]=[o.createElementVNode("i",{title:"加粗",class:"bold text-icon"},"B",-1)])]),o.createElementVNode("li",{onClick:t[3]||(t[3]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[...t[24]||(t[24]=[o.createElementVNode("i",{title:"斜体",class:"italic text-icon",style:{"font-style":"italic"}},"I",-1)])]),o.createElementVNode("li",{onClick:t[4]||(t[4]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[...t[25]||(t[25]=[o.createElementVNode("i",{title:"下划线",class:"underline text-icon",style:{"text-decoration":"underline"}},"U",-1)])]),o.createElementVNode("li",{onClick:t[5]||(t[5]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"左对齐",class:o.normalizeClass("justifyleft "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-fold":"fontAwesome fa-align-left"))},null,2)]),o.createElementVNode("li",{onClick:t[6]||(t[6]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"中间对齐",class:o.normalizeClass("justifycenter "+(e.isIonicons?"ivu-icon ivu-icon-md-menu":"fontAwesome fa-align-center"))},null,2)]),o.createElementVNode("li",{onClick:t[7]||(t[7]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"右对齐",class:o.normalizeClass("justifyright "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-unfold":"fontAwesome fa-align-right"))},null,2)]),o.createElementVNode("li",{onClick:t[8]||(t[8]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"数字编号",class:o.normalizeClass("insertorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-md-list":"fontAwesome fa-list-ol"))},null,2)]),o.createElementVNode("li",{onClick:t[9]||(t[9]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"项目编号",class:o.normalizeClass("insertunorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-ios-list":"fontAwesome fa-list-ul"))},null,2)]),o.createElementVNode("li",{onClick:t[10]||(t[10]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"增加缩进",class:o.normalizeClass("outdent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-left":"fontAwesome fa-outdent"))},null,2)]),o.createElementVNode("li",{onClick:t[11]||(t[11]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"减少缩进",class:o.normalizeClass("indent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-right":"fontAwesome fa-indent"))},null,2)]),o.createElementVNode("li",I,[o.createElementVNode("i",{title:"字体颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-brush":"fontAwesome fa-paint-brush")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[12]||(t[12]=n=>e.format("foreColor",n.target.title))},null,8,S)]),o.createElementVNode("li",L,[o.createElementVNode("i",{title:"背景颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-brush-outline":"fontAwesome fa-pencil")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[13]||(t[13]=n=>e.format("backColor",n.target.title))},null,8,T)]),o.createElementVNode("li",{onClick:t[14]||(t[14]=(...n)=>e.createLink&&e.createLink(...n))},[o.createElementVNode("i",{title:"增加链接",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-link":"fontAwesome fa-link")},null,2)]),o.createElementVNode("li",{onClick:t[15]||(t[15]=(...n)=>e.insertImage&&e.insertImage(...n))},[o.createElementVNode("i",{title:"增加图片",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-images":"fontAwesome fa-regular fa-image")},null,2)]),o.createElementVNode("li",{onClick:t[16]||(t[16]=(...n)=>e.saveRemoteImage2Local&&e.saveRemoteImage2Local(...n))},[o.createElementVNode("i",{title:"一键存图",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-photos":"fontAwesome fa-camera")},null,2)]),o.createElementVNode("li",{onClick:t[17]||(t[17]=(...n)=>e.cleanHTML&&e.cleanHTML(...n))},[o.createElementVNode("i",{title:"清理 HTML",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-done-all":"fontAwesome fa-eraser")},null,2)]),o.createElementVNode("li",{onClick:t[18]||(t[18]=n=>e.isShowCode=!e.isShowCode)},[o.createElementVNode("i",{title:"切换到代码",class:o.normalizeClass((e.isIonicons?"ivu-icon ivu-icon-md-code":"fontAwesome fa-code")+" switchMode")},null,2)])]),t[26]||(t[26]=o.createElementVNode("div",{class:"editorBody"},[o.createElementVNode("iframe",{srcdoc:"<html><body></body></html>"}),o.createElementVNode("textarea")],-1))])}const A=c(E,[["render",$]]);function z(e,t){const s=(t?parent.location:window.location).search.substring(1).split("&");for(let l=0;l<s.length;l++){const r=s[l].split("=");if(r[0]==e)return r[1]}return null}const M={};function H(e,t){return o.openBlock(),o.createElementBlock("div",null,"hi")}const P=c(M,[["render",H]]);function d(e,t,i,s,l){let r={};if(l)for(const a in l)r[a]=l[a];t=t.toUpperCase();let n=i;i&&(t==="POST"||t==="PUT")&&(r["Content-Type"]=="application/json"?n=JSON.stringify(i):r["Content-Type"]=="application/x-www-form-urlencoded"&&(n=O(i))),fetch(e,{method:t,headers:r,body:n,credentials:"include"}).then(a=>{if(a.status===404)throw new Error("Not found 404: "+e);if(a.status===500)throw new Error("Server error: "+e);if(!a.ok)throw new Error(`Unexpected status: ${a.status}`);return a.json()}).then(a=>{s&&s(a)}).catch(a=>{console.error("Network error when fetching from: "+e,a)})}function O(e){const t=[];for(const[i,s]of Object.entries(e))s!=null&&typeof s!="function"&&t.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(s))}`);return t.join("&")}function j(e,t,i){d(e,"GET",null,t,i)}function D(e,t,i,s){d(e,"POST",t,i,Object.assign({"Content-Type":"application/json"},s))}function B(e,t,i,s){d(e,"POST",t,i,Object.assign({"Content-Type":"application/x-www-form-urlencoded"},s))}function U(e,t,i,s){d(e,"PUT",t,i,Object.assign({"Content-Type":"application/json"},s))}function F(e,t,i,s){d(e,"PUT",t,i,Object.assign({"Content-Type":"application/x-www-form-urlencoded"},s))}function q(e,t,i){d(e,"DELETE",null,t,i)}var C=Object.freeze({__proto__:null,del:q,get:j,post:D,postForm:B,put:U,putForm:F});const R=o.defineComponent({data(){return{msg:"",autoLogin:!1}},methods:{hide(){this.$emit("hide")},handleSubmit(e,{username:t,password:i}){if(e){const s={grant_type:"password",username:t,password:i,client_id:"fvccgrfl3fzA7lrFyCpDA",client_secret:"zKvmM4Km8ghCIijl9ubqpHm1"};C.postForm("/iam_api/oidc/ropc_token",s,l=>{l.status?C.get("/iam_api/user/info",r=>{console.log(r),this.msg="登录成功",localStorage.setItem("isLoggedIn","true"),localStorage.setItem("userInfo",JSON.stringify(r.data)),setTimeout(()=>{this.$router.push("/?login_ok=1")},2e3)}):this.msg=l.message||"登录失败"})}},forgetPsw(){this.msg="请联系管理员重置密码"}}}),J={class:"mask"},K={class:"auto-login"},Q={class:"msg"};function W(e,t,i,s,l,r){const n=o.resolveComponent("UserName"),a=o.resolveComponent("Password"),u=o.resolveComponent("Submit"),m=o.resolveComponent("Login",!0);return o.openBlock(),o.createElementBlock("div",J,[o.createVNode(m,{onOnSubmit:e.handleSubmit,class:"login"},{default:o.withCtx(()=>[t[2]||(t[2]=o.createElementVNode("h1",null,"欢迎登录歪觅机器人管理后台",-1)),o.createVNode(n,{name:"username"}),o.createVNode(a,{name:"password"}),o.createElementVNode("div",K,[o.createElementVNode("span",Q,o.toDisplayString(e.msg),1),t[1]||(t[1]=o.createTextVNode(" ",-1)),o.createElementVNode("a",{onClick:t[0]||(t[0]=(...f)=>e.forgetPsw&&e.forgetPsw(...f))},"忘记密码")]),o.createVNode(u)]),_:1},8,["onOnSubmit"])])}const Y=c(R,[["render",W],["__scopeId","data-v-2149b790"]]),G={HomePage:P,Login:Y};exports.HtmlEditor=A;exports.MyButton=h;exports.admin=G;exports.getQueryParam=z;
|
package/dist/ajaxjs-ui.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { openBlock as
|
|
2
|
-
const
|
|
3
|
-
const
|
|
4
|
-
for (const [
|
|
5
|
-
s
|
|
6
|
-
return
|
|
1
|
+
import { openBlock as p, createElementBlock as C, defineComponent as b, createElementVNode as n, createStaticVNode as k, normalizeClass as d, resolveComponent as m, createVNode as c, withCtx as I, toDisplayString as L, createTextVNode as S } from "vue";
|
|
2
|
+
const T = {}, g = (e, o) => {
|
|
3
|
+
const i = e.__vccOpts || e;
|
|
4
|
+
for (const [s, l] of o)
|
|
5
|
+
i[s] = l;
|
|
6
|
+
return i;
|
|
7
7
|
};
|
|
8
|
-
function
|
|
9
|
-
return
|
|
8
|
+
function $(e, o, i, s, l, r) {
|
|
9
|
+
return p(), C("button", null, "hihi");
|
|
10
10
|
}
|
|
11
|
-
const
|
|
11
|
+
const ie = /* @__PURE__ */ g(T, [["render", $]]), A = b({
|
|
12
12
|
name: "HtmlEditor",
|
|
13
13
|
props: {
|
|
14
14
|
modelValue: String,
|
|
@@ -28,11 +28,11 @@ const F = /* @__PURE__ */ c(h, [["render", v]]), w = k({
|
|
|
28
28
|
};
|
|
29
29
|
},
|
|
30
30
|
mounted() {
|
|
31
|
-
this.iframeEl = this.$el.querySelector("iframe"), this.sourceEditor = this.$el.querySelector("textarea"), this.iframeEl.contentWindow.onload = (
|
|
32
|
-
this.iframeDoc = this.iframeEl.contentWindow.document, this.iframeDoc.designMode = "on", this.iframeDoc.addEventListener("paste",
|
|
31
|
+
this.iframeEl = this.$el.querySelector("iframe"), this.sourceEditor = this.$el.querySelector("textarea"), this.iframeEl.contentWindow.onload = (e) => {
|
|
32
|
+
this.iframeDoc = this.iframeEl.contentWindow.document, this.iframeDoc.designMode = "on", this.iframeDoc.addEventListener("paste", E.bind(this)), new MutationObserver((o, i) => {
|
|
33
33
|
this.isShowCode || (this.sourceEditor.value = this.iframeDoc.body.innerHTML, this.$emit("onchange", this.sourceEditor.value)), this.$emit("update:modelValue", this.iframeDoc.body.innerHTML);
|
|
34
34
|
}).observe(this.iframeDoc.body, { attributes: !0, childList: !0, subtree: !0, characterData: !0 });
|
|
35
|
-
}, this.sourceEditor.oninput = (
|
|
35
|
+
}, this.sourceEditor.oninput = (e) => {
|
|
36
36
|
this.isShowCode && this.sourceEditor.value && (this.setIframeBody(this.sourceEditor.value), this.$emit("onchange", this.sourceEditor.value));
|
|
37
37
|
};
|
|
38
38
|
},
|
|
@@ -42,8 +42,8 @@ const F = /* @__PURE__ */ c(h, [["render", v]]), w = k({
|
|
|
42
42
|
*
|
|
43
43
|
* @param html
|
|
44
44
|
*/
|
|
45
|
-
setIframeBody(
|
|
46
|
-
this.iframeDoc && this.iframeDoc.body && (this.iframeDoc.body.innerHTML =
|
|
45
|
+
setIframeBody(e) {
|
|
46
|
+
this.iframeDoc && this.iframeDoc.body && (this.iframeDoc.body.innerHTML = e);
|
|
47
47
|
},
|
|
48
48
|
/**
|
|
49
49
|
* 获取内容的 HTML
|
|
@@ -51,17 +51,17 @@ const F = /* @__PURE__ */ c(h, [["render", v]]), w = k({
|
|
|
51
51
|
* @param cleanWord 是否清理冗余标签
|
|
52
52
|
* @param encode 是否 URL 编码
|
|
53
53
|
*/
|
|
54
|
-
getValue(
|
|
55
|
-
let
|
|
56
|
-
return
|
|
54
|
+
getValue(e, o) {
|
|
55
|
+
let i = this.iframeDoc.body.innerHTML;
|
|
56
|
+
return e && (i = M(i)), o && (i = encodeURIComponent(i)), i;
|
|
57
57
|
},
|
|
58
58
|
createLink() {
|
|
59
|
-
const
|
|
60
|
-
|
|
59
|
+
const e = prompt("请输入 URL 地址");
|
|
60
|
+
e && this.format("createLink", e);
|
|
61
61
|
},
|
|
62
62
|
insertImage() {
|
|
63
|
-
window.isCreate ? alert("请保存记录后再上传图片。") : this.uploadImgMgr.show((
|
|
64
|
-
|
|
63
|
+
window.isCreate ? alert("请保存记录后再上传图片。") : this.uploadImgMgr.show((e) => {
|
|
64
|
+
e && e.isOk && this.format("insertImage", e.fullUrl);
|
|
65
65
|
});
|
|
66
66
|
},
|
|
67
67
|
/**
|
|
@@ -74,21 +74,21 @@ const F = /* @__PURE__ */ c(h, [["render", v]]), w = k({
|
|
|
74
74
|
* 一键存图
|
|
75
75
|
*/
|
|
76
76
|
saveRemoteImage2Local() {
|
|
77
|
-
const
|
|
78
|
-
for (let
|
|
79
|
-
const
|
|
80
|
-
|
|
77
|
+
const e = this.iframeDoc.querySelectorAll("img"), o = new Array(), i = [];
|
|
78
|
+
for (let s = 0, l = e.length; s < l; s++) {
|
|
79
|
+
const r = e[s], t = r.getAttribute("src");
|
|
80
|
+
t != null && /^http/.test(t) && (o.push(r), i.push(t));
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
i.length || console.log("未发现有远程图片");
|
|
83
83
|
},
|
|
84
84
|
/**
|
|
85
85
|
* 当工具条点击的时候触发
|
|
86
86
|
*
|
|
87
87
|
* @param ev
|
|
88
88
|
*/
|
|
89
|
-
onCmdClk(
|
|
90
|
-
const
|
|
91
|
-
this.format(
|
|
89
|
+
onCmdClk(e) {
|
|
90
|
+
const o = e.target, i = o.className.split(" ").shift();
|
|
91
|
+
this.format(i);
|
|
92
92
|
},
|
|
93
93
|
/**
|
|
94
94
|
* 通过 document.execCommand() 来操纵可编辑内容区域的元素
|
|
@@ -96,50 +96,50 @@ const F = /* @__PURE__ */ c(h, [["render", v]]), w = k({
|
|
|
96
96
|
* @param type 命令的名称
|
|
97
97
|
* @param para 一些命令(例如 insertImage)需要额外的参数(insertImage 需要提供插入 image 的 url),默认为 null
|
|
98
98
|
*/
|
|
99
|
-
format(
|
|
100
|
-
|
|
99
|
+
format(e, o) {
|
|
100
|
+
o ? this.iframeDoc.execCommand(e, !1, o) : this.iframeDoc.execCommand(e, !1);
|
|
101
101
|
},
|
|
102
102
|
/**
|
|
103
103
|
* 选择字号大小
|
|
104
104
|
*
|
|
105
105
|
* @param ev
|
|
106
106
|
*/
|
|
107
|
-
onFontsizeChoserClk(
|
|
108
|
-
const
|
|
109
|
-
let
|
|
110
|
-
for (
|
|
107
|
+
onFontsizeChoserClk(e) {
|
|
108
|
+
const o = e.target, i = e.currentTarget.children;
|
|
109
|
+
let s, l;
|
|
110
|
+
for (s = 0, l = i.length; s < l && o != i[s]; s++)
|
|
111
111
|
;
|
|
112
|
-
this.format("fontsize",
|
|
112
|
+
this.format("fontsize", s + "");
|
|
113
113
|
},
|
|
114
114
|
/**
|
|
115
115
|
* 选择字体
|
|
116
116
|
*
|
|
117
117
|
* @param ev
|
|
118
118
|
*/
|
|
119
|
-
onFontfamilyChoserClk(
|
|
120
|
-
const
|
|
121
|
-
this.format("fontname",
|
|
122
|
-
const
|
|
123
|
-
|
|
119
|
+
onFontfamilyChoserClk(e) {
|
|
120
|
+
const o = e.target;
|
|
121
|
+
this.format("fontname", o.innerHTML);
|
|
122
|
+
const i = o.parentNode;
|
|
123
|
+
i.style.display = "none", setTimeout(() => i.style.display = "", 300);
|
|
124
124
|
},
|
|
125
125
|
/**
|
|
126
126
|
* 创建颜色选择器
|
|
127
127
|
*/
|
|
128
128
|
createColorPickerHTML() {
|
|
129
|
-
const
|
|
130
|
-
let
|
|
131
|
-
const
|
|
132
|
-
for (let
|
|
133
|
-
|
|
134
|
-
for (let
|
|
135
|
-
|
|
136
|
-
for (let f = 0,
|
|
137
|
-
|
|
138
|
-
|
|
129
|
+
const e = ["00", "33", "66", "99", "CC", "FF"];
|
|
130
|
+
let o, i, s, l;
|
|
131
|
+
const r = ['<div class="colorhead"><span class="colortitle">颜色选择</span></div><div class="colorbody"><table cellspaci="0" cellpadding="0"><tr>'];
|
|
132
|
+
for (let t = 0; t < 6; ++t) {
|
|
133
|
+
r.push('<td><table class="colorpanel" cellspacing="0" cellpadding="0">');
|
|
134
|
+
for (let a = 0, y = e[t]; a < 6; ++a) {
|
|
135
|
+
r.push("<tr>");
|
|
136
|
+
for (let f = 0, h = e[a]; f < 6; ++f)
|
|
137
|
+
o = e[f], s = f == 5 && t != 2 && t != 5 ? ";border-right:none;" : "", l = a == 5 && t < 3 ? ";border-bottom:none" : "", i = "#" + y + o + h, r.push('<td unselectable="on" style="background-color: ' + i + s + l + '" title="' + i + '"></td>');
|
|
138
|
+
r.push("</tr>");
|
|
139
139
|
}
|
|
140
|
-
|
|
140
|
+
r.push("</table></td>"), e[t] == "66" && r.push("</tr><tr>");
|
|
141
141
|
}
|
|
142
|
-
return
|
|
142
|
+
return r.push("</tr></table></div>"), r.join("");
|
|
143
143
|
}
|
|
144
144
|
},
|
|
145
145
|
watch: {
|
|
@@ -148,256 +148,368 @@ const F = /* @__PURE__ */ c(h, [["render", v]]), w = k({
|
|
|
148
148
|
// if (!oldHtml) // 当没有值的时候输入,就是在初始化的时候(第一次)
|
|
149
149
|
// this.setIframeBody(newHtml);
|
|
150
150
|
// },
|
|
151
|
-
modelValue(
|
|
152
|
-
|
|
151
|
+
modelValue(e, o) {
|
|
152
|
+
o || this.setIframeBody(e);
|
|
153
153
|
},
|
|
154
154
|
/**
|
|
155
155
|
* 切換 HTML 編輯 or 可視化編輯
|
|
156
156
|
*
|
|
157
157
|
* @param n
|
|
158
158
|
*/
|
|
159
|
-
isShowCode(
|
|
160
|
-
|
|
159
|
+
isShowCode(e) {
|
|
160
|
+
e ? (this.iframeEl.classList.add("hide"), this.sourceEditor.classList.add("show"), w.call(this, !0)) : (this.iframeEl.classList.remove("hide"), this.sourceEditor.classList.remove("show"), w.call(this, !1));
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
|
-
function
|
|
164
|
+
function E(e) {
|
|
165
165
|
if (!this.uploadImageActionUrl) {
|
|
166
166
|
alert("未提供图片上传地址");
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
|
-
const
|
|
170
|
-
if (!
|
|
169
|
+
const o = e.clipboardData && e.clipboardData.items;
|
|
170
|
+
if (!o || !o.length)
|
|
171
171
|
return;
|
|
172
|
-
let
|
|
173
|
-
for (let
|
|
174
|
-
const
|
|
175
|
-
if (
|
|
176
|
-
|
|
172
|
+
let i = null;
|
|
173
|
+
for (let r = 0; r < o.length; r++) {
|
|
174
|
+
const t = o[r];
|
|
175
|
+
if (t.type.indexOf("image") !== -1) {
|
|
176
|
+
i = t.getAsFile();
|
|
177
177
|
break;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
|
-
if (!
|
|
180
|
+
if (!i)
|
|
181
181
|
return;
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
185
|
-
const
|
|
186
|
-
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
console.log("Success:",
|
|
182
|
+
e.preventDefault();
|
|
183
|
+
const s = new FormData();
|
|
184
|
+
s.append("file", i, i.name);
|
|
185
|
+
const l = new XMLHttpRequest();
|
|
186
|
+
l.addEventListener("load", (r) => {
|
|
187
|
+
if (l.status >= 200 && l.status < 300) {
|
|
188
|
+
const t = JSON.parse(l.responseText);
|
|
189
|
+
console.log("Success:", t), this.format("insertImage", t.data.url);
|
|
190
190
|
} else
|
|
191
|
-
console.error("Upload failed with status:",
|
|
192
|
-
}),
|
|
193
|
-
console.error("Network error during upload:",
|
|
194
|
-
}),
|
|
191
|
+
console.error("Upload failed with status:", l.status), alert("Upload failed!");
|
|
192
|
+
}), l.addEventListener("error", function(r) {
|
|
193
|
+
console.error("Network error during upload:", r), alert("Upload failed due to a network error!");
|
|
194
|
+
}), l.open("POST", this.uploadImageActionUrl), l.send(s);
|
|
195
195
|
}
|
|
196
|
-
function
|
|
197
|
-
this.$el.querySelectorAll(".toolbar i").forEach((
|
|
198
|
-
|
|
196
|
+
function w(e) {
|
|
197
|
+
this.$el.querySelectorAll(".toolbar i").forEach((o) => {
|
|
198
|
+
o.className.indexOf("switchMode") == -1 && (o.style.color = e ? "lightgray" : "");
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
function
|
|
202
|
-
return
|
|
201
|
+
function M(e) {
|
|
202
|
+
return e = e.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi, ""), e = e.replace(/(class|style|type|start)=("(.*?)"|(\w*))/gi, ""), e = e.replace(/<style(.*?)style>/gi, ""), e = e.replace(/<script(.*?)script>/gi, ""), e = e.replace(/<!--(.*?)-->/gi, ""), e;
|
|
203
203
|
}
|
|
204
|
-
const
|
|
205
|
-
function
|
|
206
|
-
return
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
204
|
+
const H = { class: "aj-form-html-editor" }, P = { class: "toolbar" }, D = { class: "dorpdown" }, N = { class: "dorpdown" }, O = { class: "dorpdown" }, j = ["innerHTML"], U = { class: "dorpdown" }, z = ["innerHTML"];
|
|
205
|
+
function F(e, o, i, s, l, r) {
|
|
206
|
+
return p(), C("div", H, [
|
|
207
|
+
n("ul", P, [
|
|
208
|
+
n("li", D, [
|
|
209
|
+
o[20] || (o[20] = n("i", {
|
|
210
210
|
title: "字体",
|
|
211
211
|
class: "text-icon"
|
|
212
212
|
}, "A", -1)),
|
|
213
|
-
|
|
213
|
+
n("div", {
|
|
214
214
|
class: "fontfamilyChoser",
|
|
215
|
-
onClick:
|
|
216
|
-
}, [...
|
|
217
|
-
|
|
215
|
+
onClick: o[0] || (o[0] = (...t) => e.onFontfamilyChoserClk && e.onFontfamilyChoserClk(...t))
|
|
216
|
+
}, [...o[19] || (o[19] = [
|
|
217
|
+
k('<a style="font-family:'宋体';">宋体</a><a style="font-family:'黑体';">黑体</a><a style="font-family:'楷体';">楷体</a><a style="font-family:'隶书';">隶书</a><a style="font-family:'幼圆';">幼圆</a><a style="font-family:'Microsoft YaHei';">Microsoft YaHei</a><a style="font-family:Arial;">Arial</a><a style="font-family:'Arial Narrow';">Arial Narrow</a><a style="font-family:'Arial Black';">Arial Black</a><a style="font-family:'Comic Sans MS';">Comic Sans MS</a><a style="font-family:Courier;">Courier</a><a style="font-family:System;">System</a><a style="font-family:'Times New Roman';">Times New Roman</a><a style="font-family:Verdana;">Verdana</a>', 14)
|
|
218
218
|
])])
|
|
219
219
|
]),
|
|
220
|
-
|
|
221
|
-
|
|
220
|
+
n("li", N, [
|
|
221
|
+
o[22] || (o[22] = n("i", {
|
|
222
222
|
title: "字号",
|
|
223
223
|
class: "text-icon"
|
|
224
224
|
}, "H", -1)),
|
|
225
|
-
|
|
225
|
+
n("div", {
|
|
226
226
|
class: "fontsizeChoser",
|
|
227
|
-
onClick:
|
|
228
|
-
}, [...
|
|
229
|
-
|
|
227
|
+
onClick: o[1] || (o[1] = (...t) => e.onFontsizeChoserClk && e.onFontsizeChoserClk(...t))
|
|
228
|
+
}, [...o[21] || (o[21] = [
|
|
229
|
+
k('<a style="font-size:xx-small;">极小</a><a style="font-size:x-small;">特小</a><a style="font-size:small;">小</a><a style="font-size:medium;">中</a><a style="font-size:large;">大</a><a style="font-size:x-large;">特大</a><a style="font-size:xx-large;line-height:140%;">极大</a>', 7)
|
|
230
230
|
])])
|
|
231
231
|
]),
|
|
232
|
-
|
|
233
|
-
onClick:
|
|
234
|
-
}, [...
|
|
235
|
-
|
|
232
|
+
n("li", {
|
|
233
|
+
onClick: o[2] || (o[2] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
234
|
+
}, [...o[23] || (o[23] = [
|
|
235
|
+
n("i", {
|
|
236
236
|
title: "加粗",
|
|
237
237
|
class: "bold text-icon"
|
|
238
238
|
}, "B", -1)
|
|
239
239
|
])]),
|
|
240
|
-
|
|
241
|
-
onClick:
|
|
242
|
-
}, [...
|
|
243
|
-
|
|
240
|
+
n("li", {
|
|
241
|
+
onClick: o[3] || (o[3] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
242
|
+
}, [...o[24] || (o[24] = [
|
|
243
|
+
n("i", {
|
|
244
244
|
title: "斜体",
|
|
245
245
|
class: "italic text-icon",
|
|
246
246
|
style: { "font-style": "italic" }
|
|
247
247
|
}, "I", -1)
|
|
248
248
|
])]),
|
|
249
|
-
|
|
250
|
-
onClick:
|
|
251
|
-
}, [...
|
|
252
|
-
|
|
249
|
+
n("li", {
|
|
250
|
+
onClick: o[4] || (o[4] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
251
|
+
}, [...o[25] || (o[25] = [
|
|
252
|
+
n("i", {
|
|
253
253
|
title: "下划线",
|
|
254
254
|
class: "underline text-icon",
|
|
255
255
|
style: { "text-decoration": "underline" }
|
|
256
256
|
}, "U", -1)
|
|
257
257
|
])]),
|
|
258
|
-
|
|
259
|
-
onClick:
|
|
258
|
+
n("li", {
|
|
259
|
+
onClick: o[5] || (o[5] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
260
260
|
}, [
|
|
261
|
-
|
|
261
|
+
n("i", {
|
|
262
262
|
title: "左对齐",
|
|
263
|
-
class:
|
|
263
|
+
class: d("justifyleft " + (e.isIonicons ? "ivu-icon ivu-icon-bingo-menu-fold" : "fontAwesome fa-align-left"))
|
|
264
264
|
}, null, 2)
|
|
265
265
|
]),
|
|
266
|
-
|
|
267
|
-
onClick:
|
|
266
|
+
n("li", {
|
|
267
|
+
onClick: o[6] || (o[6] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
268
268
|
}, [
|
|
269
|
-
|
|
269
|
+
n("i", {
|
|
270
270
|
title: "中间对齐",
|
|
271
|
-
class:
|
|
271
|
+
class: d("justifycenter " + (e.isIonicons ? "ivu-icon ivu-icon-md-menu" : "fontAwesome fa-align-center"))
|
|
272
272
|
}, null, 2)
|
|
273
273
|
]),
|
|
274
|
-
|
|
275
|
-
onClick:
|
|
274
|
+
n("li", {
|
|
275
|
+
onClick: o[7] || (o[7] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
276
276
|
}, [
|
|
277
|
-
|
|
277
|
+
n("i", {
|
|
278
278
|
title: "右对齐",
|
|
279
|
-
class:
|
|
279
|
+
class: d("justifyright " + (e.isIonicons ? "ivu-icon ivu-icon-bingo-menu-unfold" : "fontAwesome fa-align-right"))
|
|
280
280
|
}, null, 2)
|
|
281
281
|
]),
|
|
282
|
-
|
|
283
|
-
onClick:
|
|
282
|
+
n("li", {
|
|
283
|
+
onClick: o[8] || (o[8] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
284
284
|
}, [
|
|
285
|
-
|
|
285
|
+
n("i", {
|
|
286
286
|
title: "数字编号",
|
|
287
|
-
class:
|
|
287
|
+
class: d("insertorderedlist " + (e.isIonicons ? "ivu-icon ivu-icon-md-list" : "fontAwesome fa-list-ol"))
|
|
288
288
|
}, null, 2)
|
|
289
289
|
]),
|
|
290
|
-
|
|
291
|
-
onClick:
|
|
290
|
+
n("li", {
|
|
291
|
+
onClick: o[9] || (o[9] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
292
292
|
}, [
|
|
293
|
-
|
|
293
|
+
n("i", {
|
|
294
294
|
title: "项目编号",
|
|
295
|
-
class:
|
|
295
|
+
class: d("insertunorderedlist " + (e.isIonicons ? "ivu-icon ivu-icon-ios-list" : "fontAwesome fa-list-ul"))
|
|
296
296
|
}, null, 2)
|
|
297
297
|
]),
|
|
298
|
-
|
|
299
|
-
onClick:
|
|
298
|
+
n("li", {
|
|
299
|
+
onClick: o[10] || (o[10] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
300
300
|
}, [
|
|
301
|
-
|
|
301
|
+
n("i", {
|
|
302
302
|
title: "增加缩进",
|
|
303
|
-
class:
|
|
303
|
+
class: d("outdent " + (e.isIonicons ? "ivu-icon ivu-icon-ios-return-left" : "fontAwesome fa-outdent"))
|
|
304
304
|
}, null, 2)
|
|
305
305
|
]),
|
|
306
|
-
|
|
307
|
-
onClick:
|
|
306
|
+
n("li", {
|
|
307
|
+
onClick: o[11] || (o[11] = (...t) => e.onCmdClk && e.onCmdClk(...t))
|
|
308
308
|
}, [
|
|
309
|
-
|
|
309
|
+
n("i", {
|
|
310
310
|
title: "减少缩进",
|
|
311
|
-
class:
|
|
311
|
+
class: d("indent " + (e.isIonicons ? "ivu-icon ivu-icon-ios-return-right" : "fontAwesome fa-indent"))
|
|
312
312
|
}, null, 2)
|
|
313
313
|
]),
|
|
314
|
-
|
|
315
|
-
|
|
314
|
+
n("li", O, [
|
|
315
|
+
n("i", {
|
|
316
316
|
title: "字体颜色",
|
|
317
|
-
class:
|
|
317
|
+
class: d(e.isIonicons ? "ivu-icon ivu-icon-md-brush" : "fontAwesome fa-paint-brush")
|
|
318
318
|
}, null, 2),
|
|
319
|
-
|
|
319
|
+
n("div", {
|
|
320
320
|
class: "colorPicker",
|
|
321
|
-
innerHTML:
|
|
322
|
-
onClick:
|
|
323
|
-
}, null, 8,
|
|
321
|
+
innerHTML: e.createColorPickerHTML(),
|
|
322
|
+
onClick: o[12] || (o[12] = (t) => e.format("foreColor", t.target.title))
|
|
323
|
+
}, null, 8, j)
|
|
324
324
|
]),
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
n("li", U, [
|
|
326
|
+
n("i", {
|
|
327
327
|
title: "背景颜色",
|
|
328
|
-
class:
|
|
328
|
+
class: d(e.isIonicons ? "ivu-icon ivu-icon-ios-brush-outline" : "fontAwesome fa-pencil")
|
|
329
329
|
}, null, 2),
|
|
330
|
-
|
|
330
|
+
n("div", {
|
|
331
331
|
class: "colorPicker",
|
|
332
|
-
innerHTML:
|
|
333
|
-
onClick:
|
|
334
|
-
}, null, 8,
|
|
332
|
+
innerHTML: e.createColorPickerHTML(),
|
|
333
|
+
onClick: o[13] || (o[13] = (t) => e.format("backColor", t.target.title))
|
|
334
|
+
}, null, 8, z)
|
|
335
335
|
]),
|
|
336
|
-
|
|
337
|
-
onClick:
|
|
336
|
+
n("li", {
|
|
337
|
+
onClick: o[14] || (o[14] = (...t) => e.createLink && e.createLink(...t))
|
|
338
338
|
}, [
|
|
339
|
-
|
|
339
|
+
n("i", {
|
|
340
340
|
title: "增加链接",
|
|
341
|
-
class:
|
|
341
|
+
class: d(e.isIonicons ? "ivu-icon ivu-icon-ios-link" : "fontAwesome fa-link")
|
|
342
342
|
}, null, 2)
|
|
343
343
|
]),
|
|
344
|
-
|
|
345
|
-
onClick:
|
|
344
|
+
n("li", {
|
|
345
|
+
onClick: o[15] || (o[15] = (...t) => e.insertImage && e.insertImage(...t))
|
|
346
346
|
}, [
|
|
347
|
-
|
|
347
|
+
n("i", {
|
|
348
348
|
title: "增加图片",
|
|
349
|
-
class:
|
|
349
|
+
class: d(e.isIonicons ? "ivu-icon ivu-icon-md-images" : "fontAwesome fa-regular fa-image")
|
|
350
350
|
}, null, 2)
|
|
351
351
|
]),
|
|
352
|
-
|
|
353
|
-
onClick:
|
|
352
|
+
n("li", {
|
|
353
|
+
onClick: o[16] || (o[16] = (...t) => e.saveRemoteImage2Local && e.saveRemoteImage2Local(...t))
|
|
354
354
|
}, [
|
|
355
|
-
|
|
355
|
+
n("i", {
|
|
356
356
|
title: "一键存图",
|
|
357
|
-
class:
|
|
357
|
+
class: d(e.isIonicons ? "ivu-icon ivu-icon-md-photos" : "fontAwesome fa-camera")
|
|
358
358
|
}, null, 2)
|
|
359
359
|
]),
|
|
360
|
-
|
|
361
|
-
onClick:
|
|
360
|
+
n("li", {
|
|
361
|
+
onClick: o[17] || (o[17] = (...t) => e.cleanHTML && e.cleanHTML(...t))
|
|
362
362
|
}, [
|
|
363
|
-
|
|
363
|
+
n("i", {
|
|
364
364
|
title: "清理 HTML",
|
|
365
|
-
class:
|
|
365
|
+
class: d(e.isIonicons ? "ivu-icon ivu-icon-md-done-all" : "fontAwesome fa-eraser")
|
|
366
366
|
}, null, 2)
|
|
367
367
|
]),
|
|
368
|
-
|
|
369
|
-
onClick:
|
|
368
|
+
n("li", {
|
|
369
|
+
onClick: o[18] || (o[18] = (t) => e.isShowCode = !e.isShowCode)
|
|
370
370
|
}, [
|
|
371
|
-
|
|
371
|
+
n("i", {
|
|
372
372
|
title: "切换到代码",
|
|
373
|
-
class:
|
|
373
|
+
class: d((e.isIonicons ? "ivu-icon ivu-icon-md-code" : "fontAwesome fa-code") + " switchMode")
|
|
374
374
|
}, null, 2)
|
|
375
375
|
])
|
|
376
376
|
]),
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
377
|
+
o[26] || (o[26] = n("div", { class: "editorBody" }, [
|
|
378
|
+
n("iframe", { srcdoc: "<html><body></body></html>" }),
|
|
379
|
+
n("textarea")
|
|
380
380
|
], -1))
|
|
381
381
|
]);
|
|
382
382
|
}
|
|
383
|
-
const
|
|
384
|
-
function
|
|
385
|
-
const
|
|
386
|
-
for (let
|
|
387
|
-
const
|
|
388
|
-
if (
|
|
389
|
-
return
|
|
383
|
+
const ne = /* @__PURE__ */ g(A, [["render", F]]);
|
|
384
|
+
function se(e, o) {
|
|
385
|
+
const s = (o ? parent.location : window.location).search.substring(1).split("&");
|
|
386
|
+
for (let l = 0; l < s.length; l++) {
|
|
387
|
+
const r = s[l].split("=");
|
|
388
|
+
if (r[0] == e)
|
|
389
|
+
return r[1];
|
|
390
390
|
}
|
|
391
391
|
return null;
|
|
392
392
|
}
|
|
393
|
-
const
|
|
394
|
-
function
|
|
395
|
-
return
|
|
393
|
+
const B = {};
|
|
394
|
+
function V(e, o) {
|
|
395
|
+
return p(), C("div", null, "hi");
|
|
396
396
|
}
|
|
397
|
-
const
|
|
397
|
+
const R = /* @__PURE__ */ g(B, [["render", V]]);
|
|
398
|
+
function u(e, o, i, s, l) {
|
|
399
|
+
let r = {};
|
|
400
|
+
if (l)
|
|
401
|
+
for (const a in l)
|
|
402
|
+
r[a] = l[a];
|
|
403
|
+
o = o.toUpperCase();
|
|
404
|
+
let t = i;
|
|
405
|
+
i && (o === "POST" || o === "PUT") && (r["Content-Type"] == "application/json" ? t = JSON.stringify(i) : r["Content-Type"] == "application/x-www-form-urlencoded" && (t = q(i))), fetch(e, {
|
|
406
|
+
method: o,
|
|
407
|
+
headers: r,
|
|
408
|
+
body: t,
|
|
409
|
+
credentials: "include"
|
|
410
|
+
}).then((a) => {
|
|
411
|
+
if (a.status === 404)
|
|
412
|
+
throw new Error("Not found 404: " + e);
|
|
413
|
+
if (a.status === 500)
|
|
414
|
+
throw new Error("Server error: " + e);
|
|
415
|
+
if (!a.ok)
|
|
416
|
+
throw new Error(`Unexpected status: ${a.status}`);
|
|
417
|
+
return a.json();
|
|
418
|
+
}).then((a) => {
|
|
419
|
+
s && s(a);
|
|
420
|
+
}).catch((a) => {
|
|
421
|
+
console.error("Network error when fetching from: " + e, a);
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
function q(e) {
|
|
425
|
+
const o = [];
|
|
426
|
+
for (const [i, s] of Object.entries(e))
|
|
427
|
+
s != null && typeof s != "function" && o.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(s))}`);
|
|
428
|
+
return o.join("&");
|
|
429
|
+
}
|
|
430
|
+
function J(e, o, i) {
|
|
431
|
+
u(e, "GET", null, o, i);
|
|
432
|
+
}
|
|
433
|
+
function K(e, o, i, s) {
|
|
434
|
+
u(e, "POST", o, i, Object.assign({ "Content-Type": "application/json" }, s));
|
|
435
|
+
}
|
|
436
|
+
function W(e, o, i, s) {
|
|
437
|
+
u(e, "POST", o, i, Object.assign({ "Content-Type": "application/x-www-form-urlencoded" }, s));
|
|
438
|
+
}
|
|
439
|
+
function Y(e, o, i, s) {
|
|
440
|
+
u(e, "PUT", o, i, Object.assign({ "Content-Type": "application/json" }, s));
|
|
441
|
+
}
|
|
442
|
+
function G(e, o, i, s) {
|
|
443
|
+
u(e, "PUT", o, i, Object.assign({ "Content-Type": "application/x-www-form-urlencoded" }, s));
|
|
444
|
+
}
|
|
445
|
+
function Q(e, o, i) {
|
|
446
|
+
u(e, "DELETE", null, o, i);
|
|
447
|
+
}
|
|
448
|
+
var v = /* @__PURE__ */ Object.freeze({
|
|
449
|
+
__proto__: null,
|
|
450
|
+
del: Q,
|
|
451
|
+
get: J,
|
|
452
|
+
post: K,
|
|
453
|
+
postForm: W,
|
|
454
|
+
put: Y,
|
|
455
|
+
putForm: G
|
|
456
|
+
});
|
|
457
|
+
const X = b({
|
|
458
|
+
data() {
|
|
459
|
+
return {
|
|
460
|
+
msg: "",
|
|
461
|
+
autoLogin: !1
|
|
462
|
+
};
|
|
463
|
+
},
|
|
464
|
+
methods: {
|
|
465
|
+
hide() {
|
|
466
|
+
this.$emit("hide");
|
|
467
|
+
},
|
|
468
|
+
handleSubmit(e, { username: o, password: i }) {
|
|
469
|
+
if (e) {
|
|
470
|
+
const s = { grant_type: "password", username: o, password: i, client_id: "fvccgrfl3fzA7lrFyCpDA", client_secret: "zKvmM4Km8ghCIijl9ubqpHm1" };
|
|
471
|
+
v.postForm("/iam_api/oidc/ropc_token", s, (l) => {
|
|
472
|
+
l.status ? v.get("/iam_api/user/info", (r) => {
|
|
473
|
+
console.log(r), this.msg = "登录成功", localStorage.setItem("isLoggedIn", "true"), localStorage.setItem("userInfo", JSON.stringify(r.data)), setTimeout(() => {
|
|
474
|
+
this.$router.push("/?login_ok=1");
|
|
475
|
+
}, 2e3);
|
|
476
|
+
}) : this.msg = l.message || "登录失败";
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
},
|
|
480
|
+
forgetPsw() {
|
|
481
|
+
this.msg = "请联系管理员重置密码";
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
}), Z = { class: "mask" }, x = { class: "auto-login" }, _ = { class: "msg" };
|
|
485
|
+
function ee(e, o, i, s, l, r) {
|
|
486
|
+
const t = m("UserName"), a = m("Password"), y = m("Submit"), f = m("Login", !0);
|
|
487
|
+
return p(), C("div", Z, [
|
|
488
|
+
c(f, {
|
|
489
|
+
onOnSubmit: e.handleSubmit,
|
|
490
|
+
class: "login"
|
|
491
|
+
}, {
|
|
492
|
+
default: I(() => [
|
|
493
|
+
o[2] || (o[2] = n("h1", null, "欢迎登录歪觅机器人管理后台", -1)),
|
|
494
|
+
c(t, { name: "username" }),
|
|
495
|
+
c(a, { name: "password" }),
|
|
496
|
+
n("div", x, [
|
|
497
|
+
n("span", _, L(e.msg), 1),
|
|
498
|
+
o[1] || (o[1] = S(" ", -1)),
|
|
499
|
+
n("a", {
|
|
500
|
+
onClick: o[0] || (o[0] = (...h) => e.forgetPsw && e.forgetPsw(...h))
|
|
501
|
+
}, "忘记密码")
|
|
502
|
+
]),
|
|
503
|
+
c(y)
|
|
504
|
+
]),
|
|
505
|
+
_: 1
|
|
506
|
+
}, 8, ["onOnSubmit"])
|
|
507
|
+
]);
|
|
508
|
+
}
|
|
509
|
+
const oe = /* @__PURE__ */ g(X, [["render", ee], ["__scopeId", "data-v-2149b790"]]), le = { HomePage: R, Login: oe };
|
|
398
510
|
export {
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
511
|
+
ne as HtmlEditor,
|
|
512
|
+
ie as MyButton,
|
|
513
|
+
le as admin,
|
|
514
|
+
se as getQueryParam
|
|
403
515
|
};
|
package/dist/ajaxjs-ui.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(a,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(a=typeof globalThis<"u"?globalThis:a||self,o(a.ajaxjs_ui={},a.Vue))})(this,(function(a,o){"use strict";const u={},c=(e,t)=>{const l=e.__vccOpts||e;for(const[r,n]of t)l[r]=n;return l};function C(e,t,l,r,n,s){return o.openBlock(),o.createElementBlock("button",null,"hihi")}const y=c(u,[["render",C]]),p=o.defineComponent({name:"HtmlEditor",props:{modelValue:String,uploadImageActionUrl:String,isIonicons:Boolean},emits:["update:modelValue","onchange"],data(){return{isShowCode:!1,iframeEl:null,sourceEditor:null}},mounted(){this.iframeEl=this.$el.querySelector("iframe"),this.sourceEditor=this.$el.querySelector("textarea"),this.iframeEl.contentWindow.onload=e=>{this.iframeDoc=this.iframeEl.contentWindow.document,this.iframeDoc.designMode="on",this.iframeDoc.addEventListener("paste",g.bind(this)),new MutationObserver((t,l)=>{this.isShowCode||(this.sourceEditor.value=this.iframeDoc.body.innerHTML,this.$emit("onchange",this.sourceEditor.value)),this.$emit("update:modelValue",this.iframeDoc.body.innerHTML)}).observe(this.iframeDoc.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},this.sourceEditor.oninput=e=>{this.isShowCode&&this.sourceEditor.value&&(this.setIframeBody(this.sourceEditor.value),this.$emit("onchange",this.sourceEditor.value))}},methods:{setIframeBody(e){this.iframeDoc&&this.iframeDoc.body&&(this.iframeDoc.body.innerHTML=e)},getValue(e,t){let l=this.iframeDoc.body.innerHTML;return e&&(l=k(l)),t&&(l=encodeURIComponent(l)),l},createLink(){const e=prompt("请输入 URL 地址");e&&this.format("createLink",e)},insertImage(){window.isCreate?alert("请保存记录后再上传图片。"):this.uploadImgMgr.show(e=>{e&&e.isOk&&this.format("insertImage",e.fullUrl)})},cleanHTML(){this.setIframeBody(HtmlSanitizer.SanitizeHtml(this.iframeDoc.body.innerHTML))},saveRemoteImage2Local(){const e=this.iframeDoc.querySelectorAll("img"),t=new Array,l=[];for(let r=0,n=e.length;r<n;r++){const s=e[r],i=s.getAttribute("src");i!=null&&/^http/.test(i)&&(t.push(s),l.push(i))}l.length||console.log("未发现有远程图片")},onCmdClk(e){const t=e.target,l=t.className.split(" ").shift();this.format(l)},format(e,t){t?this.iframeDoc.execCommand(e,!1,t):this.iframeDoc.execCommand(e,!1)},onFontsizeChoserClk(e){const t=e.target,l=e.currentTarget.children;let r,n;for(r=0,n=l.length;r<n&&t!=l[r];r++);this.format("fontsize",r+"")},onFontfamilyChoserClk(e){const t=e.target;this.format("fontname",t.innerHTML);const l=t.parentNode;l.style.display="none",setTimeout(()=>l.style.display="",300)},createColorPickerHTML(){const e=["00","33","66","99","CC","FF"];let t,l,r,n;const s=['<div class="colorhead"><span class="colortitle">颜色选择</span></div><div class="colorbody"><table cellspaci="0" cellpadding="0"><tr>'];for(let i=0;i<6;++i){s.push('<td><table class="colorpanel" cellspacing="0" cellpadding="0">');for(let d=0,D=e[i];d<6;++d){s.push("<tr>");for(let m=0,$=e[d];m<6;++m)t=e[m],r=m==5&&i!=2&&i!=5?";border-right:none;":"",n=d==5&&i<3?";border-bottom:none":"",l="#"+D+t+$,s.push('<td unselectable="on" style="background-color: '+l+r+n+'" title="'+l+'"></td>');s.push("</tr>")}s.push("</table></td>"),e[i]=="66"&&s.push("</tr><tr>")}return s.push("</tr></table></div>"),s.join("")}},watch:{modelValue(e,t){t||this.setIframeBody(e)},isShowCode(e){e?(this.iframeEl.classList.add("hide"),this.sourceEditor.classList.add("show"),f.call(this,!0)):(this.iframeEl.classList.remove("hide"),this.sourceEditor.classList.remove("show"),f.call(this,!1))}}});function g(e){if(!this.uploadImageActionUrl){alert("未提供图片上传地址");return}const t=e.clipboardData&&e.clipboardData.items;if(!t||!t.length)return;let l=null;for(let s=0;s<t.length;s++){const i=t[s];if(i.type.indexOf("image")!==-1){l=i.getAsFile();break}}if(!l)return;e.preventDefault();const r=new FormData;r.append("file",l,l.name);const n=new XMLHttpRequest;n.addEventListener("load",s=>{if(n.status>=200&&n.status<300){const i=JSON.parse(n.responseText);console.log("Success:",i),this.format("insertImage",i.data.url)}else console.error("Upload failed with status:",n.status),alert("Upload failed!")}),n.addEventListener("error",function(s){console.error("Network error during upload:",s),alert("Upload failed due to a network error!")}),n.open("POST",this.uploadImageActionUrl),n.send(r)}function f(e){this.$el.querySelectorAll(".toolbar i").forEach(t=>{t.className.indexOf("switchMode")==-1&&(t.style.color=e?"lightgray":"")})}function k(e){return e=e.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi,""),e=e.replace(/(class|style|type|start)=("(.*?)"|(\w*))/gi,""),e=e.replace(/<style(.*?)style>/gi,""),e=e.replace(/<script(.*?)script>/gi,""),e=e.replace(/<!--(.*?)-->/gi,""),e}const E={class:"aj-form-html-editor"},h={class:"toolbar"},N={class:"dorpdown"},V={class:"dorpdown"},w={class:"dorpdown"},b=["innerHTML"],I={class:"dorpdown"},L=["innerHTML"];function A(e,t,l,r,n,s){return o.openBlock(),o.createElementBlock("div",E,[o.createElementVNode("ul",h,[o.createElementVNode("li",N,[t[20]||(t[20]=o.createElementVNode("i",{title:"字体",class:"text-icon"},"A",-1)),o.createElementVNode("div",{class:"fontfamilyChoser",onClick:t[0]||(t[0]=(...i)=>e.onFontfamilyChoserClk&&e.onFontfamilyChoserClk(...i))},[...t[19]||(t[19]=[o.createStaticVNode('<a style="font-family:'宋体';">宋体</a><a style="font-family:'黑体';">黑体</a><a style="font-family:'楷体';">楷体</a><a style="font-family:'隶书';">隶书</a><a style="font-family:'幼圆';">幼圆</a><a style="font-family:'Microsoft YaHei';">Microsoft YaHei</a><a style="font-family:Arial;">Arial</a><a style="font-family:'Arial Narrow';">Arial Narrow</a><a style="font-family:'Arial Black';">Arial Black</a><a style="font-family:'Comic Sans MS';">Comic Sans MS</a><a style="font-family:Courier;">Courier</a><a style="font-family:System;">System</a><a style="font-family:'Times New Roman';">Times New Roman</a><a style="font-family:Verdana;">Verdana</a>',14)])])]),o.createElementVNode("li",V,[t[22]||(t[22]=o.createElementVNode("i",{title:"字号",class:"text-icon"},"H",-1)),o.createElementVNode("div",{class:"fontsizeChoser",onClick:t[1]||(t[1]=(...i)=>e.onFontsizeChoserClk&&e.onFontsizeChoserClk(...i))},[...t[21]||(t[21]=[o.createStaticVNode('<a style="font-size:xx-small;">极小</a><a style="font-size:x-small;">特小</a><a style="font-size:small;">小</a><a style="font-size:medium;">中</a><a style="font-size:large;">大</a><a style="font-size:x-large;">特大</a><a style="font-size:xx-large;line-height:140%;">极大</a>',7)])])]),o.createElementVNode("li",{onClick:t[2]||(t[2]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[...t[23]||(t[23]=[o.createElementVNode("i",{title:"加粗",class:"bold text-icon"},"B",-1)])]),o.createElementVNode("li",{onClick:t[3]||(t[3]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[...t[24]||(t[24]=[o.createElementVNode("i",{title:"斜体",class:"italic text-icon",style:{"font-style":"italic"}},"I",-1)])]),o.createElementVNode("li",{onClick:t[4]||(t[4]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[...t[25]||(t[25]=[o.createElementVNode("i",{title:"下划线",class:"underline text-icon",style:{"text-decoration":"underline"}},"U",-1)])]),o.createElementVNode("li",{onClick:t[5]||(t[5]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"左对齐",class:o.normalizeClass("justifyleft "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-fold":"fontAwesome fa-align-left"))},null,2)]),o.createElementVNode("li",{onClick:t[6]||(t[6]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"中间对齐",class:o.normalizeClass("justifycenter "+(e.isIonicons?"ivu-icon ivu-icon-md-menu":"fontAwesome fa-align-center"))},null,2)]),o.createElementVNode("li",{onClick:t[7]||(t[7]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"右对齐",class:o.normalizeClass("justifyright "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-unfold":"fontAwesome fa-align-right"))},null,2)]),o.createElementVNode("li",{onClick:t[8]||(t[8]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"数字编号",class:o.normalizeClass("insertorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-md-list":"fontAwesome fa-list-ol"))},null,2)]),o.createElementVNode("li",{onClick:t[9]||(t[9]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"项目编号",class:o.normalizeClass("insertunorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-ios-list":"fontAwesome fa-list-ul"))},null,2)]),o.createElementVNode("li",{onClick:t[10]||(t[10]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"增加缩进",class:o.normalizeClass("outdent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-left":"fontAwesome fa-outdent"))},null,2)]),o.createElementVNode("li",{onClick:t[11]||(t[11]=(...i)=>e.onCmdClk&&e.onCmdClk(...i))},[o.createElementVNode("i",{title:"减少缩进",class:o.normalizeClass("indent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-right":"fontAwesome fa-indent"))},null,2)]),o.createElementVNode("li",w,[o.createElementVNode("i",{title:"字体颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-brush":"fontAwesome fa-paint-brush")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[12]||(t[12]=i=>e.format("foreColor",i.target.title))},null,8,b)]),o.createElementVNode("li",I,[o.createElementVNode("i",{title:"背景颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-brush-outline":"fontAwesome fa-pencil")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[13]||(t[13]=i=>e.format("backColor",i.target.title))},null,8,L)]),o.createElementVNode("li",{onClick:t[14]||(t[14]=(...i)=>e.createLink&&e.createLink(...i))},[o.createElementVNode("i",{title:"增加链接",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-link":"fontAwesome fa-link")},null,2)]),o.createElementVNode("li",{onClick:t[15]||(t[15]=(...i)=>e.insertImage&&e.insertImage(...i))},[o.createElementVNode("i",{title:"增加图片",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-images":"fontAwesome fa-regular fa-image")},null,2)]),o.createElementVNode("li",{onClick:t[16]||(t[16]=(...i)=>e.saveRemoteImage2Local&&e.saveRemoteImage2Local(...i))},[o.createElementVNode("i",{title:"一键存图",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-photos":"fontAwesome fa-camera")},null,2)]),o.createElementVNode("li",{onClick:t[17]||(t[17]=(...i)=>e.cleanHTML&&e.cleanHTML(...i))},[o.createElementVNode("i",{title:"清理 HTML",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-done-all":"fontAwesome fa-eraser")},null,2)]),o.createElementVNode("li",{onClick:t[18]||(t[18]=i=>e.isShowCode=!e.isShowCode)},[o.createElementVNode("i",{title:"切换到代码",class:o.normalizeClass((e.isIonicons?"ivu-icon ivu-icon-md-code":"fontAwesome fa-code")+" switchMode")},null,2)])]),t[26]||(t[26]=o.createElementVNode("div",{class:"editorBody"},[o.createElementVNode("iframe",{srcdoc:"<html><body></body></html>"}),o.createElementVNode("textarea")],-1))])}const M=c(p,[["render",A]]);function z(e,t){const r=(t?parent.location:window.location).search.substring(1).split("&");for(let n=0;n<r.length;n++){const s=r[n].split("=");if(s[0]==e)return s[1]}return null}const H={};function S(e,t){return o.openBlock(),o.createElementBlock("div",null,"hi")}const T={HomePage:c(H,[["render",S]])};a.HtmlEditor=M,a.MyButton=y,a.admin=T,a.getQueryParam=z,Object.defineProperty(a,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(d,o){typeof exports=="object"&&typeof module<"u"?o(exports,require("vue")):typeof define=="function"&&define.amd?define(["exports","vue"],o):(d=typeof globalThis<"u"?globalThis:d||self,o(d.ajaxjs_ui={},d.Vue))})(this,(function(d,o){"use strict";const y={},f=(e,t)=>{const i=e.__vccOpts||e;for(const[s,l]of t)i[s]=l;return i};function h(e,t,i,s,l,r){return o.openBlock(),o.createElementBlock("button",null,"hihi")}const E=f(y,[["render",h]]),k=o.defineComponent({name:"HtmlEditor",props:{modelValue:String,uploadImageActionUrl:String,isIonicons:Boolean},emits:["update:modelValue","onchange"],data(){return{isShowCode:!1,iframeEl:null,sourceEditor:null}},mounted(){this.iframeEl=this.$el.querySelector("iframe"),this.sourceEditor=this.$el.querySelector("textarea"),this.iframeEl.contentWindow.onload=e=>{this.iframeDoc=this.iframeEl.contentWindow.document,this.iframeDoc.designMode="on",this.iframeDoc.addEventListener("paste",w.bind(this)),new MutationObserver((t,i)=>{this.isShowCode||(this.sourceEditor.value=this.iframeDoc.body.innerHTML,this.$emit("onchange",this.sourceEditor.value)),this.$emit("update:modelValue",this.iframeDoc.body.innerHTML)}).observe(this.iframeDoc.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0})},this.sourceEditor.oninput=e=>{this.isShowCode&&this.sourceEditor.value&&(this.setIframeBody(this.sourceEditor.value),this.$emit("onchange",this.sourceEditor.value))}},methods:{setIframeBody(e){this.iframeDoc&&this.iframeDoc.body&&(this.iframeDoc.body.innerHTML=e)},getValue(e,t){let i=this.iframeDoc.body.innerHTML;return e&&(i=N(i)),t&&(i=encodeURIComponent(i)),i},createLink(){const e=prompt("请输入 URL 地址");e&&this.format("createLink",e)},insertImage(){window.isCreate?alert("请保存记录后再上传图片。"):this.uploadImgMgr.show(e=>{e&&e.isOk&&this.format("insertImage",e.fullUrl)})},cleanHTML(){this.setIframeBody(HtmlSanitizer.SanitizeHtml(this.iframeDoc.body.innerHTML))},saveRemoteImage2Local(){const e=this.iframeDoc.querySelectorAll("img"),t=new Array,i=[];for(let s=0,l=e.length;s<l;s++){const r=e[s],n=r.getAttribute("src");n!=null&&/^http/.test(n)&&(t.push(r),i.push(n))}i.length||console.log("未发现有远程图片")},onCmdClk(e){const t=e.target,i=t.className.split(" ").shift();this.format(i)},format(e,t){t?this.iframeDoc.execCommand(e,!1,t):this.iframeDoc.execCommand(e,!1)},onFontsizeChoserClk(e){const t=e.target,i=e.currentTarget.children;let s,l;for(s=0,l=i.length;s<l&&t!=i[s];s++);this.format("fontsize",s+"")},onFontfamilyChoserClk(e){const t=e.target;this.format("fontname",t.innerHTML);const i=t.parentNode;i.style.display="none",setTimeout(()=>i.style.display="",300)},createColorPickerHTML(){const e=["00","33","66","99","CC","FF"];let t,i,s,l;const r=['<div class="colorhead"><span class="colortitle">颜色选择</span></div><div class="colorbody"><table cellspaci="0" cellpadding="0"><tr>'];for(let n=0;n<6;++n){r.push('<td><table class="colorpanel" cellspacing="0" cellpadding="0">');for(let a=0,u=e[n];a<6;++a){r.push("<tr>");for(let c=0,p=e[a];c<6;++c)t=e[c],s=c==5&&n!=2&&n!=5?";border-right:none;":"",l=a==5&&n<3?";border-bottom:none":"",i="#"+u+t+p,r.push('<td unselectable="on" style="background-color: '+i+s+l+'" title="'+i+'"></td>');r.push("</tr>")}r.push("</table></td>"),e[n]=="66"&&r.push("</tr><tr>")}return r.push("</tr></table></div>"),r.join("")}},watch:{modelValue(e,t){t||this.setIframeBody(e)},isShowCode(e){e?(this.iframeEl.classList.add("hide"),this.sourceEditor.classList.add("show"),C.call(this,!0)):(this.iframeEl.classList.remove("hide"),this.sourceEditor.classList.remove("show"),C.call(this,!1))}}});function w(e){if(!this.uploadImageActionUrl){alert("未提供图片上传地址");return}const t=e.clipboardData&&e.clipboardData.items;if(!t||!t.length)return;let i=null;for(let r=0;r<t.length;r++){const n=t[r];if(n.type.indexOf("image")!==-1){i=n.getAsFile();break}}if(!i)return;e.preventDefault();const s=new FormData;s.append("file",i,i.name);const l=new XMLHttpRequest;l.addEventListener("load",r=>{if(l.status>=200&&l.status<300){const n=JSON.parse(l.responseText);console.log("Success:",n),this.format("insertImage",n.data.url)}else console.error("Upload failed with status:",l.status),alert("Upload failed!")}),l.addEventListener("error",function(r){console.error("Network error during upload:",r),alert("Upload failed due to a network error!")}),l.open("POST",this.uploadImageActionUrl),l.send(s)}function C(e){this.$el.querySelectorAll(".toolbar i").forEach(t=>{t.className.indexOf("switchMode")==-1&&(t.style.color=e?"lightgray":"")})}function N(e){return e=e.replace(/<(\/)*(\\?xml:|meta|link|span|font|del|ins|st1:|[ovwxp]:)((.|\s)*?)>/gi,""),e=e.replace(/(class|style|type|start)=("(.*?)"|(\w*))/gi,""),e=e.replace(/<style(.*?)style>/gi,""),e=e.replace(/<script(.*?)script>/gi,""),e=e.replace(/<!--(.*?)-->/gi,""),e}const V={class:"aj-form-html-editor"},b={class:"toolbar"},I={class:"dorpdown"},S={class:"dorpdown"},L={class:"dorpdown"},T=["innerHTML"],$={class:"dorpdown"},A=["innerHTML"];function z(e,t,i,s,l,r){return o.openBlock(),o.createElementBlock("div",V,[o.createElementVNode("ul",b,[o.createElementVNode("li",I,[t[20]||(t[20]=o.createElementVNode("i",{title:"字体",class:"text-icon"},"A",-1)),o.createElementVNode("div",{class:"fontfamilyChoser",onClick:t[0]||(t[0]=(...n)=>e.onFontfamilyChoserClk&&e.onFontfamilyChoserClk(...n))},[...t[19]||(t[19]=[o.createStaticVNode('<a style="font-family:'宋体';">宋体</a><a style="font-family:'黑体';">黑体</a><a style="font-family:'楷体';">楷体</a><a style="font-family:'隶书';">隶书</a><a style="font-family:'幼圆';">幼圆</a><a style="font-family:'Microsoft YaHei';">Microsoft YaHei</a><a style="font-family:Arial;">Arial</a><a style="font-family:'Arial Narrow';">Arial Narrow</a><a style="font-family:'Arial Black';">Arial Black</a><a style="font-family:'Comic Sans MS';">Comic Sans MS</a><a style="font-family:Courier;">Courier</a><a style="font-family:System;">System</a><a style="font-family:'Times New Roman';">Times New Roman</a><a style="font-family:Verdana;">Verdana</a>',14)])])]),o.createElementVNode("li",S,[t[22]||(t[22]=o.createElementVNode("i",{title:"字号",class:"text-icon"},"H",-1)),o.createElementVNode("div",{class:"fontsizeChoser",onClick:t[1]||(t[1]=(...n)=>e.onFontsizeChoserClk&&e.onFontsizeChoserClk(...n))},[...t[21]||(t[21]=[o.createStaticVNode('<a style="font-size:xx-small;">极小</a><a style="font-size:x-small;">特小</a><a style="font-size:small;">小</a><a style="font-size:medium;">中</a><a style="font-size:large;">大</a><a style="font-size:x-large;">特大</a><a style="font-size:xx-large;line-height:140%;">极大</a>',7)])])]),o.createElementVNode("li",{onClick:t[2]||(t[2]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[...t[23]||(t[23]=[o.createElementVNode("i",{title:"加粗",class:"bold text-icon"},"B",-1)])]),o.createElementVNode("li",{onClick:t[3]||(t[3]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[...t[24]||(t[24]=[o.createElementVNode("i",{title:"斜体",class:"italic text-icon",style:{"font-style":"italic"}},"I",-1)])]),o.createElementVNode("li",{onClick:t[4]||(t[4]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[...t[25]||(t[25]=[o.createElementVNode("i",{title:"下划线",class:"underline text-icon",style:{"text-decoration":"underline"}},"U",-1)])]),o.createElementVNode("li",{onClick:t[5]||(t[5]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"左对齐",class:o.normalizeClass("justifyleft "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-fold":"fontAwesome fa-align-left"))},null,2)]),o.createElementVNode("li",{onClick:t[6]||(t[6]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"中间对齐",class:o.normalizeClass("justifycenter "+(e.isIonicons?"ivu-icon ivu-icon-md-menu":"fontAwesome fa-align-center"))},null,2)]),o.createElementVNode("li",{onClick:t[7]||(t[7]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"右对齐",class:o.normalizeClass("justifyright "+(e.isIonicons?"ivu-icon ivu-icon-bingo-menu-unfold":"fontAwesome fa-align-right"))},null,2)]),o.createElementVNode("li",{onClick:t[8]||(t[8]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"数字编号",class:o.normalizeClass("insertorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-md-list":"fontAwesome fa-list-ol"))},null,2)]),o.createElementVNode("li",{onClick:t[9]||(t[9]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"项目编号",class:o.normalizeClass("insertunorderedlist "+(e.isIonicons?"ivu-icon ivu-icon-ios-list":"fontAwesome fa-list-ul"))},null,2)]),o.createElementVNode("li",{onClick:t[10]||(t[10]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"增加缩进",class:o.normalizeClass("outdent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-left":"fontAwesome fa-outdent"))},null,2)]),o.createElementVNode("li",{onClick:t[11]||(t[11]=(...n)=>e.onCmdClk&&e.onCmdClk(...n))},[o.createElementVNode("i",{title:"减少缩进",class:o.normalizeClass("indent "+(e.isIonicons?"ivu-icon ivu-icon-ios-return-right":"fontAwesome fa-indent"))},null,2)]),o.createElementVNode("li",L,[o.createElementVNode("i",{title:"字体颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-brush":"fontAwesome fa-paint-brush")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[12]||(t[12]=n=>e.format("foreColor",n.target.title))},null,8,T)]),o.createElementVNode("li",$,[o.createElementVNode("i",{title:"背景颜色",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-brush-outline":"fontAwesome fa-pencil")},null,2),o.createElementVNode("div",{class:"colorPicker",innerHTML:e.createColorPickerHTML(),onClick:t[13]||(t[13]=n=>e.format("backColor",n.target.title))},null,8,A)]),o.createElementVNode("li",{onClick:t[14]||(t[14]=(...n)=>e.createLink&&e.createLink(...n))},[o.createElementVNode("i",{title:"增加链接",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-ios-link":"fontAwesome fa-link")},null,2)]),o.createElementVNode("li",{onClick:t[15]||(t[15]=(...n)=>e.insertImage&&e.insertImage(...n))},[o.createElementVNode("i",{title:"增加图片",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-images":"fontAwesome fa-regular fa-image")},null,2)]),o.createElementVNode("li",{onClick:t[16]||(t[16]=(...n)=>e.saveRemoteImage2Local&&e.saveRemoteImage2Local(...n))},[o.createElementVNode("i",{title:"一键存图",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-photos":"fontAwesome fa-camera")},null,2)]),o.createElementVNode("li",{onClick:t[17]||(t[17]=(...n)=>e.cleanHTML&&e.cleanHTML(...n))},[o.createElementVNode("i",{title:"清理 HTML",class:o.normalizeClass(e.isIonicons?"ivu-icon ivu-icon-md-done-all":"fontAwesome fa-eraser")},null,2)]),o.createElementVNode("li",{onClick:t[18]||(t[18]=n=>e.isShowCode=!e.isShowCode)},[o.createElementVNode("i",{title:"切换到代码",class:o.normalizeClass((e.isIonicons?"ivu-icon ivu-icon-md-code":"fontAwesome fa-code")+" switchMode")},null,2)])]),t[26]||(t[26]=o.createElementVNode("div",{class:"editorBody"},[o.createElementVNode("iframe",{srcdoc:"<html><body></body></html>"}),o.createElementVNode("textarea")],-1))])}const M=f(k,[["render",z]]);function H(e,t){const s=(t?parent.location:window.location).search.substring(1).split("&");for(let l=0;l<s.length;l++){const r=s[l].split("=");if(r[0]==e)return r[1]}return null}const P={};function j(e,t){return o.openBlock(),o.createElementBlock("div",null,"hi")}const O=f(P,[["render",j]]);function m(e,t,i,s,l){let r={};if(l)for(const a in l)r[a]=l[a];t=t.toUpperCase();let n=i;i&&(t==="POST"||t==="PUT")&&(r["Content-Type"]=="application/json"?n=JSON.stringify(i):r["Content-Type"]=="application/x-www-form-urlencoded"&&(n=D(i))),fetch(e,{method:t,headers:r,body:n,credentials:"include"}).then(a=>{if(a.status===404)throw new Error("Not found 404: "+e);if(a.status===500)throw new Error("Server error: "+e);if(!a.ok)throw new Error(`Unexpected status: ${a.status}`);return a.json()}).then(a=>{s&&s(a)}).catch(a=>{console.error("Network error when fetching from: "+e,a)})}function D(e){const t=[];for(const[i,s]of Object.entries(e))s!=null&&typeof s!="function"&&t.push(`${encodeURIComponent(i)}=${encodeURIComponent(String(s))}`);return t.join("&")}function B(e,t,i){m(e,"GET",null,t,i)}function U(e,t,i,s){m(e,"POST",t,i,Object.assign({"Content-Type":"application/json"},s))}function F(e,t,i,s){m(e,"POST",t,i,Object.assign({"Content-Type":"application/x-www-form-urlencoded"},s))}function q(e,t,i,s){m(e,"PUT",t,i,Object.assign({"Content-Type":"application/json"},s))}function R(e,t,i,s){m(e,"PUT",t,i,Object.assign({"Content-Type":"application/x-www-form-urlencoded"},s))}function J(e,t,i){m(e,"DELETE",null,t,i)}var g=Object.freeze({__proto__:null,del:J,get:B,post:U,postForm:F,put:q,putForm:R});const K=o.defineComponent({data(){return{msg:"",autoLogin:!1}},methods:{hide(){this.$emit("hide")},handleSubmit(e,{username:t,password:i}){if(e){const s={grant_type:"password",username:t,password:i,client_id:"fvccgrfl3fzA7lrFyCpDA",client_secret:"zKvmM4Km8ghCIijl9ubqpHm1"};g.postForm("/iam_api/oidc/ropc_token",s,l=>{l.status?g.get("/iam_api/user/info",r=>{console.log(r),this.msg="登录成功",localStorage.setItem("isLoggedIn","true"),localStorage.setItem("userInfo",JSON.stringify(r.data)),setTimeout(()=>{this.$router.push("/?login_ok=1")},2e3)}):this.msg=l.message||"登录失败"})}},forgetPsw(){this.msg="请联系管理员重置密码"}}}),Q={class:"mask"},W={class:"auto-login"},Y={class:"msg"};function G(e,t,i,s,l,r){const n=o.resolveComponent("UserName"),a=o.resolveComponent("Password"),u=o.resolveComponent("Submit"),c=o.resolveComponent("Login",!0);return o.openBlock(),o.createElementBlock("div",Q,[o.createVNode(c,{onOnSubmit:e.handleSubmit,class:"login"},{default:o.withCtx(()=>[t[2]||(t[2]=o.createElementVNode("h1",null,"欢迎登录歪觅机器人管理后台",-1)),o.createVNode(n,{name:"username"}),o.createVNode(a,{name:"password"}),o.createElementVNode("div",W,[o.createElementVNode("span",Y,o.toDisplayString(e.msg),1),t[1]||(t[1]=o.createTextVNode(" ",-1)),o.createElementVNode("a",{onClick:t[0]||(t[0]=(...p)=>e.forgetPsw&&e.forgetPsw(...p))},"忘记密码")]),o.createVNode(u)]),_:1},8,["onOnSubmit"])])}const X={HomePage:O,Login:f(K,[["render",G],["__scopeId","data-v-2149b790"]])};d.HtmlEditor=M,d.MyButton=E,d.admin=X,d.getQueryParam=H,Object.defineProperty(d,Symbol.toStringTag,{value:"Module"})}));
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,5 +4,16 @@ export { default as MyButton } from './components/MyButton.vue';
|
|
|
4
4
|
export { default as HtmlEditor } from './components/html-editor/HtmlEditor.vue';
|
|
5
5
|
export declare const admin: {
|
|
6
6
|
HomePage: import('vue').DefineComponent<{}, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, HTMLDivElement>;
|
|
7
|
+
Login: import('vue').DefineComponent<{}, {}, {
|
|
8
|
+
msg: string;
|
|
9
|
+
autoLogin: boolean;
|
|
10
|
+
}, {}, {
|
|
11
|
+
hide(): void;
|
|
12
|
+
handleSubmit(valid: boolean, { username, password }: {
|
|
13
|
+
username: string;
|
|
14
|
+
password: string;
|
|
15
|
+
}): void;
|
|
16
|
+
forgetPsw(): void;
|
|
17
|
+
}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
|
|
7
18
|
};
|
|
8
19
|
export { getQueryParam } from './utils/utils';
|
package/dist/ui.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.aj-form-html-editor ul.toolbar{border:1px solid #C5C5C5;border-radius:4px 4px 0 0;border-bottom:0;background-color:#e8e7e4;width:100%;min-height:30px;margin:0;box-sizing:border-box;padding:3px 4px}.aj-form-html-editor ul.toolbar>li{list-style:none;float:left;cursor:pointer}.aj-form-html-editor ul.toolbar>li>i{border:1px solid transparent;min-width:25px;height:20px;line-height:20px;text-align:center;display:block}.aj-form-html-editor ul.toolbar>li>i.text-icon{font-family:Times New Roman;font-weight:700;font-style:normal}.aj-form-html-editor ul.toolbar>li>i.fontAwesome{padding-top:2px;font: 18px/1 FontAwesome}.aj-form-html-editor ul.toolbar>li>i:hover{border-right-color:#aaa;border-bottom-color:#aaa;border-top-color:#fff;border-left-color:#fff}.aj-form-html-editor ul.toolbar>li>i:active{border-right-color:#f3f8fc;border-bottom-color:#f3f8fc;border-top-color:#ccc;border-left-color:#ccc}.aj-form-html-editor ul.toolbar>li ul li{padding:3px;cursor:pointer}.aj-form-html-editor ul.toolbar>li ul li:hover{background-color:#d3d3d3}.aj-form-html-editor ul.toolbar>li .cleanHTML{background-size:16px 16px}.aj-form-html-editor ul.toolbar>li .noBg{background-image:none}.aj-form-html-editor .editorBody iframe,.aj-form-html-editor .editorBody textarea{border:1px solid #C5C5C5;border-radius:0 0 4px 4px;border-top-width:0;box-sizing:border-box;background-color:#fff;min-height:300px;width:100%}.aj-form-html-editor .editorBody iframe.hide{display:none}.aj-form-html-editor .editorBody textarea{resize:none;display:none}.aj-form-html-editor .editorBody textarea.show{display:block}.aj-form-html-editor .colorPicker{width:210px;border:1px solid #D3D3D3;position:absolute}.aj-form-html-editor .colorPicker table{border-collapse:collapse}.aj-form-html-editor .colorPicker .colorhead{height:23px;line-height:23px;font-weight:700;width:100%}.aj-form-html-editor .colorPicker .colortitle{margin-left:6px;font-size:12px}.aj-form-html-editor .colorPicker .colorpanel td{border:1px solid #000;height:10px;width:10px;overflow:hidden;font-size:1px;cursor:pointer}.aj-form-html-editor .fontfamilyChoser a,.aj-form-html-editor .fontsizeChoser a{display:block;padding:2px;color:#000;line-height:120%;text-decoration:none}.aj-form-html-editor .fontfamilyChoser a:hover,.aj-form-html-editor .fontsizeChoser a:hover{background:#e5e5e5}.aj-form-html-editor .dorpdown{position:relative}.aj-form-html-editor .dorpdown:hover .fontfamilyChoser,.aj-form-html-editor .dorpdown .fontfamilyChoser:hover,.aj-form-html-editor .dorpdown:hover .fontsizeChoser,.aj-form-html-editor .dorpdown .fontsizeChoser:hover,.aj-form-html-editor .dorpdown:hover .colorPicker,.aj-form-html-editor .dorpdown .colorPicker:hover{display:block}.aj-form-html-editor .dorpdown>div{display:none;position:absolute;top:22px;left:0;background-color:#f5f5f5;border:1px solid lightgray;border-top:0;padding:5px;width:230px}.aj-form-html-editor .dorpdown .fontsizeChoser{top:inherit;right:0}
|
|
1
|
+
.aj-form-html-editor ul.toolbar{border:1px solid #C5C5C5;border-radius:4px 4px 0 0;border-bottom:0;background-color:#e8e7e4;width:100%;min-height:30px;margin:0;box-sizing:border-box;padding:3px 4px}.aj-form-html-editor ul.toolbar>li{list-style:none;float:left;cursor:pointer}.aj-form-html-editor ul.toolbar>li>i{border:1px solid transparent;min-width:25px;height:20px;line-height:20px;text-align:center;display:block}.aj-form-html-editor ul.toolbar>li>i.text-icon{font-family:Times New Roman;font-weight:700;font-style:normal}.aj-form-html-editor ul.toolbar>li>i.fontAwesome{padding-top:2px;font: 18px/1 FontAwesome}.aj-form-html-editor ul.toolbar>li>i:hover{border-right-color:#aaa;border-bottom-color:#aaa;border-top-color:#fff;border-left-color:#fff}.aj-form-html-editor ul.toolbar>li>i:active{border-right-color:#f3f8fc;border-bottom-color:#f3f8fc;border-top-color:#ccc;border-left-color:#ccc}.aj-form-html-editor ul.toolbar>li ul li{padding:3px;cursor:pointer}.aj-form-html-editor ul.toolbar>li ul li:hover{background-color:#d3d3d3}.aj-form-html-editor ul.toolbar>li .cleanHTML{background-size:16px 16px}.aj-form-html-editor ul.toolbar>li .noBg{background-image:none}.aj-form-html-editor .editorBody iframe,.aj-form-html-editor .editorBody textarea{border:1px solid #C5C5C5;border-radius:0 0 4px 4px;border-top-width:0;box-sizing:border-box;background-color:#fff;min-height:300px;width:100%}.aj-form-html-editor .editorBody iframe.hide{display:none}.aj-form-html-editor .editorBody textarea{resize:none;display:none}.aj-form-html-editor .editorBody textarea.show{display:block}.aj-form-html-editor .colorPicker{width:210px;border:1px solid #D3D3D3;position:absolute}.aj-form-html-editor .colorPicker table{border-collapse:collapse}.aj-form-html-editor .colorPicker .colorhead{height:23px;line-height:23px;font-weight:700;width:100%}.aj-form-html-editor .colorPicker .colortitle{margin-left:6px;font-size:12px}.aj-form-html-editor .colorPicker .colorpanel td{border:1px solid #000;height:10px;width:10px;overflow:hidden;font-size:1px;cursor:pointer}.aj-form-html-editor .fontfamilyChoser a,.aj-form-html-editor .fontsizeChoser a{display:block;padding:2px;color:#000;line-height:120%;text-decoration:none}.aj-form-html-editor .fontfamilyChoser a:hover,.aj-form-html-editor .fontsizeChoser a:hover{background:#e5e5e5}.aj-form-html-editor .dorpdown{position:relative}.aj-form-html-editor .dorpdown:hover .fontfamilyChoser,.aj-form-html-editor .dorpdown .fontfamilyChoser:hover,.aj-form-html-editor .dorpdown:hover .fontsizeChoser,.aj-form-html-editor .dorpdown .fontsizeChoser:hover,.aj-form-html-editor .dorpdown:hover .colorPicker,.aj-form-html-editor .dorpdown .colorPicker:hover{display:block}.aj-form-html-editor .dorpdown>div{display:none;position:absolute;top:22px;left:0;background-color:#f5f5f5;border:1px solid lightgray;border-top:0;padding:5px;width:230px}.aj-form-html-editor .dorpdown .fontsizeChoser{top:inherit;right:0}.mask[data-v-2149b790]{position:fixed;top:0;left:0;width:100%;height:100%;z-index:9999;-webkit-backdrop-filter:blur(2px) opacity(.7);backdrop-filter:blur(2px) opacity(.7);background:#000000b3}.login[data-v-2149b790]{width:400px;margin:10% auto 0;background-color:#fff;padding:3%;border-radius:5px;box-shadow:2px 4px 5px #0006}.login h1[data-v-2149b790]{font-size:20px;letter-spacing:2px;margin-bottom:20px}.login .auto-login[data-v-2149b790]{margin-bottom:14px;text-align:left}.login .auto-login span[data-v-2149b790]{color:red}.login a[data-v-2149b790]{float:right}
|