@editora/plugins 1.0.9 → 1.0.10
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/README.md +5 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +249 -208
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +245 -178
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +512 -439
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +432 -371
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +159 -105
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +368 -328
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +308 -240
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +56 -54
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +128 -125
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +286 -238
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +49 -33
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +463 -393
- package/dist/preview.esm.js +10 -5
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +3 -3
- package/dist/slash-commands.esm.js +212 -176
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +336 -280
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +162 -100
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +678 -602
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +157 -128
- package/package.json +13 -7
- package/LICENSE +0 -21
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
package/dist/mentions.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const g=".rte-content, .editora-content",Y="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",w='.rte-mention[data-mention="true"]',b=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',L=new WeakMap,R=new WeakMap;let q=!1,N=!1,T=null,v=0;function Q(e,n){if(n===e.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,n,e.innerHTML)}catch{}}function U(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function h(e,n){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(n),e.focus({preventScroll:!0}))}function S(e,n){return e.startContainer===n.startContainer&&e.startOffset===n.startOffset&&e.endContainer===n.endContainer&&e.endOffset===n.endOffset}function E(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const o=n.getRangeAt(0);return e.contains(o.commonAncestorContainer)?o.cloneRange():null}function C(e){Array.from(e.querySelectorAll(w)).forEach(o=>{o.setAttribute("data-mention","true"),o.setAttribute("contenteditable","false"),o.setAttribute("spellcheck","false"),o.setAttribute("draggable","false"),o.classList.add("rte-mention")})}function _(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function ee(e){return e.closest(Y)||e}function M(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function ne(e){const n=ee(e);if(M(n))return!0;const o=n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return M(o)?!0:M(document.documentElement)||M(document.body)}function W(e,n){e.classList.remove("rte-mention-theme-dark"),ne(n)&&e.classList.add("rte-mention-theme-dark")}function te(e){if(e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const t=e.editorElement;if(t.matches(g))return t;const r=t.querySelector(g);if(r instanceof HTMLElement)return r}const n=window.getSelection();if(n&&n.rangeCount>0){const t=n.getRangeAt(0).startContainer,i=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest(g);if(i)return i}const o=document.activeElement;if(o){if(o.matches(g))return o;const t=o.closest(g);if(t)return t}return document.querySelector(g)}function x(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function D(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function re(e,n){return n?n.split(".").filter(Boolean).reduce((o,t)=>{if(!(!D(o)&&!Array.isArray(o)))return o[t]},e):e}function oe(e){return e?/\s|[([{"'`]/.test(e):!0}function ie(e){if(!e.collapsed)return null;const n=e.startContainer,o=e.startOffset;if(n.nodeType===Node.TEXT_NODE){const t=n;return{node:t,textBefore:t.data.slice(0,o),caretOffset:o}}if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(o>0){const r=t.childNodes[o-1];if(r&&r.nodeType===Node.TEXT_NODE){const i=r;return{node:i,textBefore:i.data,caretOffset:i.length}}}}return null}function ae(e,n,o){let t=-1,r="";if(n.forEach(a=>{const l=e.lastIndexOf(a);l>t&&(t=l,r=a)}),t<0||!oe(e[t-1]))return null;const i=e.slice(t+1);return/\s/.test(i)||i.length>o?null:{trigger:r,query:i,startOffset:t}}function le(e,n){const o=n.cloneRange();o.collapse(!1);const t=o.getClientRects();if(t.length>0)return t[t.length-1];const r=document.createElement("span");r.textContent="",r.style.position="relative",o.insertNode(r);const i=r.getBoundingClientRect();return r.remove(),e.normalize(),i}function se(e,n){if(e.panel&&e.list)return;const o=document.createElement("div");o.className="rte-mention-panel",o.style.display="none";const t=document.createElement("div");t.className="rte-mention-list",o.appendChild(t),document.body.appendChild(o),W(o,e.editor),e.panel=o,e.list=t,o.addEventListener("mousedown",r=>{r.preventDefault()}),o.addEventListener("click",r=>{const i=r.target;if(!i)return;const a=i.closest(".rte-mention-item");if(!a)return;const l=Number(a.getAttribute("data-index"));Number.isFinite(l)&&K(e,n,l)})}function m(e){e.panel&&(e.debounceHandle!==null&&(window.clearTimeout(e.debounceHandle),e.debounceHandle=null),e.abortController&&(e.abortController.abort(),e.abortController=null),e.panel.style.display="none",e.panel.classList.remove("show"),e.isOpen=!1,e.loading=!1,e.items=[],e.activeIndex=0,e.query="",e.replaceRange=null)}function $(e,n){if(!e.panel)return;W(e.panel,e.editor);const o=le(e.editor,n),t=e.panel;t.style.display="block",t.classList.add("show"),t.style.left="0px",t.style.top="0px";const r=t.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight;let l=Math.max(8,Math.min(o.left,i-r.width-8)),s=o.bottom+8;s+r.height>a-8&&(s=Math.max(8,o.top-r.height-8)),t.style.position="fixed",t.style.left=`${l}px`,t.style.top=`${s}px`}function ce(e,n){if(!n)return x(e);const o=e.toLowerCase(),t=n.toLowerCase(),r=o.indexOf(t);if(r<0)return x(e);const i=x(e.slice(0,r)),a=x(e.slice(r,r+n.length)),l=x(e.slice(r+n.length));return`${i}<mark>${a}</mark>${l}`}function B(e,n){if(!e.list)return;const o=e.list;if(o.innerHTML="",e.loading){const t=document.createElement("div");t.className="rte-mention-empty",t.textContent=n.loadingText,o.appendChild(t);return}if(e.items.length===0){const t=document.createElement("div");t.className="rte-mention-empty",t.textContent=e.query.length>0?n.noResultsText:n.emptyStateText,o.appendChild(t);return}e.items.forEach((t,r)=>{const i=document.createElement("button");i.type="button",i.className="rte-mention-item",r===e.activeIndex&&i.classList.add("active"),i.setAttribute("data-index",String(r));const a=n.itemRenderer?n.itemRenderer(t,e.query):`<span class="rte-mention-item-label">${ce(t.label,e.query)}</span>${t.meta?`<span class="rte-mention-item-meta">${x(t.meta)}</span>`:""}`;i.innerHTML=a,o.appendChild(i)})}function G(e,n){const o=new Set,t=[];return e.forEach(r=>{const i=(r.id||"").trim();!i||o.has(i)||(o.add(i),t.push({id:i,label:r.label||i,value:r.value,meta:r.meta}))}),t.slice(0,n)}function ue(e,n){if(e.buildRequest){const c=e.buildRequest(n);return{url:c.url,init:c.init||{}}}const o=(e.method||"GET").toUpperCase(),t=typeof e.headers=="function"?e.headers(n):e.headers||{},r=e.queryParam||"q",i=e.triggerParam||"trigger",a=e.limitParam||"limit",l=e.staticParams||{},s={method:o,headers:{...t},credentials:e.credentials,mode:e.mode,cache:e.cache,signal:n.signal},f=new URL(e.url,window.location.origin);if(o==="GET"||o==="HEAD"){const c=new URLSearchParams(f.search);Object.entries(l).forEach(([d,p])=>c.set(d,String(p))),c.set(r,n.query),c.set(i,n.trigger),c.set(a,String(n.limit)),f.search=c.toString()}else{const c=typeof e.body=="function"?e.body(n):e.body,d={[r]:n.query,[i]:n.trigger,[a]:n.limit,...l},p=c??d;if(D(p)){s.body=JSON.stringify(p);const y=s.headers;!y["Content-Type"]&&!y["content-type"]&&(y["Content-Type"]="application/json")}else s.body=p}return{url:f.toString(),init:s}}async function de(e,n,o,t){const r=n.api;if(!r)return[];e.abortController&&e.abortController.abort();const i=new AbortController;e.abortController=i;const a={query:o,trigger:t,limit:n.maxSuggestions,signal:i.signal},l=Math.max(0,r.timeoutMs??1e4);let s=null;l>0&&(s=window.setTimeout(()=>i.abort(),l));try{const{url:f,init:c}=ue(r,a),d=await fetch(f,{...c,signal:i.signal});if(!d.ok)throw new Error(`Mention API request failed: ${d.status}`);const y=(r.responseType||"json")==="text"?await d.text():await d.json();let O=[];if(r.transformResponse)O=r.transformResponse(y,a)||[];else{const P=re(y,r.responsePath);O=(Array.isArray(P)?P:Array.isArray(y)?y:[]).map((u,J)=>{if(r.mapItem)return r.mapItem(u,J);if(!D(u))return null;const I=String(u.id??u.value??u.key??"").trim();if(!I)return null;const Z=String(u.label??u.name??I).trim();return{id:I,label:Z,value:u.value?String(u.value):void 0,meta:u.meta?String(u.meta):void 0}}).filter(u=>!!u)}return G(O,n.maxSuggestions)}catch(f){return f?.name!=="AbortError"&&r.onError?.(f,a),[]}finally{s!==null&&window.clearTimeout(s),e.abortController===i&&(e.abortController=null)}}async function fe(e,n,o,t){const r=++e.requestId;let i=[];if(n.search){const a=await n.search(o,t);i=Array.isArray(a)?a:[]}else if(n.api)i=await de(e,n,o,t);else{const a=o.toLowerCase();i=n.items.filter(l=>a?l.label.toLowerCase().includes(a)||l.id.toLowerCase().includes(a):!0)}return r!==e.requestId?[]:G(i,n.maxSuggestions)}function me(e,n,o){const t=e.editor;if(C(t),!window.getSelection())return!1;const i=t.innerHTML;let a=e.replaceRange?e.replaceRange.cloneRange():E(t);if(!a||!t.contains(a.commonAncestorContainer)&&(a=E(t),!a))return!1;const l=A(t,a.cloneRange(),"after");S(l,a)||(h(t,l),a=l),a.deleteContents();const s=document.createElement("span");s.className="rte-mention",s.setAttribute("data-mention","true"),s.setAttribute("data-mention-id",o.id),s.setAttribute("contenteditable","false"),s.textContent=o.value||`${e.trigger}${o.label}`,a.insertNode(s);let f=s,c=1;if(n.insertSpaceAfterMention){const p=document.createTextNode(" ");s.after(p),f=p,c=1}const d=document.createRange();return d.setStart(f,c),d.collapse(!0),h(t,d),m(e),C(t),U(t),Q(t,i),!0}function K(e,n,o){if(o<0||o>=e.items.length)return;const t=e.items[o];me(e,n,t)}function pe(e){return e.startContainer!==e.endContainer||e.startContainer.nodeType!==Node.ELEMENT_NODE||e.endOffset-e.startOffset!==1?null:e.startContainer.childNodes[e.startOffset]||null}function ge(e,n){const o=pe(e);return!(o instanceof HTMLElement)||!o.matches(w)||!n.contains(o)?null:o}function V(e,n){const o=ge(e,n);if(o)return o;const r=_(e.startContainer)?.closest(w);if(r&&n.contains(r))return r;const a=_(e.endContainer)?.closest(w);return a&&n.contains(a)?a:null}function A(e,n,o="after"){const t=V(n,e);if(!t)return n;const r=document.createRange();return o==="before"?r.setStartBefore(t):r.setStartAfter(t),r.collapse(!0),r}function j(e,n,o="after"){const t=document.createRange();o==="before"?t.setStartBefore(n):t.setStartAfter(n),t.collapse(!0),h(e,t)}function he(e,n,o){if(!e.collapsed)return null;const t=e.startContainer,r=e.startOffset;let i=null;if(t.nodeType===Node.TEXT_NODE){const a=t;n==="backward"&&r===0?i=a.previousSibling:n==="forward"&&r===a.length&&(i=a.nextSibling)}else if(t.nodeType===Node.ELEMENT_NODE){const a=t;n==="backward"&&r>0?i=a.childNodes[r-1]||null:n==="forward"&&r<a.childNodes.length&&(i=a.childNodes[r]||null)}return!(i instanceof HTMLElement)||!i.matches(w)||!o.contains(i)?null:i}function z(e,n){const o=E(e);if(!o)return!1;const t=he(o,n,e);if(!t)return!1;const r=t.parentNode;if(!r)return!1;const i=e.innerHTML,a=Array.prototype.indexOf.call(r.childNodes,t);t.remove();const l=document.createRange();return l.setStart(r,Math.max(0,a)),l.collapse(!0),h(e,l),U(e),Q(e,i),!0}function X(e,n,o,t,r,i){if(se(e,n),e.query=t,e.trigger=r,e.replaceRange=i.cloneRange(),e.loading=!!(n.api&&!n.search),e.debounceHandle!==null&&(window.clearTimeout(e.debounceHandle),e.debounceHandle=null),!e.panel)return;e.isOpen||(e.panel.style.display="block",e.panel.classList.add("show"),e.isOpen=!0),B(e,n),$(e,o);const a=()=>{e.debounceHandle=null,fe(e,n,t,r).then(s=>{e.loading=!1,e.items=s,e.activeIndex=0,e.panel&&(B(e,n),$(e,o))})},l=n.api&&!n.search?Math.max(0,n.api.debounceMs??180):0;l>0?e.debounceHandle=window.setTimeout(a,l):a()}function ye(e,n){const o=e.editor;C(o);let t=E(o);if(!t||!t.collapsed){m(e);return}const r=A(o,t.cloneRange(),"after");if(!S(r,t)){h(o,r),t=r,m(e);return}const i=ie(t);if(!i){m(e);return}const a=ae(i.textBefore,n.triggerChars,n.maxQueryLength);if(!a){m(e);return}if(a.query.length<n.minChars){m(e);return}const l=t.cloneRange();l.setStart(i.node,a.startOffset),l.setEnd(i.node,i.caretOffset),X(e,n,t,a.query,a.trigger,l)}function F(e,n){if(e.items.length===0)return;const o=e.items.length;if(e.activeIndex=((e.activeIndex+n)%o+o)%o,!e.list)return;const t=Array.from(e.list.querySelectorAll(".rte-mention-item"));t.forEach((i,a)=>i.classList.toggle("active",a===e.activeIndex)),t[e.activeIndex]?.scrollIntoView({block:"nearest"})}function be(e){return{editor:e,panel:null,list:null,replaceRange:null,items:[],activeIndex:0,query:"",trigger:"@",loading:!1,isOpen:!1,requestId:0,debounceHandle:null,abortController:null}}function Ee(e){const n=L.get(e);n&&(n.panel?.parentNode&&n.panel.parentNode.removeChild(n.panel),L.delete(e))}function H(e,n,o){if(R.has(e))return;C(e);const t={beforeInput:r=>{C(e);const i=E(e);if(!i)return;const a=V(i,e);if(!a)return;const l=r.inputType||"";if(l.startsWith("insert")){if(r.preventDefault(),j(e,a,"after"),l==="insertParagraph"||l==="insertLineBreak"){const s=l==="insertLineBreak"?"insertLineBreak":"insertParagraph";document.execCommand(s,!1);return}if(l==="insertText"||l==="insertCompositionText"){const s=r.data||"";if(!s)return;document.execCommand("insertText",!1,s)}}},input:()=>{ye(n,o)},keydown:r=>{if(n.isOpen){if(r.key==="ArrowDown"){r.preventDefault(),F(n,1);return}if(r.key==="ArrowUp"){r.preventDefault(),F(n,-1);return}if(r.key==="Enter"||r.key==="Tab"){r.preventDefault(),K(n,o,n.activeIndex);return}if(r.key==="Escape"){r.preventDefault(),m(n);return}}const i=E(e);if(i){const a=A(e,i.cloneRange(),"after");if(!S(a,i)){if(r.key==="Enter"){r.preventDefault(),h(e,a),document.execCommand("insertParagraph",!1);return}r.key.length===1&&!r.metaKey&&!r.ctrlKey&&!r.altKey&&h(e,a)}}if(r.key==="Backspace"&&z(e,"backward")){r.preventDefault();return}if(r.key==="Delete"&&z(e,"forward")){r.preventDefault();return}},click:r=>{const i=r.target;if(!i)return;const l=(i.nodeType===Node.ELEMENT_NODE?i:i.parentElement)?.closest(w);!l||!e.contains(l)||(r.preventDefault(),r.stopPropagation(),j(e,l,"after"),m(n))},blur:()=>{window.setTimeout(()=>{const r=document.activeElement;n.panel&&r&&n.panel.contains(r)||m(n)},0)},mousedown:r=>{if(!n.isOpen||!n.panel)return;const i=r.target;i&&!n.panel.contains(i)&&!e.contains(i)&&m(n)}};e.addEventListener("beforeinput",t.beforeInput),e.addEventListener("input",t.input),e.addEventListener("keydown",t.keydown),e.addEventListener("click",t.click),e.addEventListener("blur",t.blur),document.addEventListener("mousedown",t.mousedown,!0),R.set(e,t)}function xe(e){const n=R.get(e);n&&(e.removeEventListener("beforeinput",n.beforeInput),e.removeEventListener("input",n.input),e.removeEventListener("keydown",n.keydown),e.removeEventListener("click",n.click),e.removeEventListener("blur",n.blur),document.removeEventListener("mousedown",n.mousedown,!0),R.delete(e))}function we(){if(q||typeof document>"u")return;q=!0;const e=document.createElement("style");e.id="rte-mention-plugin-styles",e.textContent=`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=".rte-content, .editora-content",ee="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",x='.rte-mention[data-mention="true"]',y=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',R=new WeakMap,N=new WeakMap;let _=!1,S=!1,w=null,M=0;function U(e,n){if(n===e.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,n,e.innerHTML)}catch{}}function W(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function h(e,n){const o=window.getSelection();o&&(o.removeAllRanges(),o.addRange(n),e.focus({preventScroll:!0}))}function A(e,n){return e.startContainer===n.startContainer&&e.startOffset===n.startOffset&&e.endContainer===n.endContainer&&e.endOffset===n.endOffset}function b(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const o=n.getRangeAt(0);return e.contains(o.commonAncestorContainer)?o.cloneRange():null}function T(e){Array.from(e.querySelectorAll(x)).forEach(o=>{o.setAttribute("data-mention","true"),o.setAttribute("contenteditable","false"),o.setAttribute("spellcheck","false"),o.setAttribute("draggable","false"),o.classList.add("rte-mention")})}function $(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function ne(e){return e.closest(ee)||e}function k(e){return e?(e.getAttribute("data-theme")||e.getAttribute("theme")||"").toLowerCase()==="dark"?!0:e.classList.contains("dark")||e.classList.contains("editora-theme-dark")||e.classList.contains("rte-theme-dark"):!1}function te(e){const n=ne(e);if(k(n))return!0;const o=n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return k(o)?!0:k(document.documentElement)||k(document.body)}function G(e,n){e.classList.remove("rte-mention-theme-dark"),te(n)&&e.classList.add("rte-mention-theme-dark")}function re(e){if((e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const t=e.editorElement;if(t.matches(p))return t;const r=t.querySelector(p);if(r instanceof HTMLElement)return r}const n=window.getSelection();if(n&&n.rangeCount>0){const t=n.getRangeAt(0).startContainer,r=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement,i=r==null?void 0:r.closest(p);if(i)return i}const o=document.activeElement;if(o){if(o.matches(p))return o;const t=o.closest(p);if(t)return t}return document.querySelector(p)}function E(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function P(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function oe(e,n){return n?n.split(".").filter(Boolean).reduce((o,t)=>{if(!(!P(o)&&!Array.isArray(o)))return o[t]},e):e}function ie(e){return e?/\s|[([{"'`]/.test(e):!0}function ae(e){if(!e.collapsed)return null;const n=e.startContainer,o=e.startOffset;if(n.nodeType===Node.TEXT_NODE){const t=n;return{node:t,textBefore:t.data.slice(0,o),caretOffset:o}}if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(o>0){const r=t.childNodes[o-1];if(r&&r.nodeType===Node.TEXT_NODE){const i=r;return{node:i,textBefore:i.data,caretOffset:i.length}}}}return null}function le(e,n,o){let t=-1,r="";if(n.forEach(a=>{const l=e.lastIndexOf(a);l>t&&(t=l,r=a)}),t<0||!ie(e[t-1]))return null;const i=e.slice(t+1);return/\s/.test(i)||i.length>o?null:{trigger:r,query:i,startOffset:t}}function se(e,n){const o=n.cloneRange();o.collapse(!1);const t=o.getClientRects();if(t.length>0)return t[t.length-1];const r=document.createElement("span");r.textContent="",r.style.position="relative",o.insertNode(r);const i=r.getBoundingClientRect();return r.remove(),e.normalize(),i}function ce(e,n){if(e.panel&&e.list)return;const o=document.createElement("div");o.className="rte-mention-panel",o.style.display="none";const t=document.createElement("div");t.className="rte-mention-list",o.appendChild(t),document.body.appendChild(o),G(o,e.editor),e.panel=o,e.list=t,o.addEventListener("mousedown",r=>{r.preventDefault()}),o.addEventListener("click",r=>{const i=r.target;if(!i)return;const a=i.closest(".rte-mention-item");if(!a)return;const l=Number(a.getAttribute("data-index"));Number.isFinite(l)&&V(e,n,l)})}function f(e){e.panel&&(e.debounceHandle!==null&&(window.clearTimeout(e.debounceHandle),e.debounceHandle=null),e.abortController&&(e.abortController.abort(),e.abortController=null),e.panel.style.display="none",e.panel.classList.remove("show"),e.isOpen=!1,e.loading=!1,e.items=[],e.activeIndex=0,e.query="",e.replaceRange=null)}function B(e,n){if(!e.panel)return;G(e.panel,e.editor);const o=se(e.editor,n),t=e.panel;t.style.display="block",t.classList.add("show"),t.style.left="0px",t.style.top="0px";const r=t.getBoundingClientRect(),i=window.innerWidth,a=window.innerHeight;let l=Math.max(8,Math.min(o.left,i-r.width-8)),s=o.bottom+8;s+r.height>a-8&&(s=Math.max(8,o.top-r.height-8)),t.style.position="fixed",t.style.left=`${l}px`,t.style.top=`${s}px`}function ue(e,n){if(!n)return E(e);const o=e.toLowerCase(),t=n.toLowerCase(),r=o.indexOf(t);if(r<0)return E(e);const i=E(e.slice(0,r)),a=E(e.slice(r,r+n.length)),l=E(e.slice(r+n.length));return`${i}<mark>${a}</mark>${l}`}function j(e,n){if(!e.list)return;const o=e.list;if(o.innerHTML="",e.loading){const t=document.createElement("div");t.className="rte-mention-empty",t.textContent=n.loadingText,o.appendChild(t);return}if(e.items.length===0){const t=document.createElement("div");t.className="rte-mention-empty",t.textContent=e.query.length>0?n.noResultsText:n.emptyStateText,o.appendChild(t);return}e.items.forEach((t,r)=>{const i=document.createElement("button");i.type="button",i.className="rte-mention-item",r===e.activeIndex&&i.classList.add("active"),i.setAttribute("data-index",String(r));const a=n.itemRenderer?n.itemRenderer(t,e.query):`<span class="rte-mention-item-label">${ue(t.label,e.query)}</span>${t.meta?`<span class="rte-mention-item-meta">${E(t.meta)}</span>`:""}`;i.innerHTML=a,o.appendChild(i)})}function K(e,n){const o=new Set,t=[];return e.forEach(r=>{const i=(r.id||"").trim();!i||o.has(i)||(o.add(i),t.push({id:i,label:r.label||i,value:r.value,meta:r.meta}))}),t.slice(0,n)}function de(e,n){if(e.buildRequest){const c=e.buildRequest(n);return{url:c.url,init:c.init||{}}}const o=(e.method||"GET").toUpperCase(),t=typeof e.headers=="function"?e.headers(n):e.headers||{},r=e.queryParam||"q",i=e.triggerParam||"trigger",a=e.limitParam||"limit",l=e.staticParams||{},s={method:o,headers:{...t},credentials:e.credentials,mode:e.mode,cache:e.cache,signal:n.signal},m=new URL(e.url,window.location.origin);if(o==="GET"||o==="HEAD"){const c=new URLSearchParams(m.search);Object.entries(l).forEach(([g,u])=>c.set(g,String(u))),c.set(r,n.query),c.set(i,n.trigger),c.set(a,String(n.limit)),m.search=c.toString()}else{const c=typeof e.body=="function"?e.body(n):e.body,g={[r]:n.query,[i]:n.trigger,[a]:n.limit,...l},u=c??g;if(P(u)){s.body=JSON.stringify(u);const C=s.headers;!C["Content-Type"]&&!C["content-type"]&&(C["Content-Type"]="application/json")}else s.body=u}return{url:m.toString(),init:s}}async function fe(e,n,o,t){var m;const r=n.api;if(!r)return[];e.abortController&&e.abortController.abort();const i=new AbortController;e.abortController=i;const a={query:o,trigger:t,limit:n.maxSuggestions,signal:i.signal},l=Math.max(0,r.timeoutMs??1e4);let s=null;l>0&&(s=window.setTimeout(()=>i.abort(),l));try{const{url:c,init:g}=de(r,a),u=await fetch(c,{...g,signal:i.signal});if(!u.ok)throw new Error(`Mention API request failed: ${u.status}`);const v=(r.responseType||"json")==="text"?await u.text():await u.json();let I=[];if(r.transformResponse)I=r.transformResponse(v,a)||[];else{const q=oe(v,r.responsePath);I=(Array.isArray(q)?q:Array.isArray(v)?v:[]).map((d,Z)=>{if(r.mapItem)return r.mapItem(d,Z);if(!P(d))return null;const H=String(d.id??d.value??d.key??"").trim();if(!H)return null;const Y=String(d.label??d.name??H).trim();return{id:H,label:Y,value:d.value?String(d.value):void 0,meta:d.meta?String(d.meta):void 0}}).filter(d=>!!d)}return K(I,n.maxSuggestions)}catch(c){return(c==null?void 0:c.name)!=="AbortError"&&((m=r.onError)==null||m.call(r,c,a)),[]}finally{s!==null&&window.clearTimeout(s),e.abortController===i&&(e.abortController=null)}}async function me(e,n,o,t){const r=++e.requestId;let i=[];if(n.search){const a=await n.search(o,t);i=Array.isArray(a)?a:[]}else if(n.api)i=await fe(e,n,o,t);else{const a=o.toLowerCase();i=n.items.filter(l=>a?l.label.toLowerCase().includes(a)||l.id.toLowerCase().includes(a):!0)}return r!==e.requestId?[]:K(i,n.maxSuggestions)}function ge(e,n,o){const t=e.editor;if(T(t),!window.getSelection())return!1;const i=t.innerHTML;let a=e.replaceRange?e.replaceRange.cloneRange():b(t);if(!a||!t.contains(a.commonAncestorContainer)&&(a=b(t),!a))return!1;const l=O(t,a.cloneRange(),"after");A(l,a)||(h(t,l),a=l),a.deleteContents();const s=document.createElement("span");s.className="rte-mention",s.setAttribute("data-mention","true"),s.setAttribute("data-mention-id",o.id),s.setAttribute("contenteditable","false"),s.textContent=o.value||`${e.trigger}${o.label}`,a.insertNode(s);let m=s,c=1;if(n.insertSpaceAfterMention){const u=document.createTextNode(" ");s.after(u),m=u,c=1}const g=document.createRange();return g.setStart(m,c),g.collapse(!0),h(t,g),f(e),T(t),W(t),U(t,i),!0}function V(e,n,o){if(o<0||o>=e.items.length)return;const t=e.items[o];ge(e,n,t)}function pe(e){return e.startContainer!==e.endContainer||e.startContainer.nodeType!==Node.ELEMENT_NODE||e.endOffset-e.startOffset!==1?null:e.startContainer.childNodes[e.startOffset]||null}function he(e,n){const o=pe(e);return!(o instanceof HTMLElement)||!o.matches(x)||!n.contains(o)?null:o}function X(e,n){const o=he(e,n);if(o)return o;const t=$(e.startContainer),r=t==null?void 0:t.closest(x);if(r&&n.contains(r))return r;const i=$(e.endContainer),a=i==null?void 0:i.closest(x);return a&&n.contains(a)?a:null}function O(e,n,o="after"){const t=X(n,e);if(!t)return n;const r=document.createRange();return o==="before"?r.setStartBefore(t):r.setStartAfter(t),r.collapse(!0),r}function z(e,n,o="after"){const t=document.createRange();o==="before"?t.setStartBefore(n):t.setStartAfter(n),t.collapse(!0),h(e,t)}function ye(e,n,o){if(!e.collapsed)return null;const t=e.startContainer,r=e.startOffset;let i=null;if(t.nodeType===Node.TEXT_NODE){const a=t;n==="backward"&&r===0?i=a.previousSibling:n==="forward"&&r===a.length&&(i=a.nextSibling)}else if(t.nodeType===Node.ELEMENT_NODE){const a=t;n==="backward"&&r>0?i=a.childNodes[r-1]||null:n==="forward"&&r<a.childNodes.length&&(i=a.childNodes[r]||null)}return!(i instanceof HTMLElement)||!i.matches(x)||!o.contains(i)?null:i}function F(e,n){const o=b(e);if(!o)return!1;const t=ye(o,n,e);if(!t)return!1;const r=t.parentNode;if(!r)return!1;const i=e.innerHTML,a=Array.prototype.indexOf.call(r.childNodes,t);t.remove();const l=document.createRange();return l.setStart(r,Math.max(0,a)),l.collapse(!0),h(e,l),W(e),U(e,i),!0}function J(e,n,o,t,r,i){if(ce(e,n),e.query=t,e.trigger=r,e.replaceRange=i.cloneRange(),e.loading=!!(n.api&&!n.search),e.debounceHandle!==null&&(window.clearTimeout(e.debounceHandle),e.debounceHandle=null),!e.panel)return;e.isOpen||(e.panel.style.display="block",e.panel.classList.add("show"),e.isOpen=!0),j(e,n),B(e,o);const a=()=>{e.debounceHandle=null,me(e,n,t,r).then(s=>{e.loading=!1,e.items=s,e.activeIndex=0,e.panel&&(j(e,n),B(e,o))})},l=n.api&&!n.search?Math.max(0,n.api.debounceMs??180):0;l>0?e.debounceHandle=window.setTimeout(a,l):a()}function be(e,n){const o=e.editor;T(o);let t=b(o);if(!t||!t.collapsed){f(e);return}const r=O(o,t.cloneRange(),"after");if(!A(r,t)){h(o,r),t=r,f(e);return}const i=ae(t);if(!i){f(e);return}const a=le(i.textBefore,n.triggerChars,n.maxQueryLength);if(!a){f(e);return}if(a.query.length<n.minChars){f(e);return}const l=t.cloneRange();l.setStart(i.node,a.startOffset),l.setEnd(i.node,i.caretOffset),J(e,n,t,a.query,a.trigger,l)}function Q(e,n){if(e.items.length===0)return;const o=e.items.length;if(e.activeIndex=((e.activeIndex+n)%o+o)%o,!e.list)return;const t=Array.from(e.list.querySelectorAll(".rte-mention-item"));t.forEach((i,a)=>i.classList.toggle("active",a===e.activeIndex));const r=t[e.activeIndex];r==null||r.scrollIntoView({block:"nearest"})}function Ee(e){return{editor:e,panel:null,list:null,replaceRange:null,items:[],activeIndex:0,query:"",trigger:"@",loading:!1,isOpen:!1,requestId:0,debounceHandle:null,abortController:null}}function xe(e){var o;const n=R.get(e);n&&((o=n.panel)!=null&&o.parentNode&&n.panel.parentNode.removeChild(n.panel),R.delete(e))}function D(e,n,o){if(N.has(e))return;T(e);const t={beforeInput:r=>{T(e);const i=b(e);if(!i)return;const a=X(i,e);if(!a)return;const l=r.inputType||"";if(l.startsWith("insert")){if(r.preventDefault(),z(e,a,"after"),l==="insertParagraph"||l==="insertLineBreak"){const s=l==="insertLineBreak"?"insertLineBreak":"insertParagraph";document.execCommand(s,!1);return}if(l==="insertText"||l==="insertCompositionText"){const s=r.data||"";if(!s)return;document.execCommand("insertText",!1,s)}}},input:()=>{be(n,o)},keydown:r=>{if(n.isOpen){if(r.key==="ArrowDown"){r.preventDefault(),Q(n,1);return}if(r.key==="ArrowUp"){r.preventDefault(),Q(n,-1);return}if(r.key==="Enter"||r.key==="Tab"){r.preventDefault(),V(n,o,n.activeIndex);return}if(r.key==="Escape"){r.preventDefault(),f(n);return}}const i=b(e);if(i){const a=O(e,i.cloneRange(),"after");if(!A(a,i)){if(r.key==="Enter"){r.preventDefault(),h(e,a),document.execCommand("insertParagraph",!1);return}r.key.length===1&&!r.metaKey&&!r.ctrlKey&&!r.altKey&&h(e,a)}}if(r.key==="Backspace"&&F(e,"backward")){r.preventDefault();return}if(r.key==="Delete"&&F(e,"forward")){r.preventDefault();return}},click:r=>{const i=r.target;if(!i)return;const a=i.nodeType===Node.ELEMENT_NODE?i:i.parentElement,l=a==null?void 0:a.closest(x);!l||!e.contains(l)||(r.preventDefault(),r.stopPropagation(),z(e,l,"after"),f(n))},blur:()=>{window.setTimeout(()=>{const r=document.activeElement;n.panel&&r&&n.panel.contains(r)||f(n)},0)},mousedown:r=>{if(!n.isOpen||!n.panel)return;const i=r.target;i&&!n.panel.contains(i)&&!e.contains(i)&&f(n)}};e.addEventListener("beforeinput",t.beforeInput),e.addEventListener("input",t.input),e.addEventListener("keydown",t.keydown),e.addEventListener("click",t.click),e.addEventListener("blur",t.blur),document.addEventListener("mousedown",t.mousedown,!0),N.set(e,t)}function we(e){const n=N.get(e);n&&(e.removeEventListener("beforeinput",n.beforeInput),e.removeEventListener("input",n.input),e.removeEventListener("keydown",n.keydown),e.removeEventListener("click",n.click),e.removeEventListener("blur",n.blur),document.removeEventListener("mousedown",n.mousedown,!0),N.delete(e))}function Te(){if(_||typeof document>"u")return;_=!0;const e=document.createElement("style");e.id="rte-mention-plugin-styles",e.textContent=`
|
|
2
2
|
.rte-mention {
|
|
3
3
|
display: inline-block;
|
|
4
4
|
padding: 0 6px;
|
|
@@ -71,35 +71,35 @@
|
|
|
71
71
|
text-align: center;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
${
|
|
74
|
+
${y} .rte-mention {
|
|
75
75
|
background: rgba(37, 99, 235, 0.25);
|
|
76
76
|
color: #bfdbfe;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
${
|
|
79
|
+
${y} .rte-mention-panel,
|
|
80
80
|
.rte-mention-panel.rte-mention-theme-dark {
|
|
81
81
|
border-color: #364152;
|
|
82
82
|
background: #1f2937;
|
|
83
83
|
box-shadow: 0 22px 44px rgba(0, 0, 0, 0.48);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
${
|
|
86
|
+
${y} .rte-mention-item,
|
|
87
87
|
.rte-mention-panel.rte-mention-theme-dark .rte-mention-item {
|
|
88
88
|
color: #e5e7eb;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
${
|
|
92
|
-
${
|
|
91
|
+
${y} .rte-mention-item:hover,
|
|
92
|
+
${y} .rte-mention-item.active,
|
|
93
93
|
.rte-mention-panel.rte-mention-theme-dark .rte-mention-item:hover,
|
|
94
94
|
.rte-mention-panel.rte-mention-theme-dark .rte-mention-item.active {
|
|
95
95
|
background: #334155;
|
|
96
96
|
color: #bfdbfe;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
${
|
|
100
|
-
${
|
|
99
|
+
${y} .rte-mention-item-meta,
|
|
100
|
+
${y} .rte-mention-empty,
|
|
101
101
|
.rte-mention-panel.rte-mention-theme-dark .rte-mention-item-meta,
|
|
102
102
|
.rte-mention-panel.rte-mention-theme-dark .rte-mention-empty {
|
|
103
103
|
color: #9ca3af;
|
|
104
104
|
}
|
|
105
|
-
`,document.head.appendChild(e)}function
|
|
105
|
+
`,document.head.appendChild(e)}function Ce(e){const n=(e.triggerChars||["@"]).filter(o=>typeof o=="string"&&o.length>0).map(o=>o[0]);return{triggerChars:n.length>0?n:["@"],minChars:Math.max(0,e.minChars??1),maxQueryLength:Math.max(1,e.maxQueryLength??32),maxSuggestions:Math.max(1,e.maxSuggestions??8),items:e.items||[{id:"john.doe",label:"John Doe",meta:"john@acme.com"},{id:"sarah.lee",label:"Sarah Lee",meta:"sarah@acme.com"},{id:"alex.chen",label:"Alex Chen",meta:"alex@acme.com"}],api:e.api,search:e.search,itemRenderer:e.itemRenderer,emptyStateText:e.emptyStateText||"Type to search mentions",noResultsText:e.noResultsText||"No matching mentions",loadingText:e.loadingText||"Loading...",insertSpaceAfterMention:e.insertSpaceAfterMention!==!1}}function L(e){const n=R.get(e);if(n)return n;const o=Ee(e);return R.set(e,o),o}function ve(e){S||(S=!0,w=n=>{const o=n.target;if(!(o instanceof Node))return;const t=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement,r=(t==null?void 0:t.closest(p))||null;if(!r)return;const i=L(r);D(r,i,e)},document.addEventListener("focusin",w,!0))}function Me(){!S||!w||(document.removeEventListener("focusin",w,!0),S=!1,w=null)}const ke=(e={})=>{Te();const n=Ce(e);return{name:"mentions",toolbar:[{label:"Mention",command:"insertMention",icon:'<svg width="24" height="24" focusable="false"><path d="M12.1 4a7.9 7.9 0 0 0-8 8c0 4.4 3.6 8 8 8 1.6 0 3-.4 4.4-1.3.4-.3.5-.9.2-1.3a1 1 0 0 0-1.3-.3 6 6 0 0 1-3.3.9 6 6 0 1 1 6-6v1.6c0 .8-.5 1.4-1.2 1.4-.8 0-1.2-.6-1.2-1.4V12c0-2-1.6-3.5-3.7-3.5s-3.8 1.6-3.8 3.6c0 2 1.7 3.6 3.8 3.6 1 0 1.9-.4 2.6-1 .5 1 1.4 1.6 2.5 1.6 1.8 0 3.2-1.5 3.2-3.4V12A7.9 7.9 0 0 0 12 4Zm0 9.7c-1 0-1.8-.8-1.8-1.7s.8-1.7 1.8-1.7c1 0 1.7.8 1.7 1.7s-.8 1.7-1.7 1.7Z"></path></svg>'}],commands:{insertMention:(o,t)=>{const r=re(t);if(!r)return!1;const i=L(r);D(r,i,n);let a=b(r);a||(a=document.createRange(),a.selectNodeContents(r),a.collapse(!1),h(r,a));const l=O(r,a.cloneRange(),"after");A(l,a)||(h(r,l),a=l),i.query="";const s=a.cloneRange();return i.trigger=n.triggerChars[0],J(i,n,a,"",i.trigger,s),!0}},init:()=>{M+=1,ve(n),Array.from(document.querySelectorAll(p)).forEach(t=>{const r=L(t);D(t,r,n)})},destroy:()=>{M=Math.max(0,M-1),Array.from(document.querySelectorAll(p)).forEach(t=>{f(L(t)),we(t),xe(t)}),M===0&&Me()}}};exports.MentionPlugin=ke;
|