UNPKG

@vuux/editor

Version:

Vue Nuxt 富文本编辑器

2 lines (1 loc) 1.22 kB
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("./rules.cjs"),u={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},a=t=>u[t],h=(t,r)=>{if(r){if(c.other.escapeTest.test(t))return t.replace(c.other.escapeReplace,a)}else if(c.other.escapeTestNoEncode.test(t))return t.replace(c.other.escapeReplaceNoEncode,a);return t},g=t=>{try{t=encodeURI(t).replace(c.other.percentDecode,"%")}catch{return null}return t},d=(t,r)=>{const i=t.replace(c.other.findPipe,(o,p,f)=>{let n=!1,s=p;for(;--s>=0&&f[s]==="\\";)n=!n;return n?"|":" |"}),e=i.split(c.other.splitPipe);let l=0;if(e[0].trim()||e.shift(),e.length>0&&!e.at(-1)?.trim()&&e.pop(),r)if(e.length>r)e.splice(r);else for(;e.length<r;)e.push("");for(;l<e.length;l++)e[l]=e[l].trim().replace(c.other.slashPipe,"|");return e},m=(t,r,i)=>{const e=t.length;if(e===0)return"";let l=0;for(;l<e&&t.charAt(e-l-1)===r;)l++;return t.slice(0,e-l)},C=(t,r)=>{if(t.indexOf(r[1])===-1)return-1;let i=0;for(let e=0;e<t.length;e++)if(t[e]==="\\")e++;else if(t[e]===r[0])i++;else if(t[e]===r[1]&&(i--,i<0))return e;return i>0?-2:-1};exports.cleanUrl=g;exports.escape=h;exports.findClosingBracket=C;exports.rtrim=m;exports.splitCells=d;