@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
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ajay Kumar
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -81,6 +81,15 @@ This package provides a complete set of plugins for building feature-rich text e
|
|
|
81
81
|
|
|
82
82
|
## 🚀 Quick Start
|
|
83
83
|
|
|
84
|
+
### Entry Paths (All Free + Customizable)
|
|
85
|
+
|
|
86
|
+
Every plugin entry path is MIT-licensed, free to use, and customizable:
|
|
87
|
+
|
|
88
|
+
- `@editora/plugins`: full plugin catalog
|
|
89
|
+
- `@editora/plugins/lite`: common/core plugin subset for lean bundles
|
|
90
|
+
- `@editora/plugins/enterprise`: advanced/specialized workflow plugins
|
|
91
|
+
- `@editora/plugins/<plugin-name>`: targeted per-plugin imports
|
|
92
|
+
|
|
84
93
|
### Recommended Imports For Smaller Bundles
|
|
85
94
|
|
|
86
95
|
For best bundle size, avoid importing everything from `@editora/plugins` in large apps.
|
|
@@ -91,6 +100,9 @@ Use one of these patterns:
|
|
|
91
100
|
// Lightweight preset entry
|
|
92
101
|
import { BoldPlugin, ItalicPlugin, HistoryPlugin } from '@editora/plugins/lite';
|
|
93
102
|
|
|
103
|
+
// Enterprise preset entry (advanced/specialized plugins)
|
|
104
|
+
import { MentionPlugin, TrackChangesPlugin, SmartPastePlugin } from '@editora/plugins/enterprise';
|
|
105
|
+
|
|
94
106
|
// Per-plugin subpath entry (most explicit)
|
|
95
107
|
import { BoldPlugin } from '@editora/plugins/bold';
|
|
96
108
|
import { ItalicPlugin } from '@editora/plugins/italic';
|
|
@@ -105,6 +117,16 @@ const { MediaManagerPlugin } = await import('@editora/plugins/media-manager');
|
|
|
105
117
|
const { SpellCheckPlugin } = await import('@editora/plugins/spell-check');
|
|
106
118
|
```
|
|
107
119
|
|
|
120
|
+
### Enterprise Preset Details
|
|
121
|
+
|
|
122
|
+
`@editora/plugins/enterprise` includes advanced plugins for governance, compliance, workflow, and QA:
|
|
123
|
+
|
|
124
|
+
- Collaboration/workflow: `TrackChangesPlugin`, `VersionDiffPlugin`, `CommentsPlugin`, `ApprovalWorkflowPlugin`
|
|
125
|
+
- Validation/compliance: `ContentRulesPlugin`, `DocSchemaPlugin`, `A11yCheckerPlugin`, `SpellCheckPlugin`, `PIIRedactionPlugin`
|
|
126
|
+
- Structured/dynamic authoring: `ConditionalContentPlugin`, `DataBindingPlugin`, `MergeTagPlugin`, `TemplatePlugin`, `CitationsPlugin`
|
|
127
|
+
- Productivity/runtime intelligence: `SmartPastePlugin`, `SlashCommandsPlugin`, `MentionPlugin`, `BlocksLibraryPlugin`, `TranslationWorkflowPlugin`
|
|
128
|
+
- Manager-backed advanced plugins: `MediaManagerPlugin`, `DocumentManagerPlugin`
|
|
129
|
+
|
|
108
130
|
### Basic Formatting
|
|
109
131
|
|
|
110
132
|
```typescript
|
|
@@ -0,0 +1,447 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const w=".rte-content, .editora-content",F="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",ee="__editoraCommandEditorRoot",te="rte-approval-workflow-styles",d="rte-approval-panel",h="approval",y="approvalWorkflow",g=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',ue={panelTitle:"Approval Workflow",panelAriaLabel:"Approval workflow panel",statusLabel:"Status",statusDraftText:"Draft",statusReviewText:"In Review",statusApprovedText:"Approved",requestReviewText:"Request Review",approveText:"Approve",reopenDraftText:"Reopen Draft",addCommentText:"Add Comment",actorLabel:"Actor",actorPlaceholder:"Reviewer name",commentLabel:"Comment",commentPlaceholder:"Add review note or sign-off context",closeText:"Close",commentsHeading:"Comments",signoffsHeading:"Sign-offs",noCommentsText:"No comments yet.",noSignoffsText:"No sign-offs yet.",summaryPrefix:"Workflow",lockedSuffix:"Locked",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+A/R/P/D",approveCommentRequiredText:"Approval comment is required."},fe={draft:"statusDraftText",review:"statusReviewText",approved:"statusApprovedText"},s=new WeakMap,I=new WeakMap,k=new Map,O=new WeakMap,H=new Set;let _=0,me=0,oe=0,re=0,R=null,v=null,T=null,L=null,S=null;function p(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function be(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function ne(e){return e==="review"||e==="approved"?e:"draft"}function z(e={}){return{defaultStatus:ne(e.defaultStatus),lockOnApproval:e.lockOnApproval!==!1,maxHistoryEntries:Math.max(10,Math.min(500,Number(e.maxHistoryEntries??120))),requireCommentOnApprove:!!e.requireCommentOnApprove,defaultActor:(e.defaultActor||"system").trim()||"system",labels:{...ue,...e.labels||{}},normalizeText:e.normalizeText||be}}function U(e){return e.closest(F)||e}function B(e){if(!e)return null;if(e.matches(w))return e;const t=e.querySelector(w);return t instanceof HTMLElement?t:null}function ge(){if(typeof window>"u")return null;const e=window[ee];if(!(e instanceof HTMLElement))return null;window[ee]=null;const t=B(e);if(t)return t;const o=e.closest(F);if(o){const n=B(o);if(n)return n}return null}function ve(e){const t=e.closest("[data-editora-editor]");if(t&&B(t)===e)return t;let o=e;for(;o;){if(o.matches(F)&&(o===e||B(o)===e))return o;o=o.parentElement}return U(e)}function W(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 he(e){const t=U(e);if(W(t))return!0;const o=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return W(o)?!0:W(document.documentElement)||W(document.body)}function K(e,t){e.classList.remove("rte-approval-theme-dark"),he(t)&&e.classList.add("rte-approval-theme-dark")}function le(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function x(e,t=!0){if(D(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const a=e.editorElement;if(a.matches(w))return a;const l=a.querySelector(w);if(l instanceof HTMLElement)return l}const o=ge();if(o)return o;const n=window.getSelection();if(n&&n.rangeCount>0){const l=le(n.getRangeAt(0).startContainer)?.closest(w);if(l)return l}const r=document.activeElement;if(r){if(r.matches(w))return r;const a=r.closest(w);if(a)return a}return v&&v.isConnected?v:(v&&!v.isConnected&&(v=null),t?document.querySelector(w):null)}function D(){Array.from(H).forEach(t=>{t.isConnected||(k.get(t)?.remove(),k.delete(t),O.delete(t),s.delete(t),I.delete(t),H.delete(t),v===t&&(v=null))})}function xe(e){return e?!!(e.closest(`.${d}`)||e.closest(w)||e.closest(F)):!1}function we(){const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0).startContainer;return!!le(t)?.closest(w)}function C(e,t,o){const n=ve(e);Array.from(n.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(a=>{a.classList.toggle("active",o),a.setAttribute("aria-pressed",o?"true":"false"),a.setAttribute("data-active",o?"true":"false")})}function ie(e,t,o){t!==null?e.setAttribute("contenteditable",t):e.setAttribute("contenteditable","true"),o!==null?e.setAttribute("data-readonly",o):e.removeAttribute("data-readonly")}function Y(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function X(e,t){if(t===e.innerHTML)return;const o=window.execEditorCommand||window.executeEditorCommand;if(typeof o=="function")try{o("recordDomTransaction",e,t,e.innerHTML)}catch{}}function J(){return oe+=1,`approval-comment-${Date.now().toString(36)}-${oe.toString(36)}`}function ke(){return re+=1,`approval-signoff-${Date.now().toString(36)}-${re.toString(36)}`}function se(e){return{status:e.status,locked:e.locked,comments:e.comments.map(t=>({...t})),signoffs:e.signoffs.map(t=>({...t})),updatedAt:e.updatedAt}}function ye(e,t){const o=fe[e];return t.labels[o]||e}function ce(e,t,o){if(e.setAttribute("data-approval-status",t.status),e.setAttribute("data-approval-locked",t.locked?"true":"false"),e.classList.toggle("rte-approval-locked-editor",t.locked),C(e,"toggleApprovalWorkflowPanel",Z(e)),C(e,"requestApprovalReview",t.status==="review"),C(e,"approveDocument",t.status==="approved"),C(e,"reopenDraft",t.status==="draft"),t.status==="approved"&&o.lockOnApproval){t.locked||(t.preApprovalContentEditable=e.getAttribute("contenteditable"),t.preApprovalReadonly=e.getAttribute("data-readonly")),e.setAttribute("contenteditable","false"),e.setAttribute("data-readonly","true"),t.locked=!0;return}t.locked=!1,ie(e,t.preApprovalContentEditable??t.originalContentEditable,t.preApprovalReadonly??t.originalReadonly),t.preApprovalContentEditable=null,t.preApprovalReadonly=null}function f(e,t){let o=I.get(e);return o||(o={status:t.defaultStatus,locked:!1,comments:[],signoffs:[],updatedAt:new Date().toISOString(),originalContentEditable:e.getAttribute("contenteditable"),originalReadonly:e.getAttribute("data-readonly"),preApprovalContentEditable:null,preApprovalReadonly:null},I.set(e,o),H.add(e),ce(e,o,t),o)}function j(e,t){return e.length<=t?e:e.slice(e.length-t)}function M(e,t){const o=e.querySelector(".rte-approval-live");o&&(o.textContent=t)}function Ae(e,t){const o=se(t);e.__approvalWorkflowState=o,e.dispatchEvent(new CustomEvent("editora:approval-state-changed",{bubbles:!0,detail:{state:o}}))}function P(e){const t=k.get(e);if(!t)return;const o=s.get(e)||R;if(!o)return;const n=f(e,o),r=t.querySelector(".rte-approval-summary"),a=t.querySelector('[data-action="request-review"]'),l=t.querySelector('[data-action="approve"]'),c=t.querySelector('[data-action="reopen-draft"]'),u=t.querySelector(".rte-approval-comments-list"),m=t.querySelector(".rte-approval-signoffs-list");if(r){const i=ye(n.status,o);r.textContent=`${o.labels.summaryPrefix}: ${i} | Comments: ${n.comments.length} | Sign-offs: ${n.signoffs.length}${n.locked?` | ${o.labels.lockedSuffix}`:""}`}a&&(a.disabled=n.status!=="draft"),l&&(l.disabled=n.status==="approved"),c&&(c.disabled=n.status==="draft"),u&&(n.comments.length===0?u.innerHTML=`<li class="rte-approval-empty">${p(o.labels.noCommentsText)}</li>`:u.innerHTML=n.comments.slice().reverse().map(i=>`
|
|
2
|
+
<li class="rte-approval-item rte-approval-item-${i.kind}" role="listitem">
|
|
3
|
+
<div class="rte-approval-item-head">
|
|
4
|
+
<span class="rte-approval-item-author">${p(i.author)}</span>
|
|
5
|
+
<time class="rte-approval-item-time" datetime="${p(i.createdAt)}">${p(new Date(i.createdAt).toLocaleString())}</time>
|
|
6
|
+
</div>
|
|
7
|
+
<p class="rte-approval-item-message">${p(i.message)}</p>
|
|
8
|
+
</li>
|
|
9
|
+
`).join("")),m&&(n.signoffs.length===0?m.innerHTML=`<li class="rte-approval-empty">${p(o.labels.noSignoffsText)}</li>`:m.innerHTML=n.signoffs.slice().reverse().map(i=>`
|
|
10
|
+
<li class="rte-approval-item" role="listitem">
|
|
11
|
+
<div class="rte-approval-item-head">
|
|
12
|
+
<span class="rte-approval-item-author">${p(i.author)}</span>
|
|
13
|
+
<time class="rte-approval-item-time" datetime="${p(i.createdAt)}">${p(new Date(i.createdAt).toLocaleString())}</time>
|
|
14
|
+
</div>
|
|
15
|
+
<p class="rte-approval-item-message">${p(i.comment||"Approved")}</p>
|
|
16
|
+
</li>
|
|
17
|
+
`).join(""))}function G(e,t,o){t.updatedAt=new Date().toISOString(),ce(e,t,o),P(e),Ae(e,t)}function ae(e,t,o,n){e.comments.push({id:J(),author:o||t.defaultActor,message:n,kind:"system",createdAt:new Date().toISOString()}),e.comments=j(e.comments,t.maxHistoryEntries)}function E(e,t,o,n){const r=f(e,o);if(r.status===t)return!1;const a=e.innerHTML;return r.status=t,t==="review"?ae(r,o,n,"Review requested."):t==="draft"&&ae(r,o,n,"Returned to draft."),G(e,r,o),Y(e),X(e,a),!0}function pe(e,t,o,n){const r=n.normalizeText(t);if(!r)return!1;const a=n.normalizeText(o)||n.defaultActor,l=f(e,n),c=e.innerHTML;return l.comments.push({id:J(),author:a,message:r,kind:"comment",createdAt:new Date().toISOString()}),l.comments=j(l.comments,n.maxHistoryEntries),G(e,l,n),Y(e),X(e,c),!0}function Q(e,t,o,n){const r=t.normalizeText(o)||t.defaultActor,a=t.normalizeText(n);if(t.requireCommentOnApprove&&!a)return!1;const l=f(e,t),c=e.innerHTML;return l.status="approved",l.signoffs.push({id:ke(),author:r,comment:a||void 0,createdAt:new Date().toISOString()}),l.signoffs=j(l.signoffs,t.maxHistoryEntries),a&&(l.comments.push({id:J(),author:r,message:a,kind:"system",createdAt:new Date().toISOString()}),l.comments=j(l.comments,t.maxHistoryEntries)),G(e,l,t),Y(e),X(e,c),!0}function N(e,t){return e.querySelector(`[data-field="${t}"]`)}function Se(e){const t=N(e,"actor")?.value||"",o=N(e,"comment")?.value||"";return{actor:t,comment:o}}function V(e,t){if(!t.classList.contains("show"))return;const n=U(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,420),a=Math.max(10,window.innerWidth-r-10),l=Math.min(Math.max(10,n.right-r),a),c=Math.max(10,Math.min(window.innerHeight-10-280,n.top+12));t.style.width=`${r}px`,t.style.left=`${l}px`,t.style.top=`${c}px`,t.style.maxHeight=`${Math.max(280,window.innerHeight-24)}px`}function $e(e){const t=k.get(e);if(t)return t;const o=s.get(e)||R||z(),n=`rte-approval-panel-${me++}`,r=document.createElement("section");return r.className=d,r.id=n,r.setAttribute("role","dialog"),r.setAttribute("aria-modal","false"),r.setAttribute("aria-label",o.labels.panelAriaLabel),r.setAttribute("tabindex","-1"),r.innerHTML=`
|
|
18
|
+
<header class="rte-approval-header">
|
|
19
|
+
<h2 class="rte-approval-title">${p(o.labels.panelTitle)}</h2>
|
|
20
|
+
<button type="button" class="rte-approval-icon-btn" data-action="close" aria-label="${p(o.labels.closeText)}">✕</button>
|
|
21
|
+
</header>
|
|
22
|
+
<div class="rte-approval-body">
|
|
23
|
+
<p class="rte-approval-summary" aria-live="polite"></p>
|
|
24
|
+
|
|
25
|
+
<div class="rte-approval-controls" role="toolbar" aria-label="Approval actions">
|
|
26
|
+
<button type="button" class="rte-approval-btn" data-action="request-review">${p(o.labels.requestReviewText)}</button>
|
|
27
|
+
<button type="button" class="rte-approval-btn rte-approval-btn-primary" data-action="approve">${p(o.labels.approveText)}</button>
|
|
28
|
+
<button type="button" class="rte-approval-btn" data-action="reopen-draft">${p(o.labels.reopenDraftText)}</button>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
<div class="rte-approval-form">
|
|
32
|
+
<label class="rte-approval-label">
|
|
33
|
+
${p(o.labels.actorLabel)}
|
|
34
|
+
<input type="text" data-field="actor" class="rte-approval-field" autocomplete="off" placeholder="${p(o.labels.actorPlaceholder)}" />
|
|
35
|
+
</label>
|
|
36
|
+
<label class="rte-approval-label">
|
|
37
|
+
${p(o.labels.commentLabel)}
|
|
38
|
+
<textarea data-field="comment" class="rte-approval-field" rows="2" placeholder="${p(o.labels.commentPlaceholder)}"></textarea>
|
|
39
|
+
</label>
|
|
40
|
+
<button type="button" class="rte-approval-btn" data-action="add-comment">${p(o.labels.addCommentText)}</button>
|
|
41
|
+
</div>
|
|
42
|
+
|
|
43
|
+
<section class="rte-approval-section" aria-label="${p(o.labels.commentsHeading)}">
|
|
44
|
+
<h3 class="rte-approval-section-title">${p(o.labels.commentsHeading)}</h3>
|
|
45
|
+
<ul class="rte-approval-comments-list" role="list"></ul>
|
|
46
|
+
</section>
|
|
47
|
+
|
|
48
|
+
<section class="rte-approval-section" aria-label="${p(o.labels.signoffsHeading)}">
|
|
49
|
+
<h3 class="rte-approval-section-title">${p(o.labels.signoffsHeading)}</h3>
|
|
50
|
+
<ul class="rte-approval-signoffs-list" role="list"></ul>
|
|
51
|
+
</section>
|
|
52
|
+
|
|
53
|
+
<p class="rte-approval-shortcut">${p(o.labels.shortcutText)}</p>
|
|
54
|
+
<span class="rte-approval-live" aria-live="polite"></span>
|
|
55
|
+
</div>
|
|
56
|
+
`,r.addEventListener("click",a=>{const l=a.target;if(!l)return;const c=l.closest("[data-action]");if(!c)return;const u=c.getAttribute("data-action")||"",m=s.get(e)||R||o;if(s.set(e,m),f(e,m),u==="close"){q(e,!0);return}const i=Se(r);if(u==="request-review"){E(e,"review",m,i.actor||m.defaultActor)&&M(r,"Status changed to review.");return}if(u==="reopen-draft"){E(e,"draft",m,i.actor||m.defaultActor)&&M(r,"Status changed to draft.");return}if(u==="approve"){const b=Q(e,m,i.actor,i.comment);if(!b&&m.requireCommentOnApprove){M(r,m.labels.approveCommentRequiredText);return}if(b){const $=N(r,"comment");$&&($.value=""),M(r,"Document approved and signed off.")}return}if(u==="add-comment"){if(!pe(e,i.comment,i.actor,m))return;const $=N(r,"comment");$&&($.value=""),M(r,"Comment added.");return}}),r.addEventListener("keydown",a=>{a.key==="Escape"&&(a.preventDefault(),q(e,!0))}),K(r,e),document.body.appendChild(r),k.set(e,r),O.set(e,!1),P(e),r}function Z(e){return O.get(e)===!0}function A(e){D();const t=$e(e);k.forEach((o,n)=>{n!==e&&q(n,!1)}),t.classList.add("show"),O.set(e,!0),C(e,"toggleApprovalWorkflowPanel",!0),K(t,e),V(e,t),P(e)}function q(e,t=!1){const o=k.get(e);o&&(o.classList.remove("show"),O.set(e,!1),C(e,"toggleApprovalWorkflowPanel",!1),t&&e.focus({preventScroll:!0}))}function de(e,t){const o=Z(e);return(typeof t=="boolean"?t:!o)?A(e):q(e),!0}function Ee(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="a"}function Ce(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="r"}function Te(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="p"}function Le(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="d"}function Re(e){R=e,T||(T=t=>{D();const n=t.target?.closest(w);if(!n)return;v=n;const r=s.get(n)||e;s.set(n,r),f(n,r);const a=k.get(n);a&&(K(a,n),V(n,a))},document.addEventListener("focusin",T,!0)),L||(L=t=>{if(t.defaultPrevented)return;const o=Ee(t),n=Ce(t),r=Te(t),a=Le(t),l=t.key==="Escape";if(!l&&!o&&!n&&!r&&!a)return;D();const c=t.target,u=!!c?.closest(`.${d} input, .${d} textarea, .${d} select`);if(!xe(c)&&!we())return;const i=x(void 0,!1);if(!i)return;const b=s.get(i)||R||e;s.set(i,b);const $=f(i,b);if(v=i,l&&Z(i)){t.preventDefault(),q(i,!0);return}if(!u){if(o){t.preventDefault(),t.stopPropagation(),de(i);return}if(n){t.preventDefault(),t.stopPropagation(),E(i,"review",b,b.defaultActor)&&A(i);return}if(r){t.preventDefault(),t.stopPropagation(),Q(i,b,b.defaultActor,"Approved via keyboard shortcut.")&&A(i);return}a&&(t.preventDefault(),t.stopPropagation(),$.status!=="draft"&&E(i,"draft",b,b.defaultActor)&&A(i))}},document.addEventListener("keydown",L,!0)),S||(S=()=>{D(),k.forEach((t,o)=>{!o.isConnected||!t.isConnected||(K(t,o),V(o,t))})},window.addEventListener("scroll",S,!0),window.addEventListener("resize",S))}function Me(e){const t=I.get(e);t&&(e.classList.remove("rte-approval-locked-editor"),e.removeAttribute("data-approval-status"),e.removeAttribute("data-approval-locked"),ie(e,t.preApprovalContentEditable??t.originalContentEditable,t.preApprovalReadonly??t.originalReadonly))}function De(){T&&(document.removeEventListener("focusin",T,!0),T=null),L&&(document.removeEventListener("keydown",L,!0),L=null),S&&(window.removeEventListener("scroll",S,!0),window.removeEventListener("resize",S),S=null),k.forEach(e=>e.remove()),k.clear(),H.forEach(e=>Me(e)),H.clear(),R=null,v=null}function He(){if(typeof document>"u"||document.getElementById(te))return;const e=document.createElement("style");e.id=te,e.textContent=`
|
|
57
|
+
.rte-toolbar-group-items.${h},
|
|
58
|
+
.editora-toolbar-group-items.${h},
|
|
59
|
+
.rte-toolbar-group-items.${y},
|
|
60
|
+
.editora-toolbar-group-items.${y} {
|
|
61
|
+
display: flex;
|
|
62
|
+
border: 1px solid #ccc;
|
|
63
|
+
border-radius: 3px;
|
|
64
|
+
background: #fff;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
68
|
+
.editora-toolbar-group-items.${h} .editora-toolbar-button,
|
|
69
|
+
.rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
70
|
+
.editora-toolbar-group-items.${y} .editora-toolbar-button {
|
|
71
|
+
border: none;
|
|
72
|
+
border-radius: 0;
|
|
73
|
+
border-right: 1px solid #ccc;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.rte-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
|
|
77
|
+
.editora-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
|
|
78
|
+
.rte-toolbar-button[data-command="reopenDraft"].active,
|
|
79
|
+
.editora-toolbar-button[data-command="reopenDraft"].active {
|
|
80
|
+
background-color: #ccc;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
${g} .rte-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
|
|
84
|
+
${g} .editora-toolbar-button[data-command="toggleApprovalWorkflowPanel"].active,
|
|
85
|
+
${g} .rte-toolbar-button[data-command="reopenDraft"].active,
|
|
86
|
+
${g} .editora-toolbar-button[data-command="reopenDraft"].active {
|
|
87
|
+
background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
91
|
+
.editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
92
|
+
.rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
93
|
+
.editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
94
|
+
border-right: none;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
${g} .rte-toolbar-group-items.${h},
|
|
98
|
+
${g} .editora-toolbar-group-items.${h},
|
|
99
|
+
${g} .rte-toolbar-group-items.${y},
|
|
100
|
+
${g} .editora-toolbar-group-items.${y},
|
|
101
|
+
.${d}.rte-approval-theme-dark {
|
|
102
|
+
border-color: #566275;
|
|
103
|
+
}
|
|
104
|
+
${g} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
|
|
105
|
+
${g} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
|
|
106
|
+
${g} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
|
|
107
|
+
${g} .editora-toolbar-group-items.${y} .editora-toolbar-button svg
|
|
108
|
+
{
|
|
109
|
+
fill: none;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
${g} .rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
113
|
+
${g} .editora-toolbar-group-items.${h} .editora-toolbar-button
|
|
114
|
+
{
|
|
115
|
+
border-color: #566275;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.rte-approval-locked-editor {
|
|
119
|
+
background-image: repeating-linear-gradient(
|
|
120
|
+
-45deg,
|
|
121
|
+
rgba(30, 64, 175, 0.04),
|
|
122
|
+
rgba(30, 64, 175, 0.04) 8px,
|
|
123
|
+
rgba(30, 64, 175, 0.08) 8px,
|
|
124
|
+
rgba(30, 64, 175, 0.08) 16px
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.${d} {
|
|
129
|
+
position: fixed;
|
|
130
|
+
z-index: 1500;
|
|
131
|
+
right: 16px;
|
|
132
|
+
top: 16px;
|
|
133
|
+
width: min(420px, calc(100vw - 20px));
|
|
134
|
+
max-height: calc(100vh - 24px);
|
|
135
|
+
display: none;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
border-radius: 12px;
|
|
138
|
+
border: 1px solid #d1d5db;
|
|
139
|
+
background: #ffffff;
|
|
140
|
+
color: #0f172a;
|
|
141
|
+
box-shadow: 0 18px 38px rgba(15, 23, 42, 0.16);
|
|
142
|
+
overflow: hidden;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.${d}.show {
|
|
146
|
+
display: flex;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
.${d}.rte-approval-theme-dark {
|
|
150
|
+
background: #0f172a;
|
|
151
|
+
color: #e2e8f0;
|
|
152
|
+
border-color: #334155;
|
|
153
|
+
box-shadow: 0 20px 40px rgba(2, 6, 23, 0.5);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
.rte-approval-header {
|
|
157
|
+
display: flex;
|
|
158
|
+
align-items: center;
|
|
159
|
+
justify-content: space-between;
|
|
160
|
+
padding: 10px 12px;
|
|
161
|
+
border-bottom: 1px solid #e2e8f0;
|
|
162
|
+
background: #f8fafc;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
.${d}.rte-approval-theme-dark .rte-approval-header {
|
|
166
|
+
border-bottom-color: #334155;
|
|
167
|
+
background: #111827;
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
.rte-approval-title {
|
|
171
|
+
margin: 0;
|
|
172
|
+
font-size: 14px;
|
|
173
|
+
font-weight: 700;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.rte-approval-icon-btn {
|
|
177
|
+
border: 1px solid #cbd5e1;
|
|
178
|
+
background: #ffffff;
|
|
179
|
+
color: #0f172a;
|
|
180
|
+
border-radius: 6px;
|
|
181
|
+
cursor: pointer;
|
|
182
|
+
min-width: 34px;
|
|
183
|
+
min-height: 34px;
|
|
184
|
+
width: 34px;
|
|
185
|
+
height: 34px;
|
|
186
|
+
padding: 0;
|
|
187
|
+
display: inline-flex;
|
|
188
|
+
align-items: center;
|
|
189
|
+
justify-content: center;
|
|
190
|
+
font-size: 16px;
|
|
191
|
+
line-height: 1;
|
|
192
|
+
font-weight: 600;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.rte-approval-icon-btn:hover,
|
|
196
|
+
.rte-approval-icon-btn:focus-visible {
|
|
197
|
+
outline: none;
|
|
198
|
+
border-color: #3b82f6;
|
|
199
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
.${d}.rte-approval-theme-dark .rte-approval-icon-btn {
|
|
203
|
+
background: #0f172a;
|
|
204
|
+
border-color: #475569;
|
|
205
|
+
color: #e2e8f0;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.${d}.rte-approval-theme-dark .rte-approval-icon-btn:hover,
|
|
209
|
+
.${d}.rte-approval-theme-dark .rte-approval-icon-btn:focus-visible {
|
|
210
|
+
border-color: #60a5fa;
|
|
211
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
.rte-approval-body {
|
|
215
|
+
display: flex;
|
|
216
|
+
flex-direction: column;
|
|
217
|
+
gap: 10px;
|
|
218
|
+
padding: 12px;
|
|
219
|
+
overflow: auto;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
.rte-approval-summary {
|
|
223
|
+
margin: 0;
|
|
224
|
+
font-size: 12px;
|
|
225
|
+
color: #475569;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
.${d}.rte-approval-theme-dark .rte-approval-summary {
|
|
229
|
+
color: #94a3b8;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
.rte-approval-controls {
|
|
233
|
+
display: flex;
|
|
234
|
+
flex-wrap: wrap;
|
|
235
|
+
gap: 8px;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.rte-approval-btn {
|
|
239
|
+
border: 1px solid #cbd5e1;
|
|
240
|
+
background: #f8fafc;
|
|
241
|
+
color: inherit;
|
|
242
|
+
border-radius: 8px;
|
|
243
|
+
padding: 6px 10px;
|
|
244
|
+
font-size: 12px;
|
|
245
|
+
font-weight: 600;
|
|
246
|
+
cursor: pointer;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
.rte-approval-btn:disabled {
|
|
250
|
+
opacity: 0.5;
|
|
251
|
+
cursor: not-allowed;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
.rte-approval-btn:hover:not(:disabled),
|
|
255
|
+
.rte-approval-btn:focus-visible:not(:disabled) {
|
|
256
|
+
outline: none;
|
|
257
|
+
border-color: #1d4ed8;
|
|
258
|
+
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
.rte-approval-btn-primary {
|
|
262
|
+
background: #1d4ed8;
|
|
263
|
+
border-color: #1d4ed8;
|
|
264
|
+
color: #ffffff;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
.rte-approval-btn-primary:hover:not(:disabled),
|
|
268
|
+
.rte-approval-btn-primary:focus-visible:not(:disabled) {
|
|
269
|
+
background: #1e40af;
|
|
270
|
+
border-color: #1e40af;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.${d}.rte-approval-theme-dark .rte-approval-btn {
|
|
274
|
+
border-color: #334155;
|
|
275
|
+
background: #0b1220;
|
|
276
|
+
color: #e2e8f0;
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
.${d}.rte-approval-theme-dark .rte-approval-btn-primary {
|
|
280
|
+
border-color: #2563eb;
|
|
281
|
+
background: #2563eb;
|
|
282
|
+
color: #ffffff;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
.rte-approval-form {
|
|
286
|
+
display: grid;
|
|
287
|
+
grid-template-columns: 1fr;
|
|
288
|
+
gap: 8px;
|
|
289
|
+
border: 1px solid #e2e8f0;
|
|
290
|
+
border-radius: 10px;
|
|
291
|
+
padding: 8px;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
.${d}.rte-approval-theme-dark .rte-approval-form {
|
|
295
|
+
border-color: #334155;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
.rte-approval-label {
|
|
299
|
+
display: flex;
|
|
300
|
+
flex-direction: column;
|
|
301
|
+
gap: 4px;
|
|
302
|
+
font-size: 12px;
|
|
303
|
+
font-weight: 600;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
.rte-approval-field {
|
|
307
|
+
width: 100%;
|
|
308
|
+
box-sizing: border-box;
|
|
309
|
+
min-height: 30px;
|
|
310
|
+
border-radius: 8px;
|
|
311
|
+
border: 1px solid #cbd5e1;
|
|
312
|
+
background: #ffffff;
|
|
313
|
+
color: inherit;
|
|
314
|
+
font-size: 13px;
|
|
315
|
+
padding: 6px 8px;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
.rte-approval-field:focus-visible {
|
|
319
|
+
outline: none;
|
|
320
|
+
border-color: #1d4ed8;
|
|
321
|
+
box-shadow: 0 0 0 2px rgba(29, 78, 216, 0.2);
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
.${d}.rte-approval-theme-dark .rte-approval-field {
|
|
325
|
+
border-color: #334155;
|
|
326
|
+
background: #0b1220;
|
|
327
|
+
color: #e2e8f0;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
.rte-approval-section {
|
|
331
|
+
border: 1px solid #e2e8f0;
|
|
332
|
+
border-radius: 10px;
|
|
333
|
+
padding: 8px;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.${d}.rte-approval-theme-dark .rte-approval-section {
|
|
337
|
+
border-color: #334155;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.rte-approval-section-title {
|
|
341
|
+
margin: 0 0 8px;
|
|
342
|
+
font-size: 12px;
|
|
343
|
+
font-weight: 700;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.rte-approval-comments-list,
|
|
347
|
+
.rte-approval-signoffs-list {
|
|
348
|
+
margin: 0;
|
|
349
|
+
padding: 0;
|
|
350
|
+
list-style: none;
|
|
351
|
+
display: flex;
|
|
352
|
+
flex-direction: column;
|
|
353
|
+
gap: 6px;
|
|
354
|
+
max-height: 150px;
|
|
355
|
+
overflow: auto;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
.rte-approval-item {
|
|
359
|
+
border: 1px solid #dbeafe;
|
|
360
|
+
background: #eff6ff;
|
|
361
|
+
border-radius: 8px;
|
|
362
|
+
padding: 6px;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.rte-approval-item-comment {
|
|
366
|
+
border-color: #e2e8f0;
|
|
367
|
+
background: #f8fafc;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
.${d}.rte-approval-theme-dark .rte-approval-item {
|
|
371
|
+
border-color: #334155;
|
|
372
|
+
background: #111827;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.rte-approval-item-head {
|
|
376
|
+
display: flex;
|
|
377
|
+
align-items: center;
|
|
378
|
+
justify-content: space-between;
|
|
379
|
+
gap: 8px;
|
|
380
|
+
margin-bottom: 4px;
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
.rte-approval-item-author {
|
|
384
|
+
font-size: 12px;
|
|
385
|
+
font-weight: 700;
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
.rte-approval-item-time {
|
|
389
|
+
font-size: 11px;
|
|
390
|
+
color: #64748b;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.${d}.rte-approval-theme-dark .rte-approval-item-time {
|
|
394
|
+
color: #94a3b8;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.rte-approval-item-message {
|
|
398
|
+
margin: 0;
|
|
399
|
+
font-size: 12px;
|
|
400
|
+
line-height: 1.35;
|
|
401
|
+
white-space: pre-wrap;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.rte-approval-empty {
|
|
405
|
+
border: 1px dashed #cbd5e1;
|
|
406
|
+
border-radius: 8px;
|
|
407
|
+
padding: 8px;
|
|
408
|
+
font-size: 12px;
|
|
409
|
+
color: #64748b;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.${d}.rte-approval-theme-dark .rte-approval-empty {
|
|
413
|
+
border-color: #334155;
|
|
414
|
+
color: #94a3b8;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.rte-approval-shortcut {
|
|
418
|
+
margin: 0;
|
|
419
|
+
font-size: 11px;
|
|
420
|
+
color: #64748b;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.${d}.rte-approval-theme-dark .rte-approval-shortcut {
|
|
424
|
+
color: #94a3b8;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
.rte-approval-live {
|
|
428
|
+
position: absolute;
|
|
429
|
+
width: 1px;
|
|
430
|
+
height: 1px;
|
|
431
|
+
margin: -1px;
|
|
432
|
+
padding: 0;
|
|
433
|
+
overflow: hidden;
|
|
434
|
+
clip: rect(0 0 0 0);
|
|
435
|
+
border: 0;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
@media (max-width: 768px) {
|
|
439
|
+
.${d} {
|
|
440
|
+
left: 10px !important;
|
|
441
|
+
right: 10px;
|
|
442
|
+
top: 10px !important;
|
|
443
|
+
width: auto !important;
|
|
444
|
+
max-height: calc(100vh - 20px);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
`,document.head.appendChild(e)}const Pe=(e={})=>{const t=z(e);return He(),{name:"approvalWorkflow",toolbar:[{id:"approvalWorkflowGroup",label:"Approval",type:"group",command:"approvalWorkflow",items:[{id:"approvalWorkflow",label:"Approval Workflow",command:"toggleApprovalWorkflowPanel",shortcut:"Mod-Alt-Shift-a",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4" y="5" width="16" height="14" rx="2.5" stroke="currentColor" stroke-width="1.7"/><path d="M8 10h8M8 14h5" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="m16.5 16 1.8 1.8 3.2-3.2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"approvalRequestReview",label:"Request Review",command:"requestApprovalReview",shortcut:"Mod-Alt-Shift-r",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><circle cx="11" cy="11" r="6.5" stroke="currentColor" stroke-width="1.7"/><path d="M11 8v3l2 2" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M17.5 17.5 20 20" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'},{id:"approvalApprove",label:"Approve",command:"approveDocument",shortcut:"Mod-Alt-Shift-p",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M5 12.5 9.5 17 19 7.5" stroke="currentColor" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round"/><rect x="3.8" y="3.8" width="16.4" height="16.4" rx="3" stroke="currentColor" stroke-width="1.4"/></svg>'},{id:"approvalReopen",label:"Reopen Draft",command:"reopenDraft",shortcut:"Mod-Alt-Shift-d",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M8 8H4v4" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/><path d="M5 12a7 7 0 1 0 2-4.95" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>'}]}],commands:{approvalWorkflow:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;return s.set(r,a),f(r,a),v=r,A(r),P(r),!0},toggleApprovalWorkflowPanel:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;return s.set(r,a),f(r,a),v=r,de(r,typeof o=="boolean"?o:void 0)},requestApprovalReview:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;s.set(r,a),f(r,a);const l=E(r,"review",a,a.defaultActor);return A(r),l},approveDocument:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;s.set(r,a),f(r,a);const l=typeof o=="object"&&o?String(o.author||""):a.defaultActor,c=typeof o=="object"&&o?String(o.comment||""):typeof o=="string"?o:"",u=Q(r,a,l,c);return u&&A(r),u},reopenDraft:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;s.set(r,a),f(r,a);const l=E(r,"draft",a,a.defaultActor);return l&&A(r),l},addApprovalComment:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;s.set(r,a),f(r,a);const l=typeof o=="object"&&o?String(o.author||""):a.defaultActor,c=typeof o=="object"&&o?String(o.message||""):typeof o=="string"?o:"",u=pe(r,c,l,a);return u&&A(r),u},setApprovalStatus:(o,n)=>{const r=x(n);if(!r||!o)return!1;const a=ne(o),l=s.get(r)||t;s.set(r,l),f(r,l);const c=E(r,a,l,l.defaultActor);return c&&A(r),c},setApprovalWorkflowOptions:(o,n)=>{const r=x(n);if(!r||!o||typeof o!="object")return!1;const a=s.get(r)||t,l=z({...a,...o,labels:{...a.labels,...o.labels||{}},normalizeText:o.normalizeText||a.normalizeText});s.set(r,l);const c=f(r,l);return G(r,c,l),!0},getApprovalWorkflowState:(o,n)=>{const r=x(n);if(!r)return!1;const a=s.get(r)||t;s.set(r,a);const l=f(r,a),c=se(l);if(typeof o=="function")try{o(c)}catch{}return r.__approvalWorkflowState=c,r.dispatchEvent(new CustomEvent("editora:approval-state",{bubbles:!0,detail:{state:c}})),!0}},keymap:{"Mod-Alt-Shift-a":"toggleApprovalWorkflowPanel","Mod-Alt-Shift-A":"toggleApprovalWorkflowPanel","Mod-Alt-Shift-r":"requestApprovalReview","Mod-Alt-Shift-R":"requestApprovalReview","Mod-Alt-Shift-p":"approveDocument","Mod-Alt-Shift-P":"approveDocument","Mod-Alt-Shift-d":"reopenDraft","Mod-Alt-Shift-D":"reopenDraft"},init:function(n){_+=1;const r=this&&typeof this.__pluginConfig=="object"?z({...t,...this.__pluginConfig}):t;Re(r);const a=x(n?.editorElement?{editorElement:n.editorElement}:void 0,!1);a&&(s.set(a,r),f(a,r),v=a,P(a))},destroy:()=>{_=Math.max(0,_-1),!(_>0)&&De()}}};exports.ApprovalWorkflowPlugin=Pe;
|