@editora/plugins 1.0.4 → 1.0.5

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.
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=()=>{const d=window.getSelection();if(d&&d.rangeCount>0){let t=d.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(n.getAttribute("contenteditable")==="true")return n}t=t.parentNode}}const a=document.activeElement;if(a){if(a.getAttribute("contenteditable")==="true")return a;const t=a.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},k='[data-theme="dark"], .dark, .editora-theme-dark',N=()=>{if(w()?.closest(k))return!0;const a=window.getSelection();if(a&&a.rangeCount>0){const n=a.getRangeAt(0).startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)},A=[{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"c",label:"C"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"swift",label:"Swift"},{value:"kotlin",label:"Kotlin"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"scss",label:"SCSS"},{value:"json",label:"JSON"},{value:"xml",label:"XML"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"sql",label:"SQL"},{value:"bash",label:"Bash"},{value:"shell",label:"Shell"},{value:"plaintext",label:"Plain Text"}],T=new Map;function $(d,a,t,n){const s=!!a,c=n||"javascript",g=t||"",p=N(),e=p?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",dialogBorder:"#4b5563",text:"#e2e8f0",mutedText:"#a8b5c8",headerFooterBg:"#222d3a",border:"#3b4657",fieldBg:"#111827",fieldBorder:"#4b5563",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",primaryBg:"#3b82f6",primaryHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",dialogBorder:"#e0e0e0",text:"#333333",mutedText:"#666666",headerFooterBg:"#ffffff",border:"#e0e0e0",fieldBg:"#ffffff",fieldBorder:"#dddddd",cancelBg:"#e5e7eb",cancelHover:"#d1d5db",cancelText:"#333333",primaryBg:"#2563eb",primaryHover:"#1d4ed8"},l=document.createElement("div");l.className="rte-code-sample-overlay",p&&l.classList.add("rte-theme-dark"),l.style.cssText=`
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const S=()=>{const d=window.getSelection();if(d&&d.rangeCount>0){let t=d.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE){const n=t;if(n.getAttribute("contenteditable")==="true")return n}t=t.parentNode}}const r=document.activeElement;if(r){if(r.getAttribute("contenteditable")==="true")return r;const t=r.closest('[contenteditable="true"]');if(t)return t}return document.querySelector('[contenteditable="true"]')},k='[data-theme="dark"], .dark, .editora-theme-dark',N=()=>{if(S()?.closest(k))return!0;const r=window.getSelection();if(r&&r.rangeCount>0){const n=r.getRangeAt(0).startContainer;if((n.nodeType===Node.ELEMENT_NODE?n:n.parentElement)?.closest(k))return!0}return document.activeElement?.closest(k)?!0:document.body.matches(k)||document.documentElement.matches(k)},A=[{value:"javascript",label:"JavaScript"},{value:"typescript",label:"TypeScript"},{value:"python",label:"Python"},{value:"java",label:"Java"},{value:"csharp",label:"C#"},{value:"cpp",label:"C++"},{value:"c",label:"C"},{value:"php",label:"PHP"},{value:"ruby",label:"Ruby"},{value:"go",label:"Go"},{value:"rust",label:"Rust"},{value:"swift",label:"Swift"},{value:"kotlin",label:"Kotlin"},{value:"html",label:"HTML"},{value:"css",label:"CSS"},{value:"scss",label:"SCSS"},{value:"json",label:"JSON"},{value:"xml",label:"XML"},{value:"yaml",label:"YAML"},{value:"markdown",label:"Markdown"},{value:"sql",label:"SQL"},{value:"bash",label:"Bash"},{value:"shell",label:"Shell"},{value:"plaintext",label:"Plain Text"}],B=new Map;function $(d,r,t,n){const s=!!r,c=n||"javascript",g=t||"",p=N(),e=p?{overlay:"rgba(0, 0, 0, 0.62)",dialogBg:"#1f2937",dialogBorder:"#4b5563",text:"#e2e8f0",mutedText:"#a8b5c8",headerFooterBg:"#222d3a",border:"#3b4657",fieldBg:"#111827",fieldBorder:"#4b5563",cancelBg:"#334155",cancelHover:"#475569",cancelText:"#e2e8f0",primaryBg:"#3b82f6",primaryHover:"#2563eb"}:{overlay:"rgba(0, 0, 0, 0.5)",dialogBg:"#ffffff",dialogBorder:"#e0e0e0",text:"#333333",mutedText:"#666666",headerFooterBg:"#ffffff",border:"#e0e0e0",fieldBg:"#ffffff",fieldBorder:"#dddddd",cancelBg:"#e5e7eb",cancelHover:"#d1d5db",cancelText:"#333333",primaryBg:"#2563eb",primaryHover:"#1d4ed8"},l=document.createElement("div");l.className="rte-code-sample-overlay",p&&l.classList.add("rte-theme-dark"),l.style.cssText=`
2
2
  position: fixed;
3
3
  top: 0;
4
4
  left: 0;
@@ -49,9 +49,9 @@
49
49
  color: ${e.text};
50
50
  cursor: pointer;
51
51
  ">
52
- ${A.map(r=>`
53
- <option value="${r.value}" ${r.value===c?"selected":""}>
54
- ${r.label}
52
+ ${A.map(a=>`
53
+ <option value="${a.value}" ${a.value===c?"selected":""}>
54
+ ${a.label}
55
55
  </option>
56
56
  `).join("")}
57
57
  </select>
@@ -101,7 +101,7 @@
101
101
  background: ${e.primaryBg};
102
102
  color: #fff;
103
103
  ">${s?"Update Code Sample":"Insert Code Sample"}</button>
104
- `,o.appendChild(u),o.appendChild(m),o.appendChild(y),l.appendChild(o);const L=i.querySelector(".rte-code-language"),E=b.querySelector(".rte-code-textarea"),S=b.querySelector(".rte-code-error"),f=u.querySelector(".rte-code-close-btn"),v=y.querySelector(".rte-code-cancel-btn"),h=y.querySelector(".rte-code-save-btn");f.onmouseover=()=>{f.style.color="#f8fafc",f.style.background=p?"#334155":"#f0f0f0",f.style.borderRadius="4px"},f.onmouseout=()=>{f.style.color=e.mutedText,f.style.background="none"},v.onmouseover=()=>{v.style.background=e.cancelHover},v.onmouseout=()=>{v.style.background=e.cancelBg},h.onmouseover=()=>{h.style.background=e.primaryHover},h.onmouseout=()=>{h.style.background=e.primaryBg};const C=()=>{l.remove()},B=()=>{const r=E.value.trim();if(!r){S.textContent="⚠ Code cannot be empty",S.style.display="block";return}const M=L.value;d(r,M),C()};if(f.onclick=C,v.onclick=C,h.onclick=B,E.addEventListener("keydown",r=>{(r.ctrlKey||r.metaKey)&&r.key==="Enter"&&(r.preventDefault(),B()),r.key==="Escape"&&C()}),E.addEventListener("input",()=>{S.style.display="none"}),l.addEventListener("click",r=>{r.target===l&&C()}),!document.getElementById("rte-code-sample-animations")){const r=document.createElement("style");r.id="rte-code-sample-animations",r.textContent=`
104
+ `,o.appendChild(u),o.appendChild(m),o.appendChild(y),l.appendChild(o);const L=i.querySelector(".rte-code-language"),E=b.querySelector(".rte-code-textarea"),T=b.querySelector(".rte-code-error"),f=u.querySelector(".rte-code-close-btn"),v=y.querySelector(".rte-code-cancel-btn"),h=y.querySelector(".rte-code-save-btn");f.onmouseover=()=>{f.style.color="#f8fafc",f.style.background=p?"#334155":"#f0f0f0",f.style.borderRadius="4px"},f.onmouseout=()=>{f.style.color=e.mutedText,f.style.background="none"},v.onmouseover=()=>{v.style.background=e.cancelHover},v.onmouseout=()=>{v.style.background=e.cancelBg},h.onmouseover=()=>{h.style.background=e.primaryHover},h.onmouseout=()=>{h.style.background=e.primaryBg};const C=()=>{l.remove()},w=()=>{const a=E.value.trim();if(!a){T.textContent="⚠ Code cannot be empty",T.style.display="block";return}const M=L.value;d(a,M),C()};if(f.onclick=C,v.onclick=C,h.onclick=w,E.addEventListener("keydown",a=>{(a.ctrlKey||a.metaKey)&&a.key==="Enter"&&(a.preventDefault(),w()),a.key==="Escape"&&C()}),E.addEventListener("input",()=>{T.style.display="none"}),l.addEventListener("click",a=>{a.target===l&&C()}),!document.getElementById("rte-code-sample-animations")){const a=document.createElement("style");a.id="rte-code-sample-animations",a.textContent=`
105
105
  @keyframes fadeIn {
106
106
  from { opacity: 0; }
107
107
  to { opacity: 1; }
@@ -110,7 +110,7 @@
110
110
  from { transform: translateY(20px); opacity: 0; }
111
111
  to { transform: translateY(0); opacity: 1; }
112
112
  }
113
- `,document.head.appendChild(r)}return document.body.appendChild(l),setTimeout(()=>E.focus(),100),l}function R(){if(!w())return;let a=null;const t=window.getSelection();t&&t.rangeCount>0&&(a=t.getRangeAt(0).cloneRange()),$((n,s)=>{const c=window.getSelection();if(a&&(c?.removeAllRanges(),c?.addRange(a)),!c||c.rangeCount===0)return;const g=w();if(!g)return;const p=c.anchorNode;if(!p||!g.contains(p))return;const e=c.getRangeAt(0),l=`code-block-${Date.now()}`,o=document.createElement("pre");o.className="rte-code-block",o.id=l,o.setAttribute("data-type","code-block"),o.setAttribute("data-lang",s),o.setAttribute("data-code-id",l),o.setAttribute("contenteditable","false"),o.style.cssText=`
113
+ `,document.head.appendChild(a)}return document.body.appendChild(l),setTimeout(()=>E.focus(),100),l}function R(){if(!S())return;let r=null;const t=window.getSelection();t&&t.rangeCount>0&&(r=t.getRangeAt(0).cloneRange()),$((n,s)=>{const c=window.getSelection();if(r&&(c?.removeAllRanges(),c?.addRange(r)),!c||c.rangeCount===0)return;const g=S();if(!g)return;const p=c.anchorNode;if(!p||!g.contains(p))return;const e=c.getRangeAt(0),l=`code-block-${Date.now()}`,o=document.createElement("pre");o.className="rte-code-block",o.id=l,o.setAttribute("data-type","code-block"),o.setAttribute("data-lang",s),o.setAttribute("data-code-id",l),o.setAttribute("contenteditable","false"),o.style.cssText=`
114
114
  display: block;
115
115
  position: relative;
116
116
  background: #f5f5f5;
@@ -158,4 +158,4 @@
158
158
  cursor: pointer;
159
159
  opacity: 0;
160
160
  transition: opacity 0.2s ease;
161
- `,i.onclick=x=>{x.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{i.textContent="✓ Copied!",setTimeout(()=>{i.textContent="Copy"},2e3)})},o.appendChild(m),o.appendChild(i),o.appendChild(u),o.addEventListener("mouseenter",()=>{i.style.opacity="1"}),o.addEventListener("mouseleave",()=>{i.style.opacity="0"}),o.addEventListener("dblclick",()=>{z(l)}),T.set(l,{id:l,language:s,code:n}),e.insertNode(o);const b=document.createRange();b.setStartAfter(o),b.collapse(!0),c.removeAllRanges(),c.addRange(b)})}function z(d){const a=w();if(!a)return;const t=a.querySelector(`#${d}`);if(!t)return;const n=T.get(d);n&&$((s,c)=>{const g=t.querySelector("code");g&&(g.textContent=s,g.className=`language-${c}`);const p=t.querySelector("span");p&&(p.textContent=c),t.setAttribute("data-lang",c),n.language=c,n.code=s;const e=t.querySelector(".rte-code-copy");e&&(e.onclick=l=>{l.stopPropagation(),navigator.clipboard.writeText(s).then(()=>{e.textContent="✓ Copied!",setTimeout(()=>{e.textContent="Copy"},2e3)})})},d,n.code,n.language)}const H=()=>({name:"codeSample",toolbar:[{label:"Code Block",command:"insertCodeBlock",icon:'<svg width="18px" height="18px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 8L3 11.6923L7 16M17 8L21 11.6923L17 16M14 4L10 20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',shortcut:"Mod-Shift-C"}],commands:{insertCodeBlock:(...d)=>(R(),!0)}});exports.CodeSamplePlugin=H;
161
+ `,i.onclick=x=>{x.stopPropagation(),navigator.clipboard.writeText(n).then(()=>{i.textContent="✓ Copied!",setTimeout(()=>{i.textContent="Copy"},2e3)})},o.appendChild(m),o.appendChild(i),o.appendChild(u),o.addEventListener("mouseenter",()=>{i.style.opacity="1"}),o.addEventListener("mouseleave",()=>{i.style.opacity="0"}),o.addEventListener("dblclick",()=>{z(l)}),B.set(l,{id:l,language:s,code:n}),e.insertNode(o);const b=document.createRange();b.setStartAfter(o),b.collapse(!0),c.removeAllRanges(),c.addRange(b)})}function z(d){const r=S();if(!r)return;const t=r.querySelector(`#${d}`);if(!t)return;const n=B.get(d);n&&$((s,c)=>{const g=t.querySelector("code");g&&(g.textContent=s,g.className=`language-${c}`);const p=t.querySelector("span");p&&(p.textContent=c),t.setAttribute("data-lang",c),n.language=c,n.code=s;const e=t.querySelector(".rte-code-copy");e&&(e.onclick=l=>{l.stopPropagation(),navigator.clipboard.writeText(s).then(()=>{e.textContent="✓ Copied!",setTimeout(()=>{e.textContent="Copy"},2e3)})})},d,n.code,n.language)}const H=()=>({name:"codeSample",toolbar:[{label:"Insert Code",command:"insertCodeBlock",icon:'<svg width="24" height="26" focusable="false"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"></path></svg>',shortcut:"Mod-Shift-C"}],commands:{insertCodeBlock:(...d)=>(R(),!0)}});exports.CodeSamplePlugin=H;
@@ -1,4 +1,4 @@
1
- const w = () => {
1
+ const T = () => {
2
2
  const d = window.getSelection();
3
3
  if (d && d.rangeCount > 0) {
4
4
  let t = d.getRangeAt(0).startContainer;
@@ -11,23 +11,23 @@ const w = () => {
11
11
  t = t.parentNode;
12
12
  }
13
13
  }
14
- const a = document.activeElement;
15
- if (a) {
16
- if (a.getAttribute("contenteditable") === "true")
17
- return a;
18
- const t = a.closest('[contenteditable="true"]');
14
+ const r = document.activeElement;
15
+ if (r) {
16
+ if (r.getAttribute("contenteditable") === "true")
17
+ return r;
18
+ const t = r.closest('[contenteditable="true"]');
19
19
  if (t) return t;
20
20
  }
21
21
  return document.querySelector('[contenteditable="true"]');
22
- }, k = '[data-theme="dark"], .dark, .editora-theme-dark', N = () => {
23
- if (w()?.closest(k)) return !0;
24
- const a = window.getSelection();
25
- if (a && a.rangeCount > 0) {
26
- const n = a.getRangeAt(0).startContainer;
22
+ }, k = '[data-theme="dark"], .dark, .editora-theme-dark', A = () => {
23
+ if (T()?.closest(k)) return !0;
24
+ const r = window.getSelection();
25
+ if (r && r.rangeCount > 0) {
26
+ const n = r.getRangeAt(0).startContainer;
27
27
  if ((n.nodeType === Node.ELEMENT_NODE ? n : n.parentElement)?.closest(k)) return !0;
28
28
  }
29
29
  return document.activeElement?.closest(k) ? !0 : document.body.matches(k) || document.documentElement.matches(k);
30
- }, A = [
30
+ }, M = [
31
31
  { value: "javascript", label: "JavaScript" },
32
32
  { value: "typescript", label: "TypeScript" },
33
33
  { value: "python", label: "Python" },
@@ -53,8 +53,8 @@ const w = () => {
53
53
  { value: "shell", label: "Shell" },
54
54
  { value: "plaintext", label: "Plain Text" }
55
55
  ], S = /* @__PURE__ */ new Map();
56
- function $(d, a, t, n) {
57
- const s = !!a, c = n || "javascript", g = t || "", p = N(), e = p ? {
56
+ function $(d, r, t, n) {
57
+ const s = !!r, c = n || "javascript", f = t || "", p = A(), e = p ? {
58
58
  overlay: "rgba(0, 0, 0, 0.62)",
59
59
  dialogBg: "#1f2937",
60
60
  dialogBorder: "#4b5563",
@@ -144,9 +144,9 @@ function $(d, a, t, n) {
144
144
  color: ${e.text};
145
145
  cursor: pointer;
146
146
  ">
147
- ${A.map((r) => `
148
- <option value="${r.value}" ${r.value === c ? "selected" : ""}>
149
- ${r.label}
147
+ ${M.map((a) => `
148
+ <option value="${a.value}" ${a.value === c ? "selected" : ""}>
149
+ ${a.label}
150
150
  </option>
151
151
  `).join("")}
152
152
  </select>
@@ -168,7 +168,7 @@ function $(d, a, t, n) {
168
168
  background-color: ${e.fieldBg};
169
169
  color: ${e.text};
170
170
  box-sizing: border-box;
171
- ">${g}</textarea>
171
+ ">${f}</textarea>
172
172
  <div class="rte-code-error" style="color: #dc2626; font-size: 12px; margin-top: 6px; display: none;"></div>
173
173
  `;
174
174
  const x = document.createElement("div");
@@ -203,11 +203,11 @@ function $(d, a, t, n) {
203
203
  color: #fff;
204
204
  ">${s ? "Update Code Sample" : "Insert Code Sample"}</button>
205
205
  `, o.appendChild(u), o.appendChild(m), o.appendChild(y), l.appendChild(o);
206
- const L = i.querySelector(".rte-code-language"), E = b.querySelector(".rte-code-textarea"), B = b.querySelector(".rte-code-error"), f = u.querySelector(".rte-code-close-btn"), v = y.querySelector(".rte-code-cancel-btn"), h = y.querySelector(".rte-code-save-btn");
207
- f.onmouseover = () => {
208
- f.style.color = "#f8fafc", f.style.background = p ? "#334155" : "#f0f0f0", f.style.borderRadius = "4px";
209
- }, f.onmouseout = () => {
210
- f.style.color = e.mutedText, f.style.background = "none";
206
+ const L = i.querySelector(".rte-code-language"), E = b.querySelector(".rte-code-textarea"), w = b.querySelector(".rte-code-error"), g = u.querySelector(".rte-code-close-btn"), v = y.querySelector(".rte-code-cancel-btn"), h = y.querySelector(".rte-code-save-btn");
207
+ g.onmouseover = () => {
208
+ g.style.color = "#f8fafc", g.style.background = p ? "#334155" : "#f0f0f0", g.style.borderRadius = "4px";
209
+ }, g.onmouseout = () => {
210
+ g.style.color = e.mutedText, g.style.background = "none";
211
211
  }, v.onmouseover = () => {
212
212
  v.style.background = e.cancelHover;
213
213
  }, v.onmouseout = () => {
@@ -219,24 +219,24 @@ function $(d, a, t, n) {
219
219
  };
220
220
  const C = () => {
221
221
  l.remove();
222
- }, T = () => {
223
- const r = E.value.trim();
224
- if (!r) {
225
- B.textContent = "⚠ Code cannot be empty", B.style.display = "block";
222
+ }, B = () => {
223
+ const a = E.value.trim();
224
+ if (!a) {
225
+ w.textContent = "⚠ Code cannot be empty", w.style.display = "block";
226
226
  return;
227
227
  }
228
- const M = L.value;
229
- d(r, M), C();
228
+ const N = L.value;
229
+ d(a, N), C();
230
230
  };
231
- if (f.onclick = C, v.onclick = C, h.onclick = T, E.addEventListener("keydown", (r) => {
232
- (r.ctrlKey || r.metaKey) && r.key === "Enter" && (r.preventDefault(), T()), r.key === "Escape" && C();
231
+ if (g.onclick = C, v.onclick = C, h.onclick = B, E.addEventListener("keydown", (a) => {
232
+ (a.ctrlKey || a.metaKey) && a.key === "Enter" && (a.preventDefault(), B()), a.key === "Escape" && C();
233
233
  }), E.addEventListener("input", () => {
234
- B.style.display = "none";
235
- }), l.addEventListener("click", (r) => {
236
- r.target === l && C();
234
+ w.style.display = "none";
235
+ }), l.addEventListener("click", (a) => {
236
+ a.target === l && C();
237
237
  }), !document.getElementById("rte-code-sample-animations")) {
238
- const r = document.createElement("style");
239
- r.id = "rte-code-sample-animations", r.textContent = `
238
+ const a = document.createElement("style");
239
+ a.id = "rte-code-sample-animations", a.textContent = `
240
240
  @keyframes fadeIn {
241
241
  from { opacity: 0; }
242
242
  to { opacity: 1; }
@@ -245,21 +245,21 @@ function $(d, a, t, n) {
245
245
  from { transform: translateY(20px); opacity: 0; }
246
246
  to { transform: translateY(0); opacity: 1; }
247
247
  }
248
- `, document.head.appendChild(r);
248
+ `, document.head.appendChild(a);
249
249
  }
250
250
  return document.body.appendChild(l), setTimeout(() => E.focus(), 100), l;
251
251
  }
252
252
  function R() {
253
- if (!w()) return;
254
- let a = null;
253
+ if (!T()) return;
254
+ let r = null;
255
255
  const t = window.getSelection();
256
- t && t.rangeCount > 0 && (a = t.getRangeAt(0).cloneRange()), $((n, s) => {
256
+ t && t.rangeCount > 0 && (r = t.getRangeAt(0).cloneRange()), $((n, s) => {
257
257
  const c = window.getSelection();
258
- if (a && (c?.removeAllRanges(), c?.addRange(a)), !c || c.rangeCount === 0) return;
259
- const g = w();
260
- if (!g) return;
258
+ if (r && (c?.removeAllRanges(), c?.addRange(r)), !c || c.rangeCount === 0) return;
259
+ const f = T();
260
+ if (!f) return;
261
261
  const p = c.anchorNode;
262
- if (!p || !g.contains(p)) return;
262
+ if (!p || !f.contains(p)) return;
263
263
  const e = c.getRangeAt(0), l = `code-block-${Date.now()}`, o = document.createElement("pre");
264
264
  o.className = "rte-code-block", o.id = l, o.setAttribute("data-type", "code-block"), o.setAttribute("data-lang", s), o.setAttribute("data-code-id", l), o.setAttribute("contenteditable", "false"), o.style.cssText = `
265
265
  display: block;
@@ -337,15 +337,15 @@ function R() {
337
337
  });
338
338
  }
339
339
  function z(d) {
340
- const a = w();
341
- if (!a) return;
342
- const t = a.querySelector(`#${d}`);
340
+ const r = T();
341
+ if (!r) return;
342
+ const t = r.querySelector(`#${d}`);
343
343
  if (!t) return;
344
344
  const n = S.get(d);
345
345
  n && $(
346
346
  (s, c) => {
347
- const g = t.querySelector("code");
348
- g && (g.textContent = s, g.className = `language-${c}`);
347
+ const f = t.querySelector("code");
348
+ f && (f.textContent = s, f.className = `language-${c}`);
349
349
  const p = t.querySelector("span");
350
350
  p && (p.textContent = c), t.setAttribute("data-lang", c), n.language = c, n.code = s;
351
351
  const e = t.querySelector(".rte-code-copy");
@@ -366,9 +366,9 @@ const H = () => ({
366
366
  name: "codeSample",
367
367
  toolbar: [
368
368
  {
369
- label: "Code Block",
369
+ label: "Insert Code",
370
370
  command: "insertCodeBlock",
371
- icon: '<svg width="18px" height="18px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M7 8L3 11.6923L7 16M17 8L21 11.6923L17 16M14 4L10 20" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',
371
+ icon: '<svg width="24" height="26" focusable="false"><path d="M7.1 11a2.8 2.8 0 0 1-.8 2 2.8 2.8 0 0 1 .8 2v1.7c0 .3.1.6.4.8.2.3.5.4.8.4.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.7 0-1.4-.3-2-.8-.5-.6-.8-1.3-.8-2V15c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4v-.8c0-.2.2-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V9.3c0-.7.3-1.4.8-2 .6-.5 1.3-.8 2-.8.3 0 .4.2.4.4v.8c0 .2-.1.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8V11Zm9.8 0V9.3c0-.3-.1-.6-.4-.8-.2-.3-.5-.4-.8-.4a.4.4 0 0 1-.4-.4V7c0-.2.1-.4.4-.4.7 0 1.4.3 2 .8.5.6.8 1.3.8 2V11c0 .3.1.6.4.8.2.3.5.4.8.4.2 0 .4.2.4.4v.8c0 .2-.2.4-.4.4-.3 0-.6.1-.8.4-.3.2-.4.5-.4.8v1.7c0 .7-.3 1.4-.8 2-.6.5-1.3.8-2 .8a.4.4 0 0 1-.4-.4v-.8c0-.2.1-.4.4-.4.3 0 .6-.1.8-.4.3-.2.4-.5.4-.8V15a2.8 2.8 0 0 1 .8-2 2.8 2.8 0 0 1-.8-2Zm-3.3-.4c0 .4-.1.8-.5 1.1-.3.3-.7.5-1.1.5-.4 0-.8-.2-1.1-.5-.4-.3-.5-.7-.5-1.1 0-.5.1-.9.5-1.2.3-.3.7-.4 1.1-.4.4 0 .8.1 1.1.4.4.3.5.7.5 1.2ZM12 13c.4 0 .8.1 1.1.5.4.3.5.7.5 1.1 0 1-.1 1.6-.5 2a3 3 0 0 1-1.1 1c-.4.3-.8.4-1.1.4a.5.5 0 0 1-.5-.5V17a3 3 0 0 0 1-.2l.6-.6c-.6 0-1-.2-1.3-.5-.2-.3-.3-.7-.3-1 0-.5.1-1 .5-1.2.3-.4.7-.5 1.1-.5Z" fill-rule="evenodd"></path></svg>',
372
372
  shortcut: "Mod-Shift-C"
373
373
  }
374
374
  ],