overtype 1.0.5 → 1.1.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/LICENSE +1 -1
- package/README.md +26 -0
- package/dist/overtype.esm.js +1428 -3
- package/dist/overtype.esm.js.map +4 -4
- package/dist/overtype.js +1428 -3
- package/dist/overtype.js.map +4 -4
- package/dist/overtype.min.js +83 -51
- package/package.json +2 -1
- package/src/link-tooltip.js +269 -0
- package/src/overtype.js +51 -2
- package/src/parser.js +19 -0
- package/src/styles.js +3 -1
package/dist/overtype.min.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* OverType v1.0
|
|
2
|
+
* OverType v1.1.0
|
|
3
3
|
* A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
4
4
|
* @license MIT
|
|
5
5
|
* @author Demo User
|
|
6
6
|
* https://github.com/demo/overtype
|
|
7
7
|
*/
|
|
8
|
-
var OverType=(()=>{var
|
|
9
|
-
`).map((s,
|
|
10
|
-
`).length,"lines")}catch(c){
|
|
11
|
-
`).length>1}function
|
|
12
|
-
`),
|
|
13
|
-
`.repeat(2-
|
|
14
|
-
`.repeat(2-s)),{newlinesToAppend:
|
|
15
|
-
`;)
|
|
16
|
-
`;)
|
|
17
|
-
`:
|
|
18
|
-
${
|
|
19
|
-
`);if(
|
|
20
|
-
`),
|
|
21
|
-
`),
|
|
22
|
-
`),
|
|
23
|
-
`),processed:o}}function
|
|
24
|
-
`),
|
|
25
|
-
`),processed:o}}function
|
|
26
|
-
`).map((
|
|
27
|
-
`)+
|
|
28
|
-
`),s=0,
|
|
29
|
-
`;)
|
|
30
|
-
`;)
|
|
31
|
-
`)}function
|
|
8
|
+
var OverType=(()=>{var mt=Object.defineProperty;var tn=Object.getOwnPropertyDescriptor;var en=Object.getOwnPropertyNames;var nn=Object.prototype.hasOwnProperty;var on=(e,t,n)=>t in e?mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var rn=(e,t)=>{for(var n in t)mt(e,n,{get:t[n],enumerable:!0})},sn=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of en(t))!nn.call(e,i)&&i!==n&&mt(e,i,{get:()=>t[i],enumerable:!(o=tn(t,i))||o.enumerable});return e};var ln=e=>sn(mt({},"__esModule",{value:!0}),e);var tt=(e,t,n)=>(on(e,typeof t!="symbol"?t+"":t,n),n);var Xn={};rn(Xn,{OverType:()=>N,default:()=>Qn});var et=class{static escapeHtml(t){let n={"&":"&","<":"<",">":">",'"':""","'":"'"};return t.replace(/[&<>"']/g,o=>n[o])}static preserveIndentation(t,n){let i=n.match(/^(\s*)/)[1].replace(/ /g," ");return t.replace(/^\s*/,i)}static parseHeader(t){return t.replace(/^(#{1,3})\s(.+)$/,(n,o,i)=>{let r=o.length;return`<span class="header ${["h1","h2","h3"][r-1]}"><span class="syntax-marker">${o}</span> ${i}</span>`})}static parseHorizontalRule(t){return t.match(/^(-{3,}|\*{3,}|_{3,})$/)?`<div><span class="hr-marker">${t}</span></div>`:null}static parseBlockquote(t){return t.replace(/^> (.+)$/,(n,o)=>`<span class="blockquote"><span class="syntax-marker">></span> ${o}</span>`)}static parseBulletList(t){return t.replace(/^((?: )*)([-*])\s(.+)$/,(n,o,i,r)=>`${o}<span class="syntax-marker">${i}</span> ${r}`)}static parseNumberedList(t){return t.replace(/^((?: )*)(\d+\.)\s(.+)$/,(n,o,i,r)=>`${o}<span class="syntax-marker">${i}</span> ${r}`)}static parseCodeBlock(t){return t.startsWith("```")?`<div><span class="code-fence">${t}</span></div>`:null}static parseBold(t){return t=t.replace(/\*\*(.+?)\*\*/g,'<strong><span class="syntax-marker">**</span>$1<span class="syntax-marker">**</span></strong>'),t=t.replace(/__(.+?)__/g,'<strong><span class="syntax-marker">__</span>$1<span class="syntax-marker">__</span></strong>'),t}static parseItalic(t){return t=t.replace(new RegExp("(?<!\\*)\\*(?!\\*)(.+?)(?<!\\*)\\*(?!\\*)","g"),'<em><span class="syntax-marker">*</span>$1<span class="syntax-marker">*</span></em>'),t=t.replace(new RegExp("(?<!_)_(?!_)(.+?)(?<!_)_(?!_)","g"),'<em><span class="syntax-marker">_</span>$1<span class="syntax-marker">_</span></em>'),t}static parseInlineCode(t){return t.replace(/`(.+?)`/g,'<code><span class="syntax-marker">`</span>$1<span class="syntax-marker">`</span></code>')}static parseLinks(t){return t.replace(/\[(.+?)\]\((.+?)\)/g,'<a href="$2"><span class="syntax-marker">[</span>$1<span class="syntax-marker">](</span><span class="syntax-marker">$2</span><span class="syntax-marker">)</span></a>')}static parseInlineElements(t){let n=t;n=this.parseInlineCode(n);let o=new Map;return n=n.replace(/(<code>.*?<\/code>)/g,i=>{let r=`\uE000${o.size}\uE001`;return o.set(r,i),r}),n=this.parseLinks(n),n=this.parseBold(n),n=this.parseItalic(n),o.forEach((i,r)=>{n=n.replace(r,i)}),n}static parseLine(t){let n=this.escapeHtml(t);n=this.preserveIndentation(n,t);let o=this.parseHorizontalRule(n);if(o)return o;let i=this.parseCodeBlock(n);return i||(n=this.parseHeader(n),n=this.parseBlockquote(n),n=this.parseBulletList(n),n=this.parseNumberedList(n),n=this.parseInlineElements(n),n.trim()===""?"<div> </div>":`<div>${n}</div>`)}static parse(t,n=-1,o=!1){return t.split(`
|
|
9
|
+
`).map((s,l)=>o&&l===n?`<div class="raw-line">${this.escapeHtml(s)||" "}</div>`:this.parseLine(s)).join("")}};var an=Object.defineProperty,Kt=Object.getOwnPropertySymbols,cn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,Ut=(e,t,n)=>t in e?an(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Zt=(e,t)=>{for(var n in t||(t={}))cn.call(t,n)&&Ut(e,n,t[n]);if(Kt)for(var n of Kt(t))pn.call(t,n)&&Ut(e,n,t[n]);return e},P={bold:{prefix:"**",suffix:"**",trimFirst:!0},italic:{prefix:"_",suffix:"_",trimFirst:!0},code:{prefix:"`",suffix:"`",blockPrefix:"```",blockSuffix:"```"},link:{prefix:"[",suffix:"](url)",replaceNext:"url",scanFor:"https?://"},bulletList:{prefix:"- ",multiline:!0,unorderedList:!0},numberedList:{prefix:"1. ",multiline:!0,orderedList:!0},quote:{prefix:"> ",multiline:!0,surroundWithNewlines:!0},taskList:{prefix:"- [ ] ",multiline:!0,surroundWithNewlines:!0},header1:{prefix:"# "},header2:{prefix:"## "},header3:{prefix:"### "},header4:{prefix:"#### "},header5:{prefix:"##### "},header6:{prefix:"###### "}};function dn(){return{prefix:"",suffix:"",blockPrefix:"",blockSuffix:"",multiline:!1,replaceNext:"",prefixSpace:!1,scanFor:"",surroundWithNewlines:!1,orderedList:!1,unorderedList:!1,trimFirst:!1}}function H(e){return Zt(Zt({},dn()),e)}var vt=!1;function un(){return vt}function x(e,t,n){vt&&(console.group(`\u{1F50D} ${e}`),console.log(t),n&&console.log("Data:",n),console.groupEnd())}function gt(e,t){if(!vt)return;let n=e.value.slice(e.selectionStart,e.selectionEnd);console.group(`\u{1F4CD} Selection: ${t}`),console.log("Position:",`${e.selectionStart}-${e.selectionEnd}`),console.log("Selected text:",JSON.stringify(n)),console.log("Length:",n.length);let o=e.value.slice(Math.max(0,e.selectionStart-10),e.selectionStart),i=e.value.slice(e.selectionEnd,Math.min(e.value.length,e.selectionEnd+10));console.log("Context:",JSON.stringify(o)+"[SELECTION]"+JSON.stringify(i)),console.groupEnd()}function Xt(e){vt&&(console.group("\u{1F4DD} Result"),console.log("Text to insert:",JSON.stringify(e.text)),console.log("New selection:",`${e.selectionStart}-${e.selectionEnd}`),console.groupEnd())}var B=null;function F(e,{text:t,selectionStart:n,selectionEnd:o}){let i=un();i&&(console.group("\u{1F527} insertText"),console.log("Current selection:",`${e.selectionStart}-${e.selectionEnd}`),console.log("Text to insert:",JSON.stringify(t)),console.log("New selection to set:",n,"-",o)),e.focus();let r=e.selectionStart,s=e.selectionEnd,l=e.value.slice(0,r),a=e.value.slice(s);i&&(console.log("Before text (last 20):",JSON.stringify(l.slice(-20))),console.log("After text (first 20):",JSON.stringify(a.slice(0,20))),console.log("Selected text being replaced:",JSON.stringify(e.value.slice(r,s))));let p=e.value,d=r!==s;if(B===null||B===!0){e.contentEditable="true";try{B=document.execCommand("insertText",!1,t),i&&console.log("execCommand returned:",B,"for text with",t.split(`
|
|
10
|
+
`).length,"lines")}catch(c){B=!1,i&&console.log("execCommand threw error:",c)}e.contentEditable="false"}if(i&&(console.log("canInsertText before:",B),console.log("execCommand result:",B)),B){let c=l+t+a,f=e.value;i&&(console.log("Expected length:",c.length),console.log("Actual length:",f.length)),f!==c&&i&&(console.log("execCommand changed the value but not as expected"),console.log("Expected:",JSON.stringify(c.slice(0,100))),console.log("Actual:",JSON.stringify(f.slice(0,100))))}if(!B)if(i&&console.log("Using manual insertion"),e.value===p){i&&console.log("Value unchanged, doing manual replacement");try{document.execCommand("ms-beginUndoUnit")}catch(c){}e.value=l+t+a;try{document.execCommand("ms-endUndoUnit")}catch(c){}e.dispatchEvent(new CustomEvent("input",{bubbles:!0,cancelable:!0}))}else i&&console.log("Value was changed by execCommand, skipping manual insertion");i&&console.log("Setting selection range:",n,o),n!=null&&o!=null?e.setSelectionRange(n,o):e.setSelectionRange(r,e.selectionEnd),i&&(console.log("Final value length:",e.value.length),console.groupEnd())}function Jt(e){return e.trim().split(`
|
|
11
|
+
`).length>1}function fn(e,t){let n=t;for(;e[n]&&e[n-1]!=null&&!e[n-1].match(/\s/);)n--;return n}function hn(e,t,n){let o=t,i=n?/\n/:/\s/;for(;e[o]&&!e[o].match(i);)o++;return o}function Gt(e){let t=e.value.split(`
|
|
12
|
+
`),n=0;for(let o=0;o<t.length;o++){let i=t[o].length+1;e.selectionStart>=n&&e.selectionStart<n+i&&(e.selectionStart=n),e.selectionEnd>=n&&e.selectionEnd<n+i&&(o===t.length-1?e.selectionEnd=Math.min(n+t[o].length,e.value.length):e.selectionEnd=n+i-1),n+=i}}function mn(e,t,n,o=!1){if(e.selectionStart===e.selectionEnd)e.selectionStart=fn(e.value,e.selectionStart),e.selectionEnd=hn(e.value,e.selectionEnd,o);else{let i=e.selectionStart-t.length,r=e.selectionEnd+n.length,s=e.value.slice(i,e.selectionStart)===t,l=e.value.slice(e.selectionEnd,r)===n;s&&l&&(e.selectionStart=i,e.selectionEnd=r)}return e.value.slice(e.selectionStart,e.selectionEnd)}function Ht(e){let t=e.value.slice(0,e.selectionStart),n=e.value.slice(e.selectionEnd),o=t.match(/\n*$/),i=n.match(/^\n*/),r=o?o[0].length:0,s=i?i[0].length:0,l="",a="";return t.match(/\S/)&&r<2&&(l=`
|
|
13
|
+
`.repeat(2-r)),n.match(/\S/)&&s<2&&(a=`
|
|
14
|
+
`.repeat(2-s)),{newlinesToAppend:l,newlinesToPrepend:a}}function yt(e,t,n={}){let o=e.selectionStart,i=e.selectionEnd,r=o===i,s=e.value,l=o;for(;l>0&&s[l-1]!==`
|
|
15
|
+
`;)l--;if(r){let p=o;for(;p<s.length&&s[p]!==`
|
|
16
|
+
`;)p++;e.selectionStart=l,e.selectionEnd=p}else Gt(e);let a=t(e);if(n.adjustSelection){let d=e.value.slice(e.selectionStart,e.selectionEnd).startsWith(n.prefix),c=n.adjustSelection(d,o,i,l);a.selectionStart=c.start,a.selectionEnd=c.end}else if(n.prefix){let d=e.value.slice(e.selectionStart,e.selectionEnd).startsWith(n.prefix);r?d?(a.selectionStart=Math.max(o-n.prefix.length,l),a.selectionEnd=a.selectionStart):(a.selectionStart=o+n.prefix.length,a.selectionEnd=a.selectionStart):d?(a.selectionStart=Math.max(o-n.prefix.length,l),a.selectionEnd=Math.max(i-n.prefix.length,l)):(a.selectionStart=o+n.prefix.length,a.selectionEnd=i+n.prefix.length)}return a}function wt(e,t){let n,o,{prefix:i,suffix:r,blockPrefix:s,blockSuffix:l,replaceNext:a,prefixSpace:p,scanFor:d,surroundWithNewlines:c,trimFirst:f}=t,u=e.selectionStart,m=e.selectionEnd,g=e.value.slice(e.selectionStart,e.selectionEnd),h=Jt(g)&&s&&s.length>0?`${s}
|
|
17
|
+
`:i,y=Jt(g)&&l&&l.length>0?`
|
|
18
|
+
${l}`:r;if(p){let b=e.value[e.selectionStart-1];e.selectionStart!==0&&b!=null&&!b.match(/\s/)&&(h=` ${h}`)}g=mn(e,h,y,t.multiline);let v=e.selectionStart,w=e.selectionEnd,S=a&&a.length>0&&y.indexOf(a)>-1&&g.length>0;if(c){let b=Ht(e);n=b.newlinesToAppend,o=b.newlinesToPrepend,h=n+i,y+=o}if(g.startsWith(h)&&g.endsWith(y)){let b=g.slice(h.length,g.length-y.length);if(u===m){let C=u-h.length;C=Math.max(C,v),C=Math.min(C,v+b.length),v=w=C}else w=v+b.length;return{text:b,selectionStart:v,selectionEnd:w}}else if(S)if(d&&d.length>0&&g.match(d)){y=y.replace(a,g);let b=h+y;return v=w=v+h.length,{text:b,selectionStart:v,selectionEnd:w}}else{let b=h+g+y;return v=v+h.length+g.length+y.indexOf(a),w=v+a.length,{text:b,selectionStart:v,selectionEnd:w}}else{let b=h+g+y;v=u+h.length,w=m+h.length;let C=g.match(/^\s*|\s*$/g);if(f&&C){let ft=C[0]||"",Z=C[1]||"";b=ft+h+g.trim()+y+Z,v+=ft.length,w-=Z.length}return{text:b,selectionStart:v,selectionEnd:w}}}function te(e,t){let{prefix:n,suffix:o,surroundWithNewlines:i}=t,r=e.value.slice(e.selectionStart,e.selectionEnd),s=e.selectionStart,l=e.selectionEnd,a=r.split(`
|
|
19
|
+
`);if(a.every(d=>d.startsWith(n)&&(!o||d.endsWith(o))))r=a.map(d=>{let c=d.slice(n.length);return o&&(c=c.slice(0,c.length-o.length)),c}).join(`
|
|
20
|
+
`),l=s+r.length;else if(r=a.map(d=>n+d+(o||"")).join(`
|
|
21
|
+
`),i){let{newlinesToAppend:d,newlinesToPrepend:c}=Ht(e);s+=d.length,l=s+r.length,r=d+r+c}return{text:r,selectionStart:s,selectionEnd:l}}function Yt(e){let t=e.split(`
|
|
22
|
+
`),n=/^\d+\.\s+/,o=t.every(r=>n.test(r)),i=t;return o&&(i=t.map(r=>r.replace(n,""))),{text:i.join(`
|
|
23
|
+
`),processed:o}}function Qt(e){let t=e.split(`
|
|
24
|
+
`),n="- ",o=t.every(r=>r.startsWith(n)),i=t;return o&&(i=t.map(r=>r.slice(n.length))),{text:i.join(`
|
|
25
|
+
`),processed:o}}function nt(e,t){return t?"- ":`${e+1}. `}function gn(e,t){let n,o,i;return e.orderedList?(n=Yt(t),o=Qt(n.text),i=o.text):(n=Qt(t),o=Yt(n.text),i=o.text),[n,o,i]}function vn(e,t){let n=e.selectionStart===e.selectionEnd,o=e.selectionStart,i=e.selectionEnd;Gt(e);let r=e.value.slice(e.selectionStart,e.selectionEnd),[s,l,a]=gn(t,r),p=a.split(`
|
|
26
|
+
`).map((g,h)=>`${nt(h,t.unorderedList)}${g}`),d=p.reduce((g,h,y)=>g+nt(y,t.unorderedList).length,0),c=p.reduce((g,h,y)=>g+nt(y,!t.unorderedList).length,0);if(s.processed)return n?(o=Math.max(o-nt(0,t.unorderedList).length,0),i=o):(o=e.selectionStart,i=e.selectionEnd-d),{text:a,selectionStart:o,selectionEnd:i};let{newlinesToAppend:f,newlinesToPrepend:u}=Ht(e),m=f+p.join(`
|
|
27
|
+
`)+u;return n?(o=Math.max(o+nt(0,t.unorderedList).length+f.length,0),i=o):l.processed?(o=Math.max(e.selectionStart+f.length,0),i=e.selectionEnd+f.length+d-c):(o=Math.max(e.selectionStart+f.length,0),i=e.selectionEnd+f.length+d),{text:m,selectionStart:o,selectionEnd:i}}function ee(e,t){let n=yt(e,o=>vn(o,t),{adjustSelection:(o,i,r,s)=>{let l=e.value.slice(s,e.selectionEnd),a=/^\d+\.\s+/,p=/^- /,d=a.test(l),c=p.test(l),f=t.orderedList&&d||t.unorderedList&&c;if(i===r)if(f){let u=l.match(t.orderedList?a:p),m=u?u[0].length:0;return{start:Math.max(i-m,s),end:Math.max(i-m,s)}}else if(d||c){let u=l.match(d?a:p),m=u?u[0].length:0,h=(t.unorderedList?2:3)-m;return{start:i+h,end:i+h}}else{let u=t.unorderedList?2:3;return{start:i+u,end:i+u}}else if(f){let u=l.match(t.orderedList?a:p),m=u?u[0].length:0;return{start:Math.max(i-m,s),end:Math.max(r-m,s)}}else if(d||c){let u=l.match(d?a:p),m=u?u[0].length:0,h=(t.unorderedList?2:3)-m;return{start:i+h,end:r+h}}else{let u=t.unorderedList?2:3;return{start:i+u,end:r+u}}}});F(e,n)}function yn(e){if(!e)return[];let t=[],{selectionStart:n,selectionEnd:o,value:i}=e,r=i.split(`
|
|
28
|
+
`),s=0,l="";for(let c of r){if(n>=s&&n<=s+c.length){l=c;break}s+=c.length+1}l.startsWith("- ")&&(l.startsWith("- [ ] ")||l.startsWith("- [x] ")?t.push("task-list"):t.push("bullet-list")),/^\d+\.\s/.test(l)&&t.push("numbered-list"),l.startsWith("> ")&&t.push("quote"),l.startsWith("# ")&&t.push("header"),l.startsWith("## ")&&t.push("header-2"),l.startsWith("### ")&&t.push("header-3");let a=Math.max(0,n-10),p=Math.min(i.length,o+10),d=i.slice(a,p);if(d.includes("**")){let c=i.slice(Math.max(0,n-100),n),f=i.slice(o,Math.min(i.length,o+100)),u=c.lastIndexOf("**"),m=f.indexOf("**");u!==-1&&m!==-1&&t.push("bold")}if(d.includes("_")){let c=i.slice(Math.max(0,n-100),n),f=i.slice(o,Math.min(i.length,o+100)),u=c.lastIndexOf("_"),m=f.indexOf("_");u!==-1&&m!==-1&&t.push("italic")}if(d.includes("`")){let c=i.slice(Math.max(0,n-100),n),f=i.slice(o,Math.min(i.length,o+100));c.includes("`")&&f.includes("`")&&t.push("code")}if(d.includes("[")&&d.includes("]")){let c=i.slice(Math.max(0,n-100),n),f=i.slice(o,Math.min(i.length,o+100)),u=c.lastIndexOf("["),m=f.indexOf("]");u!==-1&&m!==-1&&i.slice(o+m+1,o+m+10).startsWith("(")&&t.push("link")}return t}function bt(e){if(!e||e.disabled||e.readOnly)return;x("toggleBold","Starting"),gt(e,"Before");let t=H(P.bold),n=wt(e,t);Xt(n),F(e,n),gt(e,"After")}function xt(e){if(!e||e.disabled||e.readOnly)return;let t=H(P.italic),n=wt(e,t);F(e,n)}function ne(e){if(!e||e.disabled||e.readOnly)return;let t=H(P.code),n=wt(e,t);F(e,n)}function kt(e,t={}){if(!e||e.disabled||e.readOnly)return;let n=e.value.slice(e.selectionStart,e.selectionEnd),o=H(P.link);if(n&&n.match(/^https?:\/\//)&&!t.url?(o.suffix=`](${n})`,o.replaceNext=""):t.url&&(o.suffix=`](${t.url})`,o.replaceNext=""),t.text&&!n){let s=e.selectionStart;e.value=e.value.slice(0,s)+t.text+e.value.slice(s),e.selectionStart=s,e.selectionEnd=s+t.text.length}let r=wt(e,o);F(e,r)}function St(e){if(!e||e.disabled||e.readOnly)return;let t=H(P.bulletList);ee(e,t)}function Lt(e){if(!e||e.disabled||e.readOnly)return;let t=H(P.numberedList);ee(e,t)}function oe(e){if(!e||e.disabled||e.readOnly)return;x("toggleQuote","Starting"),gt(e,"Initial");let t=H(P.quote),n=yt(e,o=>te(o,t),{prefix:t.prefix});Xt(n),F(e,n),gt(e,"Final")}function ie(e){if(!e||e.disabled||e.readOnly)return;let t=H(P.taskList),n=yt(e,o=>te(o,t),{prefix:t.prefix});F(e,n)}function Rt(e,t=1,n=!1){if(!e||e.disabled||e.readOnly)return;(t<1||t>6)&&(t=1),x("insertHeader","============ START ============"),x("insertHeader",`Level: ${t}, Toggle: ${n}`),x("insertHeader",`Initial cursor: ${e.selectionStart}-${e.selectionEnd}`);let o=`header${t===1?"1":t}`,i=H(P[o]||P.header1);x("insertHeader",`Style prefix: "${i.prefix}"`);let r=e.value,s=e.selectionStart,l=e.selectionEnd,a=s;for(;a>0&&r[a-1]!==`
|
|
29
|
+
`;)a--;let p=l;for(;p<r.length&&r[p]!==`
|
|
30
|
+
`;)p++;let d=r.slice(a,p);x("insertHeader",`Current line (before): "${d}"`);let c=d.match(/^(#{1,6})\s*/),f=c?c[1].length:0,u=c?c[0].length:0;x("insertHeader","Existing header check:"),x("insertHeader",` - Match: ${c?`"${c[0]}"`:"none"}`),x("insertHeader",` - Existing level: ${f}`),x("insertHeader",` - Existing prefix length: ${u}`),x("insertHeader",` - Target level: ${t}`);let m=n&&f===t;x("insertHeader",`Should toggle OFF: ${m} (toggle=${n}, existingLevel=${f}, level=${t})`);let g=yt(e,h=>{let y=h.value.slice(h.selectionStart,h.selectionEnd);x("insertHeader",`Line in operation: "${y}"`);let v=y.replace(/^#{1,6}\s*/,"");x("insertHeader",`Cleaned line: "${v}"`);let w;return m?(x("insertHeader","ACTION: Toggling OFF - removing header"),w=v):f>0?(x("insertHeader",`ACTION: Replacing H${f} with H${t}`),w=i.prefix+v):(x("insertHeader","ACTION: Adding new header"),w=i.prefix+v),x("insertHeader",`New line: "${w}"`),{text:w,selectionStart:h.selectionStart,selectionEnd:h.selectionEnd}},{prefix:i.prefix,adjustSelection:(h,y,v,w)=>{if(x("insertHeader","Adjusting selection:"),x("insertHeader",` - isRemoving param: ${h}`),x("insertHeader",` - shouldToggleOff: ${m}`),x("insertHeader",` - selStart: ${y}, selEnd: ${v}`),x("insertHeader",` - lineStartPos: ${w}`),m){let S=Math.max(y-u,w);return x("insertHeader",` - Removing header, adjusting by -${u}`),{start:S,end:y===v?S:Math.max(v-u,w)}}else if(u>0){let S=i.prefix.length-u;return x("insertHeader",` - Replacing header, adjusting by ${S}`),{start:y+S,end:v+S}}else return x("insertHeader",` - Adding header, adjusting by +${i.prefix.length}`),{start:y+i.prefix.length,end:v+i.prefix.length}}});x("insertHeader",`Final result: text="${g.text}", cursor=${g.selectionStart}-${g.selectionEnd}`),x("insertHeader","============ END ============"),F(e,g)}function re(e){Rt(e,1,!0)}function se(e){Rt(e,2,!0)}function le(e){Rt(e,3,!0)}function ae(e){return yn(e)}var ot=class{constructor(t){this.editor=t,this.textarea=t.textarea}handleKeydown(t){if(!(navigator.platform.toLowerCase().includes("mac")?t.metaKey:t.ctrlKey))return!1;let i=null;switch(t.key.toLowerCase()){case"b":t.shiftKey||(i="toggleBold");break;case"i":t.shiftKey||(i="toggleItalic");break;case"k":t.shiftKey||(i="insertLink");break;case"7":t.shiftKey&&(i="toggleNumberedList");break;case"8":t.shiftKey&&(i="toggleBulletList");break}return i?(t.preventDefault(),this.editor.toolbar?this.editor.toolbar.handleAction(i):this.handleAction(i),!0):!1}async handleAction(t){let n=this.textarea;if(n){n.focus();try{switch(t){case"toggleBold":bt(n);break;case"toggleItalic":xt(n);break;case"insertLink":kt(n);break;case"toggleBulletList":St(n);break;case"toggleNumberedList":Lt(n);break}n.dispatchEvent(new Event("input",{bubbles:!0}))}catch(o){console.error("Error in markdown action:",o)}}}destroy(){}};var D={name:"solar",colors:{bgPrimary:"#faf0ca",bgSecondary:"#ffffff",text:"#0d3b66",h1:"#f95738",h2:"#ee964b",h3:"#3d8a51",strong:"#ee964b",em:"#f95738",link:"#0d3b66",code:"#0d3b66",codeBg:"rgba(244, 211, 94, 0.4)",blockquote:"#5a7a9b",hr:"#5a7a9b",syntaxMarker:"rgba(13, 59, 102, 0.52)",cursor:"#f95738",selection:"rgba(244, 211, 94, 0.4)",listMarker:"#ee964b",toolbarBg:"#ffffff",toolbarBorder:"rgba(13, 59, 102, 0.15)",toolbarIcon:"#0d3b66",toolbarHover:"#f5f5f5",toolbarActive:"#faf0ca"}},pe={name:"cave",colors:{bgPrimary:"#141E26",bgSecondary:"#1D2D3E",text:"#c5dde8",h1:"#d4a5ff",h2:"#f6ae2d",h3:"#9fcfec",strong:"#f6ae2d",em:"#9fcfec",link:"#9fcfec",code:"#c5dde8",codeBg:"#1a232b",blockquote:"#9fcfec",hr:"#c5dde8",syntaxMarker:"rgba(159, 207, 236, 0.73)",cursor:"#f26419",selection:"rgba(51, 101, 138, 0.4)",listMarker:"#f6ae2d",toolbarBg:"#1D2D3E",toolbarBorder:"rgba(197, 221, 232, 0.1)",toolbarIcon:"#c5dde8",toolbarHover:"#243546",toolbarActive:"#2a3f52"}},de={solar:D,cave:pe,light:D,dark:pe};function Y(e){return typeof e=="string"?{...de[e]||de.solar,name:e}:e}function it(e){let t=[];for(let[n,o]of Object.entries(e)){let i=n.replace(/([A-Z])/g,"-$1").toLowerCase();t.push(`--${i}: ${o};`)}return t.join(`
|
|
31
|
+
`)}function ue(e,t={}){return{...e,colors:{...e.colors,...t}}}function fe(e={}){let{fontSize:t="14px",lineHeight:n=1.6,fontFamily:o="ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', monospace",padding:i="20px",theme:r=null,mobile:s={}}=e,l=Object.keys(s).length>0?`
|
|
32
32
|
@media (max-width: 640px) {
|
|
33
33
|
.overtype-wrapper .overtype-input,
|
|
34
34
|
.overtype-wrapper .overtype-preview {
|
|
35
|
-
${Object.entries(s).map(([
|
|
35
|
+
${Object.entries(s).map(([p,d])=>`${p.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${d} !important;`).join(`
|
|
36
36
|
`)}
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
`:"",
|
|
39
|
+
`:"",a=r&&r.colors?it(r.colors):"";return`
|
|
40
40
|
/* OverType Editor Styles */
|
|
41
41
|
.overtype-container {
|
|
42
42
|
position: relative !important;
|
|
43
43
|
width: 100% !important;
|
|
44
44
|
height: 100% !important;
|
|
45
|
-
${
|
|
45
|
+
${a?`
|
|
46
46
|
/* Theme Variables */
|
|
47
|
-
${
|
|
47
|
+
${a}`:""}
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
.overtype-wrapper {
|
|
@@ -67,8 +67,8 @@ ${a}`:i;if(u){let x=n.value[n.selectionStart-1];n.selectionStart!==0&&x!=null&&!
|
|
|
67
67
|
|
|
68
68
|
/* Font properties - any difference breaks alignment */
|
|
69
69
|
font-family: ${o} !important;
|
|
70
|
-
font-size: var(--instance-font-size, ${
|
|
71
|
-
line-height: var(--instance-line-height, ${
|
|
70
|
+
font-size: var(--instance-font-size, ${t}) !important;
|
|
71
|
+
line-height: var(--instance-line-height, ${n}) !important;
|
|
72
72
|
font-weight: normal !important;
|
|
73
73
|
font-style: normal !important;
|
|
74
74
|
font-variant: normal !important;
|
|
@@ -77,7 +77,7 @@ ${a}`:i;if(u){let x=n.value[n.selectionStart-1];n.selectionStart!==0&&x!=null&&!
|
|
|
77
77
|
font-feature-settings: normal !important;
|
|
78
78
|
|
|
79
79
|
/* Box model - must match exactly */
|
|
80
|
-
padding: var(--instance-padding, ${
|
|
80
|
+
padding: var(--instance-padding, ${i}) !important;
|
|
81
81
|
margin: 0 !important;
|
|
82
82
|
border: none !important;
|
|
83
83
|
outline: none !important;
|
|
@@ -233,6 +233,8 @@ ${a}`:i;if(u){let x=n.value[n.selectionStart-1];n.selectionStart!==0&&x!=null&&!
|
|
|
233
233
|
padding: 0 !important;
|
|
234
234
|
border-radius: 2px !important;
|
|
235
235
|
font-family: inherit !important;
|
|
236
|
+
font-size: inherit !important;
|
|
237
|
+
line-height: inherit !important;
|
|
236
238
|
font-weight: normal !important;
|
|
237
239
|
}
|
|
238
240
|
|
|
@@ -467,36 +469,36 @@ ${a}`:i;if(u){let x=n.value[n.selectionStart-1];n.selectionStart!==0&&x!=null&&!
|
|
|
467
469
|
}
|
|
468
470
|
}
|
|
469
471
|
|
|
470
|
-
${
|
|
471
|
-
`}var
|
|
472
|
+
${l}
|
|
473
|
+
`}var he=`<svg viewBox="0 0 18 18">
|
|
472
474
|
<path stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z"></path>
|
|
473
475
|
<path stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z"></path>
|
|
474
|
-
</svg>`,
|
|
476
|
+
</svg>`,me=`<svg viewBox="0 0 18 18">
|
|
475
477
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="7" x2="13" y1="4" y2="4"></line>
|
|
476
478
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="5" x2="11" y1="14" y2="14"></line>
|
|
477
479
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="8" x2="10" y1="14" y2="4"></line>
|
|
478
|
-
</svg>`,
|
|
480
|
+
</svg>`,ge=`<svg viewBox="0 0 18 18">
|
|
479
481
|
<path fill="currentColor" d="M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z"></path>
|
|
480
|
-
</svg>`,
|
|
482
|
+
</svg>`,ve=`<svg viewBox="0 0 18 18">
|
|
481
483
|
<path fill="currentColor" d="M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"></path>
|
|
482
|
-
</svg>`,
|
|
484
|
+
</svg>`,ye=`<svg viewBox="0 0 18 18">
|
|
483
485
|
<path fill="currentColor" d="M16.65186,12.30664a2.6742,2.6742,0,0,1-2.915,2.68457,3.96592,3.96592,0,0,1-2.25537-.6709.56007.56007,0,0,1-.13232-.83594L11.64648,13c.209-.34082.48389-.36328.82471-.1543a2.32654,2.32654,0,0,0,1.12256.33008c.71484,0,1.12207-.35156,1.12207-.78125,0-.61523-.61621-.86816-1.46338-.86816H13.2085a.65159.65159,0,0,1-.68213-.41895l-.05518-.10937a.67114.67114,0,0,1,.14307-.78125l.71533-.86914a8.55289,8.55289,0,0,1,.68213-.7373V8.58887a3.93913,3.93913,0,0,1-.748.05469H11.9873a.54085.54085,0,0,1-.605-.60547V7.59863a.54085.54085,0,0,1,.605-.60547h3.75146a.53773.53773,0,0,1,.60547.59375v.17676a1.03723,1.03723,0,0,1-.27539.748L14.74854,10.0293A2.31132,2.31132,0,0,1,16.65186,12.30664ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z"></path>
|
|
484
|
-
</svg>`,
|
|
486
|
+
</svg>`,we=`<svg viewBox="0 0 18 18">
|
|
485
487
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="7" x2="11" y1="7" y2="11"></line>
|
|
486
488
|
<path stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z"></path>
|
|
487
489
|
<path stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z"></path>
|
|
488
|
-
</svg>`,
|
|
490
|
+
</svg>`,be=`<svg viewBox="0 0 18 18">
|
|
489
491
|
<polyline stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" points="5 7 3 9 5 11"></polyline>
|
|
490
492
|
<polyline stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" points="13 7 15 9 13 11"></polyline>
|
|
491
493
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="10" x2="8" y1="5" y2="13"></line>
|
|
492
|
-
</svg>`,
|
|
494
|
+
</svg>`,xe=`<svg viewBox="0 0 18 18">
|
|
493
495
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="6" x2="15" y1="4" y2="4"></line>
|
|
494
496
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="6" x2="15" y1="9" y2="9"></line>
|
|
495
497
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="6" x2="15" y1="14" y2="14"></line>
|
|
496
498
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="3" x2="3" y1="4" y2="4"></line>
|
|
497
499
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="3" x2="3" y1="9" y2="9"></line>
|
|
498
500
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="3" x2="3" y1="14" y2="14"></line>
|
|
499
|
-
</svg>`,
|
|
501
|
+
</svg>`,ke=`<svg viewBox="0 0 18 18">
|
|
500
502
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="7" x2="15" y1="4" y2="4"></line>
|
|
501
503
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="7" x2="15" y1="9" y2="9"></line>
|
|
502
504
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="7" x2="15" y1="14" y2="14"></line>
|
|
@@ -504,26 +506,56 @@ ${a}`:i;if(u){let x=n.value[n.selectionStart-1];n.selectionStart!==0&&x!=null&&!
|
|
|
504
506
|
<path fill="currentColor" d="M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z"></path>
|
|
505
507
|
<path stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156"></path>
|
|
506
508
|
<path stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="1" d="M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109"></path>
|
|
507
|
-
</svg
|
|
509
|
+
</svg>`,Se=`<svg viewBox="2 2 20 20">
|
|
508
510
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10 10.8182L9 10.8182C8.80222 10.8182 8.60888 10.7649 8.44443 10.665C8.27998 10.5651 8.15181 10.4231 8.07612 10.257C8.00043 10.0909 7.98063 9.90808 8.01922 9.73174C8.0578 9.55539 8.15304 9.39341 8.29289 9.26627C8.43275 9.13913 8.61093 9.05255 8.80491 9.01747C8.99889 8.98239 9.19996 9.00039 9.38268 9.0692C9.56541 9.13801 9.72159 9.25453 9.83147 9.40403C9.94135 9.55353 10 9.72929 10 9.90909L10 12.1818C10 12.664 9.78929 13.1265 9.41421 13.4675C9.03914 13.8084 8.53043 14 8 14"></path>
|
|
509
511
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 10.8182L15 10.8182C14.8022 10.8182 14.6089 10.7649 14.4444 10.665C14.28 10.5651 14.1518 10.4231 14.0761 10.257C14.0004 10.0909 13.9806 9.90808 14.0192 9.73174C14.0578 9.55539 14.153 9.39341 14.2929 9.26627C14.4327 9.13913 14.6109 9.05255 14.8049 9.01747C14.9989 8.98239 15.2 9.00039 15.3827 9.0692C15.5654 9.13801 15.7216 9.25453 15.8315 9.40403C15.9414 9.55353 16 9.72929 16 9.90909L16 12.1818C16 12.664 15.7893 13.1265 15.4142 13.4675C15.0391 13.8084 14.5304 14 14 14"></path>
|
|
510
|
-
</svg>`,
|
|
512
|
+
</svg>`,Le=`<svg viewBox="0 0 18 18">
|
|
511
513
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="8" x2="16" y1="4" y2="4"></line>
|
|
512
514
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="8" x2="16" y1="9" y2="9"></line>
|
|
513
515
|
<line stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" x1="8" x2="16" y1="14" y2="14"></line>
|
|
514
516
|
<rect stroke="currentColor" fill="none" stroke-width="1.5" x="2" y="3" width="3" height="3" rx="0.5"></rect>
|
|
515
517
|
<rect stroke="currentColor" fill="none" stroke-width="1.5" x="2" y="13" width="3" height="3" rx="0.5"></rect>
|
|
516
518
|
<polyline stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" points="2.65 9.5 3.5 10.5 5 8.5"></polyline>
|
|
517
|
-
</svg>`;var U=class{constructor(e){this.editor=e,this.container=null,this.buttons={}}create(){this.container=document.createElement("div"),this.container.className="overtype-toolbar",this.container.setAttribute("role","toolbar"),this.container.setAttribute("aria-label","Text formatting"),[{name:"bold",icon:ke,title:"Bold (Ctrl+B)",action:"toggleBold"},{name:"italic",icon:we,title:"Italic (Ctrl+I)",action:"toggleItalic"},{separator:!0},{name:"h1",icon:xe,title:"Heading 1",action:"insertH1"},{name:"h2",icon:Se,title:"Heading 2",action:"insertH2"},{name:"h3",icon:Le,title:"Heading 3",action:"insertH3"},{separator:!0},{name:"link",icon:Ce,title:"Insert Link (Ctrl+K)",action:"insertLink"},{name:"code",icon:Ee,title:"Code (Ctrl+`)",action:"toggleCode"},{separator:!0},{name:"quote",icon:$e,title:"Quote",action:"toggleQuote"},{separator:!0},{name:"bulletList",icon:Ae,title:"Bullet List",action:"toggleBulletList"},{name:"orderedList",icon:Te,title:"Numbered List",action:"toggleNumberedList"},{name:"taskList",icon:Be,title:"Task List",action:"toggleTaskList"}].forEach(r=>{if(r.separator){let i=document.createElement("div");i.className="overtype-toolbar-separator",i.setAttribute("role","separator"),this.container.appendChild(i)}else{let i=this.createButton(r);this.buttons[r.name]=i,this.container.appendChild(i)}});let t=this.editor.element.querySelector(".overtype-container"),o=this.editor.element.querySelector(".overtype-wrapper");return t&&o&&t.insertBefore(this.container,o),this.container}createButton(e){let t=document.createElement("button");return t.className="overtype-toolbar-button",t.type="button",t.title=e.title,t.setAttribute("aria-label",e.title),t.setAttribute("data-action",e.action),t.innerHTML=e.icon,t.addEventListener("click",o=>{o.preventDefault(),this.handleAction(e.action)}),t}async handleAction(e){let t=this.editor.textarea;if(t){t.focus();try{switch(e){case"toggleBold":R(t);break;case"toggleItalic":q(t);break;case"insertH1":de(t);break;case"insertH2":ue(t);break;case"insertH3":he(t);break;case"insertLink":D(t);break;case"toggleCode":le(t);break;case"toggleBulletList":W(t);break;case"toggleNumberedList":K(t);break;case"toggleQuote":ce(t);break;case"toggleTaskList":pe(t);break}t.dispatchEvent(new Event("input",{bubbles:!0}))}catch(o){console.error("Error loading markdown-actions:",o)}}}async updateButtonStates(){let e=this.editor.textarea;if(e)try{let t=fe(e);Object.entries(this.buttons).forEach(([o,r])=>{let i=!1;switch(o){case"bold":i=t.includes("bold");break;case"italic":i=t.includes("italic");break;case"code":i=!1;break;case"bulletList":i=t.includes("bullet-list");break;case"orderedList":i=t.includes("numbered-list");break;case"quote":i=t.includes("quote");break;case"taskList":i=t.includes("task-list");break;case"h1":i=t.includes("header");break;case"h2":i=t.includes("header-2");break;case"h3":i=t.includes("header-3");break}r.classList.toggle("active",i),r.setAttribute("aria-pressed",i.toString())})}catch(t){}}destroy(){this.container&&(this.container.remove(),this.container=null,this.buttons={})}};var k=class k{constructor(e,t={}){let o;if(typeof e=="string"){if(o=document.querySelectorAll(e),o.length===0)throw new Error(`No elements found for selector: ${e}`);o=Array.from(o)}else if(e instanceof Element)o=[e];else if(e instanceof NodeList)o=Array.from(e);else if(Array.isArray(e))o=e;else throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");return o.map(i=>{if(i.overTypeInstance)return i.overTypeInstance.reinit(t),i.overTypeInstance;let s=Object.create(k.prototype);return s._init(i,t),i.overTypeInstance=s,k.instances.set(i,s),s})}_init(e,t={}){this.element=e,this.instanceTheme=t.theme||null,this.options=this._mergeOptions(t),this.instanceId=++k.instanceCount,this.initialized=!1,k.injectStyles(),k.initGlobalListeners();let o=e.querySelector(".overtype-container"),r=e.querySelector(".overtype-wrapper");o||r?this._recoverFromDOM(o,r):this._buildFromScratch(),this.shortcuts=new j(this),this.options.toolbar&&(this.toolbar=new U(this),this.toolbar.create(),this.textarea.addEventListener("selectionchange",()=>{this.toolbar.updateButtonStates()}),this.textarea.addEventListener("input",()=>{this.toolbar.updateButtonStates()})),this.initialized=!0,this.options.onChange&&this.options.onChange(this.getValue(),this)}_mergeOptions(e){let t={fontSize:"14px",lineHeight:1.6,fontFamily:"'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace",padding:"16px",mobile:{fontSize:"16px",padding:"12px",lineHeight:1.5},autofocus:!1,placeholder:"Start typing...",value:"",onChange:null,onKeydown:null,showActiveLineRaw:!1,showStats:!1,toolbar:!1,statsFormatter:null},{theme:o,colors:r,...i}=e;return{...t,...i}}_recoverFromDOM(e,t){if(e&&e.classList.contains("overtype-container"))this.container=e,this.wrapper=e.querySelector(".overtype-wrapper");else if(t){this.wrapper=t,this.container=document.createElement("div"),this.container.className="overtype-container";let o=this.instanceTheme||k.currentTheme||B,r=typeof o=="string"?o:o.name;if(r&&this.container.setAttribute("data-theme",r),this.instanceTheme){let i=typeof this.instanceTheme=="string"?H(this.instanceTheme):this.instanceTheme;if(i&&i.colors){let s=N(i.colors);this.container.style.cssText+=s}}t.parentNode.insertBefore(this.container,t),this.container.appendChild(t)}if(!this.wrapper){e&&e.remove(),t&&t.remove(),this._buildFromScratch();return}if(this.textarea=this.wrapper.querySelector(".overtype-input"),this.preview=this.wrapper.querySelector(".overtype-preview"),!this.textarea||!this.preview){this.container.remove(),this._buildFromScratch();return}this.wrapper._instance=this,this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this._configureTextarea(),this._applyOptions()}_buildFromScratch(){let e=this._extractContent();this.element.innerHTML="",this._createDOM(),(e||this.options.value)&&this.setValue(e||this.options.value),this._applyOptions()}_extractContent(){let e=this.element.querySelector(".overtype-input");return e?e.value:this.element.textContent||""}_createDOM(){this.container=document.createElement("div"),this.container.className="overtype-container";let e=this.instanceTheme||k.currentTheme||B,t=typeof e=="string"?e:e.name;if(t&&this.container.setAttribute("data-theme",t),this.instanceTheme){let o=typeof this.instanceTheme=="string"?H(this.instanceTheme):this.instanceTheme;if(o&&o.colors){let r=N(o.colors);this.container.style.cssText+=r}}this.wrapper=document.createElement("div"),this.wrapper.className="overtype-wrapper",this.options.showStats&&this.wrapper.classList.add("with-stats"),this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this.wrapper._instance=this,this.textarea=document.createElement("textarea"),this.textarea.className="overtype-input",this.textarea.placeholder=this.options.placeholder,this._configureTextarea(),this.preview=document.createElement("div"),this.preview.className="overtype-preview",this.preview.setAttribute("aria-hidden","true"),this.wrapper.appendChild(this.textarea),this.wrapper.appendChild(this.preview),this.options.showStats&&(this.statsBar=document.createElement("div"),this.statsBar.className="overtype-stats",this.wrapper.appendChild(this.statsBar),this._updateStats()),this.container.appendChild(this.wrapper),this.element.appendChild(this.container)}_configureTextarea(){this.textarea.setAttribute("autocomplete","off"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.setAttribute("data-gramm","false"),this.textarea.setAttribute("data-gramm_editor","false"),this.textarea.setAttribute("data-enable-grammarly","false")}_applyOptions(){this.options.autofocus&&this.textarea.focus(),this.updatePreview()}updatePreview(){let e=this.textarea.value,t=this.textarea.selectionStart,o=this._getCurrentLine(e,t),r=M.parse(e,o,this.options.showActiveLineRaw);this.preview.innerHTML=r||'<span style="color: #808080;">Start typing...</span>',this._applyCodeBlockBackgrounds(),this.options.showStats&&this.statsBar&&this._updateStats(),this.options.onChange&&this.initialized&&this.options.onChange(e,this)}_applyCodeBlockBackgrounds(){let e=this.preview.querySelectorAll(".code-fence");for(let t=0;t<e.length-1;t+=2){let o=e[t],r=e[t+1],i=o.parentElement,s=r.parentElement;if(!i||!s)continue;o.style.display="block",r.style.display="block",i.classList.add("code-block-line"),s.classList.add("code-block-line");let a=i.nextElementSibling;for(;a&&a!==s&&(a.tagName==="DIV"&&a.classList.add("code-block-line"),a=a.nextElementSibling,!!a););}}_getCurrentLine(e,t){return e.substring(0,t).split(`
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
519
|
+
</svg>`;var Ct=class{constructor(t){this.editor=t,this.container=null,this.buttons={}}create(){this.container=document.createElement("div"),this.container.className="overtype-toolbar",this.container.setAttribute("role","toolbar"),this.container.setAttribute("aria-label","Text formatting"),[{name:"bold",icon:he,title:"Bold (Ctrl+B)",action:"toggleBold"},{name:"italic",icon:me,title:"Italic (Ctrl+I)",action:"toggleItalic"},{separator:!0},{name:"h1",icon:ge,title:"Heading 1",action:"insertH1"},{name:"h2",icon:ve,title:"Heading 2",action:"insertH2"},{name:"h3",icon:ye,title:"Heading 3",action:"insertH3"},{separator:!0},{name:"link",icon:we,title:"Insert Link (Ctrl+K)",action:"insertLink"},{name:"code",icon:be,title:"Code (Ctrl+`)",action:"toggleCode"},{separator:!0},{name:"quote",icon:Se,title:"Quote",action:"toggleQuote"},{separator:!0},{name:"bulletList",icon:xe,title:"Bullet List",action:"toggleBulletList"},{name:"orderedList",icon:ke,title:"Numbered List",action:"toggleNumberedList"},{name:"taskList",icon:Le,title:"Task List",action:"toggleTaskList"}].forEach(i=>{if(i.separator){let r=document.createElement("div");r.className="overtype-toolbar-separator",r.setAttribute("role","separator"),this.container.appendChild(r)}else{let r=this.createButton(i);this.buttons[i.name]=r,this.container.appendChild(r)}});let n=this.editor.element.querySelector(".overtype-container"),o=this.editor.element.querySelector(".overtype-wrapper");return n&&o&&n.insertBefore(this.container,o),this.container}createButton(t){let n=document.createElement("button");return n.className="overtype-toolbar-button",n.type="button",n.title=t.title,n.setAttribute("aria-label",t.title),n.setAttribute("data-action",t.action),n.innerHTML=t.icon,n.addEventListener("click",o=>{o.preventDefault(),this.handleAction(t.action)}),n}async handleAction(t){let n=this.editor.textarea;if(n){n.focus();try{switch(t){case"toggleBold":bt(n);break;case"toggleItalic":xt(n);break;case"insertH1":re(n);break;case"insertH2":se(n);break;case"insertH3":le(n);break;case"insertLink":kt(n);break;case"toggleCode":ne(n);break;case"toggleBulletList":St(n);break;case"toggleNumberedList":Lt(n);break;case"toggleQuote":oe(n);break;case"toggleTaskList":ie(n);break}n.dispatchEvent(new Event("input",{bubbles:!0}))}catch(o){console.error("Error loading markdown-actions:",o)}}}async updateButtonStates(){let t=this.editor.textarea;if(t)try{let n=ae(t);Object.entries(this.buttons).forEach(([o,i])=>{let r=!1;switch(o){case"bold":r=n.includes("bold");break;case"italic":r=n.includes("italic");break;case"code":r=!1;break;case"bulletList":r=n.includes("bullet-list");break;case"orderedList":r=n.includes("numbered-list");break;case"quote":r=n.includes("quote");break;case"taskList":r=n.includes("task-list");break;case"h1":r=n.includes("header");break;case"h2":r=n.includes("header-2");break;case"h3":r=n.includes("header-3");break}i.classList.toggle("active",r),i.setAttribute("aria-pressed",r.toString())})}catch(n){}}destroy(){this.container&&(this.container.remove(),this.container=null,this.buttons={})}};var st=Math.min,_=Math.max,lt=Math.round;var O=e=>({x:e,y:e}),bn={left:"right",right:"left",bottom:"top",top:"bottom"},xn={start:"end",end:"start"};function It(e,t,n){return _(e,st(t,n))}function at(e,t){return typeof e=="function"?e(t):e}function V(e){return e.split("-")[0]}function ct(e){return e.split("-")[1]}function Nt(e){return e==="x"?"y":"x"}function jt(e){return e==="y"?"height":"width"}var kn=new Set(["top","bottom"]);function R(e){return kn.has(V(e))?"y":"x"}function Ft(e){return Nt(R(e))}function Ee(e,t,n){n===void 0&&(n=!1);let o=ct(e),i=Ft(e),r=jt(i),s=i==="x"?o===(n?"end":"start")?"right":"left":o==="start"?"bottom":"top";return t.reference[r]>t.floating[r]&&(s=rt(s)),[s,rt(s)]}function Te(e){let t=rt(e);return[At(e),t,At(t)]}function At(e){return e.replace(/start|end/g,t=>xn[t])}var Ce=["left","right"],Ae=["right","left"],Sn=["top","bottom"],Ln=["bottom","top"];function Cn(e,t,n){switch(e){case"top":case"bottom":return n?t?Ae:Ce:t?Ce:Ae;case"left":case"right":return t?Sn:Ln;default:return[]}}function Oe(e,t,n,o){let i=ct(e),r=Cn(V(e),n==="start",o);return i&&(r=r.map(s=>s+"-"+i),t&&(r=r.concat(r.map(At)))),r}function rt(e){return e.replace(/left|right|bottom|top/g,t=>bn[t])}function An(e){return{top:0,right:0,bottom:0,left:0,...e}}function Me(e){return typeof e!="number"?An(e):{top:e,right:e,bottom:e,left:e}}function q(e){let{x:t,y:n,width:o,height:i}=e;return{width:o,height:i,top:n,left:t,right:t+o,bottom:n+i,x:t,y:n}}function Pe(e,t,n){let{reference:o,floating:i}=e,r=R(t),s=Ft(t),l=jt(s),a=V(t),p=r==="y",d=o.x+o.width/2-i.width/2,c=o.y+o.height/2-i.height/2,f=o[l]/2-i[l]/2,u;switch(a){case"top":u={x:d,y:o.y-i.height};break;case"bottom":u={x:d,y:o.y+o.height};break;case"right":u={x:o.x+o.width,y:c};break;case"left":u={x:o.x-i.width,y:c};break;default:u={x:o.x,y:o.y}}switch(ct(t)){case"start":u[s]-=f*(n&&p?-1:1);break;case"end":u[s]+=f*(n&&p?-1:1);break}return u}var $e=async(e,t,n)=>{let{placement:o="bottom",strategy:i="absolute",middleware:r=[],platform:s}=n,l=r.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(t)),p=await s.getElementRects({reference:e,floating:t,strategy:i}),{x:d,y:c}=Pe(p,o,a),f=o,u={},m=0;for(let g=0;g<l.length;g++){let{name:h,fn:y}=l[g],{x:v,y:w,data:S,reset:b}=await y({x:d,y:c,initialPlacement:o,placement:f,strategy:i,middlewareData:u,rects:p,platform:s,elements:{reference:e,floating:t}});d=v!=null?v:d,c=w!=null?w:c,u={...u,[h]:{...u[h],...S}},b&&m<=50&&(m++,typeof b=="object"&&(b.placement&&(f=b.placement),b.rects&&(p=b.rects===!0?await s.getElementRects({reference:e,floating:t,strategy:i}):b.rects),{x:d,y:c}=Pe(p,f,a)),g=-1)}return{x:d,y:c,placement:f,strategy:i,middlewareData:u}};async function Dt(e,t){var n;t===void 0&&(t={});let{x:o,y:i,platform:r,rects:s,elements:l,strategy:a}=e,{boundary:p="clippingAncestors",rootBoundary:d="viewport",elementContext:c="floating",altBoundary:f=!1,padding:u=0}=at(t,e),m=Me(u),h=l[f?c==="floating"?"reference":"floating":c],y=q(await r.getClippingRect({element:(n=await(r.isElement==null?void 0:r.isElement(h)))==null||n?h:h.contextElement||await(r.getDocumentElement==null?void 0:r.getDocumentElement(l.floating)),boundary:p,rootBoundary:d,strategy:a})),v=c==="floating"?{x:o,y:i,width:s.floating.width,height:s.floating.height}:s.reference,w=await(r.getOffsetParent==null?void 0:r.getOffsetParent(l.floating)),S=await(r.isElement==null?void 0:r.isElement(w))?await(r.getScale==null?void 0:r.getScale(w))||{x:1,y:1}:{x:1,y:1},b=q(r.convertOffsetParentRelativeRectToViewportRelativeRect?await r.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(y.top-b.top+m.top)/S.y,bottom:(b.bottom-y.bottom+m.bottom)/S.y,left:(y.left-b.left+m.left)/S.x,right:(b.right-y.right+m.right)/S.x}}var Be=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,o;let{placement:i,middlewareData:r,rects:s,initialPlacement:l,platform:a,elements:p}=t,{mainAxis:d=!0,crossAxis:c=!0,fallbackPlacements:f,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...h}=at(e,t);if((n=r.arrow)!=null&&n.alignmentOffset)return{};let y=V(i),v=R(l),w=V(l)===l,S=await(a.isRTL==null?void 0:a.isRTL(p.floating)),b=f||(w||!g?[rt(l)]:Te(l)),C=m!=="none";!f&&C&&b.push(...Oe(l,g,m,S));let ft=[l,...b],Z=await Dt(t,h),ht=[],J=((o=r.flip)==null?void 0:o.overflows)||[];if(d&&ht.push(Z[y]),c){let z=Ee(i,s,S);ht.push(Z[z[0]],Z[z[1]])}if(J=[...J,{placement:i,overflows:ht}],!ht.every(z=>z<=0)){var zt,Wt;let z=(((zt=r.flip)==null?void 0:zt.index)||0)+1,Bt=ft[z];if(Bt&&(!(c==="alignment"?v!==R(Bt):!1)||J.every(T=>R(T.placement)===v?T.overflows[0]>0:!0)))return{data:{index:z,overflows:J},reset:{placement:Bt}};let G=(Wt=J.filter(W=>W.overflows[0]<=0).sort((W,T)=>W.overflows[1]-T.overflows[1])[0])==null?void 0:Wt.placement;if(!G)switch(u){case"bestFit":{var qt;let W=(qt=J.filter(T=>{if(C){let j=R(T.placement);return j===v||j==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(j=>j>0).reduce((j,Ge)=>j+Ge,0)]).sort((T,j)=>T[1]-j[1])[0])==null?void 0:qt[0];W&&(G=W);break}case"initialPlacement":G=l;break}if(i!==G)return{reset:{placement:G}}}return{}}}};var En=new Set(["left","top"]);async function Tn(e,t){let{placement:n,platform:o,elements:i}=e,r=await(o.isRTL==null?void 0:o.isRTL(i.floating)),s=V(n),l=ct(n),a=R(n)==="y",p=En.has(s)?-1:1,d=r&&a?-1:1,c=at(t,e),{mainAxis:f,crossAxis:u,alignmentAxis:m}=typeof c=="number"?{mainAxis:c,crossAxis:0,alignmentAxis:null}:{mainAxis:c.mainAxis||0,crossAxis:c.crossAxis||0,alignmentAxis:c.alignmentAxis};return l&&typeof m=="number"&&(u=l==="end"?m*-1:m),a?{x:u*d,y:f*p}:{x:f*p,y:u*d}}var He=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,o;let{x:i,y:r,placement:s,middlewareData:l}=t,a=await Tn(t,e);return s===((n=l.offset)==null?void 0:n.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:i+a.x,y:r+a.y,data:{...a,placement:s}}}}},Re=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){let{x:n,y:o,placement:i}=t,{mainAxis:r=!0,crossAxis:s=!1,limiter:l={fn:h=>{let{x:y,y:v}=h;return{x:y,y:v}}},...a}=at(e,t),p={x:n,y:o},d=await Dt(t,a),c=R(V(i)),f=Nt(c),u=p[f],m=p[c];if(r){let h=f==="y"?"top":"left",y=f==="y"?"bottom":"right",v=u+d[h],w=u-d[y];u=It(v,u,w)}if(s){let h=c==="y"?"top":"left",y=c==="y"?"bottom":"right",v=m+d[h],w=m-d[y];m=It(v,m,w)}let g=l.fn({...t,[f]:u,[c]:m});return{...g,data:{x:g.x-n,y:g.y-o,enabled:{[f]:r,[c]:s}}}}}};function Tt(){return typeof window<"u"}function K(e){return Ne(e)?(e.nodeName||"").toLowerCase():"#document"}function L(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function $(e){var t;return(t=(Ne(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function Ne(e){return Tt()?e instanceof Node||e instanceof L(e).Node:!1}function A(e){return Tt()?e instanceof Element||e instanceof L(e).Element:!1}function M(e){return Tt()?e instanceof HTMLElement||e instanceof L(e).HTMLElement:!1}function Ie(e){return!Tt()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof L(e).ShadowRoot}var On=new Set(["inline","contents"]);function Q(e){let{overflow:t,overflowX:n,overflowY:o,display:i}=E(e);return/auto|scroll|overlay|hidden|clip/.test(t+o+n)&&!On.has(i)}var Mn=new Set(["table","td","th"]);function je(e){return Mn.has(K(e))}var Pn=[":popover-open",":modal"];function pt(e){return Pn.some(t=>{try{return e.matches(t)}catch(n){return!1}})}var $n=["transform","translate","scale","rotate","perspective"],Bn=["transform","translate","scale","rotate","perspective","filter"],Hn=["paint","layout","strict","content"];function Ot(e){let t=Mt(),n=A(e)?E(e):e;return $n.some(o=>n[o]?n[o]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||Bn.some(o=>(n.willChange||"").includes(o))||Hn.some(o=>(n.contain||"").includes(o))}function Fe(e){let t=I(e);for(;M(t)&&!U(t);){if(Ot(t))return t;if(pt(t))return null;t=I(t)}return null}function Mt(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}var Rn=new Set(["html","body","#document"]);function U(e){return Rn.has(K(e))}function E(e){return L(e).getComputedStyle(e)}function dt(e){return A(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function I(e){if(K(e)==="html")return e;let t=e.assignedSlot||e.parentNode||Ie(e)&&e.host||$(e);return Ie(t)?t.host:t}function De(e){let t=I(e);return U(t)?e.ownerDocument?e.ownerDocument.body:e.body:M(t)&&Q(t)?t:De(t)}function Et(e,t,n){var o;t===void 0&&(t=[]),n===void 0&&(n=!0);let i=De(e),r=i===((o=e.ownerDocument)==null?void 0:o.body),s=L(i);if(r){let l=Pt(s);return t.concat(s,s.visualViewport||[],Q(i)?i:[],l&&n?Et(l):[])}return t.concat(i,Et(i,[],n))}function Pt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ze(e){let t=E(e),n=parseFloat(t.width)||0,o=parseFloat(t.height)||0,i=M(e),r=i?e.offsetWidth:n,s=i?e.offsetHeight:o,l=lt(n)!==r||lt(o)!==s;return l&&(n=r,o=s),{width:n,height:o,$:l}}function We(e){return A(e)?e:e.contextElement}function X(e){let t=We(e);if(!M(t))return O(1);let n=t.getBoundingClientRect(),{width:o,height:i,$:r}=ze(t),s=(r?lt(n.width):n.width)/o,l=(r?lt(n.height):n.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}var In=O(0);function qe(e){let t=L(e);return!Mt()||!t.visualViewport?In:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function Nn(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==L(e)?!1:t}function ut(e,t,n,o){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),r=We(e),s=O(1);t&&(o?A(o)&&(s=X(o)):s=X(e));let l=Nn(r,n,o)?qe(r):O(0),a=(i.left+l.x)/s.x,p=(i.top+l.y)/s.y,d=i.width/s.x,c=i.height/s.y;if(r){let f=L(r),u=o&&A(o)?L(o):o,m=f,g=Pt(m);for(;g&&o&&u!==m;){let h=X(g),y=g.getBoundingClientRect(),v=E(g),w=y.left+(g.clientLeft+parseFloat(v.paddingLeft))*h.x,S=y.top+(g.clientTop+parseFloat(v.paddingTop))*h.y;a*=h.x,p*=h.y,d*=h.x,c*=h.y,a+=w,p+=S,m=L(g),g=Pt(m)}}return q({width:d,height:c,x:a,y:p})}function Vt(e,t){let n=dt(e).scrollLeft;return t?t.left+n:ut($(e)).left+n}function Ke(e,t,n){n===void 0&&(n=!1);let o=e.getBoundingClientRect(),i=o.left+t.scrollLeft-(n?0:Vt(e,o)),r=o.top+t.scrollTop;return{x:i,y:r}}function jn(e){let{elements:t,rect:n,offsetParent:o,strategy:i}=e,r=i==="fixed",s=$(o),l=t?pt(t.floating):!1;if(o===s||l&&r)return n;let a={scrollLeft:0,scrollTop:0},p=O(1),d=O(0),c=M(o);if((c||!c&&!r)&&((K(o)!=="body"||Q(s))&&(a=dt(o)),M(o))){let u=ut(o);p=X(o),d.x=u.x+o.clientLeft,d.y=u.y+o.clientTop}let f=s&&!c&&!r?Ke(s,a,!0):O(0);return{width:n.width*p.x,height:n.height*p.y,x:n.x*p.x-a.scrollLeft*p.x+d.x+f.x,y:n.y*p.y-a.scrollTop*p.y+d.y+f.y}}function Fn(e){return Array.from(e.getClientRects())}function Dn(e){let t=$(e),n=dt(e),o=e.ownerDocument.body,i=_(t.scrollWidth,t.clientWidth,o.scrollWidth,o.clientWidth),r=_(t.scrollHeight,t.clientHeight,o.scrollHeight,o.clientHeight),s=-n.scrollLeft+Vt(e),l=-n.scrollTop;return E(o).direction==="rtl"&&(s+=_(t.clientWidth,o.clientWidth)-i),{width:i,height:r,x:s,y:l}}function _n(e,t){let n=L(e),o=$(e),i=n.visualViewport,r=o.clientWidth,s=o.clientHeight,l=0,a=0;if(i){r=i.width,s=i.height;let p=Mt();(!p||p&&t==="fixed")&&(l=i.offsetLeft,a=i.offsetTop)}return{width:r,height:s,x:l,y:a}}var Vn=new Set(["absolute","fixed"]);function zn(e,t){let n=ut(e,!0,t==="fixed"),o=n.top+e.clientTop,i=n.left+e.clientLeft,r=M(e)?X(e):O(1),s=e.clientWidth*r.x,l=e.clientHeight*r.y,a=i*r.x,p=o*r.y;return{width:s,height:l,x:a,y:p}}function _e(e,t,n){let o;if(t==="viewport")o=_n(e,n);else if(t==="document")o=Dn($(e));else if(A(t))o=zn(t,n);else{let i=qe(e);o={x:t.x-i.x,y:t.y-i.y,width:t.width,height:t.height}}return q(o)}function Ue(e,t){let n=I(e);return n===t||!A(n)||U(n)?!1:E(n).position==="fixed"||Ue(n,t)}function Wn(e,t){let n=t.get(e);if(n)return n;let o=Et(e,[],!1).filter(l=>A(l)&&K(l)!=="body"),i=null,r=E(e).position==="fixed",s=r?I(e):e;for(;A(s)&&!U(s);){let l=E(s),a=Ot(s);!a&&l.position==="fixed"&&(i=null),(r?!a&&!i:!a&&l.position==="static"&&!!i&&Vn.has(i.position)||Q(s)&&!a&&Ue(e,s))?o=o.filter(d=>d!==s):i=l,s=I(s)}return t.set(e,o),o}function qn(e){let{element:t,boundary:n,rootBoundary:o,strategy:i}=e,s=[...n==="clippingAncestors"?pt(t)?[]:Wn(t,this._c):[].concat(n),o],l=s[0],a=s.reduce((p,d)=>{let c=_e(t,d,i);return p.top=_(c.top,p.top),p.right=st(c.right,p.right),p.bottom=st(c.bottom,p.bottom),p.left=_(c.left,p.left),p},_e(t,l,i));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Kn(e){let{width:t,height:n}=ze(e);return{width:t,height:n}}function Un(e,t,n){let o=M(t),i=$(t),r=n==="fixed",s=ut(e,!0,r,t),l={scrollLeft:0,scrollTop:0},a=O(0);function p(){a.x=Vt(i)}if(o||!o&&!r)if((K(t)!=="body"||Q(i))&&(l=dt(t)),o){let u=ut(t,!0,r,t);a.x=u.x+t.clientLeft,a.y=u.y+t.clientTop}else i&&p();r&&!o&&i&&p();let d=i&&!o&&!r?Ke(i,l):O(0),c=s.left+l.scrollLeft-a.x-d.x,f=s.top+l.scrollTop-a.y-d.y;return{x:c,y:f,width:s.width,height:s.height}}function _t(e){return E(e).position==="static"}function Ve(e,t){if(!M(e)||E(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return $(e)===n&&(n=n.ownerDocument.body),n}function Ze(e,t){let n=L(e);if(pt(e))return n;if(!M(e)){let i=I(e);for(;i&&!U(i);){if(A(i)&&!_t(i))return i;i=I(i)}return n}let o=Ve(e,t);for(;o&&je(o)&&_t(o);)o=Ve(o,t);return o&&U(o)&&_t(o)&&!Ot(o)?n:o||Fe(e)||n}var Zn=async function(e){let t=this.getOffsetParent||Ze,n=this.getDimensions,o=await n(e.floating);return{reference:Un(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Jn(e){return E(e).direction==="rtl"}var Yn={convertOffsetParentRelativeRectToViewportRelativeRect:jn,getDocumentElement:$,getClippingRect:qn,getOffsetParent:Ze,getElementRects:Zn,getClientRects:Fn,getDimensions:Kn,getScale:X,isElement:A,isRTL:Jn};var Je=He;var Ye=Re,Qe=Be;var Xe=(e,t,n)=>{let o=new Map,i={platform:Yn,...n},r={...i.platform,_c:o};return $e(e,t,{...i,platform:r})};var $t=class{constructor(t){this.editor=t,this.tooltip=null,this.currentLink=null,this.hideTimeout=null,this.isMouseInTooltip=!1,this.isMouseInLink=!1,this.init()}init(){this.createTooltip(),this.editor.textarea.addEventListener("selectionchange",()=>this.checkCursorPosition()),this.editor.textarea.addEventListener("input",()=>this.checkCursorPosition()),this.editor.textarea.addEventListener("keyup",t=>{t.key.includes("Arrow")&&this.checkCursorPosition()}),this.editor.textarea.addEventListener("scroll",()=>this.hide()),this.tooltip.addEventListener("mouseenter",()=>{this.isMouseInTooltip=!0,this.cancelHide()}),this.tooltip.addEventListener("mouseleave",()=>{this.isMouseInTooltip=!1,this.scheduleHide()})}createTooltip(){this.tooltip=document.createElement("div"),this.tooltip.className="overtype-link-tooltip",this.tooltip.style.cssText=`
|
|
520
|
+
position: absolute;
|
|
521
|
+
background: #333;
|
|
522
|
+
color: white;
|
|
523
|
+
padding: 6px 10px;
|
|
524
|
+
border-radius: 16px;
|
|
525
|
+
font-size: 12px;
|
|
526
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
|
|
527
|
+
display: none;
|
|
528
|
+
z-index: 10000;
|
|
529
|
+
cursor: pointer;
|
|
530
|
+
box-shadow: 0 2px 8px rgba(0,0,0,0.3);
|
|
531
|
+
max-width: 300px;
|
|
532
|
+
white-space: nowrap;
|
|
533
|
+
overflow: hidden;
|
|
534
|
+
text-overflow: ellipsis;
|
|
535
|
+
transition: opacity 0.2s;
|
|
536
|
+
opacity: 0;
|
|
537
|
+
`,this.tooltip.innerHTML=`
|
|
538
|
+
<span style="display: flex; align-items: center; gap: 6px;">
|
|
539
|
+
<svg width="12" height="12" viewBox="0 0 20 20" fill="currentColor" style="flex-shrink: 0;">
|
|
540
|
+
<path d="M11 3a1 1 0 100 2h2.586l-6.293 6.293a1 1 0 101.414 1.414L15 6.414V9a1 1 0 102 0V4a1 1 0 00-1-1h-5z"></path>
|
|
541
|
+
<path d="M5 5a2 2 0 00-2 2v8a2 2 0 002 2h8a2 2 0 002-2v-3a1 1 0 10-2 0v3H5V7h3a1 1 0 000-2H5z"></path>
|
|
542
|
+
</svg>
|
|
543
|
+
<span class="overtype-link-tooltip-url"></span>
|
|
544
|
+
</span>
|
|
545
|
+
`,this.tooltip.addEventListener("click",t=>{t.preventDefault(),t.stopPropagation(),this.currentLink&&(window.open(this.currentLink.url,"_blank"),this.hide())}),document.body.appendChild(this.tooltip)}checkCursorPosition(){let t=this.editor.textarea.selectionStart,n=this.editor.textarea.value,o=this.findLinkAtPosition(n,t);o?(this.isMouseInLink=!0,(!this.currentLink||this.currentLink.start!==o.start||this.currentLink.url!==o.url)&&this.show(o)):(this.isMouseInLink=!1,this.scheduleHide())}findLinkAtPosition(t,n){let o=/\[([^\]]+)\]\(([^)]+)\)/g,i;for(;(i=o.exec(t))!==null;){let r=i.index,s=i.index+i[0].length;if(n>=r&&n<=s)return{start:r,end:s,text:i[1],url:i[2],fullMatch:i[0]}}return null}async show(t){this.currentLink=t,this.cancelHide();let n=this.tooltip.querySelector(".overtype-link-tooltip-url");n.textContent=t.url;let o=this.findLinkElementInPreview(t);o?await this.positionTooltip(o):await this.positionTooltipAtCursor(t),this.tooltip.style.display="block",this.tooltip.offsetHeight,this.tooltip.style.opacity="1"}findLinkElementInPreview(t){let n=this.editor.preview.querySelectorAll("a");for(let o of n){let i=o.querySelectorAll(".syntax-marker");for(let r of i)if(r.textContent===t.url)return o}return null}async positionTooltip(t){let{x:n,y:o}=await Xe(t,this.tooltip,{placement:"bottom",middleware:[Je(6),Qe(),Ye({padding:10})]});Object.assign(this.tooltip.style,{left:`${n}px`,top:`${o}px`})}async positionTooltipAtCursor(t){let n=this.editor.textarea,o=document.createElement("div");o.style.cssText=window.getComputedStyle(n).cssText,o.style.position="absolute",o.style.visibility="hidden",o.style.whiteSpace="pre-wrap",o.style.wordWrap="break-word";let i=n.value.substring(0,t.start+t.fullMatch.length/2);o.textContent=i,document.body.appendChild(o);let r=o.offsetHeight;document.body.removeChild(o);let s=n.getBoundingClientRect(),l=s.left+s.width/2,a=s.top+Math.min(r,s.height-50);Object.assign(this.tooltip.style,{left:`${l}px`,top:`${a}px`,transform:"translateX(-50%)"})}hide(){this.tooltip.style.opacity="0",setTimeout(()=>{this.tooltip.style.opacity==="0"&&(this.tooltip.style.display="none",this.currentLink=null)},200)}scheduleHide(){this.cancelHide(),this.hideTimeout=setTimeout(()=>{!this.isMouseInTooltip&&!this.isMouseInLink&&this.hide()},300)}cancelHide(){this.hideTimeout&&(clearTimeout(this.hideTimeout),this.hideTimeout=null)}destroy(){this.cancelHide(),this.tooltip&&this.tooltip.parentNode&&this.tooltip.parentNode.removeChild(this.tooltip),this.tooltip=null,this.currentLink=null}};var k=class k{constructor(t,n={}){let o;if(typeof t=="string"){if(o=document.querySelectorAll(t),o.length===0)throw new Error(`No elements found for selector: ${t}`);o=Array.from(o)}else if(t instanceof Element)o=[t];else if(t instanceof NodeList)o=Array.from(t);else if(Array.isArray(t))o=t;else throw new Error("Invalid target: must be selector string, Element, NodeList, or Array");return o.map(r=>{if(r.overTypeInstance)return r.overTypeInstance.reinit(n),r.overTypeInstance;let s=Object.create(k.prototype);return s._init(r,n),r.overTypeInstance=s,k.instances.set(r,s),s})}_init(t,n={}){this.element=t,this.instanceTheme=n.theme||null,this.options=this._mergeOptions(n),this.instanceId=++k.instanceCount,this.initialized=!1,k.injectStyles(),k.initGlobalListeners();let o=t.querySelector(".overtype-container"),i=t.querySelector(".overtype-wrapper");o||i?this._recoverFromDOM(o,i):this._buildFromScratch(),this.shortcuts=new ot(this),this.linkTooltip=new $t(this),this.options.toolbar&&(this.toolbar=new Ct(this),this.toolbar.create(),this.textarea.addEventListener("selectionchange",()=>{this.toolbar.updateButtonStates()}),this.textarea.addEventListener("input",()=>{this.toolbar.updateButtonStates()})),this.initialized=!0,this.options.onChange&&this.options.onChange(this.getValue(),this)}_mergeOptions(t){let n={fontSize:"14px",lineHeight:1.6,fontFamily:"ui-monospace, 'SFMono-Regular', 'Menlo', 'Consolas', 'Liberation Mono', monospace",padding:"16px",mobile:{fontSize:"16px",padding:"12px",lineHeight:1.5},autofocus:!1,placeholder:"Start typing...",value:"",onChange:null,onKeydown:null,showActiveLineRaw:!1,showStats:!1,toolbar:!1,statsFormatter:null},{theme:o,colors:i,...r}=t;return{...n,...r}}_recoverFromDOM(t,n){if(t&&t.classList.contains("overtype-container"))this.container=t,this.wrapper=t.querySelector(".overtype-wrapper");else if(n){this.wrapper=n,this.container=document.createElement("div"),this.container.className="overtype-container";let o=this.instanceTheme||k.currentTheme||D,i=typeof o=="string"?o:o.name;if(i&&this.container.setAttribute("data-theme",i),this.instanceTheme){let r=typeof this.instanceTheme=="string"?Y(this.instanceTheme):this.instanceTheme;if(r&&r.colors){let s=it(r.colors);this.container.style.cssText+=s}}n.parentNode.insertBefore(this.container,n),this.container.appendChild(n)}if(!this.wrapper){t&&t.remove(),n&&n.remove(),this._buildFromScratch();return}if(this.textarea=this.wrapper.querySelector(".overtype-input"),this.preview=this.wrapper.querySelector(".overtype-preview"),!this.textarea||!this.preview){this.container.remove(),this._buildFromScratch();return}this.wrapper._instance=this,this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this._configureTextarea(),this._applyOptions()}_buildFromScratch(){let t=this._extractContent();this.element.innerHTML="",this._createDOM(),(t||this.options.value)&&this.setValue(t||this.options.value),this._applyOptions()}_extractContent(){let t=this.element.querySelector(".overtype-input");return t?t.value:this.element.textContent||""}_createDOM(){this.container=document.createElement("div"),this.container.className="overtype-container";let t=this.instanceTheme||k.currentTheme||D,n=typeof t=="string"?t:t.name;if(n&&this.container.setAttribute("data-theme",n),this.instanceTheme){let o=typeof this.instanceTheme=="string"?Y(this.instanceTheme):this.instanceTheme;if(o&&o.colors){let i=it(o.colors);this.container.style.cssText+=i}}this.wrapper=document.createElement("div"),this.wrapper.className="overtype-wrapper",this.options.showStats&&this.wrapper.classList.add("with-stats"),this.options.fontSize&&this.wrapper.style.setProperty("--instance-font-size",this.options.fontSize),this.options.lineHeight&&this.wrapper.style.setProperty("--instance-line-height",String(this.options.lineHeight)),this.options.padding&&this.wrapper.style.setProperty("--instance-padding",this.options.padding),this.wrapper._instance=this,this.textarea=document.createElement("textarea"),this.textarea.className="overtype-input",this.textarea.placeholder=this.options.placeholder,this._configureTextarea(),this.preview=document.createElement("div"),this.preview.className="overtype-preview",this.preview.setAttribute("aria-hidden","true"),this.wrapper.appendChild(this.textarea),this.wrapper.appendChild(this.preview),this.options.showStats&&(this.statsBar=document.createElement("div"),this.statsBar.className="overtype-stats",this.wrapper.appendChild(this.statsBar),this._updateStats()),this.container.appendChild(this.wrapper),this.element.appendChild(this.container)}_configureTextarea(){this.textarea.setAttribute("autocomplete","off"),this.textarea.setAttribute("autocorrect","off"),this.textarea.setAttribute("autocapitalize","off"),this.textarea.setAttribute("spellcheck","false"),this.textarea.setAttribute("data-gramm","false"),this.textarea.setAttribute("data-gramm_editor","false"),this.textarea.setAttribute("data-enable-grammarly","false")}_applyOptions(){this.options.autofocus&&this.textarea.focus(),this.updatePreview()}updatePreview(){let t=this.textarea.value,n=this.textarea.selectionStart,o=this._getCurrentLine(t,n),i=et.parse(t,o,this.options.showActiveLineRaw);this.preview.innerHTML=i||'<span style="color: #808080;">Start typing...</span>',this._applyCodeBlockBackgrounds(),this.options.showStats&&this.statsBar&&this._updateStats(),this.options.onChange&&this.initialized&&this.options.onChange(t,this)}_applyCodeBlockBackgrounds(){let t=this.preview.querySelectorAll(".code-fence");for(let n=0;n<t.length-1;n+=2){let o=t[n],i=t[n+1],r=o.parentElement,s=i.parentElement;if(!r||!s)continue;o.style.display="block",i.style.display="block",r.classList.add("code-block-line"),s.classList.add("code-block-line");let l=r.nextElementSibling;for(;l&&l!==s&&(l.tagName==="DIV"&&l.classList.add("code-block-line"),l=l.nextElementSibling,!!l););}}_getCurrentLine(t,n){return t.substring(0,n).split(`
|
|
546
|
+
`).length-1}handleInput(t){this.updatePreview()}handleKeydown(t){if(t.key==="Tab"){t.preventDefault();let o=this.textarea.selectionStart,i=this.textarea.selectionEnd,r=this.textarea.value;if(o!==i&&t.shiftKey){let s=r.substring(0,o),l=r.substring(o,i),a=r.substring(i),d=l.split(`
|
|
547
|
+
`).map(c=>c.replace(/^ /,"")).join(`
|
|
548
|
+
`);this.textarea.value=s+d+a,this.textarea.selectionStart=o,this.textarea.selectionEnd=o+d.length}else if(o!==i){let s=r.substring(0,o),l=r.substring(o,i),a=r.substring(i),d=l.split(`
|
|
549
|
+
`).map(c=>" "+c).join(`
|
|
550
|
+
`);this.textarea.value=s+d+a,this.textarea.selectionStart=o,this.textarea.selectionEnd=o+d.length}else this.textarea.value=r.substring(0,o)+" "+r.substring(i),this.textarea.selectionStart=this.textarea.selectionEnd=o+2;this.textarea.dispatchEvent(new Event("input",{bubbles:!0}));return}!this.shortcuts.handleKeydown(t)&&this.options.onKeydown&&this.options.onKeydown(t,this)}handleScroll(t){this.preview.scrollTop=this.textarea.scrollTop,this.preview.scrollLeft=this.textarea.scrollLeft}getValue(){return this.textarea.value}setValue(t){this.textarea.value=t,this.updatePreview()}focus(){this.textarea.focus()}blur(){this.textarea.blur()}isInitialized(){return this.initialized}reinit(t={}){this.options=this._mergeOptions({...this.options,...t}),this._applyOptions(),this.updatePreview()}_updateStats(){if(!this.statsBar)return;let t=this.textarea.value,n=t.split(`
|
|
551
|
+
`),o=t.length,i=t.split(/\s+/).filter(d=>d.length>0).length,r=this.textarea.selectionStart,l=t.substring(0,r).split(`
|
|
552
|
+
`),a=l.length,p=l[l.length-1].length+1;this.options.statsFormatter?this.statsBar.innerHTML=this.options.statsFormatter({chars:o,words:i,lines:n.length,line:a,column:p}):this.statsBar.innerHTML=`
|
|
521
553
|
<div class="overtype-stat">
|
|
522
554
|
<span class="live-dot"></span>
|
|
523
|
-
<span>${o} chars, ${
|
|
555
|
+
<span>${o} chars, ${i} words, ${n.length} lines</span>
|
|
524
556
|
</div>
|
|
525
|
-
<div class="overtype-stat">Line ${
|
|
526
|
-
`}showStats(
|
|
557
|
+
<div class="overtype-stat">Line ${a}, Col ${p}</div>
|
|
558
|
+
`}showStats(t){this.options.showStats=t,t&&!this.statsBar?(this.statsBar=document.createElement("div"),this.statsBar.className="overtype-stats",this.wrapper.appendChild(this.statsBar),this.wrapper.classList.add("with-stats"),this._updateStats()):!t&&this.statsBar&&(this.statsBar.remove(),this.statsBar=null,this.wrapper.classList.remove("with-stats"))}destroy(){if(this.element.overTypeInstance=null,k.instances.delete(this.element),this.shortcuts&&this.shortcuts.destroy(),this.wrapper){let t=this.getValue();this.wrapper.remove(),this.element.textContent=t}this.initialized=!1}static init(t,n={}){return new k(t,n)}static getInstance(t){return t.overTypeInstance||k.instances.get(t)||null}static destroyAll(){document.querySelectorAll("[data-overtype-instance]").forEach(n=>{let o=k.getInstance(n);o&&o.destroy()})}static injectStyles(t=!1){if(k.stylesInjected&&!t)return;let n=document.querySelector("style.overtype-styles");n&&n.remove();let o=k.currentTheme||D,i=fe({theme:o}),r=document.createElement("style");r.className="overtype-styles",r.textContent=i,document.head.appendChild(r),k.stylesInjected=!0}static setTheme(t,n=null){let o=typeof t=="string"?Y(t):t;n&&(o=ue(o,n)),k.currentTheme=o,k.injectStyles(!0),document.querySelectorAll(".overtype-container").forEach(i=>{let r=typeof o=="string"?o:o.name;r&&i.setAttribute("data-theme",r)}),document.querySelectorAll(".overtype-wrapper").forEach(i=>{if(!i.closest(".overtype-container")){let s=typeof o=="string"?o:o.name;s&&i.setAttribute("data-theme",s)}let r=i._instance;r&&r.updatePreview()})}static initGlobalListeners(){k.globalListenersInitialized||(document.addEventListener("input",t=>{if(t.target&&t.target.classList&&t.target.classList.contains("overtype-input")){let n=t.target.closest(".overtype-wrapper"),o=n==null?void 0:n._instance;o&&o.handleInput(t)}}),document.addEventListener("keydown",t=>{if(t.target&&t.target.classList&&t.target.classList.contains("overtype-input")){let n=t.target.closest(".overtype-wrapper"),o=n==null?void 0:n._instance;o&&o.handleKeydown(t)}}),document.addEventListener("scroll",t=>{if(t.target&&t.target.classList&&t.target.classList.contains("overtype-input")){let n=t.target.closest(".overtype-wrapper"),o=n==null?void 0:n._instance;o&&o.handleScroll(t)}},!0),document.addEventListener("selectionchange",t=>{let n=document.activeElement;if(n&&n.classList.contains("overtype-input")){let o=n.closest(".overtype-wrapper"),i=o==null?void 0:o._instance;i&&(i.options.showStats&&i.statsBar&&i._updateStats(),clearTimeout(i._selectionTimeout),i._selectionTimeout=setTimeout(()=>{i.updatePreview()},50))}}),k.globalListenersInitialized=!0)}};tt(k,"instances",new WeakMap),tt(k,"stylesInjected",!1),tt(k,"globalListenersInitialized",!1),tt(k,"instanceCount",0);var N=k;N.MarkdownParser=et;N.ShortcutsManager=ot;N.themes={solar:D,cave:Y("cave")};N.getTheme=Y;N.currentTheme=D;var Qn=N;return ln(Xn);})();
|
|
527
559
|
/**
|
|
528
560
|
* OverType - A lightweight markdown editor library with perfect WYSIWYG alignment
|
|
529
561
|
* @version 1.0.0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "overtype",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A lightweight markdown editor library with perfect WYSIWYG alignment using an invisible textarea overlay",
|
|
5
5
|
"main": "dist/overtype.js",
|
|
6
6
|
"module": "dist/overtype.esm.js",
|
|
@@ -46,6 +46,7 @@
|
|
|
46
46
|
},
|
|
47
47
|
"homepage": "https://github.com/panphora/overtype#readme",
|
|
48
48
|
"dependencies": {
|
|
49
|
+
"@floating-ui/dom": "^1.7.3",
|
|
49
50
|
"markdown-actions": "^1.1.2"
|
|
50
51
|
}
|
|
51
52
|
}
|