@editora/plugins 1.0.8 → 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 +22 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1070 -0
- 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/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/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +56 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +109 -81
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +726 -0
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +32 -32
- 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/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 +798 -0
- package/package.json +104 -5
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const x=".rte-content, .editora-content",ae="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",ke="__editoraCommandEditorRoot",we="rte-pii-redaction-styles",u="rte-pii-redaction-panel",k="pii-redaction",v="piiRedaction",$=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',pe=typeof NodeFilter<"u"?NodeFilter.SHOW_TEXT:4,Ne=["email","phone","ssn","credit-card","ipv4","api-key","jwt"],Oe={panelTitle:"PII Redaction",panelAriaLabel:"PII redaction panel",scanText:"Scan PII",redactAllText:"Redact All",redactText:"Redact",locateText:"Locate",realtimeOnText:"Realtime On",realtimeOffText:"Realtime Off",closeText:"Close",noFindingsText:"No PII detected in the document.",summaryPrefix:"Findings",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+I/U/M/Y",readonlyRedactionText:"Editor is read-only. Reopen editable mode to redact.",matchLabel:"Detected",maskedLabel:"Masked",excerptLabel:"Context"},ze={email:{label:"Email",severity:"medium",pattern:/\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b/gi},phone:{label:"Phone",severity:"medium",pattern:/\b(?:\+?\d{1,3}[\s.-]?)?(?:\(?\d{3}\)?[\s.-]?\d{3}[\s.-]?\d{4})\b/g},ssn:{label:"SSN",severity:"high",pattern:/\b\d{3}-\d{2}-\d{4}\b/g},"credit-card":{label:"Credit Card",severity:"high",pattern:/\b(?:\d[ -]*?){13,19}\b/g,validator:e=>qe(e)},ipv4:{label:"IPv4",severity:"low",pattern:/\b(?:(?:25[0-5]|2[0-4]\d|1?\d?\d)\.){3}(?:25[0-5]|2[0-4]\d|1?\d?\d)\b/g},"api-key":{label:"API Key",severity:"high",pattern:/\b(?:sk-[A-Za-z0-9]{20,}|AKIA[0-9A-Z]{16}|AIza[0-9A-Za-z\-_]{35}|ghp_[A-Za-z0-9]{36}|xox[baprs]-[A-Za-z0-9-]{10,})\b/g},jwt:{label:"JWT",severity:"high",pattern:/\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g}},f=new WeakMap,I=new WeakMap,E=new WeakMap,S=new WeakMap,te=new WeakMap,de=new WeakMap,Q=new WeakMap,m=new Map,Z=new WeakMap,q=new Set,W=new Set;let G=0,Fe=0,Ee=0,M=null,b=null,P=null,L=null,_=null,R=null,D=null;function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function He(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function Y(e){const t=e.flags.includes("g")?e.flags:`${e.flags}g`;return new RegExp(e.source,t)}function ge(e){return new RegExp(e.source,e.flags)}function X(e,t,n){return Math.max(t,Math.min(n,e))}function Be(e,t){return e==="high"||e==="medium"||e==="low"?e:t}function Ke(e){const t=(e||"*").slice(0,1)||"*";return/[A-Za-z0-9._%+\-\s]/.test(t)?"*":t}function ve(e){let t=2166136261;for(let n=0;n<e.length;n+=1)t^=e.charCodeAt(n),t=Math.imul(t,16777619);return t>>>0}function qe(e){const t=e.replace(/\D/g,"");if(t.length<13||t.length>19)return!1;let n=0,r=!1;for(let i=t.length-1;i>=0;i-=1){let o=Number(t[i]);r&&(o*=2,o>9&&(o-=9)),n+=o,r=!r}return n%10===0}function We(e,t){const n=ze[e];if(typeof t=="boolean")return{type:e,label:n.label,severity:n.severity,enabled:t,pattern:Y(n.pattern),validator:n.validator};if(!t)return{type:e,label:n.label,severity:n.severity,enabled:!0,pattern:Y(n.pattern),validator:n.validator};const r=t.pattern instanceof RegExp?Y(t.pattern):Y(n.pattern);return{type:e,label:n.label,severity:Be(t.severity,n.severity),enabled:t.enabled!==!1,pattern:r,validator:n.validator}}function ee(e={}){const t=Ne.map(r=>We(r,e.detectors?.[r])),n=t.map(r=>`${r.type}:${r.enabled?"1":"0"}:${r.severity}:${r.pattern.source}:${r.pattern.flags}`).join("|");return{enableRealtime:e.enableRealtime!==!1,debounceMs:X(Number(e.debounceMs??220),60,3e3),maxFindings:X(Number(e.maxFindings??140),1,500),maskChar:Ke(e.maskChar),revealStart:X(Number(e.revealStart??2),0,12),revealEnd:X(Number(e.revealEnd??2),0,12),redactionMode:e.redactionMode==="mask"?"mask":"token",redactionToken:(e.redactionToken||"REDACTED").trim()||"REDACTED",skipInCodeBlocks:e.skipInCodeBlocks!==!1,labels:{...Oe,...e.labels||{}},normalizeText:e.normalizeText||He,detectors:t,detectorSignature:n}}function ce(e){const t={};return e.detectors.forEach(n=>{t[n.type]={enabled:n.enabled,severity:n.severity,pattern:n.pattern}}),{enableRealtime:e.enableRealtime,debounceMs:e.debounceMs,maxFindings:e.maxFindings,maskChar:e.maskChar,revealStart:e.revealStart,revealEnd:e.revealEnd,redactionMode:e.redactionMode,redactionToken:e.redactionToken,skipInCodeBlocks:e.skipInCodeBlocks,labels:{...e.labels},normalizeText:e.normalizeText,detectors:t}}function be(e){return e.closest(ae)||e}function je(e){const t=e.closest("[data-editora-editor]");if(t&&O(t)===e)return t;let n=e;for(;n;){if(n.matches(ae)&&(n===e||O(n)===e))return n;n=n.parentElement}return be(e)}function O(e){if(!e)return null;if(e.matches(x))return e;const t=e.querySelector(x);return t instanceof HTMLElement?t:null}function Ze(){if(typeof window>"u")return null;const e=window[ke];if(!(e instanceof HTMLElement))return null;window[ke]=null;const t=O(e);if(t)return t;const n=e.closest(ae);if(n){const i=O(n);if(i)return i}const r=e.closest(x);return r instanceof HTMLElement?r:null}function J(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 Ve(e){const t=be(e);if(J(t))return!0;const n=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return J(n)?!0:J(document.documentElement)||J(document.body)}function ne(e,t){e.classList.remove("rte-pii-redaction-theme-dark"),Ve(t)&&e.classList.add("rte-pii-redaction-theme-dark")}function re(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function me(e){const t=te.get(e);typeof t=="number"&&(window.clearTimeout(t),W.delete(t),te.delete(e))}function V(e){return e.getAttribute("contenteditable")==="false"||e.getAttribute("data-readonly")==="true"}function le(e=0){return{total:0,high:0,medium:0,low:0,redactedCount:e,byType:{email:0,phone:0,ssn:0,"credit-card":0,ipv4:0,"api-key":0,jwt:0}}}function K(){Array.from(q).forEach(t=>{t.isConnected||Ie(t)})}function Ue(e){for(let t=0;t<e.length;t+=1){const n=e[t];if(!(n.type!=="childList"||n.removedNodes.length===0))for(let r=0;r<n.removedNodes.length;r+=1){const i=n.removedNodes[r];if(i.nodeType!==Node.ELEMENT_NODE)continue;const o=i;if(o.matches?.(x)||o.matches?.(`.${u}`)||o.querySelector?.(x)||o.querySelector?.(`.${u}`))return!0}}return!1}function T(e,t=!0){if(K(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const o=e.editorElement,a=O(o);if(a)return a}const n=Ze();if(n)return n;const r=window.getSelection();if(r&&r.rangeCount>0){const a=re(r.getRangeAt(0).startContainer)?.closest(x);if(a)return a}const i=document.activeElement;if(i){if(i.matches(x))return i;const o=i.closest(x);if(o)return o}return b&&b.isConnected?b:(b&&!b.isConnected&&(b=null),t?document.querySelector(x):null)}function Ie(e){me(e),m.get(e)?.remove(),m.delete(e),Z.delete(e),f.delete(e),I.delete(e),E.delete(e),S.delete(e),de.delete(e),Q.delete(e),q.delete(e),b===e&&(b=null)}function C(e,t,n){const r=je(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",n),o.setAttribute("data-active",n?"true":"false"),o.setAttribute("aria-pressed",n?"true":"false")})}function w(e,t){f.has(e)||f.set(e,t),I.has(e)||I.set(e,[]),E.has(e)||E.set(e,le(0)),S.has(e)||S.set(e,t.enableRealtime),q.add(e)}function oe(e){return Z.get(e)===!0}function $e(e,t,n,r){if(!e)return e;if(e.length<=n+r)return t.repeat(e.length);const i=e.slice(0,n),o=r>0?e.slice(e.length-r):"";return`${i}${t.repeat(Math.max(1,e.length-n-r))}${o}`}function se(e,t,n){const r=e.replace(/\D/g,"");if(r.length===0)return e;let i=0;const o=Math.max(0,r.length-n);return e.split("").map(a=>/\d/.test(a)?(i+=1,i<=o?t:a):a).join("")}function Ge(e,t){const n=e.indexOf("@");if(n<=0)return e;const r=e.slice(0,n),i=e.slice(n+1);return r.length<=2?`${r[0]||""}${t}[at]${i}`:`${r[0]}${t.repeat(Math.max(1,r.length-2))}${r[r.length-1]}[at]${i}`}function Ye(e,t){const n=e.split(".");return n.length!==4?e:`${n[0]}.${n[1]}.${n[2]}.${t.repeat(Math.max(1,n[3].length))}`}function Te(e,t,n){return e&&(t==="email"?Ge(e,n.maskChar):t==="phone"||t==="ssn"||t==="credit-card"?se(e,n.maskChar,4):t==="ipv4"?Ye(e,n.maskChar):t==="api-key"||t==="jwt"?$e(e,n.maskChar,0,0):$e(e,n.maskChar,n.revealStart,n.revealEnd))}function Ce(e,t,n){return n.redactionMode==="mask"?Te(e,t,n):`[${n.redactionToken}:${t.toUpperCase()}]`}function Xe(e){return Ee+=1,`pii-${e}-${Date.now().toString(36)}-${Ee.toString(36)}`}function he(e,t){return t.skipInCodeBlocks?!!e.parentElement?.closest("code, pre, kbd, samp"):!1}function Je(e,t){return t.some(n=>e.start<n.end&&n.start<e.end)}function Qe(e,t,n){const r=[];t.filter(a=>a.enabled).forEach(a=>{const l=ge(a.pattern);let c=l.exec(e);for(;c&&r.length<n*5;){const d=c[0]||"",s=c.index,g=s+d.length;d&&g>s&&(!a.validator||a.validator(d))&&r.push({type:a.type,severity:a.severity,value:d,start:s,end:g}),l.lastIndex===c.index&&(l.lastIndex+=1),c=l.exec(e)}}),r.sort((a,l)=>a.start!==l.start?a.start-l.start:l.end-a.end);const o=[];for(let a=0;a<r.length&&!(o.length>=n);a+=1){const l=r[a];Je({start:l.start,end:l.end},o)||o.push(l)}return o}function ue(e,t=120){return e.length<=t?e:`${e.slice(0,t-1).trimEnd()}...`}function et(e,t,n){const r=Math.max(0,t-28),i=Math.min(e.length,n+28);return ue(e.slice(r,i).trim(),180)}function tt(e,t){const n=le(t);return n.total=e.length,e.forEach(r=>{n.byType[r.type]+=1,r.severity==="high"?n.high+=1:r.severity==="medium"?n.medium+=1:n.low+=1}),n}function ie(e,t){const n=e.querySelector(".rte-pii-redaction-live");n&&(n.textContent=t)}function z(e,t,n){const r=t.querySelector('[data-action="toggle-realtime"]');if(!r)return;const i=F(e,n);r.textContent=i?n.labels.realtimeOnText:n.labels.realtimeOffText,r.setAttribute("aria-pressed",i?"true":"false"),C(e,"togglePIIRealtime",i)}function nt(e,t){e.setAttribute("aria-label",t.labels.panelAriaLabel);const n=e.querySelector(".rte-pii-redaction-title");n&&(n.textContent=t.labels.panelTitle);const r=e.querySelector('[data-action="close"]');r&&r.setAttribute("aria-label",t.labels.closeText);const i=e.querySelector('[data-action="run-scan"]');i&&(i.textContent=t.labels.scanText);const o=e.querySelector('[data-action="redact-all"]');o&&(o.textContent=t.labels.redactAllText);const a=e.querySelector(".rte-pii-redaction-shortcut");a&&(a.textContent=t.labels.shortcutText)}function H(e){const t=m.get(e);if(!t)return;const n=f.get(e)||M;if(!n)return;const r=I.get(e)||[],i=E.get(e)||le(0),o=V(e),a=t.querySelector(".rte-pii-redaction-count"),l=t.querySelector(".rte-pii-redaction-summary"),c=t.querySelector(".rte-pii-redaction-list"),d=t.querySelector('[data-action="redact-all"]');if(!(!a||!l||!c||!d)){if(a.textContent=String(i.total),l.textContent=`${n.labels.summaryPrefix}: ${i.total} | High ${i.high} | Medium ${i.medium} | Low ${i.low} | Redacted ${i.redactedCount}`,d.disabled=o||r.length===0,o?ie(t,n.labels.readonlyRedactionText):ie(t,`${i.total} PII findings detected.`),z(e,t,n),r.length===0){c.innerHTML=`<li class="rte-pii-redaction-empty">${p(n.labels.noFindingsText)}</li>`;return}c.innerHTML=r.map(s=>{const g=s.type.toUpperCase(),A=s.suggestion||"Redact this finding before export/share.",B=`${n.labels.locateText}: ${s.match}`,y=`${n.labels.redactText}: ${s.match}`,U=o?'disabled aria-disabled="true"':"";return`
|
|
2
|
+
<li class="rte-pii-redaction-item rte-pii-redaction-item-${s.severity}">
|
|
3
|
+
<button
|
|
4
|
+
type="button"
|
|
5
|
+
class="rte-pii-redaction-item-btn"
|
|
6
|
+
data-action="locate-finding"
|
|
7
|
+
data-finding-id="${p(s.id)}"
|
|
8
|
+
data-role="finding-button"
|
|
9
|
+
aria-label="${p(B)}"
|
|
10
|
+
>
|
|
11
|
+
<span class="rte-pii-redaction-badge">${p(s.severity.toUpperCase())}</span>
|
|
12
|
+
<span class="rte-pii-redaction-type">${p(g)}</span>
|
|
13
|
+
</button>
|
|
14
|
+
<p class="rte-pii-redaction-line"><strong>${p(n.labels.matchLabel)}:</strong> ${p(ue(s.match,80))}</p>
|
|
15
|
+
<p class="rte-pii-redaction-line"><strong>${p(n.labels.maskedLabel)}:</strong> ${p(ue(s.masked,80))}</p>
|
|
16
|
+
${s.excerpt?`<p class="rte-pii-redaction-line"><strong>${p(n.labels.excerptLabel)}:</strong> ${p(s.excerpt)}</p>`:""}
|
|
17
|
+
<p class="rte-pii-redaction-help">${p(A)}</p>
|
|
18
|
+
<div class="rte-pii-redaction-item-actions">
|
|
19
|
+
<button type="button" class="rte-pii-redaction-btn" data-action="redact-finding" data-finding-id="${p(s.id)}" aria-label="${p(y)}" ${U}>${p(n.labels.redactText)}</button>
|
|
20
|
+
</div>
|
|
21
|
+
</li>
|
|
22
|
+
`}).join("")}}function fe(e,t){if(!t.classList.contains("show"))return;const r=be(e).getBoundingClientRect(),i=Math.min(window.innerWidth-20,390),o=Math.max(10,window.innerWidth-i-10),a=Math.min(Math.max(10,r.right-i),o),l=Math.max(10,Math.min(window.innerHeight-10-280,r.top+10));t.style.width=`${i}px`,t.style.left=`${a}px`,t.style.top=`${l}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function F(e,t){const n=S.get(e);return typeof n=="boolean"?n:t?t.enableRealtime:!0}function Re(e,t){if(t===e.innerHTML)return;const n=window.execEditorCommand||window.executeEditorCommand;if(typeof n=="function")try{n("recordDomTransaction",e,t,e.innerHTML)}catch{}}function Se(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function Me(e,t){e.dispatchEvent(new CustomEvent("editora:pii-redacted",{bubbles:!0,detail:{redactedCount:t}}))}function Ae(e,t){return(I.get(e)||[]).find(r=>r.id===t)}function rt(e){const t=m.get(e);if(t)return t;const n=f.get(e)||M||ee(),r=`rte-pii-redaction-panel-${Fe++}`,i=document.createElement("section");return i.className=u,i.id=r,i.setAttribute("role","dialog"),i.setAttribute("aria-modal","false"),i.setAttribute("aria-label",n.labels.panelAriaLabel),i.innerHTML=`
|
|
23
|
+
<header class="rte-pii-redaction-header">
|
|
24
|
+
<h2 class="rte-pii-redaction-title">${p(n.labels.panelTitle)}</h2>
|
|
25
|
+
<button type="button" class="rte-pii-redaction-icon-btn" data-action="close" aria-label="${p(n.labels.closeText)}">✕</button>
|
|
26
|
+
</header>
|
|
27
|
+
<div class="rte-pii-redaction-body">
|
|
28
|
+
<div class="rte-pii-redaction-topline">
|
|
29
|
+
<p class="rte-pii-redaction-summary" aria-live="polite"></p>
|
|
30
|
+
<span class="rte-pii-redaction-count" aria-hidden="true">0</span>
|
|
31
|
+
</div>
|
|
32
|
+
<div class="rte-pii-redaction-controls" role="toolbar" aria-label="PII redaction controls">
|
|
33
|
+
<button type="button" class="rte-pii-redaction-btn rte-pii-redaction-btn-primary" data-action="run-scan">${p(n.labels.scanText)}</button>
|
|
34
|
+
<button type="button" class="rte-pii-redaction-btn" data-action="redact-all">${p(n.labels.redactAllText)}</button>
|
|
35
|
+
<button type="button" class="rte-pii-redaction-btn" data-action="toggle-realtime" aria-pressed="false"></button>
|
|
36
|
+
</div>
|
|
37
|
+
<ul class="rte-pii-redaction-list" role="list" aria-label="Detected PII findings"></ul>
|
|
38
|
+
<p class="rte-pii-redaction-shortcut">${p(n.labels.shortcutText)}</p>
|
|
39
|
+
<span class="rte-pii-redaction-live" aria-live="polite"></span>
|
|
40
|
+
</div>
|
|
41
|
+
`,i.addEventListener("click",o=>{const l=o.target?.closest("[data-action]");if(!l)return;const c=l.getAttribute("data-action")||"",d=f.get(e)||M||n;if(f.set(e,d),w(e,d),c==="close"){j(e,!0);return}if(c==="run-scan"){h(e,d,!0);return}if(c==="toggle-realtime"){const s=!F(e,d);S.set(e,s),z(e,i,d),s&&h(e,d,!0);return}if(c==="redact-all"){xe(e,d);return}if(c==="locate-finding"){const s=l.getAttribute("data-finding-id")||"",g=Ae(e,s);if(!g)return;at(e,g,d);return}if(c==="redact-finding"){const s=l.getAttribute("data-finding-id")||"";_e(e,s,d)}}),i.addEventListener("keydown",o=>{if(o.key==="Escape"){o.preventDefault(),j(e,!0);return}if(o.key!=="ArrowDown"&&o.key!=="ArrowUp")return;const a=Array.from(i.querySelectorAll('[data-role="finding-button"]'));if(a.length===0)return;const l=document.activeElement,c=a.findIndex(g=>g===l);if(c===-1)return;o.preventDefault();const d=o.key==="ArrowDown"?1:-1,s=(c+d+a.length)%a.length;a[s].focus()}),ne(i,e),document.body.appendChild(i),m.set(e,i),Z.set(e,!1),H(e),i}function j(e,t=!1){const n=m.get(e);n&&(n.classList.remove("show"),Z.set(e,!1),C(e,"togglePIIRedactionPanel",!1),t&&e.focus({preventScroll:!0}))}function N(e){K();const t=rt(e);m.forEach((r,i)=>{i!==e&&j(i,!1)}),t.classList.add("show"),Z.set(e,!0),C(e,"togglePIIRedactionPanel",!0),ne(t,e),fe(e,t),H(e),t.querySelector('[data-action="run-scan"]')?.focus()}function Pe(e,t){const n=oe(e);return(typeof t=="boolean"?t:!n)?N(e):j(e),!0}function ot(e,t){const n=t.normalizeText(e.innerText||e.textContent||""),r=e.innerHTML;return`${n.length}:${ve(n)}:${r.length}:${ve(r)}:${t.detectorSignature}`}function it(e,t){const n=[],r=ge(e.pattern);let i=r.exec(t);for(;i;){const o=i[0]||"",a=i.index,l=a+o.length;o&&l>a&&(!e.validator||e.validator(o))&&n.push({value:o,start:a,end:l}),r.lastIndex===i.index&&(r.lastIndex+=1),i=r.exec(t)}return n}function Le(e,t,n){const r=n.detectors.find(c=>c.type===t.type&&c.enabled);if(!r)return null;const i=t.match.toLowerCase();let o=0;const a=document.createTreeWalker(e,pe,null);let l=a.nextNode();for(;l;){if(!he(l,n)){const c=it(r,l.data);for(let d=0;d<c.length;d+=1){const s=c[d];if(s.value.toLowerCase()===i&&(o+=1,o===t.occurrence)){const g=document.createRange();return g.setStart(l,s.start),g.setEnd(l,s.end),g}}}l=a.nextNode()}return null}function at(e,t,n){const r=Le(e,t,n);if(!r)return!1;const i=window.getSelection();return i?(i.removeAllRanges(),i.addRange(r),re(r.startContainer)?.scrollIntoView({behavior:"smooth",block:"center",inline:"nearest"}),e.focus({preventScroll:!0}),!0):!1}async function h(e,t,n=!1){w(e,t);const r=ot(e,t);if(!n&&de.get(e)===r)return I.get(e)||[];const i=(Q.get(e)||0)+1;Q.set(e,i);const o=[],a=new Map,l=document.createTreeWalker(e,pe,null);let c=l.nextNode();for(;c&&o.length<t.maxFindings;){const g=c.data||"";if(g.trim()&&!he(c,t)){const A=Qe(g,t.detectors,t.maxFindings-o.length);for(let B=0;B<A.length&&!(o.length>=t.maxFindings);B+=1){const y=A[B],U=`${y.type}:${y.value.toLowerCase()}`,ye=(a.get(U)||0)+1;a.set(U,ye),o.push({id:Xe(y.type),type:y.type,severity:y.severity,match:y.value,masked:Te(y.value,y.type,t),occurrence:ye,excerpt:et(g,y.start,y.end),suggestion:"Review and redact this value before external sharing."})}}c=l.nextNode()}if(Q.get(e)!==i)return I.get(e)||[];const d=E.get(e)?.redactedCount||0,s=tt(o,d);return de.set(e,r),I.set(e,o),E.set(e,s),H(e),e.dispatchEvent(new CustomEvent("editora:pii-scan",{bubbles:!0,detail:{findings:o,stats:s}})),o}function lt(e,t){let n=e,r=0;return t.detectors.filter(o=>o.enabled).forEach(o=>{const a=ge(o.pattern);n=n.replace(a,l=>o.validator&&!o.validator(l)?l:(r+=1,Ce(l,o.type,t)))}),{nextValue:n,count:r}}async function _e(e,t,n){if(V(e)){const d=m.get(e);return d&&ie(d,n.labels.readonlyRedactionText),!1}const r=Ae(e,t);if(!r)return!1;const i=Le(e,r,n);if(!i)return!1;const o=e.innerHTML,a=Ce(r.match,r.type,n);if(i.startContainer===i.endContainer&&i.startContainer.nodeType===Node.TEXT_NODE){const d=i.startContainer,s=d.data,g=i.startOffset,A=i.endOffset;d.data=`${s.slice(0,g)}${a}${s.slice(A)}`}else i.deleteContents(),i.insertNode(document.createTextNode(a));Se(e),Re(e,o);const l=E.get(e)?.redactedCount||0;await h(e,n,!0);const c=E.get(e);return c&&(c.redactedCount=l+1,H(e)),Me(e,1),!0}async function xe(e,t){if(V(e)){const d=m.get(e);return d&&ie(d,t.labels.readonlyRedactionText),0}(I.get(e)||[]).length===0&&await h(e,t,!0);const r=e.innerHTML;let i=0;const o=document.createTreeWalker(e,pe,null);let a=o.nextNode();for(;a;){if(he(a,t)){a=o.nextNode();continue}const d=a.data||"";if(!d){a=o.nextNode();continue}const s=lt(d,t);s.count>0&&s.nextValue!==d&&(a.data=s.nextValue,i+=s.count),a=o.nextNode()}if(i===0)return 0;Se(e),Re(e,r);const l=E.get(e)?.redactedCount||0;await h(e,t,!0);const c=E.get(e);return c&&(c.redactedCount=l+i,H(e)),Me(e,i),i}function De(e){const t=f.get(e)||M;if(!t||!F(e,t)||V(e))return;me(e);const n=window.setTimeout(()=>{W.delete(n),te.delete(e),h(e,t,!1)},t.debounceMs);W.add(n),te.set(e,n)}function ct(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="i"}function st(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="u"}function dt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="m"}function ut(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="y"}function ft(e){const t=re(e.target);if(t){const r=t.closest(x);if(r)return r;const i=t.closest(ae);if(i){const a=O(i);if(a)return a}const o=t.closest(`.${u}`);if(o){const a=Array.from(m.entries()).find(([,l])=>l===o);if(a)return a[0]}}const n=window.getSelection();if(n&&n.rangeCount>0){const r=re(n.getRangeAt(0).startContainer)?.closest(x);if(r)return r}return null}function pt(){if(typeof document>"u"||document.getElementById(we))return;const e=document.createElement("style");e.id=we,e.textContent=`
|
|
42
|
+
.rte-toolbar-group-items.${k},
|
|
43
|
+
.editora-toolbar-group-items.${k},
|
|
44
|
+
.rte-toolbar-group-items.${v},
|
|
45
|
+
.editora-toolbar-group-items.${v} {
|
|
46
|
+
display: flex;
|
|
47
|
+
border: 1px solid #ccc;
|
|
48
|
+
border-radius: 3px;
|
|
49
|
+
background: #fff;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.rte-toolbar-group-items.${k} .rte-toolbar-button,
|
|
53
|
+
.editora-toolbar-group-items.${k} .editora-toolbar-button,
|
|
54
|
+
.rte-toolbar-group-items.${v} .rte-toolbar-button,
|
|
55
|
+
.editora-toolbar-group-items.${v} .editora-toolbar-button {
|
|
56
|
+
border: none;
|
|
57
|
+
border-radius: 0;
|
|
58
|
+
border-right: 1px solid #ccc;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.rte-toolbar-group-items.${k} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
62
|
+
.editora-toolbar-group-items.${k} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
63
|
+
.rte-toolbar-group-items.${v} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
64
|
+
.editora-toolbar-group-items.${v} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
65
|
+
border-right: none;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rte-toolbar-button[data-command="togglePIIRealtime"].active,
|
|
69
|
+
.editora-toolbar-button[data-command="togglePIIRealtime"].active {
|
|
70
|
+
background-color: #ccc;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
${$} .rte-toolbar-group-items.${k},
|
|
74
|
+
${$} .editora-toolbar-group-items.${k},
|
|
75
|
+
${$} .rte-toolbar-group-items.${v},
|
|
76
|
+
${$} .editora-toolbar-group-items.${v},
|
|
77
|
+
.${u}.rte-pii-redaction-theme-dark {
|
|
78
|
+
border-color: #566275;
|
|
79
|
+
}
|
|
80
|
+
${$} .rte-toolbar-group-items.${k} .rte-toolbar-button svg,
|
|
81
|
+
${$} .editora-toolbar-group-items.${k} .editora-toolbar-button svg,
|
|
82
|
+
${$} .rte-toolbar-group-items.${v} .rte-toolbar-button svg,
|
|
83
|
+
${$} .editora-toolbar-group-items.${v} .editora-toolbar-button svg
|
|
84
|
+
{
|
|
85
|
+
fill: none;
|
|
86
|
+
}
|
|
87
|
+
${$} .rte-toolbar-group-items.${k} .rte-toolbar-button,
|
|
88
|
+
${$} .editora-toolbar-group-items.${k} .editora-toolbar-button
|
|
89
|
+
{
|
|
90
|
+
border-color: #566275;
|
|
91
|
+
}
|
|
92
|
+
.${u} {
|
|
93
|
+
position: fixed;
|
|
94
|
+
z-index: 12000;
|
|
95
|
+
display: none;
|
|
96
|
+
width: min(390px, calc(100vw - 20px));
|
|
97
|
+
max-height: calc(100vh - 20px);
|
|
98
|
+
border: 1px solid #d1d5db;
|
|
99
|
+
border-radius: 14px;
|
|
100
|
+
background: #ffffff;
|
|
101
|
+
color: #111827;
|
|
102
|
+
box-shadow: 0 18px 45px rgba(15, 23, 42, 0.25);
|
|
103
|
+
overflow: hidden;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.${u}.show {
|
|
107
|
+
display: flex;
|
|
108
|
+
flex-direction: column;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.${u}.rte-pii-redaction-theme-dark {
|
|
112
|
+
border-color: #334155;
|
|
113
|
+
background: #0f172a;
|
|
114
|
+
color: #e2e8f0;
|
|
115
|
+
box-shadow: 0 20px 46px rgba(2, 6, 23, 0.68);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rte-pii-redaction-header {
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: space-between;
|
|
122
|
+
gap: 8px;
|
|
123
|
+
padding: 12px 14px;
|
|
124
|
+
border-bottom: 1px solid #e5e7eb;
|
|
125
|
+
background: linear-gradient(180deg, #f9fafb 0%, #f3f4f6 100%);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-header {
|
|
129
|
+
border-color: #1e293b;
|
|
130
|
+
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
.rte-pii-redaction-title {
|
|
134
|
+
margin: 0;
|
|
135
|
+
font-size: 15px;
|
|
136
|
+
line-height: 1.2;
|
|
137
|
+
font-weight: 700;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.rte-pii-redaction-icon-btn {
|
|
141
|
+
width: 34px;
|
|
142
|
+
height: 34px;
|
|
143
|
+
border: 1px solid #cbd5e1;
|
|
144
|
+
border-radius: 6px;
|
|
145
|
+
background: #ffffff;
|
|
146
|
+
color: #0f172a;
|
|
147
|
+
font-size: 16px;
|
|
148
|
+
line-height: 1;
|
|
149
|
+
font-weight: 600;
|
|
150
|
+
padding: 0;
|
|
151
|
+
display: inline-flex;
|
|
152
|
+
align-items: center;
|
|
153
|
+
justify-content: center;
|
|
154
|
+
cursor: pointer;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
.rte-pii-redaction-icon-btn:hover,
|
|
158
|
+
.rte-pii-redaction-icon-btn:focus-visible {
|
|
159
|
+
outline: none;
|
|
160
|
+
border-color: #3b82f6;
|
|
161
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-icon-btn {
|
|
165
|
+
background: #0f172a;
|
|
166
|
+
border-color: #475569;
|
|
167
|
+
color: #e2e8f0;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-icon-btn:hover,
|
|
171
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-icon-btn:focus-visible {
|
|
172
|
+
border-color: #60a5fa;
|
|
173
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.rte-pii-redaction-body {
|
|
177
|
+
display: flex;
|
|
178
|
+
flex-direction: column;
|
|
179
|
+
gap: 10px;
|
|
180
|
+
padding: 12px;
|
|
181
|
+
overflow: auto;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.rte-pii-redaction-topline {
|
|
185
|
+
display: flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: space-between;
|
|
188
|
+
gap: 8px;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.rte-pii-redaction-summary {
|
|
192
|
+
margin: 0;
|
|
193
|
+
font-size: 12px;
|
|
194
|
+
line-height: 1.35;
|
|
195
|
+
color: #475569;
|
|
196
|
+
flex: 1;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-summary {
|
|
200
|
+
color: #94a3b8;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
.rte-pii-redaction-count {
|
|
204
|
+
min-width: 32px;
|
|
205
|
+
height: 32px;
|
|
206
|
+
border-radius: 999px;
|
|
207
|
+
display: inline-flex;
|
|
208
|
+
align-items: center;
|
|
209
|
+
justify-content: center;
|
|
210
|
+
font-weight: 700;
|
|
211
|
+
font-size: 13px;
|
|
212
|
+
border: 1px solid #cbd5e1;
|
|
213
|
+
background: #f8fafc;
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-count {
|
|
217
|
+
border-color: #334155;
|
|
218
|
+
background: #111827;
|
|
219
|
+
color: #cbd5e1;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.rte-pii-redaction-controls {
|
|
223
|
+
display: flex;
|
|
224
|
+
gap: 8px;
|
|
225
|
+
flex-wrap: wrap;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.rte-pii-redaction-btn {
|
|
229
|
+
border: 1px solid #cbd5e1;
|
|
230
|
+
border-radius: 8px;
|
|
231
|
+
height: 34px;
|
|
232
|
+
padding: 0 10px;
|
|
233
|
+
background: #ffffff;
|
|
234
|
+
color: inherit;
|
|
235
|
+
font-size: 12px;
|
|
236
|
+
font-weight: 600;
|
|
237
|
+
cursor: pointer;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.rte-pii-redaction-btn:hover,
|
|
241
|
+
.rte-pii-redaction-btn:focus-visible {
|
|
242
|
+
border-color: #94a3b8;
|
|
243
|
+
background: #f8fafc;
|
|
244
|
+
outline: none;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
.rte-pii-redaction-btn:disabled {
|
|
248
|
+
opacity: 0.56;
|
|
249
|
+
cursor: not-allowed;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
.rte-pii-redaction-btn-primary {
|
|
253
|
+
border-color: #0284c7;
|
|
254
|
+
background: #0ea5e9;
|
|
255
|
+
color: #f8fafc;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
.rte-pii-redaction-btn-primary:hover,
|
|
259
|
+
.rte-pii-redaction-btn-primary:focus-visible {
|
|
260
|
+
border-color: #0369a1;
|
|
261
|
+
background: #0284c7;
|
|
262
|
+
color: #ffffff;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-btn {
|
|
266
|
+
border-color: #334155;
|
|
267
|
+
background: #111827;
|
|
268
|
+
color: #e2e8f0;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-btn:hover,
|
|
272
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-btn:focus-visible {
|
|
273
|
+
border-color: #475569;
|
|
274
|
+
background: #1e293b;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.rte-pii-redaction-list {
|
|
278
|
+
list-style: none;
|
|
279
|
+
margin: 0;
|
|
280
|
+
padding: 0;
|
|
281
|
+
display: flex;
|
|
282
|
+
flex-direction: column;
|
|
283
|
+
gap: 8px;
|
|
284
|
+
max-height: min(55vh, 420px);
|
|
285
|
+
overflow: auto;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
.rte-pii-redaction-item {
|
|
289
|
+
border: 1px solid #e2e8f0;
|
|
290
|
+
border-radius: 10px;
|
|
291
|
+
padding: 8px;
|
|
292
|
+
background: #ffffff;
|
|
293
|
+
display: grid;
|
|
294
|
+
gap: 6px;
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
.rte-pii-redaction-item-high {
|
|
298
|
+
border-color: #fca5a5;
|
|
299
|
+
background: #fef2f2;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
.rte-pii-redaction-item-medium {
|
|
303
|
+
border-color: #fcd34d;
|
|
304
|
+
background: #fffbeb;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.rte-pii-redaction-item-low {
|
|
308
|
+
border-color: #93c5fd;
|
|
309
|
+
background: #eff6ff;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item {
|
|
313
|
+
border-color: #334155;
|
|
314
|
+
background: #0b1220;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item-high {
|
|
318
|
+
border-color: #7f1d1d;
|
|
319
|
+
background: #2b0b11;
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item-medium {
|
|
323
|
+
border-color: #78350f;
|
|
324
|
+
background: #2b1907;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-item-low {
|
|
328
|
+
border-color: #1d4ed8;
|
|
329
|
+
background: #0a162f;
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
.rte-pii-redaction-item-btn {
|
|
333
|
+
border: none;
|
|
334
|
+
background: transparent;
|
|
335
|
+
width: 100%;
|
|
336
|
+
display: flex;
|
|
337
|
+
align-items: center;
|
|
338
|
+
gap: 8px;
|
|
339
|
+
text-align: left;
|
|
340
|
+
padding: 0;
|
|
341
|
+
color: inherit;
|
|
342
|
+
cursor: pointer;
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
.rte-pii-redaction-item-btn:focus-visible {
|
|
346
|
+
outline: 2px solid #0284c7;
|
|
347
|
+
outline-offset: 3px;
|
|
348
|
+
border-radius: 6px;
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.rte-pii-redaction-badge {
|
|
352
|
+
border-radius: 999px;
|
|
353
|
+
border: 1px solid currentColor;
|
|
354
|
+
padding: 1px 8px;
|
|
355
|
+
font-size: 10px;
|
|
356
|
+
font-weight: 700;
|
|
357
|
+
line-height: 1.3;
|
|
358
|
+
text-transform: uppercase;
|
|
359
|
+
opacity: 0.86;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
.rte-pii-redaction-type {
|
|
363
|
+
font-size: 12px;
|
|
364
|
+
font-weight: 700;
|
|
365
|
+
letter-spacing: 0.03em;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
.rte-pii-redaction-line,
|
|
369
|
+
.rte-pii-redaction-help {
|
|
370
|
+
margin: 0;
|
|
371
|
+
font-size: 12px;
|
|
372
|
+
line-height: 1.35;
|
|
373
|
+
color: #334155;
|
|
374
|
+
word-break: break-word;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-line,
|
|
378
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-help {
|
|
379
|
+
color: #94a3b8;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.rte-pii-redaction-item-actions {
|
|
383
|
+
display: flex;
|
|
384
|
+
justify-content: flex-end;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.rte-pii-redaction-empty {
|
|
388
|
+
border: 1px dashed #cbd5e1;
|
|
389
|
+
border-radius: 10px;
|
|
390
|
+
padding: 10px;
|
|
391
|
+
font-size: 13px;
|
|
392
|
+
color: #475569;
|
|
393
|
+
background: #f8fafc;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-empty {
|
|
397
|
+
border-color: #334155;
|
|
398
|
+
background: #0b1220;
|
|
399
|
+
color: #94a3b8;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
.rte-pii-redaction-shortcut {
|
|
403
|
+
margin: 2px 0 0;
|
|
404
|
+
font-size: 11px;
|
|
405
|
+
color: #64748b;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.${u}.rte-pii-redaction-theme-dark .rte-pii-redaction-shortcut {
|
|
409
|
+
color: #94a3b8;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.rte-pii-redaction-live {
|
|
413
|
+
position: absolute;
|
|
414
|
+
width: 1px;
|
|
415
|
+
height: 1px;
|
|
416
|
+
margin: -1px;
|
|
417
|
+
padding: 0;
|
|
418
|
+
overflow: hidden;
|
|
419
|
+
clip: rect(0 0 0 0);
|
|
420
|
+
border: 0;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
@media (max-width: 768px) {
|
|
424
|
+
.${u} {
|
|
425
|
+
left: 10px !important;
|
|
426
|
+
right: 10px;
|
|
427
|
+
top: 10px !important;
|
|
428
|
+
width: auto !important;
|
|
429
|
+
max-height: calc(100vh - 20px);
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
.rte-pii-redaction-list {
|
|
433
|
+
max-height: 45vh;
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
`,document.head.appendChild(e)}function gt(e){M=e,P||(P=t=>{K();const r=t.target?.closest(x);if(!r)return;b=r;const i=f.get(r)||e;w(r,i),f.set(r,i),C(r,"togglePIIRedactionPanel",oe(r)),C(r,"togglePIIRealtime",F(r,i));const o=m.get(r);o&&(ne(o,r),fe(r,o),z(r,o,i))},document.addEventListener("focusin",P,!0)),L||(L=t=>{const r=t.target?.closest(x);r&&(b=r,De(r))},document.addEventListener("input",L,!0)),_||(_=t=>{if(t.defaultPrevented||t.target?.closest(`.${u} input, .${u} textarea, .${u} select`))return;const r=ft(t);if(!r)return;const i=f.get(r)||M||e;if(w(r,i),f.set(r,i),b=r,t.key==="Escape"&&oe(r)){t.preventDefault(),j(r,!0);return}if(ct(t)){t.preventDefault(),t.stopPropagation(),Pe(r);return}if(st(t)){t.preventDefault(),t.stopPropagation(),h(r,i,!0),N(r);return}if(dt(t)){t.preventDefault(),t.stopPropagation(),V(r)||(xe(r,i),N(r));return}if(ut(t)){t.preventDefault(),t.stopPropagation();const o=!F(r,i);S.set(r,o);const a=m.get(r);a&&z(r,a,i),C(r,"togglePIIRealtime",o),o&&h(r,i,!0)}},document.addEventListener("keydown",_,!0)),R||(R=()=>{K(),m.forEach((t,n)=>{!n.isConnected||!t.isConnected||(ne(t,n),fe(n,t))})},window.addEventListener("scroll",R,!0),window.addEventListener("resize",R)),!D&&typeof MutationObserver<"u"&&document.body&&(D=new MutationObserver(t=>{Ue(t)&&K()}),D.observe(document.body,{childList:!0,subtree:!0}))}function bt(){P&&(document.removeEventListener("focusin",P,!0),P=null),L&&(document.removeEventListener("input",L,!0),L=null),_&&(document.removeEventListener("keydown",_,!0),_=null),R&&(window.removeEventListener("scroll",R,!0),window.removeEventListener("resize",R),R=null),D&&(D.disconnect(),D=null),m.forEach(e=>e.remove()),m.clear(),q.forEach(e=>me(e)),q.clear(),M=null,b=null}const mt=(e={})=>{const t=ee(e),n=new Set;return pt(),{name:"piiRedaction",toolbar:[{id:"piiRedactionGroup",label:"PII Redaction",type:"group",command:"piiRedaction",items:[{id:"piiRedaction",label:"PII Redaction",command:"togglePIIRedactionPanel",shortcut:"Mod-Alt-Shift-i",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3.5 19 6.5v4.8c0 4.4-2.7 8.1-7 9.2-4.3-1.1-7-4.8-7-9.2V6.5l7-3Z" stroke="currentColor" stroke-width="1.6" stroke-linejoin="round"/><path d="M8.8 11.6h6.4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="12" cy="11.6" r="1.2" fill="currentColor"/></svg>'},{id:"piiScan",label:"Scan PII",command:"runPIIScan",shortcut:"Mod-Alt-Shift-u",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4.5" y="3.5" width="11" height="15" rx="2" stroke="currentColor" stroke-width="1.6"/><path d="M7.5 8.2h5M7.5 11.2h5M7.5 14.2h3.2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><circle cx="16.8" cy="16.8" r="2.8" stroke="currentColor" stroke-width="1.6"/><path d="m18.8 18.8 2 2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/></svg>'},{id:"piiRedactAll",label:"Redact All PII",command:"redactAllPII",shortcut:"Mod-Alt-Shift-m",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 18h14" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M7 6h10l-1 8H8L7 6Z" stroke="currentColor" stroke-width="1.7"/><path d="m9 9 6 4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'},{id:"piiRealtime",label:"Toggle Realtime PII Scan",command:"togglePIIRealtime",shortcut:"Mod-Alt-Shift-y",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M12 3v4M12 17v4M4 12h4M16 12h4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="1.7"/></svg>'}]}],commands:{piiRedaction:(r,i)=>{const o=T(i);if(!o)return!1;const a=f.get(o)||t;return w(o,a),f.set(o,a),b=o,N(o),h(o,a,!1),!0},togglePIIRedactionPanel:(r,i)=>{const o=T(i);if(!o)return!1;const a=f.get(o)||t;w(o,a),f.set(o,a),b=o;const l=Pe(o,typeof r=="boolean"?r:void 0);return oe(o)&&h(o,a,!1),l},runPIIScan:async(r,i)=>{const o=T(i);if(!o)return!1;const a=f.get(o)||t;return w(o,a),f.set(o,a),b=o,await h(o,a,!0),N(o),!0},redactAllPII:async(r,i)=>{const o=T(i);if(!o)return!1;const a=f.get(o)||t;w(o,a),f.set(o,a),b=o;const l=await xe(o,a);return l>0&&N(o),l>0},redactPIIFinding:async(r,i)=>{const o=T(i);if(!o||typeof r!="string"||!r)return!1;const a=f.get(o)||t;return w(o,a),f.set(o,a),b=o,_e(o,r,a)},togglePIIRealtime:(r,i)=>{const o=T(i);if(!o)return!1;const a=f.get(o)||t;w(o,a),f.set(o,a);const l=typeof r=="boolean"?r:!F(o,a);S.set(o,l);const c=m.get(o);return c&&z(o,c,a),C(o,"togglePIIRealtime",l),l&&h(o,a,!0),!0},getPIIRedactionFindings:(r,i)=>{const o=T(i);if(!o)return!1;const a=I.get(o)||[],l=E.get(o)||le(0),c=a.map(s=>({...s})),d={...l,byType:{...l.byType}};if(typeof r=="function")try{r(c,d)}catch{}return o.__piiRedactionFindings=c,o.dispatchEvent(new CustomEvent("editora:pii-findings",{bubbles:!0,detail:{findings:c,stats:d}})),!0},setPIIRedactionOptions:(r,i)=>{const o=T(i);if(!o||!r||typeof r!="object")return!1;const a=f.get(o)||t,l=ee({...ce(a),...r,labels:{...a.labels,...r.labels||{}},detectors:{...ce(a).detectors||{},...r.detectors||{}},normalizeText:r.normalizeText||a.normalizeText});f.set(o,l),typeof r.enableRealtime=="boolean"&&S.set(o,r.enableRealtime);const c=m.get(o);return c&&(nt(c,l),H(o),z(o,c,l)),h(o,l,!0),!0}},keymap:{"Mod-Alt-Shift-i":"togglePIIRedactionPanel","Mod-Alt-Shift-I":"togglePIIRedactionPanel","Mod-Alt-Shift-u":"runPIIScan","Mod-Alt-Shift-U":"runPIIScan","Mod-Alt-Shift-m":"redactAllPII","Mod-Alt-Shift-M":"redactAllPII","Mod-Alt-Shift-y":"togglePIIRealtime","Mod-Alt-Shift-Y":"togglePIIRealtime"},init:function(i){G+=1;const o=this&&typeof this.__pluginConfig=="object"?ee({...ce(t),...this.__pluginConfig}):t;gt(o);const a=T(i?.editorElement?{editorElement:i.editorElement}:void 0,!1);a&&(b=a,n.add(a),w(a,o),f.set(a,o),C(a,"togglePIIRedactionPanel",!1),C(a,"togglePIIRealtime",o.enableRealtime),o.enableRealtime&&De(a))},destroy:()=>{n.forEach(r=>Ie(r)),n.clear(),G=Math.max(0,G-1),!(G>0)&&(W.forEach(r=>{window.clearTimeout(r)}),W.clear(),bt())}}};exports.PIIRedactionPlugin=mt;
|