@wangeditor-next/list-module 1.1.16 → 1.1.17-beta.0
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/index.js +857 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +854 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,854 @@
|
|
|
1
|
-
import{i18nAddResources as r,DomEditor as t,t as n}from"@wangeditor-next/core";import{Text as e,Path as i,Editor as o,Transforms as u,Range as f}from"slate";import a,{append as c,attr as l,parent as s}from"dom7";import{jsx as v}from"snabbdom";r("en",{listModule:{unOrderedList:"Unordered list",orderedList:"Ordered list"}}),r("zh-CN",{listModule:{unOrderedList:"无序列表",orderedList:"有序列表"}});var d,p,y="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{},h={};function g(){if(p)return d;p=1;var r=function(r){return r&&r.Math===Math&&r};return d=r("object"==typeof globalThis&&globalThis)||r("object"==typeof window&&window)||r("object"==typeof self&&self)||r("object"==typeof y&&y)||r("object"==typeof d&&d)||function(){return this}()||Function("return this")()}var b,m,w,x,O,S,E,j,T={};function A(){return m?b:(m=1,b=function(r){try{return!!r()}catch(r){return!0}})}function I(){if(x)return w;x=1;var r=A();return w=!r((function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]}))}function P(){if(S)return O;S=1;var r=A();return O=!r((function(){var r=function(){}.bind();return"function"!=typeof r||r.hasOwnProperty("prototype")}))}function L(){if(j)return E;j=1;var r=P(),t=Function.prototype.call;return E=r?t.bind(t):function(){return t.apply(t,arguments)},E}var R,k,N,z,M,_,C,F,D,B,H,$,G,V,W,U,K,Y,X,q,J,Q,Z,rr,tr,nr,er,ir,or,ur,fr,ar,cr,lr,sr,vr,dr,pr,yr,hr,gr,br={};function mr(){return N?k:(N=1,k=function(r,t){return{enumerable:!(1&r),configurable:!(2&r),writable:!(4&r),value:t}})}function wr(){if(M)return z;M=1;var r=P(),t=Function.prototype,n=t.call,e=r&&t.bind.bind(n,n);return z=r?e:function(r){return function(){return n.apply(r,arguments)}},z}function xr(){if(C)return _;C=1;var r=wr(),t=r({}.toString),n=r("".slice);return _=function(r){return n(t(r),8,-1)}}function Or(){if(D)return F;D=1;var r=wr(),t=A(),n=xr(),e=Object,i=r("".split);return F=t((function(){return!e("z").propertyIsEnumerable(0)}))?function(r){return"String"===n(r)?i(r,""):e(r)}:e}function Sr(){return H?B:(H=1,B=function(r){return null==r})}function Er(){if(G)return $;G=1;var r=Sr(),t=TypeError;return $=function(n){if(r(n))throw new t("Can't call method on "+n);return n}}function jr(){if(W)return V;W=1;var r=Or(),t=Er();return V=function(n){return r(t(n))}}function Tr(){if(K)return U;K=1;var r="object"==typeof document&&document.all;return U=void 0===r&&void 0!==r?function(t){return"function"==typeof t||t===r}:function(r){return"function"==typeof r}}function Ar(){if(X)return Y;X=1;var r=Tr();return Y=function(t){return"object"==typeof t?null!==t:r(t)}}function Ir(){if(J)return q;J=1;var r=g(),t=Tr();return q=function(n,e){return arguments.length<2?(i=r[n],t(i)?i:void 0):r[n]&&r[n][e];var i},q}function Pr(){if(Z)return Q;Z=1;var r=wr();return Q=r({}.isPrototypeOf)}function Lr(){if(er)return nr;er=1;var r,t,n=g(),e=function(){if(tr)return rr;tr=1;var r=g().navigator,t=r&&r.userAgent;return rr=t?String(t):""}(),i=n.process,o=n.Deno,u=i&&i.versions||o&&o.version,f=u&&u.v8;return f&&(t=(r=f.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!t&&e&&(!(r=e.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=e.match(/Chrome\/(\d+)/))&&(t=+r[1]),nr=t}function Rr(){if(or)return ir;or=1;var r=Lr(),t=A(),n=g().String;return ir=!!Object.getOwnPropertySymbols&&!t((function(){var t=Symbol("symbol detection");return!n(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41}))}function kr(){if(fr)return ur;fr=1;var r=Rr();return ur=r&&!Symbol.sham&&"symbol"==typeof Symbol.iterator}function Nr(){if(cr)return ar;cr=1;var r=Ir(),t=Tr(),n=Pr(),e=kr(),i=Object;return ar=e?function(r){return"symbol"==typeof r}:function(e){var o=r("Symbol");return t(o)&&n(o.prototype,i(e))}}function zr(){if(sr)return lr;sr=1;var r=String;return lr=function(t){try{return r(t)}catch(r){return"Object"}}}function Mr(){if(dr)return vr;dr=1;var r=Tr(),t=zr(),n=TypeError;return vr=function(e){if(r(e))return e;throw new n(t(e)+" is not a function")}}function _r(){if(yr)return pr;yr=1;var r=Mr(),t=Sr();return pr=function(n,e){var i=n[e];return t(i)?void 0:r(i)}}function Cr(){if(gr)return hr;gr=1;var r=L(),t=Tr(),n=Ar(),e=TypeError;return hr=function(i,o){var u,f;if("string"===o&&t(u=i.toString)&&!n(f=r(u,i)))return f;if(t(u=i.valueOf)&&!n(f=r(u,i)))return f;if("string"!==o&&t(u=i.toString)&&!n(f=r(u,i)))return f;throw new e("Can't convert object to primitive value")}}var Fr,Dr,Br,Hr,$r,Gr,Vr,Wr,Ur,Kr,Yr,Xr,qr,Jr,Qr,Zr,rt,tt,nt,et,it,ot,ut,ft,at={exports:{}};function ct(){return Dr?Fr:(Dr=1,Fr=!1)}function lt(){if(Hr)return Br;Hr=1;var r=g(),t=Object.defineProperty;return Br=function(n,e){try{t(r,n,{value:e,configurable:!0,writable:!0})}catch(t){r[n]=e}return e}}function st(){if($r)return at.exports;$r=1;var r=ct(),t=g(),n=lt(),e="__core-js_shared__",i=at.exports=t[e]||n(e,{});return(i.versions||(i.versions=[])).push({version:"3.38.1",mode:r?"pure":"global",copyright:"© 2014-2024 Denis Pushkarev (zloirock.ru)",license:"https://github.com/zloirock/core-js/blob/v3.38.1/LICENSE",source:"https://github.com/zloirock/core-js"}),at.exports}function vt(){if(Vr)return Gr;Vr=1;var r=st();return Gr=function(t,n){return r[t]||(r[t]=n||{})}}function dt(){if(Ur)return Wr;Ur=1;var r=Er(),t=Object;return Wr=function(n){return t(r(n))}}function pt(){if(Yr)return Kr;Yr=1;var r=wr(),t=dt(),n=r({}.hasOwnProperty);return Kr=Object.hasOwn||function(r,e){return n(t(r),e)}}function yt(){if(qr)return Xr;qr=1;var r=wr(),t=0,n=Math.random(),e=r(1..toString);return Xr=function(r){return"Symbol("+(void 0===r?"":r)+")_"+e(++t+n,36)}}function ht(){if(Qr)return Jr;Qr=1;var r=g(),t=vt(),n=pt(),e=yt(),i=Rr(),o=kr(),u=r.Symbol,f=t("wks"),a=o?u.for||u:u&&u.withoutSetter||e;return Jr=function(r){return n(f,r)||(f[r]=i&&n(u,r)?u[r]:a("Symbol."+r)),f[r]}}function gt(){if(rt)return Zr;rt=1;var r=L(),t=Ar(),n=Nr(),e=_r(),i=Cr(),o=ht(),u=TypeError,f=o("toPrimitive");return Zr=function(o,a){if(!t(o)||n(o))return o;var c,l=e(o,f);if(l){if(void 0===a&&(a="default"),c=r(l,o,a),!t(c)||n(c))return c;throw new u("Can't convert object to primitive value")}return void 0===a&&(a="number"),i(o,a)}}function bt(){if(nt)return tt;nt=1;var r=gt(),t=Nr();return tt=function(n){var e=r(n,"string");return t(e)?e:e+""}}function mt(){if(it)return et;it=1;var r=g(),t=Ar(),n=r.document,e=t(n)&&t(n.createElement);return et=function(r){return e?n.createElement(r):{}}}function wt(){if(ut)return ot;ut=1;var r=I(),t=A(),n=mt();return ot=!r&&!t((function(){return 7!==Object.defineProperty(n("div"),"a",{get:function(){return 7}}).a}))}function xt(){if(ft)return T;ft=1;var r=I(),t=L(),n=function(){if(R)return br;R=1;var r={}.propertyIsEnumerable,t=Object.getOwnPropertyDescriptor,n=t&&!r.call({1:2},1);return br.f=n?function(r){var n=t(this,r);return!!n&&n.enumerable}:r,br}(),e=mr(),i=jr(),o=bt(),u=pt(),f=wt(),a=Object.getOwnPropertyDescriptor;return T.f=r?a:function(r,c){if(r=i(r),c=o(c),f)try{return a(r,c)}catch(r){}if(u(r,c))return e(!t(n.f,r,c),r[c])},T}var Ot,St,Et,jt,Tt,At,It,Pt={};function Lt(){if(St)return Ot;St=1;var r=I(),t=A();return Ot=r&&t((function(){return 42!==Object.defineProperty((function(){}),"prototype",{value:42,writable:!1}).prototype}))}function Rt(){if(jt)return Et;jt=1;var r=Ar(),t=String,n=TypeError;return Et=function(e){if(r(e))return e;throw new n(t(e)+" is not an object")}}function kt(){if(Tt)return Pt;Tt=1;var r=I(),t=wt(),n=Lt(),e=Rt(),i=bt(),o=TypeError,u=Object.defineProperty,f=Object.getOwnPropertyDescriptor,a="enumerable",c="configurable",l="writable";return Pt.f=r?n?function(r,t,n){if(e(r),t=i(t),e(n),"function"==typeof r&&"prototype"===t&&"value"in n&&l in n&&!n[l]){var o=f(r,t);o&&o[l]&&(r[t]=n.value,n={configurable:c in n?n[c]:o[c],enumerable:a in n?n[a]:o[a],writable:!1})}return u(r,t,n)}:u:function(r,n,f){if(e(r),n=i(n),e(f),t)try{return u(r,n,f)}catch(r){}if("get"in f||"set"in f)throw new o("Accessors not supported");return"value"in f&&(r[n]=f.value),r},Pt}function Nt(){if(It)return At;It=1;var r=I(),t=kt(),n=mr();return At=r?function(r,e,i){return t.f(r,e,n(1,i))}:function(r,t,n){return r[t]=n,r}}var zt,Mt,_t,Ct,Ft,Dt,Bt,Ht,$t,Gt,Vt,Wt,Ut,Kt,Yt,Xt={exports:{}};function qt(){if(Mt)return zt;Mt=1;var r=I(),t=pt(),n=Function.prototype,e=r&&Object.getOwnPropertyDescriptor,i=t(n,"name"),o=i&&"something"===function(){}.name,u=i&&(!r||r&&e(n,"name").configurable);return zt={EXISTS:i,PROPER:o,CONFIGURABLE:u}}function Jt(){if(Ct)return _t;Ct=1;var r=wr(),t=Tr(),n=st(),e=r(Function.toString);return t(n.inspectSource)||(n.inspectSource=function(r){return e(r)}),_t=n.inspectSource}function Qt(){if(Dt)return Ft;Dt=1;var r=g(),t=Tr(),n=r.WeakMap;return Ft=t(n)&&/native code/.test(String(n))}function Zt(){if(Ht)return Bt;Ht=1;var r=vt(),t=yt(),n=r("keys");return Bt=function(r){return n[r]||(n[r]=t(r))}}function rn(){return Gt?$t:(Gt=1,$t={})}function tn(){if(Wt)return Vt;Wt=1;var r,t,n,e=Qt(),i=g(),o=Ar(),u=Nt(),f=pt(),a=st(),c=Zt(),l=rn(),s="Object already initialized",v=i.TypeError,d=i.WeakMap;if(e||a.state){var p=a.state||(a.state=new d);p.get=p.get,p.has=p.has,p.set=p.set,r=function(r,t){if(p.has(r))throw new v(s);return t.facade=r,p.set(r,t),t},t=function(r){return p.get(r)||{}},n=function(r){return p.has(r)}}else{var y=c("state");l[y]=!0,r=function(r,t){if(f(r,y))throw new v(s);return t.facade=r,u(r,y,t),t},t=function(r){return f(r,y)?r[y]:{}},n=function(r){return f(r,y)}}return Vt={set:r,get:t,has:n,enforce:function(e){return n(e)?t(e):r(e,{})},getterFor:function(r){return function(n){var e;if(!o(n)||(e=t(n)).type!==r)throw new v("Incompatible receiver, "+r+" required");return e}}}}function nn(){if(Ut)return Xt.exports;Ut=1;var r=wr(),t=A(),n=Tr(),e=pt(),i=I(),o=qt().CONFIGURABLE,u=Jt(),f=tn(),a=f.enforce,c=f.get,l=String,s=Object.defineProperty,v=r("".slice),d=r("".replace),p=r([].join),y=i&&!t((function(){return 8!==s((function(){}),"length",{value:8}).length})),h=String(String).split("String"),g=Xt.exports=function(r,t,n){"Symbol("===v(l(t),0,7)&&(t="["+d(l(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!e(r,"name")||o&&r.name!==t)&&(i?s(r,"name",{value:t,configurable:!0}):r.name=t),y&&n&&e(n,"arity")&&r.length!==n.arity&&s(r,"length",{value:n.arity});try{n&&e(n,"constructor")&&n.constructor?i&&s(r,"prototype",{writable:!1}):r.prototype&&(r.prototype=void 0)}catch(r){}var u=a(r);return e(u,"source")||(u.source=p(h,"string"==typeof t?t:"")),r};return Function.prototype.toString=g((function(){return n(this)&&c(this).source||u(this)}),"toString"),Xt.exports}function en(){if(Yt)return Kt;Yt=1;var r=Tr(),t=kt(),n=nn(),e=lt();return Kt=function(i,o,u,f){f||(f={});var a=f.enumerable,c=void 0!==f.name?f.name:o;if(r(u)&&n(u,c,f),f.global)a?i[o]=u:e(o,u);else{try{f.unsafe?i[o]&&(a=!0):delete i[o]}catch(r){}a?i[o]=u:t.f(i,o,{value:u,enumerable:!1,configurable:!f.nonConfigurable,writable:!f.nonWritable})}return i}}var on,un,fn,an,cn,ln,sn,vn,dn,pn,yn,hn,gn,bn,mn,wn,xn,On={};function Sn(){if(an)return fn;an=1;var r=function(){if(un)return on;un=1;var r=Math.ceil,t=Math.floor;return on=Math.trunc||function(n){var e=+n;return(e>0?t:r)(e)}}();return fn=function(t){var n=+t;return n!=n||0===n?0:r(n)}}function En(){if(ln)return cn;ln=1;var r=Sn(),t=Math.max,n=Math.min;return cn=function(e,i){var o=r(e);return o<0?t(o+i,0):n(o,i)}}function jn(){if(vn)return sn;vn=1;var r=Sn(),t=Math.min;return sn=function(n){var e=r(n);return e>0?t(e,9007199254740991):0}}function Tn(){if(pn)return dn;pn=1;var r=jn();return dn=function(t){return r(t.length)}}function An(){if(hn)return yn;hn=1;var r=jr(),t=En(),n=Tn(),e=function(e){return function(i,o,u){var f=r(i),a=n(f);if(0===a)return!e&&-1;var c,l=t(u,a);if(e&&o!=o){for(;a>l;)if((c=f[l++])!=c)return!0}else for(;a>l;l++)if((e||l in f)&&f[l]===o)return e||l||0;return!e&&-1}};return yn={includes:e(!0),indexOf:e(!1)}}function In(){if(bn)return gn;bn=1;var r=wr(),t=pt(),n=jr(),e=An().indexOf,i=rn(),o=r([].push);return gn=function(r,u){var f,a=n(r),c=0,l=[];for(f in a)!t(i,f)&&t(a,f)&&o(l,f);for(;u.length>c;)t(a,f=u[c++])&&(~e(l,f)||o(l,f));return l}}function Pn(){return wn?mn:(wn=1,mn=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"])}function Ln(){if(xn)return On;xn=1;var r=In(),t=Pn().concat("length","prototype");return On.f=Object.getOwnPropertyNames||function(n){return r(n,t)},On}var Rn,kn,Nn,zn,Mn,_n,Cn,Fn,Dn,Bn,Hn,$n,Gn,Vn,Wn,Un,Kn,Yn,Xn,qn,Jn,Qn,Zn,re,te,ne,ee,ie,oe={};function ue(){if(Nn)return kn;Nn=1;var r=Ir(),t=wr(),n=Ln(),e=(Rn||(Rn=1,oe.f=Object.getOwnPropertySymbols),oe),i=Rt(),o=t([].concat);return kn=r("Reflect","ownKeys")||function(r){var t=n.f(i(r)),u=e.f;return u?o(t,u(r)):t}}function fe(){if(Mn)return zn;Mn=1;var r=pt(),t=ue(),n=xt(),e=kt();return zn=function(i,o,u){for(var f=t(o),a=e.f,c=n.f,l=0;l<f.length;l++){var s=f[l];r(i,s)||u&&r(u,s)||a(i,s,c(o,s))}}}function ae(){if(Cn)return _n;Cn=1;var r=A(),t=Tr(),n=/#|\.prototype\./,e=function(n,e){var a=o[i(n)];return a===f||a!==u&&(t(e)?r(e):!!e)},i=e.normalize=function(r){return String(r).replace(n,".").toLowerCase()},o=e.data={},u=e.NATIVE="N",f=e.POLYFILL="P";return _n=e}function ce(){if(Dn)return Fn;Dn=1;var r=g(),t=xt().f,n=Nt(),e=en(),i=lt(),o=fe(),u=ae();return Fn=function(f,a){var c,l,s,v,d,p=f.target,y=f.global,h=f.stat;if(c=y?r:h?r[p]||i(p,{}):r[p]&&r[p].prototype)for(l in a){if(v=a[l],s=f.dontCallGetSet?(d=t(c,l))&&d.value:c[l],!u(y?l:p+(h?".":"#")+l,f.forced)&&void 0!==s){if(typeof v==typeof s)continue;o(v,s)}(f.sham||s&&s.sham)&&n(v,"sham",!0),e(c,l,v,f)}}}function le(){if(Hn)return Bn;Hn=1;var r=xr();return Bn=Array.isArray||function(t){return"Array"===r(t)}}function se(){if(Gn)return $n;Gn=1;var r=TypeError;return $n=function(t){if(t>9007199254740991)throw r("Maximum allowed index exceeded");return t}}function ve(){if(Wn)return Vn;Wn=1;var r=I(),t=kt(),n=mr();return Vn=function(e,i,o){r?t.f(e,i,n(0,o)):e[i]=o}}function de(){if(Kn)return Un;Kn=1;var r={};return r[ht()("toStringTag")]="z",Un="[object z]"===String(r)}function pe(){if(Xn)return Yn;Xn=1;var r=de(),t=Tr(),n=xr(),e=ht()("toStringTag"),i=Object,o="Arguments"===n(function(){return arguments}());return Yn=r?n:function(r){var u,f,a;return void 0===r?"Undefined":null===r?"Null":"string"==typeof(f=function(r,t){try{return r[t]}catch(r){}}(u=i(r),e))?f:o?n(u):"Object"===(a=n(u))&&t(u.callee)?"Arguments":a}}function ye(){if(Jn)return qn;Jn=1;var r=wr(),t=A(),n=Tr(),e=pe(),i=Ir(),o=Jt(),u=function(){},f=i("Reflect","construct"),a=/^\s*(?:class|function)\b/,c=r(a.exec),l=!a.test(u),s=function(r){if(!n(r))return!1;try{return f(u,[],r),!0}catch(r){return!1}},v=function(r){if(!n(r))return!1;switch(e(r)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return l||!!c(a,o(r))}catch(r){return!0}};return v.sham=!0,qn=!f||t((function(){var r;return s(s.call)||!s(Object)||!s((function(){r=!0}))||r}))?v:s}function he(){if(Zn)return Qn;Zn=1;var r=le(),t=ye(),n=Ar(),e=ht()("species"),i=Array;return Qn=function(o){var u;return r(o)&&(u=o.constructor,(t(u)&&(u===i||r(u.prototype))||n(u)&&null===(u=u[e]))&&(u=void 0)),void 0===u?i:u}}function ge(){if(te)return re;te=1;var r=he();return re=function(t,n){return new(r(t))(0===n?0:n)}}function be(){if(ee)return ne;ee=1;var r=A(),t=ht(),n=Lr(),e=t("species");return ne=function(t){return n>=51||!r((function(){var r=[];return(r.constructor={})[e]=function(){return{foo:1}},1!==r[t](Boolean).foo}))}}!function(){if(ie)return h;ie=1;var r=ce(),t=A(),n=le(),e=Ar(),i=dt(),o=Tn(),u=se(),f=ve(),a=ge(),c=be(),l=ht(),s=Lr(),v=l("isConcatSpreadable"),d=s>=51||!t((function(){var r=[];return r[v]=!1,r.concat()[0]!==r})),p=function(r){if(!e(r))return!1;var t=r[v];return void 0!==t?!!t:n(r)};r({target:"Array",proto:!0,arity:1,forced:!d||!c("concat")},{concat:function(r){var t,n,e,c,l,s=i(this),v=a(s,0),d=0;for(t=-1,e=arguments.length;t<e;t++)if(p(l=-1===t?s:arguments[t]))for(c=o(l),u(d+c),n=0;n<c;n++,d++)n in l&&f(v,d,l[n]);else u(d+1),f(v,d++,l);return v.length=d,v}})}();var me=function(r,t){return me=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,t){r.__proto__=t}||function(r,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(r[n]=t[n])},me(r,t)};function we(r,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=r}me(r,t),r.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function xe(r){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&r[t],e=0;if(n)return n.call(r);if(r&&"number"==typeof r.length)return{next:function(){return r&&e>=r.length&&(r=void 0),{value:r&&r[e++],done:!r}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function Oe(r,t){var n="function"==typeof Symbol&&r[Symbol.iterator];if(!n)return r;var e,i,o=n.call(r),u=[];try{for(;(void 0===t||t-- >0)&&!(e=o.next()).done;)u.push(e.value)}catch(r){i={error:r}}finally{try{e&&!e.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return u}function Se(r,t,n){if(n||2===arguments.length)for(var e,i=0,o=t.length;i<o;i++)!e&&i in t||(e||(e=Array.prototype.slice.call(t,0,i)),e[i]=t[i]);return r.concat(e||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;var Ee,je,Te,Ae,Ie,Pe,Le,Re,ke,Ne,ze,Me,_e,Ce,Fe,De,Be,He,$e,Ge,Ve,We,Ue,Ke,Ye,Xe,qe,Je,Qe,Ze,ri,ti,ni,ei,ii,oi={};function ui(){if(je)return Ee;je=1;var r=In(),t=Pn();return Ee=Object.keys||function(n){return r(n,t)}}function fi(){if(Ie)return Ae;Ie=1;var r=Ir();return Ae=r("document","documentElement")}function ai(){if(Le)return Pe;Le=1;var r,t=Rt(),n=function(){if(Te)return oi;Te=1;var r=I(),t=Lt(),n=kt(),e=Rt(),i=jr(),o=ui();return oi.f=r&&!t?Object.defineProperties:function(r,t){e(r);for(var u,f=i(t),a=o(t),c=a.length,l=0;c>l;)n.f(r,u=a[l++],f[u]);return r},oi}(),e=Pn(),i=rn(),o=fi(),u=mt(),f=Zt(),a="prototype",c="script",l=f("IE_PROTO"),s=function(){},v=function(r){return"<"+c+">"+r+"</"+c+">"},d=function(r){r.write(v("")),r.close();var t=r.parentWindow.Object;return r=null,t},p=function(){try{r=new ActiveXObject("htmlfile")}catch(r){}var t,n,i;p="undefined"!=typeof document?document.domain&&r?d(r):(n=u("iframe"),i="java"+c+":",n.style.display="none",o.appendChild(n),n.src=String(i),(t=n.contentWindow.document).open(),t.write(v("document.F=Object")),t.close(),t.F):d(r);for(var f=e.length;f--;)delete p[a][e[f]];return p()};return i[l]=!0,Pe=Object.create||function(r,e){var i;return null!==r?(s[a]=t(r),i=new s,s[a]=null,i[l]=r):i=p(),void 0===e?i:n.f(i,e)}}function ci(){if(ke)return Re;ke=1;var r=ht(),t=ai(),n=kt().f,e=r("unscopables"),i=Array.prototype;return void 0===i[e]&&n(i,e,{configurable:!0,value:t(null)}),Re=function(r){i[e][r]=!0}}function li(){return ze?Ne:(ze=1,Ne={})}function si(){if(Fe)return Ce;Fe=1;var r=pt(),t=Tr(),n=dt(),e=Zt(),i=function(){if(_e)return Me;_e=1;var r=A();return Me=!r((function(){function r(){}return r.prototype.constructor=null,Object.getPrototypeOf(new r)!==r.prototype}))}(),o=e("IE_PROTO"),u=Object,f=u.prototype;return Ce=i?u.getPrototypeOf:function(e){var i=n(e);if(r(i,o))return i[o];var a=i.constructor;return t(a)&&i instanceof a?a.prototype:i instanceof u?f:null}}function vi(){if(Be)return De;Be=1;var r,t,n,e=A(),i=Tr(),o=Ar(),u=ai(),f=si(),a=en(),c=ht(),l=ct(),s=c("iterator"),v=!1;return[].keys&&("next"in(n=[].keys())?(t=f(f(n)))!==Object.prototype&&(r=t):v=!0),!o(r)||e((function(){var t={};return r[s].call(t)!==t}))?r={}:l&&(r=u(r)),i(r[s])||a(r,s,(function(){return this})),De={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:v}}function di(){if($e)return He;$e=1;var r=kt().f,t=pt(),n=ht()("toStringTag");return He=function(e,i,o){e&&!o&&(e=e.prototype),e&&!t(e,n)&&r(e,n,{configurable:!0,value:i})}}function pi(){if(Ye)return Ke;Ye=1;var r=Ar();return Ke=function(t){return r(t)||null===t}}function yi(){if(qe)return Xe;qe=1;var r=pi(),t=String,n=TypeError;return Xe=function(e){if(r(e))return e;throw new n("Can't set "+t(e)+" as a prototype")}}function hi(){if(Qe)return Je;Qe=1;var r=function(){if(Ue)return We;Ue=1;var r=wr(),t=Mr();return We=function(n,e,i){try{return r(t(Object.getOwnPropertyDescriptor(n,e)[i]))}catch(r){}}}(),t=Ar(),n=Er(),e=yi();return Je=Object.setPrototypeOf||("__proto__"in{}?function(){var i,o=!1,u={};try{(i=r(Object.prototype,"__proto__","set"))(u,[]),o=u instanceof Array}catch(r){}return function(r,u){return n(r),e(u),t(r)?(o?i(r,u):r.__proto__=u,r):r}}():void 0)}function gi(){if(ri)return Ze;ri=1;var r=ce(),t=L(),n=ct(),e=qt(),i=Tr(),o=function(){if(Ve)return Ge;Ve=1;var r=vi().IteratorPrototype,t=ai(),n=mr(),e=di(),i=li(),o=function(){return this};return Ge=function(u,f,a,c){var l=f+" Iterator";return u.prototype=t(r,{next:n(+!c,a)}),e(u,l,!1,!0),i[l]=o,u}}(),u=si(),f=hi(),a=di(),c=Nt(),l=en(),s=ht(),v=li(),d=vi(),p=e.PROPER,y=e.CONFIGURABLE,h=d.IteratorPrototype,g=d.BUGGY_SAFARI_ITERATORS,b=s("iterator"),m="keys",w="values",x="entries",O=function(){return this};return Ze=function(e,s,d,S,E,j,T){o(d,s,S);var A,I,P,L=function(r){if(r===E&&M)return M;if(!g&&r&&r in N)return N[r];switch(r){case m:case w:case x:return function(){return new d(this,r)}}return function(){return new d(this)}},R=s+" Iterator",k=!1,N=e.prototype,z=N[b]||N["@@iterator"]||E&&N[E],M=!g&&z||L(E),_="Array"===s&&N.entries||z;if(_&&(A=u(_.call(new e)))!==Object.prototype&&A.next&&(n||u(A)===h||(f?f(A,h):i(A[b])||l(A,b,O)),a(A,R,!0,!0),n&&(v[R]=O)),p&&E===w&&z&&z.name!==w&&(!n&&y?c(N,"name",w):(k=!0,M=function(){return t(z,this)})),E)if(I={values:L(w),keys:j?M:L(m),entries:L(x)},T)for(P in I)(g||k||!(P in N))&&l(N,P,I[P]);else r({target:s,proto:!0,forced:g||k},I);return n&&!T||N[b]===M||l(N,b,M,{name:E}),v[s]=M,I}}function bi(){return ni?ti:(ni=1,ti=function(r,t){return{value:r,done:t}})}function mi(){if(ii)return ei;ii=1;var r=jr(),t=ci(),n=li(),e=tn(),i=kt().f,o=gi(),u=bi(),f=ct(),a=I(),c="Array Iterator",l=e.set,s=e.getterFor(c);ei=o(Array,"Array",(function(t,n){l(this,{type:c,target:r(t),index:0,kind:n})}),(function(){var r=s(this),t=r.target,n=r.index++;if(!t||n>=t.length)return r.target=null,u(void 0,!0);switch(r.kind){case"keys":return u(n,!1);case"values":return u(t[n],!1)}return u([n,t[n]],!1)}),"values");var v=n.Arguments=n.Array;if(t("keys"),t("values"),t("entries"),!f&&a&&"values"!==v.name)try{i(v,"name",{value:"values"})}catch(r){}return ei}mi();var wi,xi,Oi,Si={};!function(){if(Oi)return Si;Oi=1;var r=de(),t=en(),n=function(){if(xi)return wi;xi=1;var r=de(),t=pe();return wi=r?{}.toString:function(){return"[object "+t(this)+"]"}}();r||t(Object.prototype,"toString",n,{unsafe:!0})}();var Ei,ji,Ti,Ai,Ii,Pi={};function Li(){if(ji)return Ei;ji=1;var r=pe(),t=String;return Ei=function(n){if("Symbol"===r(n))throw new TypeError("Cannot convert a Symbol value to a string");return t(n)}}function Ri(){if(Ai)return Ti;Ai=1;var r=wr(),t=Sn(),n=Li(),e=Er(),i=r("".charAt),o=r("".charCodeAt),u=r("".slice),f=function(r){return function(f,a){var c,l,s=n(e(f)),v=t(a),d=s.length;return v<0||v>=d?r?"":void 0:(c=o(s,v))<55296||c>56319||v+1===d||(l=o(s,v+1))<56320||l>57343?r?i(s,v):c:r?u(s,v,v+2):l-56320+(c-55296<<10)+65536}};return Ti={codeAt:f(!1),charAt:f(!0)}}!function(){if(Ii)return Pi;Ii=1;var r=Ri().charAt,t=Li(),n=tn(),e=gi(),i=bi(),o="String Iterator",u=n.set,f=n.getterFor(o);e(String,"String",(function(r){u(this,{type:o,string:t(r),index:0})}),(function(){var t,n=f(this),e=n.string,o=n.index;return o>=e.length?i(void 0,!0):(t=r(e,o),n.index+=t.length,i(t,!1))}))}();var ki,Ni,zi,Mi,_i={};function Ci(){if(Ni)return ki;Ni=1;var r=A();return ki=!r((function(){return Object.isExtensible(Object.preventExtensions({}))}))}function Fi(){if(Mi)return zi;Mi=1;var r=en();return zi=function(t,n,e){for(var i in n)r(t,i,n[i],e);return t}}var Di,Bi,Hi,$i,Gi,Vi,Wi,Ui,Ki,Yi,Xi,qi,Ji,Qi,Zi,ro,to,no,eo,io,oo,uo,fo,ao,co,lo,so,vo,po,yo,ho,go,bo,mo,wo,xo,Oo={exports:{}},So={};function Eo(){if(Bi)return Di;Bi=1;var r=wr();return Di=r([].slice)}function jo(){if(Hi)return So;Hi=1;var r=xr(),t=jr(),n=Ln().f,e=Eo(),i="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];return So.f=function(o){return i&&"Window"===r(o)?function(r){try{return n(r)}catch(r){return e(i)}}(o):n(t(o))},So}function To(){if(Wi)return Vi;Wi=1;var r=A(),t=Ar(),n=xr(),e=function(){if(Gi)return $i;Gi=1;var r=A();return $i=r((function(){if("function"==typeof ArrayBuffer){var r=new ArrayBuffer(8);Object.isExtensible(r)&&Object.defineProperty(r,"a",{value:8})}}))}(),i=Object.isExtensible,o=r((function(){}));return Vi=o||e?function(r){return!!t(r)&&((!e||"ArrayBuffer"!==n(r))&&(!i||i(r)))}:i}function Ao(){if(Ui)return Oo.exports;Ui=1;var r=ce(),t=wr(),n=rn(),e=Ar(),i=pt(),o=kt().f,u=Ln(),f=jo(),a=To(),c=yt(),l=Ci(),s=!1,v=c("meta"),d=0,p=function(r){o(r,v,{value:{objectID:"O"+d++,weakData:{}}})},y=Oo.exports={enable:function(){y.enable=function(){},s=!0;var n=u.f,e=t([].splice),i={};i[v]=1,n(i).length&&(u.f=function(r){for(var t=n(r),i=0,o=t.length;i<o;i++)if(t[i]===v){e(t,i,1);break}return t},r({target:"Object",stat:!0,forced:!0},{getOwnPropertyNames:f.f}))},fastKey:function(r,t){if(!e(r))return"symbol"==typeof r?r:("string"==typeof r?"S":"P")+r;if(!i(r,v)){if(!a(r))return"F";if(!t)return"E";p(r)}return r[v].objectID},getWeakData:function(r,t){if(!i(r,v)){if(!a(r))return!0;if(!t)return!1;p(r)}return r[v].weakData},onFreeze:function(r){return l&&s&&a(r)&&!i(r,v)&&p(r),r}};return n[v]=!0,Oo.exports}function Io(){if(qi)return Xi;qi=1;var r=function(){if(Yi)return Ki;Yi=1;var r=xr(),t=wr();return Ki=function(n){if("Function"===r(n))return t(n)}}(),t=Mr(),n=P(),e=r(r.bind);return Xi=function(r,i){return t(r),void 0===i?r:n?e(r,i):function(){return r.apply(i,arguments)}},Xi}function Po(){if(Qi)return Ji;Qi=1;var r=ht(),t=li(),n=r("iterator"),e=Array.prototype;return Ji=function(r){return void 0!==r&&(t.Array===r||e[n]===r)}}function Lo(){if(ro)return Zi;ro=1;var r=pe(),t=_r(),n=Sr(),e=li(),i=ht()("iterator");return Zi=function(o){if(!n(o))return t(o,i)||t(o,"@@iterator")||e[r(o)]}}function Ro(){if(no)return to;no=1;var r=L(),t=Mr(),n=Rt(),e=zr(),i=Lo(),o=TypeError;return to=function(u,f){var a=arguments.length<2?i(u):f;if(t(a))return n(r(a,u));throw new o(e(u)+" is not iterable")},to}function ko(){if(io)return eo;io=1;var r=L(),t=Rt(),n=_r();return eo=function(e,i,o){var u,f;t(e);try{if(!(u=n(e,"return"))){if("throw"===i)throw o;return o}u=r(u,e)}catch(r){f=!0,u=r}if("throw"===i)throw o;if(f)throw u;return t(u),o}}function No(){if(uo)return oo;uo=1;var r=Io(),t=L(),n=Rt(),e=zr(),i=Po(),o=Tn(),u=Pr(),f=Ro(),a=Lo(),c=ko(),l=TypeError,s=function(r,t){this.stopped=r,this.result=t},v=s.prototype;return oo=function(d,p,y){var h,g,b,m,w,x,O,S=y&&y.that,E=!(!y||!y.AS_ENTRIES),j=!(!y||!y.IS_RECORD),T=!(!y||!y.IS_ITERATOR),A=!(!y||!y.INTERRUPTED),I=r(p,S),P=function(r){return h&&c(h,"normal",r),new s(!0,r)},L=function(r){return E?(n(r),A?I(r[0],r[1],P):I(r[0],r[1])):A?I(r,P):I(r)};if(j)h=d.iterator;else if(T)h=d;else{if(!(g=a(d)))throw new l(e(d)+" is not iterable");if(i(g)){for(b=0,m=o(d);m>b;b++)if((w=L(d[b]))&&u(v,w))return w;return new s(!1)}h=f(d,g)}for(x=j?d.next:h.next;!(O=t(x,h)).done;){try{w=L(O.value)}catch(r){c(h,"throw",r)}if("object"==typeof w&&w&&u(v,w))return w}return new s(!1)}}function zo(){if(ao)return fo;ao=1;var r=Pr(),t=TypeError;return fo=function(n,e){if(r(e,n))return n;throw new t("Incorrect invocation")}}function Mo(){if(lo)return co;lo=1;var r=ht()("iterator"),t=!1;try{var n=0,e={next:function(){return{done:!!n++}},return:function(){t=!0}};e[r]=function(){return this},Array.from(e,(function(){throw 2}))}catch(r){}return co=function(n,e){try{if(!e&&!t)return!1}catch(r){return!1}var i=!1;try{var o={};o[r]=function(){return{next:function(){return{done:i=!0}}}},n(o)}catch(r){}return i}}function _o(){if(vo)return so;vo=1;var r=Tr(),t=Ar(),n=hi();return so=function(e,i,o){var u,f;return n&&r(u=i.constructor)&&u!==o&&t(f=u.prototype)&&f!==o.prototype&&n(e,f),e}}function Co(){if(yo)return po;yo=1;var r=ce(),t=g(),n=wr(),e=ae(),i=en(),o=Ao(),u=No(),f=zo(),a=Tr(),c=Sr(),l=Ar(),s=A(),v=Mo(),d=di(),p=_o();return po=function(y,h,g){var b=-1!==y.indexOf("Map"),m=-1!==y.indexOf("Weak"),w=b?"set":"add",x=t[y],O=x&&x.prototype,S=x,E={},j=function(r){var t=n(O[r]);i(O,r,"add"===r?function(r){return t(this,0===r?0:r),this}:"delete"===r?function(r){return!(m&&!l(r))&&t(this,0===r?0:r)}:"get"===r?function(r){return m&&!l(r)?void 0:t(this,0===r?0:r)}:"has"===r?function(r){return!(m&&!l(r))&&t(this,0===r?0:r)}:function(r,n){return t(this,0===r?0:r,n),this})};if(e(y,!a(x)||!(m||O.forEach&&!s((function(){(new x).entries().next()})))))S=g.getConstructor(h,y,b,w),o.enable();else if(e(y,!0)){var T=new S,A=T[w](m?{}:-0,1)!==T,I=s((function(){T.has(1)})),P=v((function(r){new x(r)})),L=!m&&s((function(){for(var r=new x,t=5;t--;)r[w](t,t);return!r.has(-0)}));P||((S=h((function(r,t){f(r,O);var n=p(new x,r,S);return c(t)||u(t,n[w],{that:n,AS_ENTRIES:b}),n}))).prototype=O,O.constructor=S),(I||L)&&(j("delete"),j("has"),b&&j("get")),(L||A)&&j(w),m&&O.clear&&delete O.clear}return E[y]=S,r({global:!0,constructor:!0,forced:S!==x},E),d(S,y),m||g.setStrong(S,y,b),S}}function Fo(){if(go)return ho;go=1;var r=Io(),t=wr(),n=Or(),e=dt(),i=Tn(),o=ge(),u=t([].push),f=function(t){var f=1===t,a=2===t,c=3===t,l=4===t,s=6===t,v=7===t,d=5===t||s;return function(p,y,h,g){for(var b,m,w=e(p),x=n(w),O=i(x),S=r(y,h),E=0,j=g||o,T=f?j(p,O):a||v?j(p,0):void 0;O>E;E++)if((d||E in x)&&(m=S(b=x[E],E,w),t))if(f)T[E]=m;else if(m)switch(t){case 3:return!0;case 5:return b;case 6:return E;case 2:u(T,b)}else switch(t){case 4:return!1;case 7:u(T,b)}return s?-1:c||l?l:T}};return ho={forEach:f(0),map:f(1),filter:f(2),some:f(3),every:f(4),find:f(5),findIndex:f(6),filterReject:f(7)}}function Do(){if(mo)return bo;mo=1;var r=wr(),t=Fi(),n=Ao().getWeakData,e=zo(),i=Rt(),o=Sr(),u=Ar(),f=No(),a=Fo(),c=pt(),l=tn(),s=l.set,v=l.getterFor,d=a.find,p=a.findIndex,y=r([].splice),h=0,g=function(r){return r.frozen||(r.frozen=new b)},b=function(){this.entries=[]},m=function(r,t){return d(r.entries,(function(r){return r[0]===t}))};return b.prototype={get:function(r){var t=m(this,r);if(t)return t[1]},has:function(r){return!!m(this,r)},set:function(r,t){var n=m(this,r);n?n[1]=t:this.entries.push([r,t])},delete:function(r){var t=p(this.entries,(function(t){return t[0]===r}));return~t&&y(this.entries,t,1),!!~t}},bo={getConstructor:function(r,a,l,d){var p=r((function(r,t){e(r,y),s(r,{type:a,id:h++,frozen:null}),o(t)||f(t,r[d],{that:r,AS_ENTRIES:l})})),y=p.prototype,b=v(a),m=function(r,t,e){var o=b(r),u=n(i(t),!0);return!0===u?g(o).set(t,e):u[o.id]=e,r};return t(y,{delete:function(r){var t=b(this);if(!u(r))return!1;var e=n(r);return!0===e?g(t).delete(r):e&&c(e,t.id)&&delete e[t.id]},has:function(r){var t=b(this);if(!u(r))return!1;var e=n(r);return!0===e?g(t).has(r):e&&c(e,t.id)}}),t(y,l?{get:function(r){var t=b(this);if(u(r)){var e=n(r);if(!0===e)return g(t).get(r);if(e)return e[t.id]}},set:function(r,t){return m(this,r,t)}}:{add:function(r){return m(this,r,!0)}}),p}}}xo||(xo=1,function(){if(wo)return _i;wo=1;var r,t=Ci(),n=g(),e=wr(),i=Fi(),o=Ao(),u=Co(),f=Do(),a=Ar(),c=tn().enforce,l=A(),s=Qt(),v=Object,d=Array.isArray,p=v.isExtensible,y=v.isFrozen,h=v.isSealed,b=v.freeze,m=v.seal,w=!n.ActiveXObject&&"ActiveXObject"in n,x=function(r){return function(){return r(this,arguments.length?arguments[0]:void 0)}},O=u("WeakMap",x,f),S=O.prototype,E=e(S.set);if(s)if(w){r=f.getConstructor(x,"WeakMap",!0),o.enable();var j=e(S.delete),T=e(S.has),I=e(S.get);i(S,{delete:function(t){if(a(t)&&!p(t)){var n=c(this);return n.frozen||(n.frozen=new r),j(this,t)||n.frozen.delete(t)}return j(this,t)},has:function(t){if(a(t)&&!p(t)){var n=c(this);return n.frozen||(n.frozen=new r),T(this,t)||n.frozen.has(t)}return T(this,t)},get:function(t){if(a(t)&&!p(t)){var n=c(this);return n.frozen||(n.frozen=new r),T(this,t)?I(this,t):n.frozen.get(t)}return I(this,t)},set:function(t,n){if(a(t)&&!p(t)){var e=c(this);e.frozen||(e.frozen=new r),T(this,t)?E(this,t,n):e.frozen.set(t,n)}else E(this,t,n);return this}})}else t&&l((function(){var r=b([]);return E(new O,r,1),!y(r)}))&&i(S,{set:function(r,t){var n;return d(r)&&(y(r)?n=b:h(r)&&(n=m)),E(this,r,t),n&&n(r),this}})}());var Bo,Ho,$o,Go,Vo,Wo={};!function(){if(Vo)return Wo;Vo=1;var r=g(),t=Ho?Bo:(Ho=1,Bo={CSSRuleList:0,CSSStyleDeclaration:0,CSSValueList:0,ClientRectList:0,DOMRectList:0,DOMStringList:0,DOMTokenList:1,DataTransferItemList:0,FileList:0,HTMLAllCollection:0,HTMLCollection:0,HTMLFormElement:0,HTMLSelectElement:0,MediaList:0,MimeTypeArray:0,NamedNodeMap:0,NodeList:1,PaintRequestList:0,Plugin:0,PluginArray:0,SVGLengthList:0,SVGNumberList:0,SVGPathSegList:0,SVGPointList:0,SVGStringList:0,SVGTransformList:0,SourceBufferList:0,StyleSheetList:0,TextTrackCueList:0,TextTrackList:0,TouchList:0}),n=function(){if(Go)return $o;Go=1;var r=mt()("span").classList,t=r&&r.constructor&&r.constructor.prototype;return $o=t===Object.prototype?void 0:t}(),e=mi(),i=Nt(),o=di(),u=ht()("iterator"),f=e.values,a=function(r,n){if(r){if(r[u]!==f)try{i(r,u,f)}catch(t){r[u]=f}if(o(r,n,!0),t[n])for(var a in e)if(r[a]!==e[a])try{i(r,a,e[a])}catch(t){r[a]=e[a]}}};for(var c in t)a(r[c]&&r[c].prototype,c);a(n,"DOMTokenList")}();var Uo=new WeakMap;function Ko(r){var t,n=r.children||[],i=n.length;if(0===i)return"";for(var o=0;o<i&&!t;o+=1){var u=n[o];e.isText(u)&&(t=u)}return null==t?"":t.color||""}function Yo(r,n,e){for(var u=n.type,f=function(r,t){var n={};for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&t.indexOf(e)<0&&(n[e]=r[e]);if(null!=r&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(e=Object.getOwnPropertySymbols(r);i<e.length;i++)t.indexOf(e[i])<0&&Object.prototype.propertyIsEnumerable.call(r,e[i])&&(n[e[i]]=r[e[i]])}return n}(n,["type"]),a=void 0!==e?e:f.level||0,c=t.findPath(r,n),l=c;;){if(0===l.length||0===c[c.length-1])return null;l=i.previous(l);var s=o.node(r,l);if(!s)return null;var v=Oe(s,1)[0],d=v.level,p=void 0===d?0:d;if(t.getNodeType(v)!==u)return null;if(p===a)return v}}function Xo(r,t,n){var e=Yo(r,t,n);return!!e&&e.ordered===t.ordered}var qo=[];var Jo,Qo={type:"list-item",elemToHtml:function(r,n){var e="",u="",f=r.ordered,a=void 0!==f&&f?"ol":"ul",c=function(r){var n=Uo.get(r);if(null==n)return 0;var e=r,u=e.type,f=e.ordered,a=void 0!==f&&f,c=e.level,l=void 0===c?0:c,s=t.findPath(n,r);if(0===s[0])return l+1;var v=i.previous(s),d=o.node(n,v);if(!d)return 0;var p=Oe(d,1)[0];if(t.getNodeType(p)!==u)return l+1;var y=p,h=y.ordered,g=void 0!==h&&h,b=y.level,m=void 0===b?0:b;return m<l?l-m:m>l?Xo(n,r)?0:1:m===l?g===a?0:1:0}(r);if(c>0)for(var l=0;l<c;l+=1)e+="<".concat(a,">"),qo.push(a);var s=function(r){var n=Uo.get(r);if(null==n)return 0;var e=r,u=e.type,f=e.ordered,a=void 0!==f&&f,c=e.level,l=void 0===c?0:c,s=t.findPath(n,r);if(s[0]===n.children.length-1)return l+1;var v=i.next(s),d=o.node(n,v);if(!d)return 0;var p=Oe(d,1)[0];if(t.getNodeType(p)!==u)return l+1;var y=p,h=y.ordered,g=void 0!==h&&h,b=y.level,m=void 0===b?0:b;return m<l?Xo(n,p)?l-m:l-m+1:m>l?0:m===l?g===a?0:1:0}(r);if(s>0)for(l=0;l<s;l+=1){var v=qo.pop();u+="</".concat(v,">")}var d=Ko(r),p=d?' style="color:'.concat(d,'"'):"";return{html:"<li".concat(p,">").concat(n,"</li>"),prefix:e,suffix:u}}},Zo={};!function(){if(Jo)return Zo;Jo=1;var r=ce(),t=An().includes,n=A(),e=ci();r({target:"Array",proto:!0,forced:n((function(){return!Array(1).includes()}))},{includes:function(r){return t(this,r,arguments.length>1?arguments[1]:void 0)}}),e("includes")}();var ru,tu,nu,eu,iu,ou,uu,fu,au,cu,lu,su={};function vu(){if(tu)return ru;tu=1;var r=Rt();return ru=function(){var t=r(this),n="";return t.hasIndices&&(n+="d"),t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.dotAll&&(n+="s"),t.unicode&&(n+="u"),t.unicodeSets&&(n+="v"),t.sticky&&(n+="y"),n}}function du(){if(cu)return au;cu=1;var r,t,n=L(),e=wr(),i=Li(),o=vu(),u=function(){if(eu)return nu;eu=1;var r=A(),t=g().RegExp,n=r((function(){var r=t("a","y");return r.lastIndex=2,null!==r.exec("abcd")})),e=n||r((function(){return!t("a","y").sticky})),i=n||r((function(){var r=t("^r","gy");return r.lastIndex=2,null!==r.exec("str")}));return nu={BROKEN_CARET:i,MISSED_STICKY:e,UNSUPPORTED_Y:n}}(),f=vt(),a=ai(),c=tn().get,l=function(){if(ou)return iu;ou=1;var r=A(),t=g().RegExp;return iu=r((function(){var r=t(".","s");return!(r.dotAll&&r.test("\n")&&"s"===r.flags)}))}(),s=function(){if(fu)return uu;fu=1;var r=A(),t=g().RegExp;return uu=r((function(){var r=t("(?<a>b)","g");return"b"!==r.exec("b").groups.a||"bc"!=="b".replace(r,"$<a>c")}))}(),v=f("native-string-replace",String.prototype.replace),d=RegExp.prototype.exec,p=d,y=e("".charAt),h=e("".indexOf),b=e("".replace),m=e("".slice),w=(t=/b*/g,n(d,r=/a/,"a"),n(d,t,"a"),0!==r.lastIndex||0!==t.lastIndex),x=u.BROKEN_CARET,O=void 0!==/()??/.exec("")[1];return(w||O||x||l||s)&&(p=function(r){var t,e,u,f,l,s,g,S=this,E=c(S),j=i(r),T=E.raw;if(T)return T.lastIndex=S.lastIndex,t=n(p,T,j),S.lastIndex=T.lastIndex,t;var A=E.groups,I=x&&S.sticky,P=n(o,S),L=S.source,R=0,k=j;if(I&&(P=b(P,"y",""),-1===h(P,"g")&&(P+="g"),k=m(j,S.lastIndex),S.lastIndex>0&&(!S.multiline||S.multiline&&"\n"!==y(j,S.lastIndex-1))&&(L="(?: "+L+")",k=" "+k,R++),e=new RegExp("^(?:"+L+")",P)),O&&(e=new RegExp("^"+L+"$(?!\\s)",P)),w&&(u=S.lastIndex),f=n(d,I?e:S,k),I?f?(f.input=m(f.input,R),f[0]=m(f[0],R),f.index=S.lastIndex,S.lastIndex+=f[0].length):S.lastIndex=0:w&&f&&(S.lastIndex=S.global?f.index+f[0].length:u),O&&f&&f.length>1&&n(v,f[0],e,(function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(f[l]=void 0)})),f&&A)for(f.groups=s=a(null),l=0;l<A.length;l++)s[(g=A[l])[0]]=f[g[1]];return f}),au=p}function pu(){if(lu)return su;lu=1;var r=ce(),t=du();return r({target:"RegExp",proto:!0,forced:/./.exec!==t},{exec:t}),su}pu();var yu,hu=function(){function r(){this.type="list-item",this.tag="button"}return r.prototype.getListNode=function(r){var n=this.type;return t.getSelectedNodeByType(r,n)},r.prototype.getValue=function(r){return""},r.prototype.isActive=function(r){var t=this.getListNode(r);if(null==t)return!1;var n=t.ordered;return(void 0!==n&&n)===this.ordered},r.prototype.isDisabled=function(r){return null==r.selection||!!t.getSelectedElems(r).some((function(t){if(o.isVoid(r,t)&&o.isBlock(r,t))return!0;var n=t.type;return!!["pre","code","table"].includes(n)}))},r.prototype.exec=function(r,t){this.isActive(r)?u.setNodes(r,{type:"paragraph",ordered:void 0,level:void 0}):u.setNodes(r,{type:"list-item",ordered:this.ordered,indent:void 0})},r}(),gu=function(r){function t(){var t=r.apply(this,Se([],Oe(arguments),!1))||this;return t.ordered=!1,t.title=n("listModule.unOrderedList"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M384 64h640v128H384V64z m0 384h640v128H384v-128z m0 384h640v128H384v-128zM0 128a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z"></path></svg>',t}return we(t,r),t}(hu),bu=function(r){function t(){var t=r.apply(this,Se([],Oe(arguments),!1))||this;return t.ordered=!0,t.title=n("listModule.orderedList"),t.iconSvg='<svg viewBox="0 0 1024 1024"><path d="M384 832h640v128H384z m0-384h640v128H384z m0-384h640v128H384zM192 0v256H128V64H64V0zM128 526.016v50.016h128v64H64v-146.016l128-60V384H64v-64h192v146.016zM256 704v320H64v-64h128v-64H64v-64h128v-64H64v-64z"></path></svg>',t}return we(t,r),t}(hu),mu={key:"bulletedList",factory:function(){return new gu}},wu={key:"numberedList",factory:function(){return new bu}},xu={};!function(){if(yu)return xu;yu=1;var r=ce(),t=Fo().filter;r({target:"Array",proto:!0,forced:!be()("filter")},{filter:function(r){return t(this,r,arguments.length>1?arguments[1]:void 0)}})}();var Ou,Su,Eu,ju={};!function(){if(Eu)return ju;Eu=1;var r=ce(),t=function(){if(Su)return Ou;Su=1;var r=le(),t=Tn(),n=se(),e=Io(),i=function(o,u,f,a,c,l,s,v){for(var d,p,y=c,h=0,g=!!s&&e(s,v);h<a;)h in f&&(d=g?g(f[h],h,u):f[h],l>0&&r(d)?(p=t(d),y=i(o,u,d,p,y,l-1)-1):(n(y+1),o[y]=d),y++),h++;return y};return Ou=i}(),n=dt(),e=Tn(),i=Sn(),o=ge();r({target:"Array",proto:!0},{flat:function(){var r=arguments.length?arguments[0]:void 0,u=n(this),f=e(u),a=o(u,0);return a.length=t(a,u,u,f,0,void 0===r?1:i(r)),a}})}();var Tu;Tu||(Tu=1,ci()("flat"));var Au,Iu,Pu,Lu,Ru,ku,Nu,zu,Mu,_u,Cu,Fu={};function Du(){if(ku)return Ru;ku=1;var r=Ri().charAt;return Ru=function(t,n,e){return n+(e?r(t,n).length:1)}}function Bu(){if(zu)return Nu;zu=1;var r=wr(),t=dt(),n=Math.floor,e=r("".charAt),i=r("".replace),o=r("".slice),u=/\$([$&'`]|\d{1,2}|<[^>]*>)/g,f=/\$([$&'`]|\d{1,2})/g;return Nu=function(r,a,c,l,s,v){var d=c+r.length,p=l.length,y=f;return void 0!==s&&(s=t(s),y=u),i(v,y,(function(t,i){var u;switch(e(i,0)){case"$":return"$";case"&":return r;case"`":return o(a,0,c);case"'":return o(a,d);case"<":u=s[o(i,1,-1)];break;default:var f=+i;if(0===f)return t;if(f>p){var v=n(f/10);return 0===v?t:v<=p?void 0===l[v-1]?e(i,1):l[v-1]+e(i,1):t}u=l[f-1]}return void 0===u?"":u}))}}!function(){if(Cu)return Fu;Cu=1;var r=function(){if(Iu)return Au;Iu=1;var r=P(),t=Function.prototype,n=t.apply,e=t.call;return Au="object"==typeof Reflect&&Reflect.apply||(r?e.bind(n):function(){return e.apply(n,arguments)}),Au}(),t=L(),n=wr(),e=function(){if(Lu)return Pu;Lu=1,pu();var r=L(),t=en(),n=du(),e=A(),i=ht(),o=Nt(),u=i("species"),f=RegExp.prototype;return Pu=function(a,c,l,s){var v=i(a),d=!e((function(){var r={};return r[v]=function(){return 7},7!==""[a](r)})),p=d&&!e((function(){var r=!1,t=/a/;return"split"===a&&((t={}).constructor={},t.constructor[u]=function(){return t},t.flags="",t[v]=/./[v]),t.exec=function(){return r=!0,null},t[v](""),!r}));if(!d||!p||l){var y=/./[v],h=c(v,""[a],(function(t,e,i,o,u){var a=e.exec;return a===n||a===f.exec?d&&!u?{done:!0,value:r(y,e,i,o)}:{done:!0,value:r(t,i,e,o)}:{done:!1}}));t(String.prototype,a,h[0]),t(f,v,h[1])}s&&o(f[v],"sham",!0)}}(),i=A(),o=Rt(),u=Tr(),f=Sr(),a=Sn(),c=jn(),l=Li(),s=Er(),v=Du(),d=_r(),p=Bu(),y=function(){if(_u)return Mu;_u=1;var r=L(),t=Rt(),n=Tr(),e=xr(),i=du(),o=TypeError;return Mu=function(u,f){var a=u.exec;if(n(a)){var c=r(a,u,f);return null!==c&&t(c),c}if("RegExp"===e(u))return r(i,u,f);throw new o("RegExp#exec called on incompatible receiver")}}(),h=ht()("replace"),g=Math.max,b=Math.min,m=n([].concat),w=n([].push),x=n("".indexOf),O=n("".slice),S="$0"==="a".replace(/./,"$0"),E=!!/./[h]&&""===/./[h]("a","$0");e("replace",(function(n,e,i){var S=E?"$":"$0";return[function(r,n){var i=s(this),o=f(r)?void 0:d(r,h);return o?t(o,r,i,n):t(e,l(i),r,n)},function(t,n){var f=o(this),s=l(t);if("string"==typeof n&&-1===x(n,S)&&-1===x(n,"$<")){var d=i(e,f,s,n);if(d.done)return d.value}var h=u(n);h||(n=l(n));var E,j=f.global;j&&(E=f.unicode,f.lastIndex=0);for(var T,A=[];null!==(T=y(f,s))&&(w(A,T),j);){""===l(T[0])&&(f.lastIndex=v(s,c(f.lastIndex),E))}for(var I,P="",L=0,R=0;R<A.length;R++){for(var k,N=l((T=A[R])[0]),z=g(b(a(T.index),s.length),0),M=[],_=1;_<T.length;_++)w(M,void 0===(I=T[_])?I:String(I));var C=T.groups;if(h){var F=m([N],M,z,s);void 0!==C&&w(F,C),k=l(r(n,void 0,F))}else k=p(N,s,z,M,C,n);z>=L&&(P+=O(s,L,z)+k,L=z+N.length)}return P+O(s,L)}]}),!!i((function(){var r=/./;return r.exec=function(){var r=[];return r.groups={a:"7"},r},"7"!=="".replace(r,"$<a>")}))||!S||E)}();var Hu,$u,Gu={};function Vu(r){return r.length?r[0].tagName.toLowerCase():""}function Wu(r){return o.nodes(r,{at:r.selection||void 0,match:function(n){return 1===t.findPath(r,n).length}})}$u||($u=1,function(){if(Hu)return Gu;Hu=1;var r=ce(),t=g();r({global:!0,forced:t.globalThis!==t},{globalThis:t})}()),c&&(a.fn.append=c),l&&(a.fn.attr=l),s&&(a.fn.parent=s);var Uu={renderElems:[{type:"list-item",renderElem:function(r,n,e){Uo.set(r,e);var u=r,f=u.level,a=void 0===f?0:f,c=u.ordered,l=void 0!==c&&c,s={margin:"5px 0 5px ".concat(20*a,"px")},d="";if(l){var p=function(r,n){var e=n,u=e.type,f=e.level,a=void 0===f?0:f,c=e.ordered,l=void 0!==c&&c,s=1,v=n,d=t.findPath(r,v);if(0===d[0])return 1;for(;d[0]>0;){var p=i.previous(d),y=o.node(r,p);if(null==y)break;var h=y[0],g=h.level,b=void 0===g?0:g,m=h.type,w=h.ordered;if(m!==u)break;if(b<a)break;if(b===a){if(w!==l)break;s+=1}v=h,d=p}return s}(e,r);d="".concat(p,".")}else d=function(r){void 0===r&&(r=0);var t="";switch(r){case 0:t="•";break;case 1:t="◦";break;default:t="▪"}return t}(a);var y=Ko(r);return v("div",{style:s},v("span",{contentEditable:!1,style:{marginRight:"0.5em",color:y},"data-w-e-reserve":!0},d),v("span",null,n))}}],editorPlugin:function(r){var n=r.deleteBackward,e=r.handleTab,i=r.normalizeNode,a=r.insertBreak,c=r;return c.insertBreak=function(){var n=Oe(o.nodes(r,{match:function(r){return t.checkNodeType(r,"list-item")},universal:!0}),1)[0];return n?""!==n[0].children[0].text?a():void u.setNodes(c,{type:"paragraph",ordered:void 0,level:void 0}):a()},c.deleteBackward=function(e){var i=c.selection;if(null!=i)if(f.isExpanded(i))n(e);else{var o=t.getSelectedNodeByType(c,"list-item");if(null!=o)if(0!==i.focus.offset)n(e);else{var a=o,l=a.level,s=void 0===l?0:l,v=a.ordered,d=void 0!==v&&v;if(s>0){var p=Yo(r,o,s-1);p&&p.ordered!==d?u.setNodes(c,{level:s-1,ordered:!d}):u.setNodes(c,{level:s-1})}else u.setNodes(c,{type:"paragraph",ordered:void 0,level:void 0})}else n(e)}else n(e)},c.handleTab=function(){var r,n,i,o,a=c.selection;if(null!=a){if(f.isCollapsed(a)){var l=t.getSelectedNodeByType(c,"list-item");if(null==l)return void e();if(0===a.focus.offset){var s=l.level,v=void 0===s?0:s;return void u.setNodes(c,{level:v+1})}}if(f.isExpanded(a)){var d=0,p=!1;try{for(var y=xe(Wu(c)),h=y.next();!h.done;h=y.next()){var g=Oe(h.value,1)[0];"list-item"===t.getNodeType(g)?d+=1:p=!0}}catch(t){r={error:t}}finally{try{h&&!h.done&&(n=y.return)&&n.call(y)}finally{if(r)throw r.error}}if(p||d<=1)return void e();try{for(var b=xe(Wu(c)),m=b.next();!m.done;m=b.next()){var w=Oe(m.value,2),x=(g=w[0],w[1]),O=g.level;v=void 0===O?0:O;u.setNodes(c,{level:v+1},{at:x})}}catch(r){i={error:r}}finally{try{m&&!m.done&&(o=b.return)&&o.call(b)}finally{if(i)throw i.error}}}else e()}else e()},c.normalizeNode=function(r){var n=Oe(r,2),e=n[0],o=n[1],f=t.getNodeType(e);return"bulleted-list"!==f&&"numbered-list"!==f||u.unwrapNodes(c,{at:o}),i([e,o])},c},menus:[mu,wu],elemsToHtml:[Qo],parseElemsHtml:[{selector:"ul:not([data-w-e-type]),ol:not([data-w-e-type])",parseElemHtml:function(r,t,n){return t.flat(1/0)}},{selector:"li:not([data-w-e-type])",parseElemHtml:function(r,t,n){var i=a(r);0===(t=t.filter((function(r){return!!e.isText(r)||!!n.isInline(r)}))).length&&(t=[{text:i.text().replace(/\s+/gm," ")}]);var o=function(r){return"ol"===Vu(r.parent())}(i),u=function(r){for(var t=0,n=r.parent(),e=Vu(n);"ul"===e||"ol"===e;)e=Vu(n=n.parent()),t+=1;return t-1}(i);return{type:"list-item",ordered:o,level:u,children:t}}}]};export{Uu as default};
|
|
2
|
-
|
|
1
|
+
import { i18nAddResources, DomEditor, t } from '@wangeditor-next/core';
|
|
2
|
+
import { Text, Path, Editor, Transforms, Range } from 'slate';
|
|
3
|
+
import $, { append, attr, parent } from 'dom7';
|
|
4
|
+
import { jsx } from 'snabbdom';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description i18n en
|
|
8
|
+
* @author wangfupeng
|
|
9
|
+
*/
|
|
10
|
+
var enResources = {
|
|
11
|
+
listModule: {
|
|
12
|
+
unOrderedList: 'Unordered list',
|
|
13
|
+
orderedList: 'Ordered list',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @description i18n zh-CN
|
|
19
|
+
* @author wangfupeng
|
|
20
|
+
*/
|
|
21
|
+
var zhResources = {
|
|
22
|
+
listModule: {
|
|
23
|
+
unOrderedList: '无序列表',
|
|
24
|
+
orderedList: '有序列表',
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description i18n entry
|
|
30
|
+
* @author wangfupeng
|
|
31
|
+
*/
|
|
32
|
+
i18nAddResources('en', enResources);
|
|
33
|
+
i18nAddResources('zh-CN', zhResources);
|
|
34
|
+
|
|
35
|
+
/******************************************************************************
|
|
36
|
+
Copyright (c) Microsoft Corporation.
|
|
37
|
+
|
|
38
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
39
|
+
purpose with or without fee is hereby granted.
|
|
40
|
+
|
|
41
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
42
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
43
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
44
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
45
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
46
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
47
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
48
|
+
***************************************************************************** */
|
|
49
|
+
/* global Reflect, Promise, SuppressedError, Symbol */
|
|
50
|
+
|
|
51
|
+
var extendStatics = function(d, b) {
|
|
52
|
+
extendStatics = Object.setPrototypeOf ||
|
|
53
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
54
|
+
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
55
|
+
return extendStatics(d, b);
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
function __extends(d, b) {
|
|
59
|
+
if (typeof b !== "function" && b !== null)
|
|
60
|
+
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
61
|
+
extendStatics(d, b);
|
|
62
|
+
function __() { this.constructor = d; }
|
|
63
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function __rest(s, e) {
|
|
67
|
+
var t = {};
|
|
68
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
69
|
+
t[p] = s[p];
|
|
70
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
71
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
72
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
73
|
+
t[p[i]] = s[p[i]];
|
|
74
|
+
}
|
|
75
|
+
return t;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function __values(o) {
|
|
79
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
80
|
+
if (m) return m.call(o);
|
|
81
|
+
if (o && typeof o.length === "number") return {
|
|
82
|
+
next: function () {
|
|
83
|
+
if (o && i >= o.length) o = void 0;
|
|
84
|
+
return { value: o && o[i++], done: !o };
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function __read(o, n) {
|
|
91
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
92
|
+
if (!m) return o;
|
|
93
|
+
var i = m.call(o), r, ar = [], e;
|
|
94
|
+
try {
|
|
95
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
96
|
+
}
|
|
97
|
+
catch (error) { e = { error: error }; }
|
|
98
|
+
finally {
|
|
99
|
+
try {
|
|
100
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
101
|
+
}
|
|
102
|
+
finally { if (e) throw e.error; }
|
|
103
|
+
}
|
|
104
|
+
return ar;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function __spreadArray(to, from, pack) {
|
|
108
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
109
|
+
if (ar || !(i in from)) {
|
|
110
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
111
|
+
ar[i] = from[i];
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
118
|
+
var e = new Error(message);
|
|
119
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* @description maps
|
|
124
|
+
* @author wangfupeng
|
|
125
|
+
*/
|
|
126
|
+
var ELEM_TO_EDITOR = new WeakMap();
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* 获取第一个 text-node 的颜色
|
|
130
|
+
* @param elem elem
|
|
131
|
+
*/
|
|
132
|
+
function getListItemColor(elem) {
|
|
133
|
+
var children = elem.children || [];
|
|
134
|
+
var length = children.length;
|
|
135
|
+
if (length === 0) {
|
|
136
|
+
return '';
|
|
137
|
+
}
|
|
138
|
+
var firstTextNode;
|
|
139
|
+
for (var i = 0; i < length; i += 1) {
|
|
140
|
+
if (firstTextNode) {
|
|
141
|
+
break;
|
|
142
|
+
} // 已找到第一个 text-node ,则退出
|
|
143
|
+
var child = children[i];
|
|
144
|
+
if (Text.isText(child)) {
|
|
145
|
+
firstTextNode = child;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (firstTextNode == null) {
|
|
149
|
+
return '';
|
|
150
|
+
}
|
|
151
|
+
return firstTextNode.color || '';
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* @description table menu helpers
|
|
156
|
+
* @author wangfupeng
|
|
157
|
+
*/
|
|
158
|
+
/**
|
|
159
|
+
* 获取上一个同一 level 的 list item
|
|
160
|
+
* @param editor 编辑器实例
|
|
161
|
+
* @param elem elem
|
|
162
|
+
*/
|
|
163
|
+
function getBrotherListNodeByLevel(editor, elem, level) {
|
|
164
|
+
var type = elem.type, otherProps = __rest(elem
|
|
165
|
+
// level 可能是 退格前的值,所以这里需要判断
|
|
166
|
+
, ["type"]);
|
|
167
|
+
// level 可能是 退格前的值,所以这里需要判断
|
|
168
|
+
var elemLevel = level !== undefined ? level : otherProps.level || 0;
|
|
169
|
+
var path = DomEditor.findPath(editor, elem);
|
|
170
|
+
var brotherPath = path;
|
|
171
|
+
// eslint-disable-next-line no-constant-condition
|
|
172
|
+
while (true) {
|
|
173
|
+
if (brotherPath.length === 0 || path[path.length - 1] === 0) {
|
|
174
|
+
return null; // 已经是最后一个节点或没有找到有效的前一个 list 节点
|
|
175
|
+
}
|
|
176
|
+
brotherPath = Path.previous(brotherPath);
|
|
177
|
+
var brotherEntry = Editor.node(editor, brotherPath);
|
|
178
|
+
if (!brotherEntry) {
|
|
179
|
+
return null; // 没有找到有效的前一个节点
|
|
180
|
+
}
|
|
181
|
+
var _a = __read(brotherEntry, 1), brotherElem = _a[0];
|
|
182
|
+
var _b = brotherElem.level, brotherLevel = _b === void 0 ? 0 : _b;
|
|
183
|
+
var brotherType = DomEditor.getNodeType(brotherElem);
|
|
184
|
+
// 验证兄弟节点是否是期望的类型和层级
|
|
185
|
+
if (brotherType !== type) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
if (brotherLevel === elemLevel) {
|
|
189
|
+
return brotherElem;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
function hasSameOrderWithBrother(editor, elem, level) {
|
|
194
|
+
var brotherElem = getBrotherListNodeByLevel(editor, elem, level);
|
|
195
|
+
return brotherElem ? brotherElem.ordered === elem.ordered : false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* @description to html
|
|
200
|
+
* @author wangfupeng
|
|
201
|
+
*/
|
|
202
|
+
/**
|
|
203
|
+
* 当前 list-item 前面需要拼接几个 <ol> 或 <ul>
|
|
204
|
+
* @param elem elem
|
|
205
|
+
*/
|
|
206
|
+
function getStartContainerTagNumber(elem) {
|
|
207
|
+
var editor = ELEM_TO_EDITOR.get(elem);
|
|
208
|
+
if (editor == null) {
|
|
209
|
+
return 0;
|
|
210
|
+
}
|
|
211
|
+
var _a = elem, type = _a.type, _b = _a.ordered, ordered = _b === void 0 ? false : _b, _c = _a.level, level = _c === void 0 ? 0 : _c;
|
|
212
|
+
var path = DomEditor.findPath(editor, elem);
|
|
213
|
+
if (path[0] === 0) {
|
|
214
|
+
// list-item 是第一个元素,再往前没有了。需要拼接 <ol> 或 <ul>
|
|
215
|
+
return level + 1;
|
|
216
|
+
}
|
|
217
|
+
// 获取上一个 elem
|
|
218
|
+
var prevPath = Path.previous(path);
|
|
219
|
+
var prevEntry = Editor.node(editor, prevPath);
|
|
220
|
+
if (!prevEntry) {
|
|
221
|
+
return 0;
|
|
222
|
+
}
|
|
223
|
+
var _d = __read(prevEntry, 1), prevElem = _d[0];
|
|
224
|
+
var prevType = DomEditor.getNodeType(prevElem);
|
|
225
|
+
if (prevType !== type) {
|
|
226
|
+
// 上一个 elem 不是 list-item ,需要拼接 <ol> 或 <ul>
|
|
227
|
+
return level + 1;
|
|
228
|
+
}
|
|
229
|
+
// 上一个 elem 是 list-item
|
|
230
|
+
var _e = prevElem, _f = _e.ordered, prevOrdered = _f === void 0 ? false : _f, _g = _e.level, prevLevel = _g === void 0 ? 0 : _g;
|
|
231
|
+
if (prevLevel < level) {
|
|
232
|
+
// 上一个 level 小于当前 level ,需要拼接 <ol> 或 <ul>
|
|
233
|
+
return level - prevLevel;
|
|
234
|
+
}
|
|
235
|
+
if (prevLevel > level) {
|
|
236
|
+
// 此处需要看上一个同级兄弟节点 ordered 是否一致,如果一致则不需要拼接,否则需要拼接
|
|
237
|
+
return hasSameOrderWithBrother(editor, elem) ? 0 : 1;
|
|
238
|
+
}
|
|
239
|
+
if (prevLevel === level) {
|
|
240
|
+
// 上一个 level 等于当前 level
|
|
241
|
+
if (prevOrdered === ordered) {
|
|
242
|
+
// ordered 一致,则不需要拼接 <ol> 或 <ul>
|
|
243
|
+
return 0;
|
|
244
|
+
}
|
|
245
|
+
/// ordered 不一致,则需要拼接 <ol> 或 <ul>
|
|
246
|
+
return 1;
|
|
247
|
+
}
|
|
248
|
+
// 其他情况
|
|
249
|
+
return 0;
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* 当前 list-item 后面面需要拼接几个 </ol> 或 </ul>
|
|
253
|
+
* @param elem elem
|
|
254
|
+
*/
|
|
255
|
+
function getEndContainerTagNumber(elem) {
|
|
256
|
+
var editor = ELEM_TO_EDITOR.get(elem);
|
|
257
|
+
if (editor == null) {
|
|
258
|
+
return 0;
|
|
259
|
+
}
|
|
260
|
+
var _a = elem, type = _a.type, _b = _a.ordered, ordered = _b === void 0 ? false : _b, _c = _a.level, level = _c === void 0 ? 0 : _c;
|
|
261
|
+
var path = DomEditor.findPath(editor, elem);
|
|
262
|
+
if (path[0] === editor.children.length - 1) {
|
|
263
|
+
// list-item 是最后一个元素,再往后没有了。需要拼接 </ol> 或 </ul>
|
|
264
|
+
return level + 1;
|
|
265
|
+
}
|
|
266
|
+
// 获取下一个 elem
|
|
267
|
+
var nextPath = Path.next(path);
|
|
268
|
+
var nextEntry = Editor.node(editor, nextPath);
|
|
269
|
+
if (!nextEntry) {
|
|
270
|
+
return 0;
|
|
271
|
+
}
|
|
272
|
+
var _d = __read(nextEntry, 1), nextElem = _d[0];
|
|
273
|
+
var nextType = DomEditor.getNodeType(nextElem);
|
|
274
|
+
if (nextType !== type) {
|
|
275
|
+
// 下一个 elem 不是 list-item ,需要拼接 <ol> 或 <ul>
|
|
276
|
+
return level + 1;
|
|
277
|
+
}
|
|
278
|
+
// 下一个 elem 是 list-item
|
|
279
|
+
var _e = nextElem, _f = _e.ordered, nextOrdered = _f === void 0 ? false : _f, _g = _e.level, nextLevel = _g === void 0 ? 0 : _g;
|
|
280
|
+
if (nextLevel < level) {
|
|
281
|
+
// 下一个 level 小于当前 level,此处需要看上一个同级兄弟节点 ordered 是否一致,如果一致则不需要拼接,否则需要拼接
|
|
282
|
+
if (hasSameOrderWithBrother(editor, nextElem)) {
|
|
283
|
+
// ordered 一致,则不需要额外拼接 </ol> 或 </ul>
|
|
284
|
+
return level - nextLevel;
|
|
285
|
+
}
|
|
286
|
+
// ordered 不一致,则需要额外拼接 </ol> 或 </ul>
|
|
287
|
+
return level - nextLevel + 1;
|
|
288
|
+
}
|
|
289
|
+
if (nextLevel > level) {
|
|
290
|
+
// 下一个 level 大于当前 level ,不需要拼接 </ol> 或 </ul>
|
|
291
|
+
return 0;
|
|
292
|
+
}
|
|
293
|
+
if (nextLevel === level) {
|
|
294
|
+
// 下一个 level 等于当前 level
|
|
295
|
+
if (nextOrdered === ordered) {
|
|
296
|
+
// ordered 一致,则不需要拼接 </ol> 或 </ul>
|
|
297
|
+
return 0;
|
|
298
|
+
}
|
|
299
|
+
/// ordered 不一致,则需要拼接 </ol> 或 </ul>
|
|
300
|
+
return 1;
|
|
301
|
+
}
|
|
302
|
+
// 其他情况
|
|
303
|
+
return 0;
|
|
304
|
+
}
|
|
305
|
+
// ol ul 栈
|
|
306
|
+
var CONTAINER_TAG_STACK = [];
|
|
307
|
+
function elemToHtml(elem, childrenHtml) {
|
|
308
|
+
var startContainerStr = '';
|
|
309
|
+
var endContainerStr = '';
|
|
310
|
+
var _a = elem.ordered, ordered = _a === void 0 ? false : _a;
|
|
311
|
+
var containerTag = ordered ? 'ol' : 'ul';
|
|
312
|
+
// 前面需要拼接几个 <ol> 或 <ul>
|
|
313
|
+
var startContainerTagNumber = getStartContainerTagNumber(elem);
|
|
314
|
+
if (startContainerTagNumber > 0) {
|
|
315
|
+
for (var i = 0; i < startContainerTagNumber; i += 1) {
|
|
316
|
+
startContainerStr += "<".concat(containerTag, ">"); // 记录 start container tag ,如 `<ul>`
|
|
317
|
+
CONTAINER_TAG_STACK.push(containerTag); // tag 压栈
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
// 后面需要拼接几个 </ol> 或 </ul>
|
|
321
|
+
var endContainerTagNumber = getEndContainerTagNumber(elem);
|
|
322
|
+
if (endContainerTagNumber > 0) {
|
|
323
|
+
for (var i = 0; i < endContainerTagNumber; i += 1) {
|
|
324
|
+
var tag = CONTAINER_TAG_STACK.pop(); // tag 从栈中获取
|
|
325
|
+
endContainerStr += "</".concat(tag, ">"); // 记录 end container tag ,如 `</ul>`
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
// 获取前缀颜色
|
|
329
|
+
var prefixColor = getListItemColor(elem);
|
|
330
|
+
var colorStyle = prefixColor ? " style=\"color:".concat(prefixColor, "\"") : '';
|
|
331
|
+
return {
|
|
332
|
+
html: "<li".concat(colorStyle, ">").concat(childrenHtml, "</li>"),
|
|
333
|
+
prefix: startContainerStr,
|
|
334
|
+
suffix: endContainerStr,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
var listItemToHtmlConf = {
|
|
338
|
+
type: 'list-item',
|
|
339
|
+
elemToHtml: elemToHtml,
|
|
340
|
+
};
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* @description icon svg
|
|
344
|
+
* @author wangfupeng
|
|
345
|
+
*/
|
|
346
|
+
/**
|
|
347
|
+
* 【注意】svg 字符串的长度 ,否则会导致代码体积过大
|
|
348
|
+
* 尽量选择 https://www.iconfont.cn/collections/detail?spm=a313x.7781069.0.da5a778a4&cid=20293
|
|
349
|
+
* 找不到再从 iconfont.com 搜索
|
|
350
|
+
*/
|
|
351
|
+
// 无序列表
|
|
352
|
+
var BULLETED_LIST_SVG = '<svg viewBox="0 0 1024 1024"><path d="M384 64h640v128H384V64z m0 384h640v128H384v-128z m0 384h640v128H384v-128zM0 128a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z m0 384a128 128 0 1 1 256 0 128 128 0 0 1-256 0z"></path></svg>';
|
|
353
|
+
// 有序列表
|
|
354
|
+
var NUMBERED_LIST_SVG = '<svg viewBox="0 0 1024 1024"><path d="M384 832h640v128H384z m0-384h640v128H384z m0-384h640v128H384zM192 0v256H128V64H64V0zM128 526.016v50.016h128v64H64v-146.016l128-60V384H64v-64h192v146.016zM256 704v320H64v-64h128v-64H64v-64h128v-64H64v-64z"></path></svg>';
|
|
355
|
+
|
|
356
|
+
/**
|
|
357
|
+
* @description base menu
|
|
358
|
+
* @author wangfupeng
|
|
359
|
+
*/
|
|
360
|
+
var BaseMenu = /** @class */ (function () {
|
|
361
|
+
function BaseMenu() {
|
|
362
|
+
this.type = 'list-item';
|
|
363
|
+
this.tag = 'button';
|
|
364
|
+
}
|
|
365
|
+
BaseMenu.prototype.getListNode = function (editor) {
|
|
366
|
+
var type = this.type;
|
|
367
|
+
return DomEditor.getSelectedNodeByType(editor, type);
|
|
368
|
+
};
|
|
369
|
+
BaseMenu.prototype.getValue = function (_editor) {
|
|
370
|
+
return '';
|
|
371
|
+
};
|
|
372
|
+
BaseMenu.prototype.isActive = function (editor) {
|
|
373
|
+
var node = this.getListNode(editor);
|
|
374
|
+
if (node == null) {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
var _a = node.ordered, ordered = _a === void 0 ? false : _a;
|
|
378
|
+
return ordered === this.ordered;
|
|
379
|
+
};
|
|
380
|
+
BaseMenu.prototype.isDisabled = function (editor) {
|
|
381
|
+
if (editor.selection == null) {
|
|
382
|
+
return true;
|
|
383
|
+
}
|
|
384
|
+
var selectedElems = DomEditor.getSelectedElems(editor);
|
|
385
|
+
var notMatch = selectedElems.some(function (elem) {
|
|
386
|
+
if (Editor.isVoid(editor, elem) && Editor.isBlock(editor, elem)) {
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
var type = elem.type;
|
|
390
|
+
if (['pre', 'code', 'table'].includes(type)) {
|
|
391
|
+
return true;
|
|
392
|
+
}
|
|
393
|
+
return false;
|
|
394
|
+
});
|
|
395
|
+
if (notMatch) {
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
return false;
|
|
399
|
+
};
|
|
400
|
+
BaseMenu.prototype.exec = function (editor, _value) {
|
|
401
|
+
var active = this.isActive(editor);
|
|
402
|
+
if (active) {
|
|
403
|
+
// 如果当前 active ,则转换为 p 标签
|
|
404
|
+
Transforms.setNodes(editor, {
|
|
405
|
+
type: 'paragraph',
|
|
406
|
+
// @ts-ignore
|
|
407
|
+
ordered: undefined,
|
|
408
|
+
level: undefined,
|
|
409
|
+
});
|
|
410
|
+
}
|
|
411
|
+
else {
|
|
412
|
+
// 否则,转换为 list-item
|
|
413
|
+
Transforms.setNodes(editor, {
|
|
414
|
+
type: 'list-item',
|
|
415
|
+
ordered: this.ordered, // 有序/无序
|
|
416
|
+
indent: undefined,
|
|
417
|
+
});
|
|
418
|
+
}
|
|
419
|
+
};
|
|
420
|
+
return BaseMenu;
|
|
421
|
+
}());
|
|
422
|
+
|
|
423
|
+
/**
|
|
424
|
+
* @description bulleted list menu
|
|
425
|
+
* @author wangfupeng
|
|
426
|
+
*/
|
|
427
|
+
var BulletedListMenu = /** @class */ (function (_super) {
|
|
428
|
+
__extends(BulletedListMenu, _super);
|
|
429
|
+
function BulletedListMenu() {
|
|
430
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
431
|
+
_this.ordered = false;
|
|
432
|
+
_this.title = t('listModule.unOrderedList');
|
|
433
|
+
_this.iconSvg = BULLETED_LIST_SVG;
|
|
434
|
+
return _this;
|
|
435
|
+
}
|
|
436
|
+
return BulletedListMenu;
|
|
437
|
+
}(BaseMenu));
|
|
438
|
+
|
|
439
|
+
/**
|
|
440
|
+
* @description numbered list menu
|
|
441
|
+
* @author wangfupeng
|
|
442
|
+
*/
|
|
443
|
+
var NumberedListMenu = /** @class */ (function (_super) {
|
|
444
|
+
__extends(NumberedListMenu, _super);
|
|
445
|
+
function NumberedListMenu() {
|
|
446
|
+
var _this = _super.apply(this, __spreadArray([], __read(arguments), false)) || this;
|
|
447
|
+
_this.ordered = true;
|
|
448
|
+
_this.title = t('listModule.orderedList');
|
|
449
|
+
_this.iconSvg = NUMBERED_LIST_SVG;
|
|
450
|
+
return _this;
|
|
451
|
+
}
|
|
452
|
+
return NumberedListMenu;
|
|
453
|
+
}(BaseMenu));
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* @description menu entry
|
|
457
|
+
* @author wangfupeng
|
|
458
|
+
*/
|
|
459
|
+
var bulletedListMenuConf = {
|
|
460
|
+
key: 'bulletedList',
|
|
461
|
+
factory: function () {
|
|
462
|
+
return new BulletedListMenu();
|
|
463
|
+
},
|
|
464
|
+
};
|
|
465
|
+
var numberedListMenuConf = {
|
|
466
|
+
key: 'numberedList',
|
|
467
|
+
factory: function () {
|
|
468
|
+
return new NumberedListMenu();
|
|
469
|
+
},
|
|
470
|
+
};
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* @description DOM 操作
|
|
474
|
+
* @author wangfupeng
|
|
475
|
+
*/
|
|
476
|
+
if (append) {
|
|
477
|
+
$.fn.append = append;
|
|
478
|
+
}
|
|
479
|
+
// if (on) $.fn.on = on
|
|
480
|
+
// if (focus) $.fn.focus = focus
|
|
481
|
+
if (attr) {
|
|
482
|
+
$.fn.attr = attr;
|
|
483
|
+
}
|
|
484
|
+
// if (val) $.fn.val = val
|
|
485
|
+
// if (html) $.fn.html = html
|
|
486
|
+
if (parent) {
|
|
487
|
+
$.fn.parent = parent;
|
|
488
|
+
}
|
|
489
|
+
/**
|
|
490
|
+
* 获取 tagName lower-case
|
|
491
|
+
* @param $elem $elem
|
|
492
|
+
*/
|
|
493
|
+
function getTagName($elem) {
|
|
494
|
+
if ($elem.length) {
|
|
495
|
+
return $elem[0].tagName.toLowerCase();
|
|
496
|
+
}
|
|
497
|
+
return '';
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* @description parse elem html
|
|
502
|
+
* @author wangfupeng
|
|
503
|
+
*/
|
|
504
|
+
/**
|
|
505
|
+
* 获取 ordered
|
|
506
|
+
* @param $elem list $elem
|
|
507
|
+
*/
|
|
508
|
+
function getOrdered($elem) {
|
|
509
|
+
var $list = $elem.parent();
|
|
510
|
+
var listTagName = getTagName($list);
|
|
511
|
+
if (listTagName === 'ol') {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
return false;
|
|
515
|
+
}
|
|
516
|
+
/**
|
|
517
|
+
* 获取 level
|
|
518
|
+
* @param $elem list $elem
|
|
519
|
+
*/
|
|
520
|
+
function getLevel($elem) {
|
|
521
|
+
var level = 0;
|
|
522
|
+
var $cur = $elem.parent();
|
|
523
|
+
var tagName = getTagName($cur);
|
|
524
|
+
while (tagName === 'ul' || tagName === 'ol') {
|
|
525
|
+
$cur = $cur.parent();
|
|
526
|
+
tagName = getTagName($cur);
|
|
527
|
+
level += 1;
|
|
528
|
+
}
|
|
529
|
+
return level - 1;
|
|
530
|
+
}
|
|
531
|
+
function parseItemHtml(elem, children, editor) {
|
|
532
|
+
var $elem = $(elem);
|
|
533
|
+
children = children.filter(function (child) {
|
|
534
|
+
if (Text.isText(child)) {
|
|
535
|
+
return true;
|
|
536
|
+
}
|
|
537
|
+
if (editor.isInline(child)) {
|
|
538
|
+
return true;
|
|
539
|
+
}
|
|
540
|
+
return false;
|
|
541
|
+
});
|
|
542
|
+
// 无 children ,则用纯文本
|
|
543
|
+
if (children.length === 0) {
|
|
544
|
+
children = [{ text: $elem.text().replace(/\s+/gm, ' ') }];
|
|
545
|
+
}
|
|
546
|
+
var ordered = getOrdered($elem);
|
|
547
|
+
var level = getLevel($elem);
|
|
548
|
+
return {
|
|
549
|
+
type: 'list-item',
|
|
550
|
+
ordered: ordered,
|
|
551
|
+
level: level,
|
|
552
|
+
// @ts-ignore
|
|
553
|
+
children: children,
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
var parseItemHtmlConf = {
|
|
557
|
+
selector: 'li:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性
|
|
558
|
+
parseElemHtml: parseItemHtml,
|
|
559
|
+
};
|
|
560
|
+
function parseListHtml(_elem, children, _editor) {
|
|
561
|
+
// @ts-ignore flatten 因为可能有 ul/ol 嵌套,重要!!!
|
|
562
|
+
return children.flat(Infinity);
|
|
563
|
+
}
|
|
564
|
+
var parseListHtmlConf = {
|
|
565
|
+
selector: 'ul:not([data-w-e-type]),ol:not([data-w-e-type])', // data-w-e-type 属性,留给自定义元素,保证扩展性
|
|
566
|
+
parseElemHtml: parseListHtml,
|
|
567
|
+
};
|
|
568
|
+
|
|
569
|
+
/**
|
|
570
|
+
* @description editor 插件,重写 editor API
|
|
571
|
+
* @author wangfupeng
|
|
572
|
+
*/
|
|
573
|
+
/**
|
|
574
|
+
* 获取选中的 top elems
|
|
575
|
+
* @param editor editor
|
|
576
|
+
*/
|
|
577
|
+
function getTopSelectedElemsBySelection(editor) {
|
|
578
|
+
return Editor.nodes(editor, {
|
|
579
|
+
at: editor.selection || undefined,
|
|
580
|
+
match: function (n) { return DomEditor.findPath(editor, n).length === 1; }, // 只匹配顶级元素
|
|
581
|
+
});
|
|
582
|
+
}
|
|
583
|
+
function withList(editor) {
|
|
584
|
+
var deleteBackward = editor.deleteBackward, handleTab = editor.handleTab, normalizeNode = editor.normalizeNode, insertBreak = editor.insertBreak;
|
|
585
|
+
var newEditor = editor;
|
|
586
|
+
// 重写 insertBreak - 空 list 点击回车时删除该空 list
|
|
587
|
+
newEditor.insertBreak = function () {
|
|
588
|
+
var _a = __read(Editor.nodes(editor, {
|
|
589
|
+
match: function (n) { return DomEditor.checkNodeType(n, 'list-item'); },
|
|
590
|
+
universal: true,
|
|
591
|
+
}), 1), nodeEntry = _a[0];
|
|
592
|
+
if (!nodeEntry) {
|
|
593
|
+
return insertBreak();
|
|
594
|
+
}
|
|
595
|
+
var listElem = nodeEntry[0];
|
|
596
|
+
if (listElem.children[0].text === '') {
|
|
597
|
+
Transforms.setNodes(newEditor, {
|
|
598
|
+
type: 'paragraph',
|
|
599
|
+
// @ts-ignore
|
|
600
|
+
ordered: undefined,
|
|
601
|
+
level: undefined,
|
|
602
|
+
});
|
|
603
|
+
return;
|
|
604
|
+
}
|
|
605
|
+
return insertBreak();
|
|
606
|
+
};
|
|
607
|
+
// 重写 deleteBackward - 降低 level 或者转换为 p 元素
|
|
608
|
+
newEditor.deleteBackward = function (unit) {
|
|
609
|
+
var selection = newEditor.selection;
|
|
610
|
+
if (selection == null) {
|
|
611
|
+
deleteBackward(unit);
|
|
612
|
+
return;
|
|
613
|
+
}
|
|
614
|
+
if (Range.isExpanded(selection)) {
|
|
615
|
+
deleteBackward(unit);
|
|
616
|
+
return;
|
|
617
|
+
}
|
|
618
|
+
var listItemElem = DomEditor.getSelectedNodeByType(newEditor, 'list-item');
|
|
619
|
+
if (listItemElem == null) {
|
|
620
|
+
// 未匹配到 list-item
|
|
621
|
+
deleteBackward(unit);
|
|
622
|
+
return;
|
|
623
|
+
}
|
|
624
|
+
if (selection.focus.offset === 0) {
|
|
625
|
+
// 选中了当前 list-item 文本的开头,此时按删除键,应该降低 level 或转换为 p 元素
|
|
626
|
+
var _a = listItemElem, _b = _a.level, level = _b === void 0 ? 0 : _b, _c = _a.ordered, ordered = _c === void 0 ? false : _c;
|
|
627
|
+
if (level > 0) {
|
|
628
|
+
// 如果有兄弟节点,则判断 ordered 是否一致,不一致需要切换 ordered
|
|
629
|
+
var brotherElem = getBrotherListNodeByLevel(editor, listItemElem, level - 1);
|
|
630
|
+
if (brotherElem && brotherElem.ordered !== ordered) {
|
|
631
|
+
Transforms.setNodes(newEditor, { level: level - 1, ordered: !ordered });
|
|
632
|
+
}
|
|
633
|
+
else {
|
|
634
|
+
Transforms.setNodes(newEditor, { level: level - 1 });
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
// 转换为 p 元素
|
|
639
|
+
Transforms.setNodes(newEditor, {
|
|
640
|
+
type: 'paragraph',
|
|
641
|
+
// @ts-ignore
|
|
642
|
+
ordered: undefined,
|
|
643
|
+
level: undefined,
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
return;
|
|
647
|
+
}
|
|
648
|
+
// 其他情况
|
|
649
|
+
deleteBackward(unit);
|
|
650
|
+
};
|
|
651
|
+
// 重写 tab - 当选中 list-item 文本开头时,增加 level
|
|
652
|
+
newEditor.handleTab = function () {
|
|
653
|
+
var e_1, _a, e_2, _b;
|
|
654
|
+
var selection = newEditor.selection;
|
|
655
|
+
if (selection == null) {
|
|
656
|
+
handleTab();
|
|
657
|
+
return;
|
|
658
|
+
}
|
|
659
|
+
// 选区是合并的,判断单个 list-item 即可
|
|
660
|
+
if (Range.isCollapsed(selection)) {
|
|
661
|
+
var listItemElem = DomEditor.getSelectedNodeByType(newEditor, 'list-item');
|
|
662
|
+
if (listItemElem == null) {
|
|
663
|
+
// 未匹配到 list-item
|
|
664
|
+
handleTab();
|
|
665
|
+
return;
|
|
666
|
+
}
|
|
667
|
+
if (selection.focus.offset === 0) {
|
|
668
|
+
// 选中了当前 list-item 文本的开头,此时按 tab 应该增加 level
|
|
669
|
+
var _c = listItemElem.level, level = _c === void 0 ? 0 : _c;
|
|
670
|
+
Transforms.setNodes(newEditor, { level: level + 1 });
|
|
671
|
+
return;
|
|
672
|
+
}
|
|
673
|
+
}
|
|
674
|
+
// 选区是展开的,要判断多个 list-item
|
|
675
|
+
if (Range.isExpanded(selection)) {
|
|
676
|
+
var listItemNum = 0; // 选中的 list-item 有几个
|
|
677
|
+
var hasOtherElem = false; // 是否有其他元素
|
|
678
|
+
try {
|
|
679
|
+
for (var _d = __values(getTopSelectedElemsBySelection(newEditor)), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
680
|
+
var entry = _e.value;
|
|
681
|
+
var _f = __read(entry, 1), elem = _f[0];
|
|
682
|
+
var type = DomEditor.getNodeType(elem);
|
|
683
|
+
if (type === 'list-item') {
|
|
684
|
+
listItemNum += 1;
|
|
685
|
+
}
|
|
686
|
+
else {
|
|
687
|
+
hasOtherElem = true;
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
692
|
+
finally {
|
|
693
|
+
try {
|
|
694
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
695
|
+
}
|
|
696
|
+
finally { if (e_1) throw e_1.error; }
|
|
697
|
+
}
|
|
698
|
+
if (hasOtherElem || listItemNum <= 1) {
|
|
699
|
+
// 选中了其他元素,或者只选中一个 list-item ,则执行默认行为
|
|
700
|
+
handleTab();
|
|
701
|
+
return;
|
|
702
|
+
}
|
|
703
|
+
try {
|
|
704
|
+
// 未选中其他元素,且选中多个 list-item ,则增加 level
|
|
705
|
+
for (var _g = __values(getTopSelectedElemsBySelection(newEditor)), _h = _g.next(); !_h.done; _h = _g.next()) {
|
|
706
|
+
var entry = _h.value;
|
|
707
|
+
var _j = __read(entry, 2), elem = _j[0], path = _j[1];
|
|
708
|
+
var _k = elem.level, level = _k === void 0 ? 0 : _k;
|
|
709
|
+
Transforms.setNodes(newEditor, { level: level + 1 }, { at: path });
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
713
|
+
finally {
|
|
714
|
+
try {
|
|
715
|
+
if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
|
|
716
|
+
}
|
|
717
|
+
finally { if (e_2) throw e_2.error; }
|
|
718
|
+
}
|
|
719
|
+
return;
|
|
720
|
+
}
|
|
721
|
+
// 其他情况
|
|
722
|
+
handleTab();
|
|
723
|
+
};
|
|
724
|
+
// 兼容之前的 JSON 格式 `numbered-list` 和 `bulleted-list` (之前的 list 没有嵌套功能)
|
|
725
|
+
newEditor.normalizeNode = function (_a) {
|
|
726
|
+
var _b = __read(_a, 2), node = _b[0], path = _b[1];
|
|
727
|
+
var type = DomEditor.getNodeType(node);
|
|
728
|
+
if (type === 'bulleted-list' || type === 'numbered-list') {
|
|
729
|
+
Transforms.unwrapNodes(newEditor, { at: path });
|
|
730
|
+
}
|
|
731
|
+
// 执行默认行为
|
|
732
|
+
return normalizeNode([node, path]);
|
|
733
|
+
};
|
|
734
|
+
return newEditor;
|
|
735
|
+
}
|
|
736
|
+
|
|
737
|
+
/**
|
|
738
|
+
* @description render list elem
|
|
739
|
+
* @author wangfupeng
|
|
740
|
+
*/
|
|
741
|
+
/**
|
|
742
|
+
* 无序列表:根据 level 获取的前置符号
|
|
743
|
+
* @param level 层级
|
|
744
|
+
*/
|
|
745
|
+
function genPreSymbol(level) {
|
|
746
|
+
if (level === void 0) { level = 0; }
|
|
747
|
+
var s = '';
|
|
748
|
+
switch (level) {
|
|
749
|
+
case 0:
|
|
750
|
+
s = '•'; // 第一层级
|
|
751
|
+
break;
|
|
752
|
+
case 1:
|
|
753
|
+
s = '◦'; // 第一层级
|
|
754
|
+
break;
|
|
755
|
+
case 2:
|
|
756
|
+
s = '▪'; // 第三层级
|
|
757
|
+
break;
|
|
758
|
+
default:
|
|
759
|
+
s = '▪'; // 其他层级
|
|
760
|
+
}
|
|
761
|
+
return s;
|
|
762
|
+
}
|
|
763
|
+
/**
|
|
764
|
+
* 有序列表:获取前缀 number
|
|
765
|
+
* @param editor editor
|
|
766
|
+
* @param elem listItem elem
|
|
767
|
+
*/
|
|
768
|
+
function getOrderedItemNumber(editor, elem) {
|
|
769
|
+
var _a = elem, type = _a.type, _b = _a.level, level = _b === void 0 ? 0 : _b, _c = _a.ordered, ordered = _c === void 0 ? false : _c;
|
|
770
|
+
var num = 1; // 默认值 1
|
|
771
|
+
var curElem = elem;
|
|
772
|
+
var curPath = DomEditor.findPath(editor, curElem);
|
|
773
|
+
// 第一个元素,直接返回 1
|
|
774
|
+
if (curPath[0] === 0) {
|
|
775
|
+
return 1;
|
|
776
|
+
}
|
|
777
|
+
while (curPath[0] > 0) {
|
|
778
|
+
var prevPath = Path.previous(curPath);
|
|
779
|
+
var prevEntry = Editor.node(editor, prevPath);
|
|
780
|
+
if (prevEntry == null) {
|
|
781
|
+
break;
|
|
782
|
+
}
|
|
783
|
+
var prevElem = prevEntry[0]; // 上一个节点
|
|
784
|
+
var _d = prevElem.level, prevLevel = _d === void 0 ? 0 : _d, prevType = prevElem.type, prevOrdered = prevElem.ordered;
|
|
785
|
+
// type 不一致,退出循环,不再累加 num
|
|
786
|
+
if (prevType !== type) {
|
|
787
|
+
break;
|
|
788
|
+
}
|
|
789
|
+
// prevLevel 更小,退出循环,不再累加 num
|
|
790
|
+
if (prevLevel < level) {
|
|
791
|
+
break;
|
|
792
|
+
}
|
|
793
|
+
if (prevLevel === level) {
|
|
794
|
+
// level 一样,如果 ordered 不一样,则退出循环,不再累加 num
|
|
795
|
+
if (prevOrdered !== ordered) {
|
|
796
|
+
break;
|
|
797
|
+
}
|
|
798
|
+
else {
|
|
799
|
+
// level 一样,order 一样,则累加 num
|
|
800
|
+
num += 1;
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
// prevLevel 更大,不累加 num ,继续向前
|
|
804
|
+
curElem = prevElem;
|
|
805
|
+
curPath = prevPath;
|
|
806
|
+
}
|
|
807
|
+
return num;
|
|
808
|
+
}
|
|
809
|
+
function renderListElem(elemNode, children, editor) {
|
|
810
|
+
ELEM_TO_EDITOR.set(elemNode, editor); // 记录 elem 和 editor 关系,elem-to-html 时要用
|
|
811
|
+
var _a = elemNode, _b = _a.level, level = _b === void 0 ? 0 : _b, _c = _a.ordered, ordered = _c === void 0 ? false : _c;
|
|
812
|
+
// 根据 level 增加 margin-left
|
|
813
|
+
var listStyle = { margin: "5px 0 5px ".concat(level * 20, "px") };
|
|
814
|
+
// list-item 前缀
|
|
815
|
+
var prefix = '';
|
|
816
|
+
if (ordered) {
|
|
817
|
+
// 有序列表:获取前缀 number
|
|
818
|
+
var orderedNumber = getOrderedItemNumber(editor, elemNode);
|
|
819
|
+
prefix = "".concat(orderedNumber, ".");
|
|
820
|
+
}
|
|
821
|
+
else {
|
|
822
|
+
// 无序列表:根据层级,使用不同的前缀符号
|
|
823
|
+
prefix = genPreSymbol(level);
|
|
824
|
+
}
|
|
825
|
+
// 获取前缀颜色
|
|
826
|
+
var prefixColor = getListItemColor(elemNode);
|
|
827
|
+
var vnode = (jsx("div", { style: listStyle },
|
|
828
|
+
jsx("span", { contentEditable: false, style: { marginRight: '0.5em', color: prefixColor }, "data-w-e-reserve": true }, prefix),
|
|
829
|
+
jsx("span", null, children)));
|
|
830
|
+
return vnode;
|
|
831
|
+
}
|
|
832
|
+
var renderListItemConf = {
|
|
833
|
+
type: 'list-item',
|
|
834
|
+
renderElem: renderListElem,
|
|
835
|
+
};
|
|
836
|
+
|
|
837
|
+
/**
|
|
838
|
+
* @description list module entry
|
|
839
|
+
* @author wangfupeng
|
|
840
|
+
*/
|
|
841
|
+
var list = {
|
|
842
|
+
renderElems: [renderListItemConf],
|
|
843
|
+
editorPlugin: withList,
|
|
844
|
+
menus: [bulletedListMenuConf, numberedListMenuConf],
|
|
845
|
+
elemsToHtml: [listItemToHtmlConf],
|
|
846
|
+
parseElemsHtml: [parseListHtmlConf, parseItemHtmlConf],
|
|
847
|
+
};
|
|
848
|
+
|
|
849
|
+
/**
|
|
850
|
+
* @description list module
|
|
851
|
+
* @author wangfupeng
|
|
852
|
+
*/
|
|
853
|
+
|
|
854
|
+
export { list as default };
|