UNPKG

velaris-richtext-editor

Version:

A modern WYSIWYG rich text editor based on tiptap and shadcn ui for React

3 lines (2 loc) 1.04 kB
"use strict";const i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",C=r=>{r=r.replace(/\r\n/g,` `);let n=0,e="";for(;n<r.length;n++){const t=r.charCodeAt(n);t<128?e+=String.fromCharCode(t):t>127&&t<2048?(e+=String.fromCharCode(t>>6|192),e+=String.fromCharCode(63&t|128)):(e+=String.fromCharCode(t>>12|224),e+=String.fromCharCode(t>>6&63|128),e+=String.fromCharCode(63&t|128))}return e},f=r=>{let n,e,t,d,c,h,o,a=0,s="";for(r=C(r);a<r.length;)n=r.charCodeAt(a++),e=r.charCodeAt(a++),t=r.charCodeAt(a++),d=n>>2,c=(3&n)<<4|e>>4,h=(15&e)<<2|t>>6,o=63&t,isNaN(e)?h=o=64:isNaN(t)&&(o=64),s=s+i.charAt(d)+i.charAt(c)+i.charAt(h)+i.charAt(o);return s},l=r=>typeof r=="string"?"string":typeof SVGElement<"u"&&r instanceof SVGElement?"element":void 0,g=r=>"data:image/svg+xml;base64,"+f(r),m=r=>g(new XMLSerializer().serializeToString(r)),u=r=>{switch(l(r)){case"string":return g(r);case"element":return m(r);default:return r}};function S(r=8){return Math.random().toString(36).substring(2,r+2)}exports.i=u;exports.shortId=S;