@editora/plugins 1.0.7 → 1.0.9
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 +21 -0
- package/README.md +72 -4
- package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/anchor.cjs.js +11 -11
- package/dist/anchor.esm.js +130 -107
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1070 -0
- package/dist/background-color.cjs.js +3 -3
- package/dist/background-color.esm.js +116 -119
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1317 -0
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1457 -0
- package/dist/code.cjs.js +82 -102
- package/dist/code.esm.js +1172 -662
- package/dist/comments.cjs.js +10 -10
- package/dist/comments.esm.js +195 -177
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1360 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1093 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +913 -0
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1310 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/embed-iframe.cjs.js +2 -2
- package/dist/embed-iframe.esm.js +8 -5
- package/dist/emojis.cjs.js +64 -39
- package/dist/emojis.esm.js +133 -104
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +56 -0
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
- package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
- package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
- package/dist/index.esm.js +111 -75
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
- package/dist/link.cjs.js +6 -6
- package/dist/link.esm.js +41 -39
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +151 -112
- package/dist/media-manager.cjs.js +15 -15
- package/dist/media-manager.esm.js +227 -206
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +726 -0
- package/dist/merge-tag.cjs.js +44 -12
- package/dist/merge-tag.esm.js +368 -241
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +85 -77
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1377 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +29 -29
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +752 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1388 -0
- package/dist/special-characters.cjs.js +83 -45
- package/dist/special-characters.esm.js +149 -100
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +235 -216
- package/dist/template.cjs.js +14 -14
- package/dist/template.esm.js +157 -131
- package/dist/text-color.cjs.js +9 -9
- package/dist/text-color.esm.js +131 -115
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +755 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1718 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +768 -0
- package/index.d.ts +849 -1
- package/package.json +105 -6
- package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
- package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
- package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
- package/dist/documentManager-_tQQfQi9.js +0 -317
- package/dist/index-D3pJyAsj.js +0 -1
|
@@ -0,0 +1,548 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const E=".rte-content, .editora-content",mt="rte-citations-styles",b="rte-citations-panel",ot=".rte-citation-ref[data-citation-id]",W='.rte-citation-bibliography[data-type="citation-bibliography"]',G='.rte-citation-footnotes[data-type="citation-footnotes"]',x=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',L=["apa","mla","chicago"],Bt={panelTitle:"Citations",panelAriaLabel:"Citations panel",styleLabel:"Citation style",authorLabel:"Author",yearLabel:"Year",titleLabel:"Title",sourceLabel:"Source",urlLabel:"URL",noteLabel:"Footnote note",insertText:"Insert Citation",refreshText:"Refresh Bibliography",closeText:"Close",bibliographyTitle:"References",footnotesTitle:"Citation Notes",noCitationsText:"No citations inserted yet.",styleButtonPrefix:"Style",recentHeading:"Recent citations",deleteRecentText:"x",summaryPrefix:"Citations",invalidMessage:"Author and title are required."},f=new WeakMap,T=new WeakMap,pt=new WeakMap,D=new WeakMap,v=new Map,V=new WeakMap,Q=new WeakMap,q=new Set;let I=null,B=null,O=null,k=null,Y=0,Ot=0,at=0,M=null,p=null;function g(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function Pt(t){return t.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function ht(t,e){const n=e(t);if(!n)return"";const i=n.match(/\d{4}/);return i?i[0]:n}function xt(t,e){const n=e(t);return n?/^https?:\/\//i.test(n)?n:`https://${n}`:""}function F(t){return t.toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,80)}function yt(t,e){return{id:F(e.normalizeText(t.id||"")),author:e.normalizeText(t.author||""),year:ht(t.year||"",e.normalizeText)||void 0,title:e.normalizeText(t.title||""),source:e.normalizeText(t.source||"")||void 0,url:xt(t.url||"",e.normalizeText)||void 0,note:e.normalizeText(t.note||"")||void 0}}function Z(t={}){const e=t.defaultStyle&&L.includes(t.defaultStyle)?t.defaultStyle:"apa",n={...Bt,...t.labels||{}};return{defaultStyle:e,enableFootnoteSync:t.enableFootnoteSync!==!1,debounceMs:Math.max(80,Number(t.debounceMs??220)),maxRecentCitations:Math.max(3,Math.min(30,Number(t.maxRecentCitations??8))),labels:n,normalizeText:t.normalizeText||Pt,generateCitationId:typeof t.generateCitationId=="function"?t.generateCitationId:void 0}}function Ct(t){return t?t.nodeType===Node.ELEMENT_NODE?t:t.parentElement:null}function lt(t){return t.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||t}function X(t){return t?(t.getAttribute("data-theme")||t.getAttribute("theme")||"").toLowerCase()==="dark"?!0:t.classList.contains("dark")||t.classList.contains("editora-theme-dark")||t.classList.contains("rte-theme-dark"):!1}function Dt(t){const e=lt(t);if(X(e))return!0;const n=e.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return X(n)?!0:X(document.documentElement)||X(document.body)}function tt(t,e){t.classList.remove("rte-citations-theme-dark"),Dt(e)&&t.classList.add("rte-citations-theme-dark")}function h(t,e=!0){if(t?.contentElement instanceof HTMLElement)return t.contentElement;if(t?.editorElement instanceof HTMLElement){const o=t.editorElement;if(o.matches(E))return o;const r=o.querySelector(E);if(r instanceof HTMLElement)return r}const n=window.getSelection();if(n&&n.rangeCount>0){const o=n.getRangeAt(0).startContainer,a=Ct(o)?.closest(E);if(a)return a}const i=document.activeElement;if(i){if(i.matches(E))return i;const o=i.closest(E);if(o)return o}return p&&p.isConnected?p:(p&&!p.isConnected&&(p=null),e?document.querySelector(E):null)}function $(t){return t.getAttribute("contenteditable")==="false"||t.getAttribute("data-readonly")==="true"}function j(t){const e=Ct(t);return e?!!(e.closest(W)||e.closest(G)):!1}function Ht(t,e){if(at+=1,e.generateCitationId){const n=e.generateCitationId({editor:t,index:at}),i=F(e.normalizeText(n||""));if(i)return i}return`cite-${Date.now().toString(36)}-${at.toString(36)}`}function st(t){return t.map(e=>(e||"").trim()).filter(Boolean).join(" ").trim()}function Ft(t,e){const n=t.author||"Unknown",i=t.year||"n.d.";return e==="mla"?`(${n} ${i})`:e==="chicago"?`(${n} ${i})`:`(${n}, ${i})`}function ut(t,e){const n=t.author||"Unknown",i=t.year||"n.d.",o=t.title||"Untitled",r=t.source||"",a=t.url||"";return st(e==="mla"?[`${n}.`,`"${o}."`,r?`${r},`:"",`${i}.`,a]:e==="chicago"?[`${n}.`,`${o}.`,r?`${r}.`:"",`(${i}).`,a]:[`${n}.`,`(${i}).`,`${o}.`,r?`${r}.`:"",a])}function R(t){return Array.from(t.querySelectorAll(ot)).filter(e=>!e.closest(W)&&!e.closest(G))}function wt(t,e){const n=F(e.normalizeText(t.getAttribute("data-citation-id")||""));if(!n)return null;const i=e.normalizeText(t.getAttribute("data-citation-author")||""),o=e.normalizeText(t.getAttribute("data-citation-title")||"");return{id:n,author:i||"Unknown",year:ht(t.getAttribute("data-citation-year")||"",e.normalizeText)||void 0,title:o||"Untitled",source:e.normalizeText(t.getAttribute("data-citation-source")||"")||void 0,url:xt(t.getAttribute("data-citation-url")||"",e.normalizeText)||void 0,note:e.normalizeText(t.getAttribute("data-citation-note")||"")||void 0}}function vt(t,e,n){t.classList.add("rte-citation-ref"),t.setAttribute("data-citation-id",e.id),t.setAttribute("data-citation-author",e.author||""),t.setAttribute("data-citation-year",e.year||""),t.setAttribute("data-citation-title",e.title||""),t.setAttribute("data-citation-source",e.source||""),t.setAttribute("data-citation-url",e.url||""),t.setAttribute("data-citation-note",e.note||""),t.setAttribute("contenteditable","false"),t.setAttribute("tabindex","0"),t.setAttribute("role","doc-biblioref"),t.setAttribute("data-style",n),t.textContent=Ft(e,n)}function it(t,e,n){const i=lt(t);Array.from(i.querySelectorAll(`.rte-toolbar-button[data-command="${e}"], .editora-toolbar-button[data-command="${e}"]`)).forEach(r=>{r.classList.toggle("active",n),r.setAttribute("data-active",n?"true":"false"),r.setAttribute("aria-pressed",n?"true":"false")})}function N(t,e){const n=T.get(t);return n&&L.includes(n)?n:e?.defaultStyle||"apa"}function K(t,e){const n=R(t),i=new Map;return n.forEach(o=>{const r=wt(o,e);if(!r)return;if(!i.has(r.id)){i.set(r.id,r);return}const a=i.get(r.id);i.set(r.id,{...a,author:a.author||r.author,title:a.title||r.title,year:a.year||r.year,source:a.source||r.source,url:a.url||r.url,note:a.note||r.note})}),Array.from(i.values())}function _t(t,e,n){const i=yt(e,n);if(!i.id||!i.author||!i.title)return;const r=(D.get(t)||[]).filter(a=>a.id!==i.id);D.set(t,[i,...r].slice(0,n.maxRecentCitations))}function rt(t,e,n){const i=D.get(t)||[],o=new Map;e.slice(Math.max(0,e.length-n.maxRecentCitations)).reverse().forEach(a=>{a.id&&o.set(a.id,a)}),i.forEach(a=>{!a.id||o.has(a.id)||o.set(a.id,a)});const r=Array.from(o.values()).slice(0,n.maxRecentCitations);return D.set(t,r),r}function St(t,e,n,i){const o=F(i.normalizeText(e||""));return o&&rt(t,n,i).find(a=>a.id===o)||null}function qt(t,e,n){const i=F(n.normalizeText(e||""));if(!i)return!1;const o=D.get(t)||[],r=o.filter(a=>a.id!==i);return r.length===o.length?!1:(D.set(t,r),!0)}function Et(t,e,n){const i=document.createElement("section");i.className=t,i.setAttribute("data-type",e),i.setAttribute("contenteditable","false"),i.setAttribute("aria-label",n),e==="citation-bibliography"?i.setAttribute("role","doc-bibliography"):e==="citation-footnotes"&&i.setAttribute("role","doc-endnotes");const o=document.createElement("h3");o.className="rte-citation-section-title",o.textContent=n;const r=document.createElement("ol");return r.className="rte-citation-list",r.setAttribute("role","list"),i.appendChild(o),i.appendChild(r),i}function jt(t,e){let n=t.querySelector(W);n||(n=Et("rte-citation-bibliography","citation-bibliography",e.labels.bibliographyTitle),t.appendChild(n));const i=n.querySelector(".rte-citation-section-title");return i&&(i.textContent=e.labels.bibliographyTitle),n.setAttribute("aria-label",e.labels.bibliographyTitle),n}function Kt(t,e){let n=t.querySelector(G);n||(n=Et("rte-citation-footnotes","citation-footnotes",e.labels.footnotesTitle),t.appendChild(n));const i=n.querySelector(".rte-citation-section-title");return i&&(i.textContent=e.labels.footnotesTitle),n.setAttribute("aria-label",e.labels.footnotesTitle),n}function $t(t,e){t.querySelector(e)?.remove()}function Ut(t,e,n,i){if(e.length===0){$t(t,W);return}const r=jt(t,n).querySelector(".rte-citation-list");if(!r)return;const a=document.createDocumentFragment();e.forEach((s,u)=>{const c=document.createElement("li");c.className="rte-citation-item",c.id=`rte-citation-entry-${s.id}`,c.setAttribute("data-citation-id",s.id),c.setAttribute("data-citation-number",String(u+1)),c.textContent=ut(s,i),a.appendChild(c)}),r.innerHTML="",r.appendChild(a)}function Wt(t,e,n,i){if(!n.enableFootnoteSync||e.length===0){$t(t,G),R(t).forEach(l=>{l.removeAttribute("data-footnote-number"),l.removeAttribute("data-footnote-target")});return}const r=Kt(t,n).querySelector(".rte-citation-list");if(!r)return;const a=new Map,s=new Map;e.forEach((l,d)=>{s.set(l.id,d+1)});const u=new Map;R(t).forEach(l=>{const d=l.getAttribute("data-citation-id")||"";if(!d||!s.has(d))return;const m=(u.get(d)||0)+1;u.set(d,m);const w=`rte-citation-ref-${d}-${m}`;l.id=w;const A=s.get(d);l.setAttribute("data-footnote-number",String(A)),l.setAttribute("data-footnote-target",`rte-citation-note-${d}`),a.has(d)||a.set(d,w)});const c=document.createDocumentFragment();e.forEach((l,d)=>{const m=document.createElement("li");m.className="rte-citation-item rte-citation-footnote-item",m.id=`rte-citation-note-${l.id}`,m.setAttribute("data-citation-id",l.id);const w=document.createElement("span");w.className="rte-citation-footnote-number",w.textContent=`${d+1}. `;const A=document.createElement("span");A.className="rte-citation-footnote-text";const It=l.note?`${l.note}. `:"";A.textContent=`${It}${ut(l,i)}`,m.appendChild(w),m.appendChild(A);const gt=a.get(l.id);if(gt){const _=document.createElement("a");_.className="rte-citation-backref",_.href=`#${gt}`,_.setAttribute("aria-label",`Back to citation ${d+1}`),_.textContent="Back",m.appendChild(_)}c.appendChild(m)}),r.innerHTML="",r.appendChild(c)}function Gt(t,e,n,i){const o=ut(e,n);t.setAttribute("data-citation-number",String(i)),t.setAttribute("aria-label",`Citation ${i}: ${o}`)}function Vt(t,e,n){const i=R(t);let o=`${e}:${n?"1":"0"}:${i.length}`;return i.forEach(r=>{o+=`|${r.getAttribute("data-citation-id")||""}`,o+=`|${r.getAttribute("data-citation-author")||""}`,o+=`|${r.getAttribute("data-citation-year")||""}`,o+=`|${r.getAttribute("data-citation-title")||""}`,o+=`|${r.getAttribute("data-citation-source")||""}`,o+=`|${r.getAttribute("data-citation-url")||""}`,o+=`|${r.getAttribute("data-citation-note")||""}`}),o}function H(t){const e=v.get(t);if(!e)return;const n=f.get(t)||M;if(!n)return;const i=N(t,n),o=K(t,n),r=rt(t,o,n),a=e.querySelector(".rte-citations-status"),s=e.querySelector('[data-action="cycle-style"]'),u=e.querySelector(".rte-citations-recent-list");if(a){const c=o.length;a.textContent=`${n.labels.summaryPrefix}: ${c} | Style: ${i.toUpperCase()} | Footnotes: ${n.enableFootnoteSync?"On":"Off"}`}if(s&&(s.textContent=`${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`,s.setAttribute("aria-label",`${n.labels.styleButtonPrefix}: ${i.toUpperCase()}`)),u){if(r.length===0){u.innerHTML=`<li class="rte-citations-empty">${g(n.labels.noCitationsText)}</li>`;return}u.innerHTML=r.map(c=>`
|
|
2
|
+
<li class="rte-citations-recent-item">
|
|
3
|
+
<div class="rte-citations-recent-row">
|
|
4
|
+
<button
|
|
5
|
+
type="button"
|
|
6
|
+
class="rte-citations-recent-btn"
|
|
7
|
+
data-action="insert-from-recent"
|
|
8
|
+
data-citation-id="${g(c.id)}"
|
|
9
|
+
aria-label="Insert citation: ${g(c.title)}"
|
|
10
|
+
>
|
|
11
|
+
<span class="rte-citations-recent-title">${g(c.title)}</span>
|
|
12
|
+
<span class="rte-citations-recent-meta">${g(c.author)}${c.year?` (${g(c.year)})`:""}</span>
|
|
13
|
+
</button>
|
|
14
|
+
<button
|
|
15
|
+
type="button"
|
|
16
|
+
class="rte-citations-recent-delete"
|
|
17
|
+
data-action="delete-by-id"
|
|
18
|
+
data-citation-id="${g(c.id)}"
|
|
19
|
+
aria-label="Delete citation: ${g(c.title)}"
|
|
20
|
+
>${g(n.labels.deleteRecentText)}</button>
|
|
21
|
+
</div>
|
|
22
|
+
</li>
|
|
23
|
+
`).join("")}}function y(t,e,n=!1){const i=N(t,e),o=Vt(t,i,e.enableFootnoteSync);if(!n&&pt.get(t)===o)return K(t,e);const r=R(t),a=new Map;r.forEach(c=>{const l=wt(c,e);l&&(a.has(l.id)||a.set(l.id,l))});const s=Array.from(a.values());rt(t,s,e);const u=new Map;return s.forEach((c,l)=>{u.set(c.id,l+1)}),r.forEach(c=>{const l=c.getAttribute("data-citation-id")||"",d=a.get(l);if(!d)return;vt(c,d,i);const m=u.get(d.id)||1;Gt(c,d,i,Math.max(1,m))}),Ut(t,s,e,i),Wt(t,s,e,i),pt.set(t,o),H(t),t.dispatchEvent(new CustomEvent("editora:citations-refreshed",{bubbles:!0,detail:{citations:s,style:i,footnoteSync:e.enableFootnoteSync}})),s}function At(t){const e=Q.get(t);typeof e=="number"&&(window.clearTimeout(e),q.delete(e),Q.delete(t))}function kt(t){const e=f.get(t)||M;if(!e)return;At(t);const n=window.setTimeout(()=>{q.delete(n),Q.delete(t),y(t,e,!1)},e.debounceMs);q.add(n),Q.set(t,n)}function Yt(t){const e=window.getSelection();if(!e)throw new Error("Selection unavailable");if(e.rangeCount>0){const a=e.getRangeAt(0);if(t.contains(a.commonAncestorContainer)&&!j(a.commonAncestorContainer))return a.cloneRange()}const n=document.createRange(),i=t.querySelector(W),o=t.querySelector(G),r=i||o;return r?(n.setStartBefore(r),n.collapse(!0),n):(n.selectNodeContents(t),n.collapse(!1),n)}function dt(t){t.dispatchEvent(new Event("input",{bubbles:!0}))}function ft(t,e){if(e===t.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",t,e,t.innerHTML)}catch{}}function Tt(t,e){const n=window.getSelection();if(!n)return;const i=document.createRange();if(t.nodeType===Node.TEXT_NODE){const o=t,r=Math.max(0,Math.min(e,o.length));i.setStart(o,r)}else{const o=t.childNodes.length,r=Math.max(0,Math.min(e,o));i.setStart(t,r)}i.collapse(!0),n.removeAllRanges(),n.addRange(i)}function Mt(t){if(t.collapsed||t.startContainer!==t.endContainer||t.endOffset!==t.startOffset+1||!(t.startContainer instanceof Element||t.startContainer instanceof DocumentFragment))return null;const e=t.startContainer.childNodes[t.startOffset];return!(e instanceof HTMLElement)||!e.matches(ot)?null:e}function J(t,e,n){const{startContainer:i,startOffset:o}=t;if(i.nodeType===Node.ELEMENT_NODE){const a=i;if(n==="previous"){if(o>0)return a.childNodes[o-1]||null}else if(o<a.childNodes.length)return a.childNodes[o]||null}if(i.nodeType===Node.TEXT_NODE&&(n==="previous"&&o<i.data.length||n==="next"&&o>0))return null;let r=i;for(;r&&r!==e;){const a=n==="previous"?r.previousSibling:r.nextSibling;if(a)return a;r=r.parentNode}return null}function Lt(t,e,n){if(!t.collapsed)return null;const i=a=>a instanceof HTMLElement&&a.matches(ot)?a:null,{startContainer:o,startOffset:r}=t;if(o.nodeType===Node.ELEMENT_NODE){const a=o;return n==="Backspace"&&r>0?i(a.childNodes[r-1]||null):n==="Delete"?i(a.childNodes[r]||null):null}if(o.nodeType===Node.TEXT_NODE){const a=o;if(n==="Backspace"&&r===0){const s=i(a.previousSibling);return s||i(J(t,e,"previous"))}if(n==="Delete"&&r===a.data.length){const s=i(a.nextSibling);return s||i(J(t,e,"next"))}}return i(n==="Backspace"?J(t,e,"previous"):J(t,e,"next"))}function P(t,e,n){const i=t.closest(E);if(!i||j(t))return!1;const o=t.parentNode;if(!o)return!1;const r=i.innerHTML,a=Array.from(o.childNodes).indexOf(t);if(a<0)return!1;const s=t.nextSibling;return s instanceof Text&&(s.data===" "?s.remove():s.data.startsWith(" ")&&(s.data=s.data.slice(1))),t.remove(),Tt(o,a),y(i,n,!0),ft(i,r),dt(i),e==="Delete"&&i.focus({preventScroll:!0}),!0}function Xt(t,e,n){if(t.key!=="Backspace"&&t.key!=="Delete")return!1;const i=t.key,o=t.target;if(o?.matches(ot)&&e.contains(o)&&!j(o))return t.preventDefault(),t.stopPropagation(),P(o,i,n);const r=window.getSelection();if(!r||r.rangeCount===0)return!1;const a=r.getRangeAt(0);if(!e.contains(a.commonAncestorContainer)||j(a.commonAncestorContainer))return!1;const s=Mt(a);if(s)return t.preventDefault(),t.stopPropagation(),P(s,i,n);const u=Lt(a,e,i);return u?(t.preventDefault(),t.stopPropagation(),P(u,i,n)):!1}function Rt(t,e,n){const i=F(n.normalizeText(e||""));if(!i)return!1;const o=R(t).filter(a=>a.getAttribute("data-citation-id")===i);if(o.length===0)return!1;if(o.length===1)return P(o[0],"Delete",n);const r=t.innerHTML;return o.forEach(a=>{const s=a.nextSibling;s instanceof Text&&(s.data===" "?s.remove():s.data.startsWith(" ")&&(s.data=s.data.slice(1))),a.remove()}),Tt(t,t.childNodes.length),y(t,n,!0),ft(t,r),dt(t),t.focus({preventScroll:!0}),!0}function Jt(t,e){const n=window.getSelection();if(!n||n.rangeCount===0)return!1;const i=n.getRangeAt(0);if(!t.contains(i.commonAncestorContainer)||j(i.commonAncestorContainer))return!1;const o=Mt(i);if(o)return P(o,"Delete",e);const r=Lt(i,t,"Backspace");return r?P(r,"Backspace",e):!1}function et(t,e,n){const i=yt(e,n);if(!i.author||!i.title)return!1;i.id||(i.id=Ht(t,n));const o=t.innerHTML;let r;try{r=Yt(t)}catch{return!1}const a=window.getSelection();if(!a)return!1;r.collapsed||r.deleteContents();const s=document.createElement("span");vt(s,i,N(t,n));try{r.insertNode(s)}catch{return!1}const u=document.createTextNode(" ");s.nextSibling?s.parentNode?.insertBefore(u,s.nextSibling):s.parentNode?.appendChild(u);const c=document.createRange();if(u.parentNode){const l=Array.from(u.parentNode.childNodes).indexOf(u)+1;c.setStart(u.parentNode,Math.max(0,l))}else c.setStartAfter(s);return c.collapse(!0),a.removeAllRanges(),a.addRange(c),_t(t,i,n),y(t,n,!0),ft(t,o),dt(t),!0}function Zt(t,e){if(!e)return!1;const n=R(t).find(r=>r.getAttribute("data-citation-id")===e)||null;if(!n)return!1;n.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),n.focus({preventScroll:!0});const i=window.getSelection();if(!i)return!0;const o=document.createRange();return o.selectNode(n),i.removeAllRanges(),i.addRange(o),!0}function nt(t){return V.get(t)===!0}function U(t,e=!1){const n=v.get(t);n&&(n.classList.remove("show"),V.set(t,!1),it(t,"toggleCitationsPanel",!1),e&&t.focus({preventScroll:!0}))}function Qt(t){v.forEach((e,n)=>{n!==t&&U(n,!1)})}function ct(t,e){if(!e.classList.contains("show"))return;const i=lt(t).getBoundingClientRect(),o=Math.min(window.innerWidth-20,380),r=Math.max(10,window.innerWidth-o-10),a=Math.min(Math.max(10,i.right-o),r),s=Math.max(10,Math.min(window.innerHeight-10-260,i.top+10));e.style.width=`${o}px`,e.style.left=`${a}px`,e.style.top=`${s}px`,e.style.maxHeight=`${Math.max(260,window.innerHeight-24)}px`}function C(t,e){return t.querySelector(`[data-field="${e}"]`)}function te(t){const e=C(t,"author")?.value||"",n=C(t,"year")?.value||"",i=C(t,"title")?.value||"",o=C(t,"source")?.value||"",r=C(t,"url")?.value||"",a=C(t,"note")?.value||"";return{author:e,year:n,title:i,source:o,url:r,note:a}}function S(t,e){const n=t.querySelector(".rte-citations-live");n&&(n.textContent=e)}function ee(t,e,n){const i=C(e,"style");i&&(i.value=N(t,n))}function Nt(t,e,n){const i=L.includes(e)?e:n.defaultStyle;return T.set(t,i),y(t,n,!0),i}function bt(t,e){const n=N(t,e),i=L.indexOf(n),o=L[(i+1)%L.length];return T.set(t,o),y(t,e,!0),o}function ne(t){const e=v.get(t);if(e)return e;const n=f.get(t)||M||Z(),i=`rte-citations-panel-${Ot++}`,o=document.createElement("section");o.className=b,o.id=i,o.setAttribute("role","dialog"),o.setAttribute("aria-modal","false"),o.setAttribute("aria-label",n.labels.panelAriaLabel),o.setAttribute("tabindex","-1"),o.innerHTML=`
|
|
24
|
+
<header class="rte-citations-header">
|
|
25
|
+
<h2 class="rte-citations-title">${g(n.labels.panelTitle)}</h2>
|
|
26
|
+
<button type="button" class="rte-citations-icon-btn" data-action="close" aria-label="${g(n.labels.closeText)}">✕</button>
|
|
27
|
+
</header>
|
|
28
|
+
<div class="rte-citations-body">
|
|
29
|
+
<p class="rte-citations-status" aria-live="polite"></p>
|
|
30
|
+
|
|
31
|
+
<div class="rte-citations-grid">
|
|
32
|
+
<label class="rte-citations-label">
|
|
33
|
+
${g(n.labels.styleLabel)}
|
|
34
|
+
<select data-field="style" class="rte-citations-field">
|
|
35
|
+
<option value="apa">APA</option>
|
|
36
|
+
<option value="mla">MLA</option>
|
|
37
|
+
<option value="chicago">Chicago</option>
|
|
38
|
+
</select>
|
|
39
|
+
</label>
|
|
40
|
+
<label class="rte-citations-label">
|
|
41
|
+
${g(n.labels.authorLabel)}
|
|
42
|
+
<input type="text" data-field="author" class="rte-citations-field" autocomplete="off" />
|
|
43
|
+
</label>
|
|
44
|
+
<label class="rte-citations-label">
|
|
45
|
+
${g(n.labels.yearLabel)}
|
|
46
|
+
<input type="text" data-field="year" class="rte-citations-field" inputmode="numeric" autocomplete="off" />
|
|
47
|
+
</label>
|
|
48
|
+
<label class="rte-citations-label">
|
|
49
|
+
${g(n.labels.titleLabel)}
|
|
50
|
+
<input type="text" data-field="title" class="rte-citations-field" autocomplete="off" />
|
|
51
|
+
</label>
|
|
52
|
+
<label class="rte-citations-label">
|
|
53
|
+
${g(n.labels.sourceLabel)}
|
|
54
|
+
<input type="text" data-field="source" class="rte-citations-field" autocomplete="off" />
|
|
55
|
+
</label>
|
|
56
|
+
<label class="rte-citations-label">
|
|
57
|
+
${g(n.labels.urlLabel)}
|
|
58
|
+
<input type="url" data-field="url" class="rte-citations-field" autocomplete="off" />
|
|
59
|
+
</label>
|
|
60
|
+
<label class="rte-citations-label rte-citations-label-note">
|
|
61
|
+
${g(n.labels.noteLabel)}
|
|
62
|
+
<textarea data-field="note" class="rte-citations-field" rows="2"></textarea>
|
|
63
|
+
</label>
|
|
64
|
+
</div>
|
|
65
|
+
|
|
66
|
+
<div class="rte-citations-controls" role="toolbar" aria-label="Citation actions">
|
|
67
|
+
<button type="button" class="rte-citations-btn rte-citations-btn-primary" data-action="insert">${g(n.labels.insertText)}</button>
|
|
68
|
+
<button type="button" class="rte-citations-btn" data-action="refresh">${g(n.labels.refreshText)}</button>
|
|
69
|
+
<button type="button" class="rte-citations-btn" data-action="cycle-style"></button>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
<section class="rte-citations-recent" aria-label="${g(n.labels.recentHeading)}">
|
|
73
|
+
<h3 class="rte-citations-recent-heading">${g(n.labels.recentHeading)}</h3>
|
|
74
|
+
<ul class="rte-citations-recent-list" role="list"></ul>
|
|
75
|
+
</section>
|
|
76
|
+
|
|
77
|
+
<p class="rte-citations-shortcut">Shortcut: Ctrl/Cmd + Alt + Shift + C</p>
|
|
78
|
+
<span class="rte-citations-live" aria-live="polite"></span>
|
|
79
|
+
</div>
|
|
80
|
+
`,o.addEventListener("click",a=>{const s=a.target;if(!s)return;const u=s.closest("[data-action]");if(!u)return;const c=u.getAttribute("data-action")||"",l=f.get(t)||M||n;if(f.set(t,l),c==="close"){U(t,!0);return}if(c==="insert"){if($(t))return;const d=te(o);if(!l.normalizeText(d.author)||!l.normalizeText(d.title)){S(o,l.labels.invalidMessage);return}if(!et(t,d,l)){S(o,l.labels.invalidMessage);return}S(o,"Citation inserted.");const w=C(o,"title"),A=C(o,"note");w&&(w.value=""),A&&(A.value="");return}if(c==="refresh"){const d=y(t,l,!0);S(o,`Refreshed ${d.length} citation${d.length===1?"":"s"}.`);return}if(c==="cycle-style"){const d=bt(t,l);ee(t,o,l),S(o,`Style changed to ${d.toUpperCase()}.`);return}if(c==="insert-from-recent"){if($(t))return;const d=u.getAttribute("data-citation-id")||"",m=St(t,d,K(t,l),l);if(!m)return;et(t,m,l),S(o,`Inserted citation: ${m.title}.`);return}if(c==="delete-by-id"){if($(t))return;const d=u.getAttribute("data-citation-id")||"";if(Rt(t,d,l)){S(o,"Citation deleted.");return}qt(t,d,l)&&(H(t),S(o,"Removed from recent citations."))}}),o.addEventListener("keydown",a=>{if(a.key==="Escape"){a.preventDefault(),U(t,!0);return}const s=a.target;if(!s||!s.matches(".rte-citations-recent-btn")||a.key!=="ArrowDown"&&a.key!=="ArrowUp")return;const u=Array.from(o.querySelectorAll(".rte-citations-recent-btn"));if(u.length===0)return;const c=u.indexOf(s);if(c<0)return;a.preventDefault();const l=a.key==="ArrowDown"?1:-1,d=(c+l+u.length)%u.length;u[d].focus()});const r=C(o,"style");return r?.addEventListener("change",()=>{const a=f.get(t)||M||n,s=r.value;Nt(t,s,a),S(o,`Style changed to ${s.toUpperCase()}.`)}),tt(o,t),document.body.appendChild(o),v.set(t,o),V.set(t,!1),H(t),o}function z(t){const e=ne(t);Qt(t),e.classList.add("show"),V.set(t,!0),it(t,"toggleCitationsPanel",!0),tt(e,t),ct(t,e),H(t),C(e,"author")?.focus()}function zt(t,e){const n=nt(t);return(typeof e=="boolean"?e:!n)?z(t):U(t,!1),!0}function oe(t){const e=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="c"}function ie(t){const e=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="b"}function re(t){const e=t.key.toLowerCase();return(t.metaKey||t.ctrlKey)&&t.altKey&&t.shiftKey&&e==="j"}function ae(t){M=t,I||(I=e=>{const i=e.target?.closest(E);if(!i)return;p=i,f.has(i)||f.set(i,t),T.has(i)||T.set(i,t.defaultStyle);const o=v.get(i);o&&(tt(o,i),ct(i,o)),it(i,"toggleCitationsPanel",nt(i))},document.addEventListener("focusin",I,!0)),B||(B=e=>{const i=e.target?.closest(E);i&&(p=i,kt(i))},document.addEventListener("input",B,!0)),O||(O=e=>{if(e.defaultPrevented)return;const i=!!e.target?.closest(`.${b} input, .${b} textarea, .${b} select`),o=h(void 0,!1);if(!o||$(o))return;const r=f.get(o)||M||t;if(f.set(o,r),p=o,e.key==="Escape"&&nt(o)){e.preventDefault(),U(o,!0);return}if(!i&&!Xt(e,o,r)){if(oe(e)){e.preventDefault(),e.stopPropagation(),zt(o);return}if(ie(e)){e.preventDefault(),e.stopPropagation(),y(o,r,!0),z(o);return}re(e)&&(e.preventDefault(),e.stopPropagation(),bt(o,r))}},document.addEventListener("keydown",O,!0)),k||(k=()=>{v.forEach((e,n)=>{if(!n.isConnected||!e.isConnected){At(n),e.remove(),v.delete(n),V.delete(n);return}tt(e,n),ct(n,e)})},window.addEventListener("scroll",k,!0),window.addEventListener("resize",k))}function se(){I&&(document.removeEventListener("focusin",I,!0),I=null),B&&(document.removeEventListener("input",B,!0),B=null),O&&(document.removeEventListener("keydown",O,!0),O=null),k&&(window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),k=null),v.forEach(t=>t.remove()),v.clear(),M=null,p=null}function ce(){if(typeof document>"u"||document.getElementById(mt))return;const t=document.createElement("style");t.id=mt,t.textContent=`
|
|
81
|
+
.rte-toolbar-group-items.citations,
|
|
82
|
+
.editora-toolbar-group-items.citations {
|
|
83
|
+
display: flex;
|
|
84
|
+
border: 1px solid #ccc;
|
|
85
|
+
border-radius: 3px;
|
|
86
|
+
background: #fff;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
.rte-toolbar-group-items.citations .rte-toolbar-button,
|
|
90
|
+
.editora-toolbar-group-items.citations .editora-toolbar-button {
|
|
91
|
+
border: none;
|
|
92
|
+
border-radius: 0;
|
|
93
|
+
border-right: 1px solid #ccc;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.rte-toolbar-group-items.citations .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
97
|
+
.editora-toolbar-group-items.citations .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
98
|
+
border-right: none;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.rte-toolbar-button[data-command="toggleCitationsPanel"].active,
|
|
102
|
+
.editora-toolbar-button[data-command="toggleCitationsPanel"].active {
|
|
103
|
+
background: #ccc;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
${x} .rte-toolbar-group-items.citations,
|
|
107
|
+
${x} .editora-toolbar-group-items.citations,
|
|
108
|
+
.${b}.rte-citations-theme-dark {
|
|
109
|
+
border-color: #566275;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
${x} .rte-toolbar-group-items.citations .rte-toolbar-button[data-command="refreshCitations"] svg,
|
|
113
|
+
${x} .editora-toolbar-group-items.citations .editora-toolbar-button[data-command="refreshCitations"] svg
|
|
114
|
+
{
|
|
115
|
+
fill: none;
|
|
116
|
+
}
|
|
117
|
+
${x} .rte-toolbar-group-items.citations .rte-toolbar-button,
|
|
118
|
+
${x} .editora-toolbar-group-items.citations .editora-toolbar-button
|
|
119
|
+
{
|
|
120
|
+
border-color: #566275;
|
|
121
|
+
}
|
|
122
|
+
${x} .rte-toolbar-button[data-command="toggleCitationsPanel"].active,
|
|
123
|
+
${x} .editora-toolbar-button[data-command="toggleCitationsPanel"].active {
|
|
124
|
+
background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
|
|
125
|
+
}
|
|
126
|
+
.${b} {
|
|
127
|
+
position: fixed;
|
|
128
|
+
z-index: 1500;
|
|
129
|
+
right: 16px;
|
|
130
|
+
top: 16px;
|
|
131
|
+
width: min(380px, calc(100vw - 20px));
|
|
132
|
+
max-height: calc(100vh - 24px);
|
|
133
|
+
display: none;
|
|
134
|
+
flex-direction: column;
|
|
135
|
+
border-radius: 12px;
|
|
136
|
+
border: 1px solid #d1d5db;
|
|
137
|
+
background: #ffffff;
|
|
138
|
+
color: #0f172a;
|
|
139
|
+
box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
|
|
140
|
+
overflow: hidden;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.${b}.show {
|
|
144
|
+
display: flex;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.${b}.rte-citations-theme-dark {
|
|
148
|
+
background: #0f172a;
|
|
149
|
+
color: #e2e8f0;
|
|
150
|
+
border-color: #334155;
|
|
151
|
+
box-shadow: 0 20px 40px rgba(2, 6, 23, 0.5);
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
.rte-citations-header {
|
|
155
|
+
display: flex;
|
|
156
|
+
align-items: center;
|
|
157
|
+
justify-content: space-between;
|
|
158
|
+
padding: 10px 12px;
|
|
159
|
+
border-bottom: 1px solid #e2e8f0;
|
|
160
|
+
background: #f8fafc;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.${b}.rte-citations-theme-dark .rte-citations-header {
|
|
164
|
+
border-bottom-color: #334155;
|
|
165
|
+
background: #111827;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
.rte-citations-title {
|
|
169
|
+
margin: 0;
|
|
170
|
+
font-size: 14px;
|
|
171
|
+
font-weight: 700;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.rte-citations-icon-btn {
|
|
175
|
+
border: 1px solid #cbd5e1;
|
|
176
|
+
background: #ffffff;
|
|
177
|
+
color: #0f172a;
|
|
178
|
+
border-radius: 6px;
|
|
179
|
+
cursor: pointer;
|
|
180
|
+
min-width: 34px;
|
|
181
|
+
min-height: 34px;
|
|
182
|
+
width: 34px;
|
|
183
|
+
height: 34px;
|
|
184
|
+
padding: 0;
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
font-size: 16px;
|
|
189
|
+
line-height: 1;
|
|
190
|
+
font-weight: 600;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.rte-citations-icon-btn:hover,
|
|
194
|
+
.rte-citations-icon-btn:focus-visible {
|
|
195
|
+
outline: none;
|
|
196
|
+
border-color: #3b82f6;
|
|
197
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.${b}.rte-citations-theme-dark .rte-citations-icon-btn {
|
|
201
|
+
background: #0f172a;
|
|
202
|
+
border-color: #475569;
|
|
203
|
+
color: #e2e8f0;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.${b}.rte-citations-theme-dark .rte-citations-icon-btn:hover,
|
|
207
|
+
.${b}.rte-citations-theme-dark .rte-citations-icon-btn:focus-visible {
|
|
208
|
+
border-color: #60a5fa;
|
|
209
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.rte-citations-body {
|
|
213
|
+
display: flex;
|
|
214
|
+
flex-direction: column;
|
|
215
|
+
gap: 10px;
|
|
216
|
+
padding: 12px;
|
|
217
|
+
overflow: auto;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.rte-citations-status {
|
|
221
|
+
margin: 0;
|
|
222
|
+
font-size: 12px;
|
|
223
|
+
color: #475569;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
.${b}.rte-citations-theme-dark .rte-citations-status {
|
|
227
|
+
color: #94a3b8;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.rte-citations-grid {
|
|
231
|
+
display: grid;
|
|
232
|
+
grid-template-columns: 1fr 1fr;
|
|
233
|
+
gap: 8px;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.rte-citations-label {
|
|
237
|
+
display: flex;
|
|
238
|
+
flex-direction: column;
|
|
239
|
+
gap: 4px;
|
|
240
|
+
font-size: 12px;
|
|
241
|
+
font-weight: 600;
|
|
242
|
+
color: inherit;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.rte-citations-label-note {
|
|
246
|
+
grid-column: 1 / -1;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.rte-citations-field {
|
|
250
|
+
width: 100%;
|
|
251
|
+
box-sizing: border-box;
|
|
252
|
+
min-height: 30px;
|
|
253
|
+
border-radius: 8px;
|
|
254
|
+
border: 1px solid #cbd5e1;
|
|
255
|
+
background: #ffffff;
|
|
256
|
+
color: inherit;
|
|
257
|
+
font-size: 13px;
|
|
258
|
+
padding: 6px 8px;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.rte-citations-field:focus-visible {
|
|
262
|
+
outline: none;
|
|
263
|
+
border-color: #1d4ed8;
|
|
264
|
+
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.${b}.rte-citations-theme-dark .rte-citations-field {
|
|
268
|
+
border-color: #334155;
|
|
269
|
+
background: #0b1220;
|
|
270
|
+
color: #e2e8f0;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.rte-citations-controls {
|
|
274
|
+
display: flex;
|
|
275
|
+
flex-wrap: wrap;
|
|
276
|
+
gap: 8px;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.rte-citations-btn {
|
|
280
|
+
border: 1px solid #cbd5e1;
|
|
281
|
+
background: #f8fafc;
|
|
282
|
+
color: inherit;
|
|
283
|
+
border-radius: 8px;
|
|
284
|
+
padding: 6px 10px;
|
|
285
|
+
font-size: 12px;
|
|
286
|
+
font-weight: 600;
|
|
287
|
+
cursor: pointer;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.rte-citations-btn:hover,
|
|
291
|
+
.rte-citations-btn:focus-visible {
|
|
292
|
+
outline: none;
|
|
293
|
+
border-color: #1d4ed8;
|
|
294
|
+
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.rte-citations-btn-primary {
|
|
298
|
+
background: #1d4ed8;
|
|
299
|
+
border-color: #1d4ed8;
|
|
300
|
+
color: #ffffff;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
.rte-citations-btn-primary:hover,
|
|
304
|
+
.rte-citations-btn-primary:focus-visible {
|
|
305
|
+
background: #1e40af;
|
|
306
|
+
border-color: #1e40af;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
.${b}.rte-citations-theme-dark .rte-citations-btn {
|
|
310
|
+
border-color: #334155;
|
|
311
|
+
background: #0b1220;
|
|
312
|
+
color: #e2e8f0;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
.${b}.rte-citations-theme-dark .rte-citations-btn-primary {
|
|
316
|
+
border-color: #2563eb;
|
|
317
|
+
background: #2563eb;
|
|
318
|
+
color: #ffffff;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.rte-citations-recent {
|
|
322
|
+
border: 1px solid #e2e8f0;
|
|
323
|
+
border-radius: 10px;
|
|
324
|
+
padding: 8px;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.${b}.rte-citations-theme-dark .rte-citations-recent {
|
|
328
|
+
border-color: #334155;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.rte-citations-recent-heading {
|
|
332
|
+
margin: 0 0 8px;
|
|
333
|
+
font-size: 12px;
|
|
334
|
+
font-weight: 700;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.rte-citations-recent-list {
|
|
338
|
+
margin: 0;
|
|
339
|
+
padding: 0;
|
|
340
|
+
list-style: none;
|
|
341
|
+
display: flex;
|
|
342
|
+
flex-direction: column;
|
|
343
|
+
gap: 6px;
|
|
344
|
+
max-height: 170px;
|
|
345
|
+
overflow: auto;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
.rte-citations-recent-btn {
|
|
349
|
+
width: 100%;
|
|
350
|
+
text-align: left;
|
|
351
|
+
border: 1px solid #cbd5e1;
|
|
352
|
+
background: #ffffff;
|
|
353
|
+
color: inherit;
|
|
354
|
+
border-radius: 8px;
|
|
355
|
+
padding: 7px;
|
|
356
|
+
cursor: pointer;
|
|
357
|
+
display: flex;
|
|
358
|
+
flex-direction: column;
|
|
359
|
+
gap: 2px;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.rte-citations-recent-row {
|
|
363
|
+
display: flex;
|
|
364
|
+
gap: 6px;
|
|
365
|
+
align-items: stretch;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.rte-citations-recent-delete {
|
|
369
|
+
flex: 0 0 auto;
|
|
370
|
+
border: 1px solid #fecaca;
|
|
371
|
+
background: #fff1f2;
|
|
372
|
+
color: #b91c1c;
|
|
373
|
+
border-radius: 8px;
|
|
374
|
+
padding: 0 8px;
|
|
375
|
+
font-size: 11px;
|
|
376
|
+
font-weight: 700;
|
|
377
|
+
cursor: pointer;
|
|
378
|
+
min-height: 34px;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
.rte-citations-recent-delete:hover,
|
|
382
|
+
.rte-citations-recent-delete:focus-visible {
|
|
383
|
+
outline: none;
|
|
384
|
+
border-color: #f87171;
|
|
385
|
+
box-shadow: 0 0 0 2px rgba(248, 113, 113, 0.2);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.rte-citations-recent-btn:focus-visible,
|
|
389
|
+
.rte-citations-recent-btn:hover {
|
|
390
|
+
outline: none;
|
|
391
|
+
border-color: #1d4ed8;
|
|
392
|
+
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.18);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
.${b}.rte-citations-theme-dark .rte-citations-recent-btn {
|
|
396
|
+
border-color: #334155;
|
|
397
|
+
background: #0b1220;
|
|
398
|
+
color: #e2e8f0;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.${b}.rte-citations-theme-dark .rte-citations-recent-delete {
|
|
402
|
+
border-color: #7f1d1d;
|
|
403
|
+
background: #2b1218;
|
|
404
|
+
color: #fca5a5;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.rte-citations-recent-title {
|
|
408
|
+
font-size: 12px;
|
|
409
|
+
font-weight: 700;
|
|
410
|
+
line-height: 1.3;
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
.rte-citations-recent-meta {
|
|
414
|
+
font-size: 11px;
|
|
415
|
+
color: #64748b;
|
|
416
|
+
line-height: 1.3;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
.${b}.rte-citations-theme-dark .rte-citations-recent-meta {
|
|
420
|
+
color: #94a3b8;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.rte-citations-empty {
|
|
424
|
+
border: 1px dashed #cbd5e1;
|
|
425
|
+
border-radius: 8px;
|
|
426
|
+
padding: 8px;
|
|
427
|
+
font-size: 12px;
|
|
428
|
+
color: #64748b;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.${b}.rte-citations-theme-dark .rte-citations-empty {
|
|
432
|
+
border-color: #334155;
|
|
433
|
+
color: #94a3b8;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
.rte-citations-shortcut {
|
|
437
|
+
margin: 0;
|
|
438
|
+
font-size: 11px;
|
|
439
|
+
color: #64748b;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.${b}.rte-citations-theme-dark .rte-citations-shortcut {
|
|
443
|
+
color: #94a3b8;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.rte-citations-live {
|
|
447
|
+
position: absolute;
|
|
448
|
+
width: 1px;
|
|
449
|
+
height: 1px;
|
|
450
|
+
margin: -1px;
|
|
451
|
+
padding: 0;
|
|
452
|
+
overflow: hidden;
|
|
453
|
+
clip: rect(0 0 0 0);
|
|
454
|
+
border: 0;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
.rte-citation-ref {
|
|
458
|
+
display: inline-flex;
|
|
459
|
+
align-items: center;
|
|
460
|
+
border-radius: 6px;
|
|
461
|
+
border: 1px solid rgba(29, 78, 216, 0.24);
|
|
462
|
+
background: rgba(29, 78, 216, 0.08);
|
|
463
|
+
color: #1e3a8a;
|
|
464
|
+
padding: 0 4px;
|
|
465
|
+
margin: 0 1px;
|
|
466
|
+
font-size: 0.92em;
|
|
467
|
+
line-height: 1.35;
|
|
468
|
+
white-space: nowrap;
|
|
469
|
+
cursor: pointer;
|
|
470
|
+
user-select: all;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
.rte-citation-ref:focus,
|
|
474
|
+
.rte-citation-ref:focus-visible {
|
|
475
|
+
outline: none;
|
|
476
|
+
border-color: #1d4ed8;
|
|
477
|
+
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.22);
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
.${x} .rte-citation-ref {
|
|
481
|
+
border-color: rgba(96, 165, 250, 0.45);
|
|
482
|
+
background: rgba(37, 99, 235, 0.22);
|
|
483
|
+
color: #bfdbfe;
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
.rte-citation-bibliography,
|
|
487
|
+
.rte-citation-footnotes {
|
|
488
|
+
margin-top: 16px;
|
|
489
|
+
border-top: 1px solid #d1d5db;
|
|
490
|
+
padding-top: 10px;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.${x} .rte-citation-bibliography,
|
|
494
|
+
.${x} .rte-citation-footnotes {
|
|
495
|
+
border-top-color: #475569;
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
.rte-citation-section-title {
|
|
499
|
+
margin: 0 0 8px;
|
|
500
|
+
font-size: 1em;
|
|
501
|
+
font-weight: 700;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
.rte-citation-list {
|
|
505
|
+
margin: 0;
|
|
506
|
+
padding-left: 22px;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
.rte-citation-item {
|
|
510
|
+
margin: 0 0 8px;
|
|
511
|
+
line-height: 1.45;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.rte-citation-backref {
|
|
515
|
+
margin-left: 8px;
|
|
516
|
+
color: #1d4ed8;
|
|
517
|
+
text-decoration: none;
|
|
518
|
+
font-size: 0.9em;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
.rte-citation-backref:hover,
|
|
522
|
+
.rte-citation-backref:focus-visible {
|
|
523
|
+
text-decoration: underline;
|
|
524
|
+
outline: none;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
.${x} .rte-citation-backref {
|
|
528
|
+
color: #93c5fd;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
@media (max-width: 768px) {
|
|
532
|
+
.${b} {
|
|
533
|
+
left: 10px !important;
|
|
534
|
+
right: 10px;
|
|
535
|
+
top: 10px !important;
|
|
536
|
+
width: auto !important;
|
|
537
|
+
max-height: calc(100vh - 20px);
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.rte-citations-grid {
|
|
541
|
+
grid-template-columns: 1fr;
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
.rte-citations-recent-list {
|
|
545
|
+
max-height: 34vh;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
`,document.head.appendChild(t)}const le=(t={})=>{const e=Z(t);return ce(),{name:"citations",toolbar:[{id:"citationsGroup",label:"Citations",type:"group",command:"citations",items:[{id:"citations",label:"Citations",command:"toggleCitationsPanel",shortcut:"Mod-Alt-Shift-c",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M6 5h12M6 9h12M6 13h8M6 17h10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17 14.5a2.5 2.5 0 0 1 2.5 2.5v2H15v-2a2 2 0 0 1 2-2Z" stroke="currentColor" stroke-width="1.5"/></svg>'},{id:"citationsRefresh",label:"Refresh Citations",command:"refreshCitations",shortcut:"Mod-Alt-Shift-b",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M20 12a8 8 0 1 1-2.34-5.66" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M20 4v6h-6" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"citationsStyle",label:"Cycle Citation Style",command:"cycleCitationStyle",shortcut:"Mod-Alt-Shift-j",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 6h14M5 10h8M5 14h14M5 18h10" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><circle cx="18" cy="10" r="2" stroke="currentColor" stroke-width="1.6"/></svg>'}]}],commands:{citations:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;return f.set(o,r),T.set(o,N(o,r)),p=o,z(o),y(o,r,!1),!0},toggleCitationsPanel:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;f.set(o,r),p=o;const a=zt(o,typeof n=="boolean"?n:void 0);return nt(o)&&y(o,r,!1),a},insertCitation:(n,i)=>{const o=h(i);if(!o||$(o)||!n||typeof n!="object")return!1;const r=f.get(o)||e;f.set(o,r),p=o;const a=et(o,n,r);return a&&z(o),a},refreshCitations:(n,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||e;return f.set(o,r),p=o,y(o,r,!0),z(o),!0},setCitationStyle:(n,i)=>{const o=h(i);if(!o||!n)return!1;const r=f.get(o)||e;return f.set(o,r),p=o,Nt(o,n,r),!0},cycleCitationStyle:(n,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||e;return f.set(o,r),p=o,bt(o,r),H(o),!0},getCitationRecords:(n,i)=>{const o=h(i);if(!o)return!1;const r=f.get(o)||e,a=K(o,r);if(typeof n=="function")try{n(a)}catch{}return o.__citationRecords=a,o.dispatchEvent(new CustomEvent("editora:citations-data",{bubbles:!0,detail:{records:a,style:N(o,r)}})),!0},setCitationsOptions:(n,i)=>{const o=h(i);if(!o||!n||typeof n!="object")return!1;const r=f.get(o)||e,a=Z({...r,...n,labels:{...r.labels,...n.labels||{}},normalizeText:n.normalizeText||r.normalizeText,generateCitationId:n.generateCitationId||r.generateCitationId});return f.set(o,a),n.defaultStyle&&L.includes(n.defaultStyle)&&T.set(o,n.defaultStyle),y(o,a,!0),H(o),!0},locateCitation:(n,i)=>{const o=h(i);return!o||typeof n!="string"?!1:Zt(o,n)},deleteCitation:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;return f.set(o,r),typeof n=="string"&&n.trim()?Rt(o,n,r):Jt(o,r)},insertRecentCitation:(n,i)=>{const o=h(i);if(!o||$(o))return!1;const r=f.get(o)||e;f.set(o,r);const a=K(o,r),s=rt(o,a,r);if(s.length===0)return!1;const u=typeof n=="string"&&n.trim()?St(o,n,a,r):s[0];if(!u)return!1;const c=et(o,u,r);return c&&z(o),c}},keymap:{"Mod-Alt-Shift-c":"toggleCitationsPanel","Mod-Alt-Shift-C":"toggleCitationsPanel","Mod-Alt-Shift-b":"refreshCitations","Mod-Alt-Shift-B":"refreshCitations","Mod-Alt-Shift-j":"cycleCitationStyle","Mod-Alt-Shift-J":"cycleCitationStyle"},init:function(i){Y+=1;const o=this&&typeof this.__pluginConfig=="object"?Z({...e,...this.__pluginConfig}):e;ae(o);const r=h(i&&i.editorElement?{editorElement:i.editorElement}:void 0,!1);r&&(p=r,f.set(r,o),T.set(r,o.defaultStyle),it(r,"toggleCitationsPanel",!1),kt(r))},destroy:()=>{Y=Math.max(0,Y-1),!(Y>0)&&(q.forEach(n=>{window.clearTimeout(n)}),q.clear(),se())}}};exports.CitationsPlugin=le;
|