From 1b5fe1289a38d221f0945b8a8b85b54c59214ef3 Mon Sep 17 00:00:00 2001 From: pedrocx486 Date: Sun, 5 Mar 2023 02:03:32 -0300 Subject: [PATCH] Update editor --- editor/assets/{index-31e6387a.js => index-930021cc.js} | 2 +- editor/index.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename editor/assets/{index-31e6387a.js => index-930021cc.js} (98%) diff --git a/editor/assets/index-31e6387a.js b/editor/assets/index-930021cc.js similarity index 98% rename from editor/assets/index-31e6387a.js rename to editor/assets/index-930021cc.js index d571173..d801da4 100644 --- a/editor/assets/index-31e6387a.js +++ b/editor/assets/index-930021cc.js @@ -138,4 +138,4 @@ var ts=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Lc=ts((_n,es) `).forEach(function(a){d=a.indexOf(":"),n=a.substring(0,d).trim().toLowerCase(),r=a.substring(d+1).trim(),!(!n||t[n]&&Ea[n])&&(n==="set-cookie"?t[n]?t[n].push(r):t[n]=[r]:t[n]=t[n]?t[n]+", "+r:r)}),t},Tu=Symbol("internals");function It(e){return e&&String(e).trim().toLowerCase()}function pr(e){return e===!1||e==null?e:P.isArray(e)?e.map(pr):String(e)}function Ca(e){const t=Object.create(null),n=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=n.exec(e);)t[r[1]]=r[2];return t}function Sa(e){return/^[-_a-zA-Z]+$/.test(e.trim())}function Gr(e,t,n,r){if(P.isFunction(r))return r.call(this,t,n);if(P.isString(t)){if(P.isString(r))return t.indexOf(r)!==-1;if(P.isRegExp(r))return r.test(t)}}function Aa(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,(t,n,r)=>n.toUpperCase()+r)}function Ta(e,t){const n=P.toCamelCase(" "+t);["get","set","has"].forEach(r=>{Object.defineProperty(e,r+n,{value:function(d,s,a){return this[r].call(this,t,d,s,a)},configurable:!0})})}class Fr{constructor(t){t&&this.set(t)}set(t,n,r){const d=this;function s(c,h,g){const v=It(h);if(!v)throw new Error("header name must be a non-empty string");const C=P.findKey(d,v);(!C||d[C]===void 0||g===!0||g===void 0&&d[C]!==!1)&&(d[C||h]=pr(c))}const a=(c,h)=>P.forEach(c,(g,v)=>s(g,v,h));return P.isPlainObject(t)||t instanceof this.constructor?a(t,n):P.isString(t)&&(t=t.trim())&&!Sa(t)?a(Pa(t),n):t!=null&&s(n,t,r),this}get(t,n){if(t=It(t),t){const r=P.findKey(this,t);if(r){const d=this[r];if(!n)return d;if(n===!0)return Ca(d);if(P.isFunction(n))return n.call(this,d,r);if(P.isRegExp(n))return n.exec(d);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,n){if(t=It(t),t){const r=P.findKey(this,t);return!!(r&&this[r]!==void 0&&(!n||Gr(this,this[r],r,n)))}return!1}delete(t,n){const r=this;let d=!1;function s(a){if(a=It(a),a){const c=P.findKey(r,a);c&&(!n||Gr(r,r[c],c,n))&&(delete r[c],d=!0)}}return P.isArray(t)?t.forEach(s):s(t),d}clear(t){const n=Object.keys(this);let r=n.length,d=!1;for(;r--;){const s=n[r];(!t||Gr(this,this[s],s,t))&&(delete this[s],d=!0)}return d}normalize(t){const n=this,r={};return P.forEach(this,(d,s)=>{const a=P.findKey(r,s);if(a){n[a]=pr(d),delete n[s];return}const c=t?Aa(s):String(s).trim();c!==s&&delete n[s],n[c]=pr(d),r[c]=!0}),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const n=Object.create(null);return P.forEach(this,(r,d)=>{r!=null&&r!==!1&&(n[d]=t&&P.isArray(r)?r.join(", "):r)}),n}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map(([t,n])=>t+": "+n).join(` `)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...n){const r=new this(t);return n.forEach(d=>r.set(d)),r}static accessor(t){const r=(this[Tu]=this[Tu]={accessors:{}}).accessors,d=this.prototype;function s(a){const c=It(a);r[c]||(Ta(d,a),r[c]=!0)}return P.isArray(t)?t.forEach(s):s(t),this}}Fr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]);P.freezeMethods(Fr.prototype);P.freezeMethods(Fr);const Ge=Fr;function Zr(e,t){const n=this||$n,r=t||n,d=Ge.from(r.headers);let s=r.data;return P.forEach(e,function(c){s=c.call(n,s,d.normalize(),t?t.status:void 0)}),d.normalize(),s}function Gd(e){return!!(e&&e.__CANCEL__)}function xt(e,t,n){re.call(this,e??"canceled",re.ERR_CANCELED,t,n),this.name="CanceledError"}P.inherits(xt,re,{__CANCEL__:!0});function ja(e,t,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?e(n):t(new re("Request failed with status code "+n.status,[re.ERR_BAD_REQUEST,re.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}const Oa=Ve.isStandardBrowserEnv?function(){return{write:function(n,r,d,s,a,c){const h=[];h.push(n+"="+encodeURIComponent(r)),P.isNumber(d)&&h.push("expires="+new Date(d).toGMTString()),P.isString(s)&&h.push("path="+s),P.isString(a)&&h.push("domain="+a),c===!0&&h.push("secure"),document.cookie=h.join("; ")},read:function(n){const r=document.cookie.match(new RegExp("(^|;\\s*)("+n+")=([^;]*)"));return r?decodeURIComponent(r[3]):null},remove:function(n){this.write(n,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}();function Ma(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}function Ra(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}function Zd(e,t){return e&&!Ma(t)?Ra(e,t):t}const La=Ve.isStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),n=document.createElement("a");let r;function d(s){let a=s;return t&&(n.setAttribute("href",a),a=n.href),n.setAttribute("href",a),{href:n.href,protocol:n.protocol?n.protocol.replace(/:$/,""):"",host:n.host,search:n.search?n.search.replace(/^\?/,""):"",hash:n.hash?n.hash.replace(/^#/,""):"",hostname:n.hostname,port:n.port,pathname:n.pathname.charAt(0)==="/"?n.pathname:"/"+n.pathname}}return r=d(window.location.href),function(a){const c=P.isString(a)?d(a):a;return c.protocol===r.protocol&&c.host===r.host}}():function(){return function(){return!0}}();function za(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}function Na(e,t){e=e||10;const n=new Array(e),r=new Array(e);let d=0,s=0,a;return t=t!==void 0?t:1e3,function(h){const g=Date.now(),v=r[s];a||(a=g),n[d]=h,r[d]=g;let C=s,I=0;for(;C!==d;)I+=n[C++],C=C%e;if(d=(d+1)%e,d===s&&(s=(s+1)%e),g-a{const s=d.loaded,a=d.lengthComputable?d.total:void 0,c=s-n,h=r(c),g=s<=a;n=s;const v={loaded:s,total:a,progress:a?s/a:void 0,bytes:c,rate:h||void 0,estimated:h&&a&&g?(a-s)/h:void 0,event:d};v[t?"download":"upload"]=!0,e(v)}}const Ia=typeof XMLHttpRequest<"u",Ba=Ia&&function(e){return new Promise(function(n,r){let d=e.data;const s=Ge.from(e.headers).normalize(),a=e.responseType;let c;function h(){e.cancelToken&&e.cancelToken.unsubscribe(c),e.signal&&e.signal.removeEventListener("abort",c)}P.isFormData(d)&&(Ve.isStandardBrowserEnv||Ve.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let g=new XMLHttpRequest;if(e.auth){const D=e.auth.username||"",B=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(D+":"+B))}const v=Zd(e.baseURL,e.url);g.open(e.method.toUpperCase(),Wd(v,e.params,e.paramsSerializer),!0),g.timeout=e.timeout;function C(){if(!g)return;const D=Ge.from("getAllResponseHeaders"in g&&g.getAllResponseHeaders()),H={data:!a||a==="text"||a==="json"?g.responseText:g.response,status:g.status,statusText:g.statusText,headers:D,config:e,request:g};ja(function(X){n(X),h()},function(X){r(X),h()},H),g=null}if("onloadend"in g?g.onloadend=C:g.onreadystatechange=function(){!g||g.readyState!==4||g.status===0&&!(g.responseURL&&g.responseURL.indexOf("file:")===0)||setTimeout(C)},g.onabort=function(){g&&(r(new re("Request aborted",re.ECONNABORTED,e,g)),g=null)},g.onerror=function(){r(new re("Network Error",re.ERR_NETWORK,e,g)),g=null},g.ontimeout=function(){let B=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const H=e.transitional||Kd;e.timeoutErrorMessage&&(B=e.timeoutErrorMessage),r(new re(B,H.clarifyTimeoutError?re.ETIMEDOUT:re.ECONNABORTED,e,g)),g=null},Ve.isStandardBrowserEnv){const D=(e.withCredentials||La(v))&&e.xsrfCookieName&&Oa.read(e.xsrfCookieName);D&&s.set(e.xsrfHeaderName,D)}d===void 0&&s.setContentType(null),"setRequestHeader"in g&&P.forEach(s.toJSON(),function(B,H){g.setRequestHeader(H,B)}),P.isUndefined(e.withCredentials)||(g.withCredentials=!!e.withCredentials),a&&a!=="json"&&(g.responseType=e.responseType),typeof e.onDownloadProgress=="function"&&g.addEventListener("progress",ju(e.onDownloadProgress,!0)),typeof e.onUploadProgress=="function"&&g.upload&&g.upload.addEventListener("progress",ju(e.onUploadProgress)),(e.cancelToken||e.signal)&&(c=D=>{g&&(r(!D||D.type?new xt(null,e,g):D),g.abort(),g=null)},e.cancelToken&&e.cancelToken.subscribe(c),e.signal&&(e.signal.aborted?c():e.signal.addEventListener("abort",c)));const I=za(v);if(I&&Ve.protocols.indexOf(I)===-1){r(new re("Unsupported protocol "+I+":",re.ERR_BAD_REQUEST,e));return}g.send(d||null)})},mr={http:aa,xhr:Ba};P.forEach(mr,(e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch{}Object.defineProperty(e,"adapterName",{value:t})}});const Fa={getAdapter:e=>{e=P.isArray(e)?e:[e];const{length:t}=e;let n,r;for(let d=0;de instanceof Ge?e.toJSON():e;function At(e,t){t=t||{};const n={};function r(g,v,C){return P.isPlainObject(g)&&P.isPlainObject(v)?P.merge.call({caseless:C},g,v):P.isPlainObject(v)?P.merge({},v):P.isArray(v)?v.slice():v}function d(g,v,C){if(P.isUndefined(v)){if(!P.isUndefined(g))return r(void 0,g,C)}else return r(g,v,C)}function s(g,v){if(!P.isUndefined(v))return r(void 0,v)}function a(g,v){if(P.isUndefined(v)){if(!P.isUndefined(g))return r(void 0,g)}else return r(void 0,v)}function c(g,v,C){if(C in t)return r(g,v);if(C in e)return r(void 0,g)}const h={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:c,headers:(g,v)=>d(Mu(g),Mu(v),!0)};return P.forEach(Object.keys(e).concat(Object.keys(t)),function(v){const C=h[v]||d,I=C(e[v],t[v],v);P.isUndefined(I)&&C!==c||(n[v]=I)}),n}const Xd="1.3.2",Dn={};["object","boolean","number","function","string","symbol"].forEach((e,t)=>{Dn[e]=function(r){return typeof r===e||"a"+(t<1?"n ":" ")+e}});const Ru={};Dn.transitional=function(t,n,r){function d(s,a){return"[Axios v"+Xd+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,c)=>{if(t===!1)throw new re(d(a," has been removed"+(n?" in "+n:"")),re.ERR_DEPRECATED);return n&&!Ru[a]&&(Ru[a]=!0,console.warn(d(a," has been deprecated since v"+n+" and will be removed in the near future"))),t?t(s,a,c):!0}};function Ha(e,t,n){if(typeof e!="object")throw new re("options must be an object",re.ERR_BAD_OPTION_VALUE);const r=Object.keys(e);let d=r.length;for(;d-- >0;){const s=r[d],a=t[s];if(a){const c=e[s],h=c===void 0||a(c,s,e);if(h!==!0)throw new re("option "+s+" must be "+h,re.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new re("Unknown option "+s,re.ERR_BAD_OPTION)}}const pn={assertOptions:Ha,validators:Dn},xe=pn.validators;class Er{constructor(t){this.defaults=t,this.interceptors={request:new Au,response:new Au}}request(t,n){typeof t=="string"?(n=n||{},n.url=t):n=t||{},n=At(this.defaults,n);const{transitional:r,paramsSerializer:d,headers:s}=n;r!==void 0&&pn.assertOptions(r,{silentJSONParsing:xe.transitional(xe.boolean),forcedJSONParsing:xe.transitional(xe.boolean),clarifyTimeoutError:xe.transitional(xe.boolean)},!1),d!==void 0&&pn.assertOptions(d,{encode:xe.function,serialize:xe.function},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a;a=s&&P.merge(s.common,s[n.method]),a&&P.forEach(["delete","get","head","post","put","patch","common"],B=>{delete s[B]}),n.headers=Ge.concat(a,s);const c=[];let h=!0;this.interceptors.request.forEach(function(H){typeof H.runWhen=="function"&&H.runWhen(n)===!1||(h=h&&H.synchronous,c.unshift(H.fulfilled,H.rejected))});const g=[];this.interceptors.response.forEach(function(H){g.push(H.fulfilled,H.rejected)});let v,C=0,I;if(!h){const B=[Ou.bind(this),void 0];for(B.unshift.apply(B,c),B.push.apply(B,g),I=B.length,v=Promise.resolve(n);C{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](d);r._listeners=null}),this.promise.then=d=>{let s;const a=new Promise(c=>{r.subscribe(c),s=c}).then(d);return a.cancel=function(){r.unsubscribe(s)},a},t(function(s,a,c){r.reason||(r.reason=new xt(s,a,c),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}static source(){let t;return{token:new Un(function(d){t=d}),cancel:t}}}const $a=Un;function Da(e){return function(n){return e.apply(null,n)}}function Ua(e){return P.isObject(e)&&e.isAxiosError===!0}const mn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(mn).forEach(([e,t])=>{mn[t]=e});const qa=mn;function Yd(e){const t=new _r(e),n=Rd(_r.prototype.request,t);return P.extend(n,_r.prototype,t,{allOwnKeys:!0}),P.extend(n,t,null,{allOwnKeys:!0}),n.create=function(d){return Yd(At(e,d))},n}const ge=Yd($n);ge.Axios=_r;ge.CanceledError=xt;ge.CancelToken=$a;ge.isCancel=Gd;ge.VERSION=Xd;ge.toFormData=Ir;ge.AxiosError=re;ge.Cancel=ge.CanceledError;ge.all=function(t){return Promise.all(t)};ge.spread=Da;ge.isAxiosError=Ua;ge.mergeConfig=At;ge.AxiosHeaders=Ge;ge.formToJSON=e=>Jd(P.isHTMLForm(e)?new FormData(e):e);ge.HttpStatusCode=qa;ge.default=ge;const Qd=ge;function Pr(e){return Pr=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Pr(e)}function gr(e,t){if(!e.vueAxiosInstalled){var n=xd(t)?Ka(t):t;if(Ja(n)){var r=Ga(e);if(r){var d=r<3?Va:Wa;Object.keys(n).forEach(function(s){d(e,s,n[s])}),e.vueAxiosInstalled=!0}else console.error("[vue-axios] unknown Vue version")}else console.error("[vue-axios] configuration is invalid, expected options are either or { : }")}}function Va(e,t,n){Object.defineProperty(e.prototype,t,{get:function(){return n}}),e[t]=n}function Wa(e,t,n){e.config.globalProperties[t]=n,e[t]=n}function xd(e){return e&&typeof e.get=="function"&&typeof e.post=="function"}function Ka(e){return{axios:e,$http:e}}function Ja(e){return Pr(e)==="object"&&Object.keys(e).every(function(t){return xd(e[t])})}function Ga(e){return e&&e.version&&Number(e.version.split(".")[0])}(typeof _n>"u"?"undefined":Pr(_n))=="object"?es.exports=gr:typeof define=="function"&&define.amd?define([],function(){return gr}):window.Vue&&window.axios&&window.Vue.use&&Vue.use(gr,window.axios);const Za=e=>{if(!e)return"None yet.";for(e=e.replace(/[^a-zA-Z0-9_]+/gi,"-").toLowerCase();e.endsWith("-");)e=e.slice(0,-1);return e.length>50&&(e=e.substring(0,50),e.includes("-")&&(e=e.substring(0,Math.min(e.length,e.lastIndexOf("-"))))),e},Lu=(e,t)=>{const n=new Blob([JSON.stringify(e,null,2)],{type:"text/plain;charset=utf-8;"}),r=document.createElement("a");r.setAttribute("download",`${t}.json`),r.setAttribute("href",window.URL.createObjectURL(n)),r.click()},Xa=e=>new Promise((t,n)=>{const r=new FileReader;e||n("No file!"),r.onload=d=>{const s=d.target.result,a={postTitle:"",timestamp:"",editedTimestamp:"",postContent:"",filename:"",draft:!1};try{Object.keys(JSON.parse(s.toString())).toString()===Object.keys(a).toString()?t(JSON.parse(s.toString())):(alert("Invalid file! Are you sure it's an Dumblog compatible JSON?"),n("Invalid file!"))}catch(c){alert("Error loading file! Check the console for more info."),console.log(c),n("Error loading file!")}},r.onerror=n,r.readAsText(e)}),ir=()=>Math.round(new Date().getTime()/1e3).toString(),zu=e=>e?new Date(Number(e)*1e3).toUTCString():"",Ya=(e,t,n,r,d,s,a)=>({postTitle:e,timestamp:d?"":t,editedTimestamp:d?"":s?a:"",postContent:n,filename:r,draft:d}),qn=Qd.create({headers:{"Cache-Control":"no-cache",Pragma:"no-cache",Expires:"0"}});qn.interceptors.response.use(async e=>e,async e=>(console.error(`${e.request.status} (${e.request.statusText})`),Promise.reject(e)));async function Qa(e){return await qn.get(`https://${e}/assets/posts/archive.json`).then(t=>t.data).catch(t=>{alert(`Failed to load Archive! We've got a ${t.message}! Are you connected to the internet or is the location correct?`)})}async function xa(e,t){return await qn.get(`https://${e}/assets/posts/${t}.json`).then(n=>n.data).catch(n=>{alert(`Failed to load Post! We've got a ${n.message}! -Are you connected to the internet?`)})}const ec={class:"wrapper"},tc={id:"dialog"},rc={class:"dialog-header"},nc={key:0},uc=ee("h4",null,"Load Archive...",-1),dc=[uc],sc={key:1},ic=ee("h4",null,"Load post from Archive...",-1),oc=[ic],ac={class:"close-btn"},cc={key:0},lc=ee("br",null,null,-1),fc=["disabled"],hc={key:1,class:"loaded"},pc=["onClick"],mc={class:"editor-area"},_c={class:"title-area"},gc=ee("label",{for:"draft"},"Draft",-1),bc=ee("br",null,null,-1),wc={class:"preview"},yc=ee("p",{class:"preview-title"},"  Preview: ",-1),vc={class:"footer"},kc={key:0},Ec=ee("br",null,null,-1),Pc=ee("br",null,null,-1),Cc={key:1},Sc=ee("br",null,null,-1),Ac=ee("br",null,null,-1),Tc={class:"footer-buttons"},jc=["disabled"],Oc=ee("br",null,null,-1),Mc=ee("label",{for:"file-input"},"Load Post (from File)",-1),Rc=hd({__name:"App",setup(e){let t;const n=We(""),r=We(),d=We(""),s=We(""),a=We(""),c=We(""),h=We(!1),g=We(!1),v=We(!1),C=(o=!1)=>{v.value=o,document.getElementById("dialog").showModal()},I=()=>{document.getElementById("dialog").close()},D=()=>{r.value=void 0,d.value="",s.value="",a.value="",c.value="",h.value=!1,g.value=!1,c.value="",clearInterval(t),t=setInterval(()=>{a.value=ir()},33)},B=o=>{Qa(o).then(i=>{r.value=i,v.value&&(v.value=!1,I())})},H=o=>{r.value=void 0,Xa(o.target.files[0]).then(i=>{d.value=i.postTitle,s.value=i.postContent,a.value=i.timestamp,h.value=i.draft,g.value=!0,clearInterval(t),t=setInterval(()=>{c.value=ir()},33)})},ue=(o,i)=>{xa(o,i).then(l=>{d.value=l.postTitle,s.value=l.postContent,a.value=l.timestamp,h.value=l.draft,g.value=!0,clearInterval(t),t=setInterval(()=>{c.value=ir()},33),I()})},X=o=>{var i,l;d.value||(d.value="No title."),s.value||(s.value="No content."),Lu(Ya(d.value,a.value,s.value,le.value,h.value,g.value,c.value),le.value),o&&(!((i=r.value)!=null&&i.filter(_=>_.filename===le.value))&&!h&&((l=r.value)==null||l.push({postTitle:d.value,timestamp:a.value,filename:le.value})),Lu(r.value,"archive"))};_d(()=>{t=setInterval(()=>{a.value=ir()},33)});const le=mt(()=>Za(d.value)),G=mt(()=>zu(a.value)),u=mt(()=>zu(c.value));return(o,i)=>(De(),Ke(Re,null,[ee("div",ec,[ee("dialog",tc,[ee("div",rc,[v.value?(De(),Ke("div",nc,dc)):(De(),Ke("div",sc,oc)),ee("div",ac,[ee("button",{class:"btn-primary",onClick:i[0]||(i[0]=l=>I())}," X ")])]),r.value?Nt("",!0):(De(),Ke("div",cc,[je(" Blog Location: https:// "),sr(ee("input",{type:"text","onUpdate:modelValue":i[1]||(i[1]=l=>n.value=l),placeholder:"pedrocx486.club/blog"},null,512),[[Kr,n.value]]),je(" /assets/posts/archive.json "),lc,ee("button",{class:"btn-primary btn-wide",disabled:!n.value,onClick:i[2]||(i[2]=l=>B(n.value))}," Load Archive ",8,fc)])),r.value&&v.value?(De(),Ke("div",hc," Archive loaded. ")):Nt("",!0),v.value?Nt("",!0):(De(!0),Ke(Re,{key:2},Ci(r.value,l=>(De(),Ke("div",null,[ee("button",{class:"btn-secondary btn-wide",onClick:_=>ue(n.value,l.filename)},Lt(l.postTitle),9,pc)]))),256))]),ee("div",mc,[ee("div",_c,[sr(ee("input",{class:"title",type:"text",placeholder:"Post title...","onUpdate:modelValue":i[3]||(i[3]=l=>d.value=l)},null,512),[[Kr,d.value]]),sr(ee("input",{type:"checkbox",id:"draft","onUpdate:modelValue":i[4]||(i[4]=l=>h.value=l)},null,512),[[Eo,h.value]]),gc]),bc,sr(ee("textarea",{class:"editor","onUpdate:modelValue":i[5]||(i[5]=l=>s.value=l),placeholder:"Post content..."},null,512),[[Kr,s.value]])]),ee("div",wc,[yc,Ce(Ft(Md),{markdown:s.value,flavor:"github",options:{emoji:!0},tag:"span"},null,8,["markdown"])])]),ee("div",vc,[je(" Filename: "+Lt(Ft(le)),1),d.value?(De(),Ke("span",kc,".json")):Nt("",!0),je(),Ec,je(" Created on: "+Lt(Ft(G))+" ",1),Pc,g.value?(De(),Ke("span",Cc,[je("Edited on: "+Lt(Ft(u))+" ",1),Sc])):Nt("",!0),je(" Is it a draft? "+Lt(h.value?"Yes":"No")+". ",1),Ac,ee("div",Tc,[ee("button",{class:"btn-tertiary",onClick:i[6]||(i[6]=l=>D())},"Reset Editor"),je("   "),ee("button",{class:"btn-primary",onClick:i[7]||(i[7]=l=>C(!0))},"Load Archive"),je("   "),ee("button",{class:"btn-primary",onClick:i[8]||(i[8]=l=>C())},"Load Post (from Archive)"),je("   "),ee("button",{class:"btn-primary",onClick:i[9]||(i[9]=l=>X())},"Save Post"),je("   "),ee("button",{class:"btn-primary",onClick:i[10]||(i[10]=l=>X(!0)),disabled:!r.value||h.value},"Save Post & Archive",8,jc),je("   "),Oc,ee("input",{type:"file",accept:".json",id:"file-input",onChange:i[11]||(i[11]=l=>H(l))},null,32),Mc])])],64))}}),Zt=Ao(Rc);Zt.use(gr,Qd);Zt.provide("axios",Zt.config.globalProperties.axios);Zt.component("VueShowdown",Md);Zt.mount("#app")});export default Lc(); +Are you connected to the internet?`)})}const ec={class:"wrapper"},tc={id:"dialog"},rc={class:"dialog-header"},nc={key:0},uc=ee("h4",null,"Load Archive...",-1),dc=[uc],sc={key:1},ic=ee("h4",null,"Load post from Archive...",-1),oc=[ic],ac={class:"close-btn"},cc={key:0},lc=ee("br",null,null,-1),fc=["disabled"],hc={key:1,class:"loaded"},pc=["onClick"],mc={class:"editor-area"},_c={class:"title-area"},gc=ee("label",{for:"draft"},"Draft",-1),bc=ee("br",null,null,-1),wc={class:"preview"},yc=ee("p",{class:"preview-title"},"  Preview: ",-1),vc={class:"footer"},kc={key:0},Ec=ee("br",null,null,-1),Pc=ee("br",null,null,-1),Cc={key:1},Sc=ee("br",null,null,-1),Ac=ee("br",null,null,-1),Tc={class:"footer-buttons"},jc=["disabled"],Oc=ee("br",null,null,-1),Mc=ee("label",{for:"file-input"},"Load Post (from File)",-1),Rc=hd({__name:"App",setup(e){let t;const n=We(""),r=We(),d=We(""),s=We(""),a=We(""),c=We(""),h=We(!1),g=We(!1),v=We(!1),C=(o=!1)=>{v.value=o,document.getElementById("dialog").showModal()},I=()=>{document.getElementById("dialog").close()},D=()=>{r.value=void 0,d.value="",s.value="",a.value="",c.value="",h.value=!1,g.value=!1,c.value="",clearInterval(t),t=setInterval(()=>{a.value=ir()},33)},B=o=>{Qa(o).then(i=>{r.value=i,v.value&&(v.value=!1,I())})},H=o=>{r.value=void 0,Xa(o.target.files[0]).then(i=>{d.value=i.postTitle,s.value=i.postContent,a.value=i.timestamp,h.value=i.draft,g.value=!0,clearInterval(t),t=setInterval(()=>{c.value=ir()},33)})},ue=(o,i)=>{xa(o,i).then(l=>{d.value=l.postTitle,s.value=l.postContent,a.value=l.timestamp,h.value=l.draft,g.value=!0,clearInterval(t),t=setInterval(()=>{c.value=ir()},33),I()})},X=o=>{var i,l;d.value||(d.value="No title."),s.value||(s.value="No content."),Lu(Ya(d.value,a.value,s.value,le.value,h.value,g.value,c.value),le.value),o&&(!((i=r.value)!=null&&i.filter(_=>_.filename===le.value).length)&&!h&&((l=r.value)==null||l.push({postTitle:d.value,timestamp:a.value,filename:le.value})),Lu(r.value,"archive"))};_d(()=>{t=setInterval(()=>{a.value=ir()},33)});const le=mt(()=>Za(d.value)),G=mt(()=>zu(a.value)),u=mt(()=>zu(c.value));return(o,i)=>(De(),Ke(Re,null,[ee("div",ec,[ee("dialog",tc,[ee("div",rc,[v.value?(De(),Ke("div",nc,dc)):(De(),Ke("div",sc,oc)),ee("div",ac,[ee("button",{class:"btn-primary",onClick:i[0]||(i[0]=l=>I())}," X ")])]),r.value?Nt("",!0):(De(),Ke("div",cc,[je(" Blog Location: https:// "),sr(ee("input",{type:"text","onUpdate:modelValue":i[1]||(i[1]=l=>n.value=l),placeholder:"pedrocx486.club/blog"},null,512),[[Kr,n.value]]),je(" /assets/posts/archive.json "),lc,ee("button",{class:"btn-primary btn-wide",disabled:!n.value,onClick:i[2]||(i[2]=l=>B(n.value))}," Load Archive ",8,fc)])),r.value&&v.value?(De(),Ke("div",hc," Archive loaded. ")):Nt("",!0),v.value?Nt("",!0):(De(!0),Ke(Re,{key:2},Ci(r.value,l=>(De(),Ke("div",null,[ee("button",{class:"btn-secondary btn-wide",onClick:_=>ue(n.value,l.filename)},Lt(l.postTitle),9,pc)]))),256))]),ee("div",mc,[ee("div",_c,[sr(ee("input",{class:"title",type:"text",placeholder:"Post title...","onUpdate:modelValue":i[3]||(i[3]=l=>d.value=l)},null,512),[[Kr,d.value]]),sr(ee("input",{type:"checkbox",id:"draft","onUpdate:modelValue":i[4]||(i[4]=l=>h.value=l)},null,512),[[Eo,h.value]]),gc]),bc,sr(ee("textarea",{class:"editor","onUpdate:modelValue":i[5]||(i[5]=l=>s.value=l),placeholder:"Post content..."},null,512),[[Kr,s.value]])]),ee("div",wc,[yc,Ce(Ft(Md),{markdown:s.value,flavor:"github",options:{emoji:!0},tag:"span"},null,8,["markdown"])])]),ee("div",vc,[je(" Filename: "+Lt(Ft(le)),1),d.value?(De(),Ke("span",kc,".json")):Nt("",!0),je(),Ec,je(" Created on: "+Lt(Ft(G))+" ",1),Pc,g.value?(De(),Ke("span",Cc,[je("Edited on: "+Lt(Ft(u))+" ",1),Sc])):Nt("",!0),je(" Is it a draft? "+Lt(h.value?"Yes":"No")+". ",1),Ac,ee("div",Tc,[ee("button",{class:"btn-tertiary",onClick:i[6]||(i[6]=l=>D())},"Reset Editor"),je("   "),ee("button",{class:"btn-primary",onClick:i[7]||(i[7]=l=>C(!0))},"Load Archive"),je("   "),ee("button",{class:"btn-primary",onClick:i[8]||(i[8]=l=>C())},"Load Post (from Archive)"),je("   "),ee("button",{class:"btn-primary",onClick:i[9]||(i[9]=l=>X())},"Save Post"),je("   "),ee("button",{class:"btn-primary",onClick:i[10]||(i[10]=l=>X(!0)),disabled:!r.value||h.value},"Save Post & Archive",8,jc),je("   "),Oc,ee("input",{type:"file",accept:".json",id:"file-input",onChange:i[11]||(i[11]=l=>H(l))},null,32),Mc])])],64))}}),Zt=Ao(Rc);Zt.use(gr,Qd);Zt.provide("axios",Zt.config.globalProperties.axios);Zt.component("VueShowdown",Md);Zt.mount("#app")});export default Lc(); diff --git a/editor/index.html b/editor/index.html index 3253f30..46f5b21 100644 --- a/editor/index.html +++ b/editor/index.html @@ -5,7 +5,7 @@ ngx-retroblog editor - +