@editora/plugins 1.0.11 → 1.0.13
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 +1 -1
- package/dist/approval-workflow.cjs.js +14 -14
- package/dist/approval-workflow.esm.js +265 -262
- package/dist/blockquote.cjs.js +1 -1
- package/dist/blockquote.esm.js +177 -15
- package/dist/blocks-library.cjs.js +6 -6
- package/dist/blocks-library.esm.js +95 -92
- package/dist/bold.cjs.js +1 -1
- package/dist/bold.esm.js +10 -6
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +124 -44
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +251 -191
- package/dist/citations.cjs.js +4 -4
- package/dist/citations.esm.js +131 -128
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +68 -36
- package/dist/code.cjs.js +121 -44
- package/dist/code.esm.js +2694 -889
- package/dist/content-rules.cjs.js +5 -5
- package/dist/content-rules.esm.js +104 -101
- package/dist/data-binding.cjs.js +3 -3
- package/dist/data-binding.esm.js +51 -48
- package/dist/direction.cjs.js +1 -1
- package/dist/direction.esm.js +97 -74
- package/dist/doc-schema.cjs.js +4 -4
- package/dist/doc-schema.esm.js +104 -101
- package/dist/embed-iframe.cjs.js +21 -4
- package/dist/embed-iframe.esm.js +279 -116
- package/dist/heading.cjs.js +1 -1
- package/dist/heading.esm.js +239 -56
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +74 -89
- package/dist/inlineFormatting-DOYOJdnD.js +1 -0
- package/dist/inlineFormatting-DuVTGXYG.mjs +95 -0
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +12 -8
- package/dist/math.cjs.js +27 -21
- package/dist/math.esm.js +218 -146
- package/dist/merge-tag.cjs.js +8 -2
- package/dist/merge-tag.esm.js +130 -111
- package/dist/pii-redaction.cjs.js +6 -6
- package/dist/pii-redaction.esm.js +169 -166
- package/dist/smart-paste.cjs.js +5 -5
- package/dist/smart-paste.esm.js +120 -117
- package/dist/special-characters.cjs.js +6 -10
- package/dist/special-characters.esm.js +97 -75
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +11 -25
- package/dist/translation-workflow.cjs.js +7 -7
- package/dist/translation-workflow.esm.js +103 -100
- package/dist/underline.cjs.js +1 -1
- package/dist/underline.esm.js +7 -3
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -695,7 +695,7 @@ MIT © [Ajay Kumar](https://github.com/ajaykr089)
|
|
|
695
695
|
|
|
696
696
|
## 🔗 Links
|
|
697
697
|
|
|
698
|
-
- [Documentation](https://
|
|
698
|
+
- [Documentation](https://editora-ecosystem.netlify.app/)
|
|
699
699
|
- [GitHub Repository](https://github.com/ajaykr089/Editora)
|
|
700
700
|
- [Issue Tracker](https://github.com/ajaykr089/Editora/issues)
|
|
701
701
|
- [npm Package](https://www.npmjs.com/package/@editora/plugins)
|
|
@@ -1,4 +1,4 @@
|
|
|
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",
|
|
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",te="__editoraCommandEditorRoot",oe="rte-approval-workflow-styles",d="rte-approval-panel",h="approval",k="approvalWorkflow",g=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',fe={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."},me={draft:"statusDraftText",review:"statusReviewText",approved:"statusApprovedText"},s=new WeakMap,I=new WeakMap,y=new Map,O=new WeakMap,H=new Set;let _=0,be=0,re=0,ae=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 ge(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function le(e){return e==="review"||e==="approved"?e:"draft"}function z(e={}){return{defaultStatus:le(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:{...fe,...e.labels||{}},normalizeText:e.normalizeText||ge}}function Y(e){return e.closest(F)||e}function K(e){if(!e)return null;if(e.matches(w))return e;const t=e.querySelector(w);return t instanceof HTMLElement?t:null}function ve(){if(typeof window>"u")return null;const e=window[te];if(!(e instanceof HTMLElement))return null;window[te]=null;const t=K(e);if(t)return t;const o=e.closest(F);if(o){const n=K(o);if(n)return n}return null}function he(e){const t=e.closest("[data-editora-editor]");if(t&&K(t)===e)return t;let o=e;for(;o;){if(o.matches(F)&&(o===e||K(o)===e))return o;o=o.parentElement}return Y(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 xe(e){const t=Y(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 B(e,t){e.classList.remove("rte-approval-theme-dark"),xe(t)&&e.classList.add("rte-approval-theme-dark")}function ie(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=ve();if(o)return o;const n=window.getSelection();if(n&&n.rangeCount>0){const l=ie(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||(y.get(t)?.remove(),y.delete(t),O.delete(t),s.delete(t),I.delete(t),H.delete(t),v===t&&(v=null))})}function we(e){return e?!!(e.closest(`.${d}`)||e.closest(w)||e.closest(F)):!1}function ye(){const e=window.getSelection();if(!e||e.rangeCount===0)return!1;const t=e.getRangeAt(0).startContainer;return!!ie(t)?.closest(w)}function C(e,t,o){const n=he(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 se(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 X(e){e.dispatchEvent(new Event("input",{bubbles:!0}))}function J(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 Q(){return re+=1,`approval-comment-${Date.now().toString(36)}-${re.toString(36)}`}function ke(){return ae+=1,`approval-signoff-${Date.now().toString(36)}-${ae.toString(36)}`}function ce(e){return{status:e.status,locked:e.locked,comments:e.comments.map(t=>({...t})),signoffs:e.signoffs.map(t=>({...t})),updatedAt:e.updatedAt}}function Ae(e,t){const o=me[e];return t.labels[o]||e}function pe(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",ee(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,se(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),pe(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 Se(e,t){const o=ce(t);e.__approvalWorkflowState=o,e.dispatchEvent(new CustomEvent("editora:approval-state-changed",{bubbles:!0,detail:{state:o}}))}function P(e){const t=y.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=Ae(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
2
|
<li class="rte-approval-item rte-approval-item-${i.kind}" role="listitem">
|
|
3
3
|
<div class="rte-approval-item-head">
|
|
4
4
|
<span class="rte-approval-item-author">${p(i.author)}</span>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</div>
|
|
15
15
|
<p class="rte-approval-item-message">${p(i.comment||"Approved")}</p>
|
|
16
16
|
</li>
|
|
17
|
-
`).join(""))}function G(e,t,o){t.updatedAt=new Date().toISOString(),
|
|
17
|
+
`).join(""))}function G(e,t,o){t.updatedAt=new Date().toISOString(),pe(e,t,o),P(e),Se(e,t)}function ne(e,t,o,n){e.comments.push({id:Q(),author:o||t.defaultActor,message:n,kind:"system",createdAt:new Date().toISOString()}),e.comments=j(e.comments,t.maxHistoryEntries)}function $(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"?ne(r,o,n,"Review requested."):t==="draft"&&ne(r,o,n,"Returned to draft."),G(e,r,o),X(e),J(e,a),!0}function de(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:Q(),author:a,message:r,kind:"comment",createdAt:new Date().toISOString()}),l.comments=j(l.comments,n.maxHistoryEntries),G(e,l,n),X(e),J(e,c),!0}function Z(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:Q(),author:r,message:a,kind:"system",createdAt:new Date().toISOString()}),l.comments=j(l.comments,t.maxHistoryEntries)),G(e,l,t),X(e),J(e,c),!0}function N(e,t){return e.querySelector(`[data-field="${t}"]`)}function Ee(e){const t=N(e,"actor")?.value||"",o=N(e,"comment")?.value||"";return{actor:t,comment:o}}function U(e,t){if(!t.classList.contains("show"))return;const n=Y(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=y.get(e);if(t)return t;const o=s.get(e)||R||z(),n=`rte-approval-panel-${be++}`,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
18
|
<header class="rte-approval-header">
|
|
19
19
|
<h2 class="rte-approval-title">${p(o.labels.panelTitle)}</h2>
|
|
20
20
|
<button type="button" class="rte-approval-icon-btn" data-action="close" aria-label="${p(o.labels.closeText)}">✕</button>
|
|
@@ -53,11 +53,11 @@
|
|
|
53
53
|
<p class="rte-approval-shortcut">${p(o.labels.shortcutText)}</p>
|
|
54
54
|
<span class="rte-approval-live" aria-live="polite"></span>
|
|
55
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=
|
|
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=Ee(r);if(u==="request-review"){$(e,"review",m,i.actor||m.defaultActor)&&M(r,"Status changed to review.");return}if(u==="reopen-draft"){$(e,"draft",m,i.actor||m.defaultActor)&&M(r,"Status changed to draft.");return}if(u==="approve"){const b=Z(e,m,i.actor,i.comment);if(!b&&m.requireCommentOnApprove){M(r,m.labels.approveCommentRequiredText);return}if(b){const E=N(r,"comment");E&&(E.value=""),M(r,"Document approved and signed off.")}return}if(u==="add-comment"){if(!de(e,i.comment,i.actor,m))return;const E=N(r,"comment");E&&(E.value=""),M(r,"Comment added.");return}}),r.addEventListener("keydown",a=>{a.key==="Escape"&&(a.preventDefault(),q(e,!0))}),B(r,e),document.body.appendChild(r),y.set(e,r),O.set(e,!1),P(e),r}function ee(e){return O.get(e)===!0}function A(e){D();const t=$e(e);y.forEach((o,n)=>{n!==e&&q(n,!1)}),t.classList.add("show"),O.set(e,!0),C(e,"toggleApprovalWorkflowPanel",!0),B(t,e),U(e,t),P(e)}function q(e,t=!1){const o=y.get(e);o&&(o.classList.remove("show"),O.set(e,!1),C(e,"toggleApprovalWorkflowPanel",!1),t&&e.focus({preventScroll:!0}))}function ue(e,t){const o=ee(e);return(typeof t=="boolean"?t:!o)?A(e):q(e),!0}function V(e){return typeof e.key=="string"?e.key.toLowerCase():""}function Ce(e){const t=V(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="a"}function Te(e){const t=V(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="r"}function Le(e){const t=V(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="p"}function Re(e){const t=V(e);return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="d"}function Me(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=y.get(n);a&&(B(a,n),U(n,a))},document.addEventListener("focusin",T,!0)),L||(L=t=>{if(t.defaultPrevented)return;const o=Ce(t),n=Te(t),r=Le(t),a=Re(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(!we(c)&&!ye())return;const i=x(void 0,!1);if(!i)return;const b=s.get(i)||R||e;s.set(i,b);const E=f(i,b);if(v=i,l&&ee(i)){t.preventDefault(),q(i,!0);return}if(!u){if(o){t.preventDefault(),t.stopPropagation(),ue(i);return}if(n){t.preventDefault(),t.stopPropagation(),$(i,"review",b,b.defaultActor)&&A(i);return}if(r){t.preventDefault(),t.stopPropagation(),Z(i,b,b.defaultActor,"Approved via keyboard shortcut.")&&A(i);return}a&&(t.preventDefault(),t.stopPropagation(),E.status!=="draft"&&$(i,"draft",b,b.defaultActor)&&A(i))}},document.addEventListener("keydown",L,!0)),S||(S=()=>{D(),y.forEach((t,o)=>{!o.isConnected||!t.isConnected||(B(t,o),U(o,t))})},window.addEventListener("scroll",S,!0),window.addEventListener("resize",S))}function De(e){const t=I.get(e);t&&(e.classList.remove("rte-approval-locked-editor"),e.removeAttribute("data-approval-status"),e.removeAttribute("data-approval-locked"),se(e,t.preApprovalContentEditable??t.originalContentEditable,t.preApprovalReadonly??t.originalReadonly))}function He(){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),y.forEach(e=>e.remove()),y.clear(),H.forEach(e=>De(e)),H.clear(),R=null,v=null}function Pe(){if(typeof document>"u"||document.getElementById(oe))return;const e=document.createElement("style");e.id=oe,e.textContent=`
|
|
57
57
|
.rte-toolbar-group-items.${h},
|
|
58
58
|
.editora-toolbar-group-items.${h},
|
|
59
|
-
.rte-toolbar-group-items.${
|
|
60
|
-
.editora-toolbar-group-items.${
|
|
59
|
+
.rte-toolbar-group-items.${k},
|
|
60
|
+
.editora-toolbar-group-items.${k} {
|
|
61
61
|
display: flex;
|
|
62
62
|
border: 1px solid #ccc;
|
|
63
63
|
border-radius: 3px;
|
|
@@ -66,8 +66,8 @@
|
|
|
66
66
|
|
|
67
67
|
.rte-toolbar-group-items.${h} .rte-toolbar-button,
|
|
68
68
|
.editora-toolbar-group-items.${h} .editora-toolbar-button,
|
|
69
|
-
.rte-toolbar-group-items.${
|
|
70
|
-
.editora-toolbar-group-items.${
|
|
69
|
+
.rte-toolbar-group-items.${k} .rte-toolbar-button,
|
|
70
|
+
.editora-toolbar-group-items.${k} .editora-toolbar-button {
|
|
71
71
|
border: none;
|
|
72
72
|
border-radius: 0;
|
|
73
73
|
border-right: 1px solid #ccc;
|
|
@@ -89,22 +89,22 @@
|
|
|
89
89
|
|
|
90
90
|
.rte-toolbar-group-items.${h} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
91
91
|
.editora-toolbar-group-items.${h} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
92
|
-
.rte-toolbar-group-items.${
|
|
93
|
-
.editora-toolbar-group-items.${
|
|
92
|
+
.rte-toolbar-group-items.${k} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
93
|
+
.editora-toolbar-group-items.${k} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
94
94
|
border-right: none;
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
${g} .rte-toolbar-group-items.${h},
|
|
98
98
|
${g} .editora-toolbar-group-items.${h},
|
|
99
|
-
${g} .rte-toolbar-group-items.${
|
|
100
|
-
${g} .editora-toolbar-group-items.${
|
|
99
|
+
${g} .rte-toolbar-group-items.${k},
|
|
100
|
+
${g} .editora-toolbar-group-items.${k},
|
|
101
101
|
.${d}.rte-approval-theme-dark {
|
|
102
102
|
border-color: #566275;
|
|
103
103
|
}
|
|
104
104
|
${g} .rte-toolbar-group-items.${h} .rte-toolbar-button svg,
|
|
105
105
|
${g} .editora-toolbar-group-items.${h} .editora-toolbar-button svg,
|
|
106
|
-
${g} .rte-toolbar-group-items.${
|
|
107
|
-
${g} .editora-toolbar-group-items.${
|
|
106
|
+
${g} .rte-toolbar-group-items.${k} .rte-toolbar-button svg,
|
|
107
|
+
${g} .editora-toolbar-group-items.${k} .editora-toolbar-button svg
|
|
108
108
|
{
|
|
109
109
|
fill: none;
|
|
110
110
|
}
|
|
@@ -444,4 +444,4 @@
|
|
|
444
444
|
max-height: calc(100vh - 20px);
|
|
445
445
|
}
|
|
446
446
|
}
|
|
447
|
-
`,document.head.appendChild(e)}const
|
|
447
|
+
`,document.head.appendChild(e)}const qe=(e={})=>{const t=z(e);return Pe(),{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,ue(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=$(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=Z(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=$(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=de(r,c,l,a);return u&&A(r),u},setApprovalStatus:(o,n)=>{const r=x(n);if(!r||!o)return!1;const a=le(o),l=s.get(r)||t;s.set(r,l),f(r,l);const c=$(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=ce(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;Me(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)&&He()}}};exports.ApprovalWorkflowPlugin=qe;
|