@deskhero/dh_ui 1.43.7 → 1.43.8
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/dh_ui.es.js
CHANGED
|
@@ -43614,7 +43614,7 @@ const _sfc_main$1 = {
|
|
|
43614
43614
|
required: false
|
|
43615
43615
|
}
|
|
43616
43616
|
},
|
|
43617
|
-
emits: ["
|
|
43617
|
+
emits: ["change", "toggleEditor"],
|
|
43618
43618
|
setup(__props, { expose, emit }) {
|
|
43619
43619
|
const props = __props;
|
|
43620
43620
|
const jsonRes = ref(null);
|
|
@@ -43634,7 +43634,7 @@ const _sfc_main$1 = {
|
|
|
43634
43634
|
isSaved.value = false;
|
|
43635
43635
|
if (event.type !== "block-changed" || !props.wordCount) {
|
|
43636
43636
|
const content2 = await api.saver.save();
|
|
43637
|
-
emit("
|
|
43637
|
+
emit("change", content2.blocks);
|
|
43638
43638
|
return;
|
|
43639
43639
|
}
|
|
43640
43640
|
function couldBeCounted(block) {
|
|
@@ -43772,7 +43772,7 @@ const _sfc_main$1 = {
|
|
|
43772
43772
|
function save() {
|
|
43773
43773
|
editor.save().then((savedData) => {
|
|
43774
43774
|
jsonRes.value = savedData;
|
|
43775
|
-
|
|
43775
|
+
return savedData;
|
|
43776
43776
|
});
|
|
43777
43777
|
editor.readOnly.toggle();
|
|
43778
43778
|
isSaved.value = true;
|
|
@@ -43781,12 +43781,13 @@ const _sfc_main$1 = {
|
|
|
43781
43781
|
editor.clear();
|
|
43782
43782
|
}
|
|
43783
43783
|
expose({
|
|
43784
|
+
jsonRes,
|
|
43784
43785
|
edit,
|
|
43785
43786
|
save,
|
|
43786
43787
|
clear
|
|
43787
43788
|
});
|
|
43788
43789
|
function toggleEditor() {
|
|
43789
|
-
emit("
|
|
43790
|
+
emit("toggleEditor");
|
|
43790
43791
|
myEditor();
|
|
43791
43792
|
}
|
|
43792
43793
|
onMounted(() => {
|
package/dist/dh_ui.umd.js
CHANGED
|
@@ -444,4 +444,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
444
444
|
/*# sourceMappingURL=data:application/json;base64,`+btoa(unescape(encodeURIComponent(JSON.stringify(Y))))+" */");var U=new Blob([S],{type:"text/css"}),Q=z.href;z.href=URL.createObjectURL(U),Q&&URL.revokeObjectURL(Q)}.bind(null,w,A),I=function(){y(w),w.href&&URL.revokeObjectURL(w.href)}):(w=N(A),b=function(z,C){var E=C.css,S=C.media;if(S&&z.setAttribute("media",S),z.styleSheet)z.styleSheet.cssText=E;else{for(;z.firstChild;)z.removeChild(z.firstChild);z.appendChild(document.createTextNode(E))}}.bind(null,w),I=function(){y(w)});return b(k),function(z){if(z){if(z.css===k.css&&z.media===k.media&&z.sourceMap===k.sourceMap)return;b(k=z)}else I()}}t.exports=function(k,A){if(typeof DEBUG!="undefined"&&DEBUG&&typeof document!="object")throw new Error("The style-loader cannot be used in a non-browser environment");(A=A||{}).attrs=typeof A.attrs=="object"?A.attrs:{},A.singleton||typeof A.singleton=="boolean"||(A.singleton=l()),A.insertInto||(A.insertInto="head"),A.insertAt||(A.insertAt="bottom");var w=D(k,A);return h(w,A),function(b){for(var I=[],T=0;T<w.length;T++){var O=w[T];(z=s[O.id]).refs--,I.push(z)}for(b&&h(D(b,A),A),T=0;T<I.length;T++){var z;if((z=I[T]).refs===0){for(var C=0;C<z.parts.length;C++)z.parts[C]();delete s[z.id]}}}};var p,v=(p=[],function(k,A){return p[k]=A,p.filter(Boolean).join(`
|
|
445
445
|
`)});function L(k,A,w,b){var I=w?"":b.css;if(k.styleSheet)k.styleSheet.cssText=v(A,I);else{var T=document.createTextNode(I),O=k.childNodes;O[A]&&k.removeChild(O[A]),O.length?k.insertBefore(T,O[A]):k.appendChild(T)}}},function(t,o){t.exports=function(e){var i=typeof window!="undefined"&&window.location;if(!i)throw new Error("fixUrls requires window.location");if(!e||typeof e!="string")return e;var a=i.protocol+"//"+i.host,s=a+i.pathname.replace(/\/[^\/]*$/,"/");return e.replace(/url\s*\(((?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gi,function(l,u){var d,f=u.trim().replace(/^"(.*)"$/,function(M,g){return g}).replace(/^'(.*)'$/,function(M,g){return g});return/^(#|data:|http:\/\/|https:\/\/|file:\/\/\/|\s*$)/i.test(f)?l:(d=f.indexOf("//")===0?f:f.indexOf("/")===0?a+f:s+f.replace(/^\.\//,""),"url("+JSON.stringify(d)+")")})}},function(t,o,e){e.r(o),e(0);const i='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19V19C9.13623 19 8.20435 19 7.46927 18.6955C6.48915 18.2895 5.71046 17.5108 5.30448 16.5307C5 15.7956 5 14.8638 5 13V12C5 9.19108 5 7.78661 5.67412 6.77772C5.96596 6.34096 6.34096 5.96596 6.77772 5.67412C7.78661 5 9.19108 5 12 5H13.5C14.8956 5 15.5933 5 16.1611 5.17224C17.4395 5.56004 18.44 6.56046 18.8278 7.83886C19 8.40666 19 9.10444 19 10.5V10.5"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6.5 17.5L17.5 6.5"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 10.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.9919 19H11.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13L13 5"/></svg>',a='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M18.9919 9.5H19.0015"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14.5 5H14.5096"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M14.625 5H15C17.2091 5 19 6.79086 19 9V9.375"/><path stroke="currentColor" stroke-width="2" d="M9.375 5L9 5C6.79086 5 5 6.79086 5 9V9.375"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 5H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 9.5H5.00957"/><path stroke="currentColor" stroke-width="2" d="M9.375 19H9C6.79086 19 5 17.2091 5 15V14.625"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.3725 19H9.38207"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 14.55H5.00957"/><path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M16 13V16M16 19V16M19 16H16M16 16H13"/></svg>',s='<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17 9L20 12L17 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M14 12H20"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 9L4 12L7 15"/><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 12H10"/></svg>';function l(M){return function(g){if(Array.isArray(g)){for(var h=0,D=new Array(g.length);h<g.length;h++)D[h]=g[h];return D}}(M)||function(g){if(Symbol.iterator in Object(g)||Object.prototype.toString.call(g)==="[object Arguments]")return Array.from(g)}(M)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function u(M,g,h){return g in M?Object.defineProperty(M,g,{value:h,enumerable:!0,configurable:!0,writable:!0}):M[g]=h,M}function d(M,g){for(var h=0;h<g.length;h++){var D=g[h];D.enumerable=D.enumerable||!1,D.configurable=!0,"value"in D&&(D.writable=!0),Object.defineProperty(M,D.key,D)}}e.d(o,"default",function(){return f});var f=function(){function M(x){var y=x.data,N=(x.config,x.api),j=x.readOnly;(function(m,p){if(!(m instanceof p))throw new TypeError("Cannot call a class as a function")})(this,M),this.api=N,this.readOnly=j,this.blockIndex=this.api.blocks.getCurrentBlockIndex()+1,this.CSS={baseClass:this.api.styles.block,loading:this.api.styles.loader,input:this.api.styles.input,wrapper:"cdx-simple-image",imageHolder:"cdx-simple-image__picture",caption:"cdx-simple-image__caption"},this.nodes={wrapper:null,imageHolder:null,image:null,caption:null},this.data={url:y.url||"",caption:y.caption||"",withBorder:y.withBorder!==void 0&&y.withBorder,withBackground:y.withBackground!==void 0&&y.withBackground,stretched:y.stretched!==void 0&&y.stretched},this.tunes=[{name:"withBorder",label:"Add Border",icon:a},{name:"stretched",label:"Stretch Image",icon:s},{name:"withBackground",label:"Add Background",icon:i}]}var g,h,D;return g=M,D=[{key:"sanitize",get:function(){return{url:{},withBorder:{},withBackground:{},stretched:{},caption:{br:!0}}}},{key:"isReadOnlySupported",get:function(){return!0}},{key:"pasteConfig",get:function(){return{patterns:{image:/https?:\/\/\S+\.(gif|jpe?g|tiff|png|webp)$/i},tags:["img"],files:{mimeTypes:["image/*"]}}}}],(h=[{key:"render",value:function(){var x=this,y=this._make("div",[this.CSS.baseClass,this.CSS.wrapper]),N=this._make("div",this.CSS.loading),j=this._make("div",this.CSS.imageHolder),m=this._make("img"),p=this._make("div",[this.CSS.input,this.CSS.caption],{contentEditable:!this.readOnly,innerHTML:this.data.caption||""});return p.dataset.placeholder="Enter a caption",y.appendChild(N),this.data.url&&(m.src=this.data.url),m.onload=function(){y.classList.remove(x.CSS.loading),j.appendChild(m),y.appendChild(j),y.appendChild(p),N.remove(),x._acceptTuneView()},m.onerror=function(v){console.log("Failed to load an image",v)},this.nodes.imageHolder=j,this.nodes.wrapper=y,this.nodes.image=m,this.nodes.caption=p,y}},{key:"save",value:function(x){var y=x.querySelector("img"),N=x.querySelector("."+this.CSS.input);return y?Object.assign(this.data,{url:y.src,caption:N.innerHTML}):this.data}},{key:"onDropHandler",value:function(x){var y=new FileReader;return y.readAsDataURL(x),new Promise(function(N){y.onload=function(j){N({url:j.target.result,caption:x.name})}})}},{key:"onPaste",value:function(x){var y=this;switch(x.type){case"tag":var N=x.detail.data;this.data={url:N.src};break;case"pattern":var j=x.detail.data;this.data={url:j};break;case"file":var m=x.detail.file;this.onDropHandler(m).then(function(p){y.data=p})}}},{key:"renderSettings",value:function(){var x=this;return this.tunes.map(function(y){return function(N){for(var j=1;j<arguments.length;j++){var m=arguments[j]!=null?arguments[j]:{},p=Object.keys(m);typeof Object.getOwnPropertySymbols=="function"&&(p=p.concat(Object.getOwnPropertySymbols(m).filter(function(v){return Object.getOwnPropertyDescriptor(m,v).enumerable}))),p.forEach(function(v){u(N,v,m[v])})}return N}({},y,{label:x.api.i18n.t(y.label),toggle:!0,onActivate:function(){return x._toggleTune(y.name)},isActive:!!x.data[y.name]})})}},{key:"_make",value:function(x){var y,N=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null,j=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},m=document.createElement(x);Array.isArray(N)?(y=m.classList).add.apply(y,l(N)):N&&m.classList.add(N);for(var p in j)m[p]=j[p];return m}},{key:"_toggleTune",value:function(x){this.data[x]=!this.data[x],this._acceptTuneView()}},{key:"_acceptTuneView",value:function(){var x=this;this.tunes.forEach(function(y){x.nodes.imageHolder.classList.toggle(x.CSS.imageHolder+"--"+y.name.replace(/([A-Z])/g,function(N){return"-".concat(N[0].toLowerCase())}),!!x.data[y.name]),y.name==="stretched"&&x.api.blocks.stretchBlock(x.blockIndex,!!x.data.stretched)})}},{key:"data",get:function(){return this._data},set:function(x){this._data=Object.assign({},this.data,x),this.nodes.image&&(this.nodes.image.src=this.data.url),this.nodes.caption&&(this.nodes.caption.innerHTML=this.data.caption)}}])&&d(g.prototype,h),D&&d(g,D),M}()}]).default})})(YM);var Jk=Nt(YM.exports),BM={exports:{}};(function(r,n){(function(t,o){r.exports=o()})(self,function(){return(()=>{var t={506:(i,a,s)=>{function l(f,M){for(var g=0;g<M.length;g++){var h=M[g];h.enumerable=h.enumerable||!1,h.configurable=!0,"value"in h&&(h.writable=!0),Object.defineProperty(f,h.key,h)}}function u(f,M,g){return M&&l(f.prototype,M),g&&l(f,g),f}s(548).toString();var d=function(){function f(M){var g=M.api;(function(h,D){if(!(h instanceof D))throw new TypeError("Cannot call a class as a function")})(this,f),this.api=g,this.button=null,this.tag="DEL",this.iconClasses={base:this.api.styles.inlineToolButton,active:this.api.styles.inlineToolButtonActive}}return u(f,null,[{key:"CSS",get:function(){return"cdx-strikethrough"}}]),u(f,[{key:"render",value:function(){return this.button=document.createElement("button"),this.button.type="button",this.button.classList.add(this.iconClasses.base),this.button.innerHTML=this.toolboxIcon,this.button}},{key:"surround",value:function(M){if(M){var g=this.api.selection.findParentTag(this.tag,f.CSS);g?this.unwrap(g):this.wrap(M)}}},{key:"wrap",value:function(M){var g=document.createElement(this.tag);g.classList.add(f.CSS),g.appendChild(M.extractContents()),M.insertNode(g),this.api.selection.expandToTag(g)}},{key:"unwrap",value:function(M){this.api.selection.expandToTag(M);var g=window.getSelection(),h=g.getRangeAt(0),D=h.extractContents();M.parentNode.removeChild(M),h.insertNode(D),g.removeAllRanges(),g.addRange(h)}},{key:"checkState",value:function(){var M=this.api.selection.findParentTag(this.tag,f.CSS);this.button.classList.toggle(this.iconClasses.active,!!M)}},{key:"toolboxIcon",get:function(){return s(476).Z}}],[{key:"isInline",get:function(){return!0}},{key:"sanitize",get:function(){return{del:{class:f.CSS}}}}]),f}();i.exports=d},424:(i,a,s)=>{s.d(a,{Z:()=>d});var l=s(645),u=s.n(l)()(function(f){return f[1]});u.push([i.id,".cdx-strikethrough {}",""]);const d=u},645:i=>{i.exports=function(a){var s=[];return s.toString=function(){return this.map(function(l){var u=a(l);return l[2]?"@media ".concat(l[2]," {").concat(u,"}"):u}).join("")},s.i=function(l,u,d){typeof l=="string"&&(l=[[null,l,""]]);var f={};if(d)for(var M=0;M<this.length;M++){var g=this[M][0];g!=null&&(f[g]=!0)}for(var h=0;h<l.length;h++){var D=[].concat(l[h]);d&&f[D[0]]||(u&&(D[2]?D[2]="".concat(u," and ").concat(D[2]):D[2]=u),s.push(D))}},s}},476:(i,a,s)=>{s.d(a,{Z:()=>l});const l='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="12" height="12"><path d="M17.154 14c.23.516.346 1.09.346 1.72 0 1.342-.524 2.392-1.571 3.147C14.88 19.622 13.433 20 11.586 20c-1.64 0-3.263-.381-4.87-1.144V16.6c1.52.877 3.075 1.316 4.666 1.316 2.551 0 3.83-.732 3.839-2.197a2.21 2.21 0 0 0-.648-1.603l-.12-.117H3v-2h18v2h-3.846zm-4.078-3H7.629a4.086 4.086 0 0 1-.481-.522C6.716 9.92 6.5 9.246 6.5 8.452c0-1.236.466-2.287 1.397-3.153C8.83 4.433 10.271 4 12.222 4c1.471 0 2.879.328 4.222.984v2.152c-1.2-.687-2.515-1.03-3.946-1.03-2.48 0-3.719.782-3.719 2.346 0 .42.218.786.654 1.099.436.313.974.562 1.613.75.62.18 1.297.414 2.03.699z"/></svg>'},548:(i,a,s)=>{var l=s(379),u=s.n(l),d=s(424);u()(d.Z,{insert:"head",singleton:!1}),d.Z.locals},379:(i,a,s)=>{var l,u=function(){var p={};return function(v){if(p[v]===void 0){var L=document.querySelector(v);if(window.HTMLIFrameElement&&L instanceof window.HTMLIFrameElement)try{L=L.contentDocument.head}catch{L=null}p[v]=L}return p[v]}}(),d=[];function f(p){for(var v=-1,L=0;L<d.length;L++)if(d[L].identifier===p){v=L;break}return v}function M(p,v){for(var L={},k=[],A=0;A<p.length;A++){var w=p[A],b=v.base?w[0]+v.base:w[0],I=L[b]||0,T="".concat(b," ").concat(I);L[b]=I+1;var O=f(T),z={css:w[1],media:w[2],sourceMap:w[3]};O!==-1?(d[O].references++,d[O].updater(z)):d.push({identifier:T,updater:m(z,v),references:1}),k.push(T)}return k}function g(p){var v=document.createElement("style"),L=p.attributes||{};if(L.nonce===void 0){var k=s.nc;k&&(L.nonce=k)}if(Object.keys(L).forEach(function(w){v.setAttribute(w,L[w])}),typeof p.insert=="function")p.insert(v);else{var A=u(p.insert||"head");if(!A)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");A.appendChild(v)}return v}var h,D=(h=[],function(p,v){return h[p]=v,h.filter(Boolean).join(`
|
|
446
446
|
`)});function x(p,v,L,k){var A=L?"":k.media?"@media ".concat(k.media," {").concat(k.css,"}"):k.css;if(p.styleSheet)p.styleSheet.cssText=D(v,A);else{var w=document.createTextNode(A),b=p.childNodes;b[v]&&p.removeChild(b[v]),b.length?p.insertBefore(w,b[v]):p.appendChild(w)}}function y(p,v,L){var k=L.css,A=L.media,w=L.sourceMap;if(A?p.setAttribute("media",A):p.removeAttribute("media"),w&&typeof btoa!="undefined"&&(k+=`
|
|
447
|
-
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(w))))," */")),p.styleSheet)p.styleSheet.cssText=k;else{for(;p.firstChild;)p.removeChild(p.firstChild);p.appendChild(document.createTextNode(k))}}var N=null,j=0;function m(p,v){var L,k,A;if(v.singleton){var w=j++;L=N||(N=g(v)),k=x.bind(null,L,w,!1),A=x.bind(null,L,w,!0)}else L=g(v),k=y.bind(null,L,v),A=function(){(function(b){if(b.parentNode===null)return!1;b.parentNode.removeChild(b)})(L)};return k(p),function(b){if(b){if(b.css===p.css&&b.media===p.media&&b.sourceMap===p.sourceMap)return;k(p=b)}else A()}}i.exports=function(p,v){(v=v||{}).singleton||typeof v.singleton=="boolean"||(v.singleton=(l===void 0&&(l=Boolean(window&&document&&document.all&&!window.atob)),l));var L=M(p=p||[],v);return function(k){if(k=k||[],Object.prototype.toString.call(k)==="[object Array]"){for(var A=0;A<L.length;A++){var w=f(L[A]);d[w].references--}for(var b=M(k,v),I=0;I<L.length;I++){var T=f(L[I]);d[T].references===0&&(d[T].updater(),d.splice(T,1))}L=b}}}}},o={};function e(i){if(o[i])return o[i].exports;var a=o[i]={id:i,exports:{}};return t[i](a,a.exports,e),a.exports}return e.n=i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return e.d(a,{a}),a},e.d=(i,a)=>{for(var s in a)e.o(a,s)&&!e.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:a[s]})},e.o=(i,a)=>Object.prototype.hasOwnProperty.call(i,a),e(506)})()})})(BM);var PM=Nt(BM.exports),HA="";const Xk={class:"editor__wrapper"},Kk={key:0,class:"editor__count"},qk=c.createTextVNode(" /300 "),eA={class:"editor__body"},tA={key:0,class:"editor__first"},nA={class:"editor__first_text"},rA={class:"editor__first_link",href:"https://deskhero.com",target:"_blank"},oA=c.createElementVNode("div",{id:"codex-editor"},null,-1),iA={__name:"TextEditor",props:{data:{type:Object,default:()=>({blocks:[]}),required:!1},readOnly:{type:Boolean,default:!0,required:!1},featureSet:{type:String,default:"Default",required:!1},firstBlock:{type:Boolean,default:!0,required:!1},firstBlockText:{type:String,default:"add your first block",required:!1},learnMoreText:{type:String,default:"Learn more about the text editor",required:!1},placeholder:{type:String,default:"Start typing...",required:!1},wordCount:{type:Boolean,default:!1,required:!1},minHeight:{type:Number,default:50,required:!1}},emits:["saveData","toggleEdit"],setup(r,{expose:n,emit:t}){const o=r,e=c.ref(null),i=c.ref(!1),a=c.ref(!1),s=c.ref(0),l=c.ref({holder:"codex-editor",autofocus:!0,minHeight:0,defaultBlock:"paragraph",readOnly:o.readOnly,onReady:()=>{a.value=!0},onChange:async(D,x)=>{if(i.value=!1,x.type!=="block-changed"||!o.wordCount){const I=await D.saver.save();t("saveData",I.blocks);return}function y(I){return"text"in I.data}function N(I){return I.filter(y).reduce((T,O)=>(T+=O.data.text.length,T),0)}const j=300,m=await D.saver.save(),p=N(m.blocks);if(s.value=p,p<=j)return;const v=x.detail.target,L=x.detail.index,k=m.blocks.filter(I=>I.id===v.id).pop(),A=m.blocks.filter(I=>I.id!==v.id),w=N(A),b=j-w;D.blocks.update(v.id,{text:k.data.text.substr(0,b)}),D.caret.setToBlock(L,"end")}}),u=c.computed(()=>s.value>300);function d(){o.featureSet=="Full"?window.editor=new Zl({...l.value,data:o.data,minHeight:o.minHeight,tools:{paragraph:{class:Wl,config:{placeholder:o.placeholder}},header:{class:Hl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},strikethrough:{class:PM,shortcut:"CMD+SHIFT+X"},inlineCode:{class:Hk},checklist:{class:$k},table:{class:Wk},delimiter:{class:Gk},image:{class:Jk},code:{class:Fk}}}):o.featureSet=="Mail"?window.editor=new Zl({...l.value,data:o.data,minHeight:o.minHeight,tools:{paragraph:{class:Wl,config:{placeholder:o.placeholder}},header:{class:Hl}}}):window.editor=new Zl({...l.value,data:o.data,minHeight:o.minHeight,tools:{paragraph:{class:Wl,config:{placeholder:o.placeholder}},header:{class:Hl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},strikethrough:{class:PM,shortcut:"CMD+SHIFT+X"}}})}function f(){editor.readOnly.toggle()}function M(){editor.save().then(D=>{e.value=D,t("saveData",D)}),editor.readOnly.toggle(),i.value=!0}function g(){editor.clear()}n({edit:f,save:M,clear:g});function h(){t("toggleEdit"),d()}return c.onMounted(()=>{o.firstBlock&&d()}),(D,x)=>(c.openBlock(),c.createElementBlock("div",Xk,[r.wordCount?(c.openBlock(),c.createElementBlock("div",Kk,[c.createElementVNode("span",{class:c.normalizeClass(c.unref(u)?"editor__count--danger":"")},c.toDisplayString(s.value),3),qk])):c.createCommentVNode("",!0),c.createElementVNode("div",eA,[r.firstBlock?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",tA,[c.createElementVNode("button",{class:"editor__first_btn",onClick:h},"+"),c.createElementVNode("p",nA,c.toDisplayString(r.firstBlockText),1),c.createElementVNode("a",rA,c.toDisplayString(r.learnMoreText),1)])),oA])]))}};var WA="";const aA={class:"code"},sA=["autocomplete"],lA=["autocomplete"],uA=["autocomplete"],cA=["autocomplete"],dA=["autocomplete"],fA=["autocomplete"];var MA=st(c.defineComponent({__name:"VerificationCode",props:{code:{type:String,required:!1,default:""},focusOnFirstInput:{type:Boolean,default:!0},focusOnFirstInputDelay:{type:Number,default:100},autoComplete:{type:String,default:"off"}},emits:["submit"],setup(r,{emit:n}){const t=r,o=c.ref(null),e=c.ref(null),i=c.ref(null),a=c.ref(null),s=c.ref(null),l=c.ref(null);async function u(x){var y,N,j,m,p;switch(x){case 1:break;case 2:(y=o.value)==null||y.focus();break;case 3:(N=e.value)==null||N.focus();break;case 4:(j=i.value)==null||j.focus();break;case 5:(m=a.value)==null||m.focus();break;case 6:(p=s.value)==null||p.focus();break}}async function d(x){var y,N,j,m,p;switch(x){case 1:(y=e.value)==null||y.focus();break;case 2:(N=i.value)==null||N.focus();break;case 3:(j=a.value)==null||j.focus();break;case 4:(m=s.value)==null||m.focus();break;case 5:(p=l.value)==null||p.focus();break}}async function f(x,y){const N=x.key;let j=!0;[{_index:1,nextInput:e},{_index:2,nextInput:i},{_index:3,nextInput:a},{_index:4,nextInput:s},{_index:5,nextInput:l}].forEach(({_index:m,nextInput:p})=>{y===m&&(p.value&&N.match(/^[0-9]+$/)&&p.value.focus({}),j=!1),x.preventDefault()}),N.match(/^[0-9]+$/)&&(x.target.value=N),j&&h()}async function M(x){var N;const y=((N=x.clipboardData)==null?void 0:N.getData("text/plain"))||"";g(y),h()}function g(x){const y=x.replace(/\D/g,"");if(y.length!==6)return;const[N,j,m,p,v,L]=y.split("");o.value&&(o.value.value=N),e.value&&(e.value.value=j),i.value&&(i.value.value=m),a.value&&(a.value.value=p),s.value&&(s.value.value=v),l.value&&(l.value.value=L)}async function h(){var y,N,j,m,p,v;const x=`${(y=o.value)==null?void 0:y.value}${(N=e.value)==null?void 0:N.value}${(j=i.value)==null?void 0:j.value}${(m=a.value)==null?void 0:m.value}${(p=s.value)==null?void 0:p.value}${(v=l.value)==null?void 0:v.value}`;n("submit",x)}function D(){setTimeout(()=>{var x;t.focusOnFirstInput&&((x=o.value)==null||x.focus())},t.focusOnFirstInputDelay)}return c.onMounted(()=>{t.code&&(g(t.code),h()),D()}),(x,y)=>(c.openBlock(),c.createElementBlock("div",aA,[c.createElementVNode("input",{ref_key:"txtInput1",ref:o,autocomplete:r.autoComplete,autofocus:"",class:"form-input input-1","data-e2e":"input-1",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[0]||(y[0]=N=>f(N,1)),onKeyup:[y[1]||(y[1]=c.withKeys(N=>u(1),["delete"])),y[2]||(y[2]=c.withKeys(N=>u(1),["left"])),y[3]||(y[3]=c.withKeys(N=>d(1),["right"]))],onPaste:M},null,40,sA),c.createElementVNode("input",{ref_key:"txtInput2",ref:e,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-2",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[4]||(y[4]=N=>f(N,2)),onKeyup:[y[5]||(y[5]=c.withKeys(N=>u(2),["delete"])),y[6]||(y[6]=c.withKeys(N=>u(2),["left"])),y[7]||(y[7]=c.withKeys(N=>d(2),["right"]))],onPaste:M},null,40,lA),c.createElementVNode("input",{ref_key:"txtInput3",ref:i,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-3",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[8]||(y[8]=N=>f(N,3)),onKeyup:[y[9]||(y[9]=c.withKeys(N=>u(3),["delete"])),y[10]||(y[10]=c.withKeys(N=>u(3),["left"])),y[11]||(y[11]=c.withKeys(N=>d(3),["right"]))],onPaste:M},null,40,uA),c.createElementVNode("input",{ref_key:"txtInput4",ref:a,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-4",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[12]||(y[12]=N=>f(N,4)),onKeyup:[y[13]||(y[13]=c.withKeys(N=>u(4),["delete"])),y[14]||(y[14]=c.withKeys(N=>u(4),["left"])),y[15]||(y[15]=c.withKeys(N=>d(4),["right"]))],onPaste:M},null,40,cA),c.createElementVNode("input",{ref_key:"txtInput5",ref:s,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-5",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[16]||(y[16]=N=>f(N,5)),onKeyup:[y[17]||(y[17]=c.withKeys(N=>u(5),["delete"])),y[18]||(y[18]=c.withKeys(N=>u(5),["left"])),y[19]||(y[19]=c.withKeys(N=>d(5),["right"]))],onPaste:M},null,40,dA),c.createElementVNode("input",{ref_key:"txtInput6",ref:l,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-6",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[20]||(y[20]=N=>f(N,6)),onKeyup:[y[21]||(y[21]=c.withKeys(N=>u(6),["delete"])),y[22]||(y[22]=c.withKeys(N=>u(6),["left"])),y[23]||(y[23]=c.withKeys(N=>d(6),["right"]))],onPaste:M},null,40,fA)]))}}),[["__scopeId","data-v-2ace876a"]]);Se.DhAdvancedDatePicker=L2,Se.DhAdvancedFilter=jM,Se.DhCopyText=U2,Se.DhDatePicker=P2,Se.DhDropdownMenu=W2,Se.DhError=G2,Se.DhExpansionPanel=q2,Se.DhFileUpload=yT,Se.DhIcon=we,Se.DhInputDropdown=vT,Se.DhInputGroup=kT,Se.DhInputList=gk,Se.DhModal=Ik,Se.DhNotification=kk,Se.DhNumberRange=IM,Se.DhPasswordField=Ok,Se.DhRadioBox=vM,Se.DhRadioBoxGroup=Qk,Se.DhSearchInput=Bk,Se.DhStepper=Zk,Se.DhSwitch=pd,Se.DhTextEditor=iA,Se.DhTooltip=DM,Se.DhVerificationCode=MA,Object.defineProperties(Se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
447
|
+
/*# sourceMappingURL=data:application/json;base64,`.concat(btoa(unescape(encodeURIComponent(JSON.stringify(w))))," */")),p.styleSheet)p.styleSheet.cssText=k;else{for(;p.firstChild;)p.removeChild(p.firstChild);p.appendChild(document.createTextNode(k))}}var N=null,j=0;function m(p,v){var L,k,A;if(v.singleton){var w=j++;L=N||(N=g(v)),k=x.bind(null,L,w,!1),A=x.bind(null,L,w,!0)}else L=g(v),k=y.bind(null,L,v),A=function(){(function(b){if(b.parentNode===null)return!1;b.parentNode.removeChild(b)})(L)};return k(p),function(b){if(b){if(b.css===p.css&&b.media===p.media&&b.sourceMap===p.sourceMap)return;k(p=b)}else A()}}i.exports=function(p,v){(v=v||{}).singleton||typeof v.singleton=="boolean"||(v.singleton=(l===void 0&&(l=Boolean(window&&document&&document.all&&!window.atob)),l));var L=M(p=p||[],v);return function(k){if(k=k||[],Object.prototype.toString.call(k)==="[object Array]"){for(var A=0;A<L.length;A++){var w=f(L[A]);d[w].references--}for(var b=M(k,v),I=0;I<L.length;I++){var T=f(L[I]);d[T].references===0&&(d[T].updater(),d.splice(T,1))}L=b}}}}},o={};function e(i){if(o[i])return o[i].exports;var a=o[i]={id:i,exports:{}};return t[i](a,a.exports,e),a.exports}return e.n=i=>{var a=i&&i.__esModule?()=>i.default:()=>i;return e.d(a,{a}),a},e.d=(i,a)=>{for(var s in a)e.o(a,s)&&!e.o(i,s)&&Object.defineProperty(i,s,{enumerable:!0,get:a[s]})},e.o=(i,a)=>Object.prototype.hasOwnProperty.call(i,a),e(506)})()})})(BM);var PM=Nt(BM.exports),HA="";const Xk={class:"editor__wrapper"},Kk={key:0,class:"editor__count"},qk=c.createTextVNode(" /300 "),eA={class:"editor__body"},tA={key:0,class:"editor__first"},nA={class:"editor__first_text"},rA={class:"editor__first_link",href:"https://deskhero.com",target:"_blank"},oA=c.createElementVNode("div",{id:"codex-editor"},null,-1),iA={__name:"TextEditor",props:{data:{type:Object,default:()=>({blocks:[]}),required:!1},readOnly:{type:Boolean,default:!0,required:!1},featureSet:{type:String,default:"Default",required:!1},firstBlock:{type:Boolean,default:!0,required:!1},firstBlockText:{type:String,default:"add your first block",required:!1},learnMoreText:{type:String,default:"Learn more about the text editor",required:!1},placeholder:{type:String,default:"Start typing...",required:!1},wordCount:{type:Boolean,default:!1,required:!1},minHeight:{type:Number,default:50,required:!1}},emits:["change","toggleEditor"],setup(r,{expose:n,emit:t}){const o=r,e=c.ref(null),i=c.ref(!1),a=c.ref(!1),s=c.ref(0),l=c.ref({holder:"codex-editor",autofocus:!0,minHeight:0,defaultBlock:"paragraph",readOnly:o.readOnly,onReady:()=>{a.value=!0},onChange:async(D,x)=>{if(i.value=!1,x.type!=="block-changed"||!o.wordCount){const I=await D.saver.save();t("change",I.blocks);return}function y(I){return"text"in I.data}function N(I){return I.filter(y).reduce((T,O)=>(T+=O.data.text.length,T),0)}const j=300,m=await D.saver.save(),p=N(m.blocks);if(s.value=p,p<=j)return;const v=x.detail.target,L=x.detail.index,k=m.blocks.filter(I=>I.id===v.id).pop(),A=m.blocks.filter(I=>I.id!==v.id),w=N(A),b=j-w;D.blocks.update(v.id,{text:k.data.text.substr(0,b)}),D.caret.setToBlock(L,"end")}}),u=c.computed(()=>s.value>300);function d(){o.featureSet=="Full"?window.editor=new Zl({...l.value,data:o.data,minHeight:o.minHeight,tools:{paragraph:{class:Wl,config:{placeholder:o.placeholder}},header:{class:Hl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},strikethrough:{class:PM,shortcut:"CMD+SHIFT+X"},inlineCode:{class:Hk},checklist:{class:$k},table:{class:Wk},delimiter:{class:Gk},image:{class:Jk},code:{class:Fk}}}):o.featureSet=="Mail"?window.editor=new Zl({...l.value,data:o.data,minHeight:o.minHeight,tools:{paragraph:{class:Wl,config:{placeholder:o.placeholder}},header:{class:Hl}}}):window.editor=new Zl({...l.value,data:o.data,minHeight:o.minHeight,tools:{paragraph:{class:Wl,config:{placeholder:o.placeholder}},header:{class:Hl},list:{class:CM},underline:{class:wM,shortcut:"CMD+SHIFT+U"},marker:{class:kM,shortcut:"CMD+SHIFT+H"},strikethrough:{class:PM,shortcut:"CMD+SHIFT+X"}}})}function f(){editor.readOnly.toggle()}function M(){editor.save().then(D=>(e.value=D,D)),editor.readOnly.toggle(),i.value=!0}function g(){editor.clear()}n({jsonRes:e,edit:f,save:M,clear:g});function h(){t("toggleEditor"),d()}return c.onMounted(()=>{o.firstBlock&&d()}),(D,x)=>(c.openBlock(),c.createElementBlock("div",Xk,[r.wordCount?(c.openBlock(),c.createElementBlock("div",Kk,[c.createElementVNode("span",{class:c.normalizeClass(c.unref(u)?"editor__count--danger":"")},c.toDisplayString(s.value),3),qk])):c.createCommentVNode("",!0),c.createElementVNode("div",eA,[r.firstBlock?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",tA,[c.createElementVNode("button",{class:"editor__first_btn",onClick:h},"+"),c.createElementVNode("p",nA,c.toDisplayString(r.firstBlockText),1),c.createElementVNode("a",rA,c.toDisplayString(r.learnMoreText),1)])),oA])]))}};var WA="";const aA={class:"code"},sA=["autocomplete"],lA=["autocomplete"],uA=["autocomplete"],cA=["autocomplete"],dA=["autocomplete"],fA=["autocomplete"];var MA=st(c.defineComponent({__name:"VerificationCode",props:{code:{type:String,required:!1,default:""},focusOnFirstInput:{type:Boolean,default:!0},focusOnFirstInputDelay:{type:Number,default:100},autoComplete:{type:String,default:"off"}},emits:["submit"],setup(r,{emit:n}){const t=r,o=c.ref(null),e=c.ref(null),i=c.ref(null),a=c.ref(null),s=c.ref(null),l=c.ref(null);async function u(x){var y,N,j,m,p;switch(x){case 1:break;case 2:(y=o.value)==null||y.focus();break;case 3:(N=e.value)==null||N.focus();break;case 4:(j=i.value)==null||j.focus();break;case 5:(m=a.value)==null||m.focus();break;case 6:(p=s.value)==null||p.focus();break}}async function d(x){var y,N,j,m,p;switch(x){case 1:(y=e.value)==null||y.focus();break;case 2:(N=i.value)==null||N.focus();break;case 3:(j=a.value)==null||j.focus();break;case 4:(m=s.value)==null||m.focus();break;case 5:(p=l.value)==null||p.focus();break}}async function f(x,y){const N=x.key;let j=!0;[{_index:1,nextInput:e},{_index:2,nextInput:i},{_index:3,nextInput:a},{_index:4,nextInput:s},{_index:5,nextInput:l}].forEach(({_index:m,nextInput:p})=>{y===m&&(p.value&&N.match(/^[0-9]+$/)&&p.value.focus({}),j=!1),x.preventDefault()}),N.match(/^[0-9]+$/)&&(x.target.value=N),j&&h()}async function M(x){var N;const y=((N=x.clipboardData)==null?void 0:N.getData("text/plain"))||"";g(y),h()}function g(x){const y=x.replace(/\D/g,"");if(y.length!==6)return;const[N,j,m,p,v,L]=y.split("");o.value&&(o.value.value=N),e.value&&(e.value.value=j),i.value&&(i.value.value=m),a.value&&(a.value.value=p),s.value&&(s.value.value=v),l.value&&(l.value.value=L)}async function h(){var y,N,j,m,p,v;const x=`${(y=o.value)==null?void 0:y.value}${(N=e.value)==null?void 0:N.value}${(j=i.value)==null?void 0:j.value}${(m=a.value)==null?void 0:m.value}${(p=s.value)==null?void 0:p.value}${(v=l.value)==null?void 0:v.value}`;n("submit",x)}function D(){setTimeout(()=>{var x;t.focusOnFirstInput&&((x=o.value)==null||x.focus())},t.focusOnFirstInputDelay)}return c.onMounted(()=>{t.code&&(g(t.code),h()),D()}),(x,y)=>(c.openBlock(),c.createElementBlock("div",aA,[c.createElementVNode("input",{ref_key:"txtInput1",ref:o,autocomplete:r.autoComplete,autofocus:"",class:"form-input input-1","data-e2e":"input-1",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[0]||(y[0]=N=>f(N,1)),onKeyup:[y[1]||(y[1]=c.withKeys(N=>u(1),["delete"])),y[2]||(y[2]=c.withKeys(N=>u(1),["left"])),y[3]||(y[3]=c.withKeys(N=>d(1),["right"]))],onPaste:M},null,40,sA),c.createElementVNode("input",{ref_key:"txtInput2",ref:e,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-2",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[4]||(y[4]=N=>f(N,2)),onKeyup:[y[5]||(y[5]=c.withKeys(N=>u(2),["delete"])),y[6]||(y[6]=c.withKeys(N=>u(2),["left"])),y[7]||(y[7]=c.withKeys(N=>d(2),["right"]))],onPaste:M},null,40,lA),c.createElementVNode("input",{ref_key:"txtInput3",ref:i,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-3",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[8]||(y[8]=N=>f(N,3)),onKeyup:[y[9]||(y[9]=c.withKeys(N=>u(3),["delete"])),y[10]||(y[10]=c.withKeys(N=>u(3),["left"])),y[11]||(y[11]=c.withKeys(N=>d(3),["right"]))],onPaste:M},null,40,uA),c.createElementVNode("input",{ref_key:"txtInput4",ref:a,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-4",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[12]||(y[12]=N=>f(N,4)),onKeyup:[y[13]||(y[13]=c.withKeys(N=>u(4),["delete"])),y[14]||(y[14]=c.withKeys(N=>u(4),["left"])),y[15]||(y[15]=c.withKeys(N=>d(4),["right"]))],onPaste:M},null,40,cA),c.createElementVNode("input",{ref_key:"txtInput5",ref:s,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-5",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[16]||(y[16]=N=>f(N,5)),onKeyup:[y[17]||(y[17]=c.withKeys(N=>u(5),["delete"])),y[18]||(y[18]=c.withKeys(N=>u(5),["left"])),y[19]||(y[19]=c.withKeys(N=>d(5),["right"]))],onPaste:M},null,40,dA),c.createElementVNode("input",{ref_key:"txtInput6",ref:l,autocomplete:r.autoComplete,class:"form-input","data-e2e":"input-6",inputmode:"numeric",maxlength:"1",placeholder:"_",type:"text",onKeypress:y[20]||(y[20]=N=>f(N,6)),onKeyup:[y[21]||(y[21]=c.withKeys(N=>u(6),["delete"])),y[22]||(y[22]=c.withKeys(N=>u(6),["left"])),y[23]||(y[23]=c.withKeys(N=>d(6),["right"]))],onPaste:M},null,40,fA)]))}}),[["__scopeId","data-v-2ace876a"]]);Se.DhAdvancedDatePicker=L2,Se.DhAdvancedFilter=jM,Se.DhCopyText=U2,Se.DhDatePicker=P2,Se.DhDropdownMenu=W2,Se.DhError=G2,Se.DhExpansionPanel=q2,Se.DhFileUpload=yT,Se.DhIcon=we,Se.DhInputDropdown=vT,Se.DhInputGroup=kT,Se.DhInputList=gk,Se.DhModal=Ik,Se.DhNotification=kk,Se.DhNumberRange=IM,Se.DhPasswordField=Ok,Se.DhRadioBox=vM,Se.DhRadioBoxGroup=Qk,Se.DhSearchInput=Bk,Se.DhStepper=Zk,Se.DhSwitch=pd,Se.DhTextEditor=iA,Se.DhTooltip=DM,Se.DhVerificationCode=MA,Object.defineProperties(Se,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
declare const _default: import("vue").DefineComponent<{}, {
|
|
2
|
+
jsonRes: import("vue").Ref<null>;
|
|
2
3
|
edit: () => void;
|
|
3
4
|
save: () => void;
|
|
4
5
|
clear: () => void;
|
|
@@ -51,6 +52,6 @@ declare const _default: import("vue").DefineComponent<{}, {
|
|
|
51
52
|
required: false;
|
|
52
53
|
};
|
|
53
54
|
}>>;
|
|
54
|
-
$emit: (event: "
|
|
55
|
+
$emit: (event: "change" | "toggleEditor", ...args: any[]) => void;
|
|
55
56
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, import("vue").EmitsOptions, string, import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{}>>, {}>;
|
|
56
57
|
export default _default;
|