@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,626 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const S=".rte-content, .editora-content",ke="[data-editora-editor], .rte-editor, .editora-editor, editora-editor",Te="__editoraCommandEditorRoot",ve="rte-translation-workflow-styles",u="rte-translation-workflow-panel",y="translation-workflow",$="translationWorkflow",h=':is([data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark)',$e=["p","h1","h2","h3","h4","h5","h6","li","td","th","blockquote","figcaption"].join(", "),Me=new Set(["ArrowUp","ArrowDown","Home","End"]),Ee=[{locale:"en",label:"English",minLengthRatio:.6,maxLengthRatio:1.4,requireDifferentFromSource:!1,preserveTokens:!0},{locale:"fr",label:"French",minLengthRatio:.75,maxLengthRatio:1.7,requireDifferentFromSource:!0,preserveTokens:!0},{locale:"de",label:"German",minLengthRatio:.8,maxLengthRatio:1.9,requireDifferentFromSource:!0,preserveTokens:!0},{locale:"es",label:"Spanish",minLengthRatio:.7,maxLengthRatio:1.7,requireDifferentFromSource:!0,preserveTokens:!0},{locale:"it",label:"Italian",minLengthRatio:.7,maxLengthRatio:1.7,requireDifferentFromSource:!0,preserveTokens:!0},{locale:"ja",label:"Japanese",minLengthRatio:.45,maxLengthRatio:1.2,requireDifferentFromSource:!0,preserveTokens:!0},{locale:"zh",label:"Chinese",minLengthRatio:.4,maxLengthRatio:1.2,requireDifferentFromSource:!0,preserveTokens:!0}],Ne={panelTitle:"Translation Workflow",panelAriaLabel:"Translation workflow panel",sourceLocaleLabel:"Source Locale",targetLocaleLabel:"Target Locale",validateText:"Validate Locale",captureSourceText:"Capture Source",lockSelectedText:"Lock Selected",unlockSelectedText:"Unlock Selected",lockSegmentAriaLabel:"Lock segment",unlockSegmentAriaLabel:"Unlock segment",realtimeOnText:"Realtime On",realtimeOffText:"Realtime Off",closeText:"Close",summaryPrefix:"Locale QA",noIssuesText:"No locale validation issues.",issuesLabel:"Locale issues",segmentsLabel:"Segments",sourcePreviewLabel:"Source",targetPreviewLabel:"Target",helperText:"Select segments, lock finalized ones, and run locale validation before handoff.",shortcutText:"Shortcuts: Ctrl/Cmd+Alt+Shift+L (panel), Ctrl/Cmd+Alt+Shift+V (validate), Ctrl/Cmd+Alt+Shift+K (lock segment)",readonlySegmentMessage:"This segment is locked. Unlock before editing.",sourceCapturedMessage:"Source snapshot captured from current content.",selectedSegmentPrefix:"Selected Segment",missingTargetMessage:"Segment is empty in target locale.",tokenMismatchMessage:"Tokens/placeholders do not match source segment.",untranslatedMessage:"Segment appears untranslated (same as source).",lengthOutOfRangeMessage:"Translation length is outside expected locale range."},c=new WeakMap,re=new WeakMap,P=new WeakMap,p=new Map,j=new WeakMap,le=new WeakMap,U=new Set;let X=0,_e=0,Ae=0,Fe=0,k=null,x=null,D=null,z=null,O=null,N=null,I=null,_=null;function m(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function We(e){return e.replace(/\u00A0/g," ").replace(/\s+/g," ").trim()}function C(e,t,r){return Number.isFinite(e)?Math.max(t,Math.min(r,e)):t}function A(e){return(e||"").trim()||"en-US"}function W(e){return e.trim().toLowerCase()}function Ke(e){return e.replace(/"/g,""")}function Ve(e,t=120){return e.length<=t?e:`${e.slice(0,Math.max(0,t-1)).trimEnd()}…`}function Re(e){const t=e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);return!t||t.length===0?[]:t.map(r=>r.trim()).filter(Boolean)}function je(e,t){const r=Re(e).sort(),n=Re(t).sort();if(r.length!==n.length)return!1;for(let a=0;a<r.length;a+=1)if(r[a]!==n[a])return!1;return!0}function Ue(e,t){const r=Array.isArray(t)&&t.length>0?t:Ee,n=[],a=new Set;return r.forEach(o=>{const l=W(o.locale||"");if(!l)return;const s=l;a.has(s)||(a.add(s),n.push({locale:s,label:(o.label||l).trim()||l,minLengthRatio:C(Number(o.minLengthRatio??.5),.1,3),maxLengthRatio:C(Number(o.maxLengthRatio??1.8),.2,4),requireDifferentFromSource:o.requireDifferentFromSource!==!1,preserveTokens:o.preserveTokens!==!1}))}),e.forEach(o=>{const l=W(o);if(a.has(l))return;const s=Ee.find(i=>l.startsWith(i.locale));n.push(s?{...s,locale:l,label:o}:{locale:l,label:o,minLengthRatio:.5,maxLengthRatio:1.8,requireDifferentFromSource:!0,preserveTokens:!0})}),n}function oe(e={}){const t=e.normalizeText||We,r=A(e.sourceLocale||"en-US"),n=A(e.targetLocale||"fr-FR"),a=new Set([r,n]);(Array.isArray(e.locales)?e.locales:[]).forEach(s=>{if(typeof s!="string")return;const i=A(s);a.add(i)});const o=Array.from(a),l=Ue(o,e.localeRules);return{sourceLocale:r,targetLocale:n,locales:o,localeRules:l,enableRealtime:e.enableRealtime!==!1,debounceMs:C(Number(e.debounceMs??260),60,2e3),maxIssues:C(Number(e.maxIssues??120),5,1e3),maxSegments:C(Number(e.maxSegments??600),20,3e3),minSourceLengthForRatio:C(Number(e.minSourceLengthForRatio??8),2,100),segmentSelector:(e.segmentSelector||$e).trim()||$e,labels:{...Ne,...e.labels||{}},normalizeText:t}}function Ge(e){return{sourceLocale:e.sourceLocale,targetLocale:e.targetLocale,locales:[...e.locales],localeRules:e.localeRules.map(t=>({locale:t.locale,label:t.label,minLengthRatio:t.minLengthRatio,maxLengthRatio:t.maxLengthRatio,requireDifferentFromSource:t.requireDifferentFromSource,preserveTokens:t.preserveTokens})),enableRealtime:e.enableRealtime,debounceMs:e.debounceMs,maxIssues:e.maxIssues,maxSegments:e.maxSegments,minSourceLengthForRatio:e.minSourceLengthForRatio,segmentSelector:e.segmentSelector,labels:{...e.labels},normalizeText:e.normalizeText}}function xe(e){return e.closest(ke)||e}function K(e){if(!e)return null;if(e.matches(S))return e;const t=e.querySelector(S);return t instanceof HTMLElement?t:null}function Ye(){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 r=e.closest(ke);if(r){const a=K(r);if(a)return a}const n=e.closest(S);return n instanceof HTMLElement?n:null}function Ze(e){const t=e.closest("[data-editora-editor]");if(t&&K(t)===e)return t;let r=e;for(;r;){if(r.matches(ke)&&(r===e||K(r)===e))return r;r=r.parentElement}return xe(e)}function Ce(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function ee(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 Je(e){const t=xe(e);if(ee(t))return!0;const r=t.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return ee(r)?!0:ee(document.documentElement)||ee(document.body)}function ge(e,t){e.classList.remove("rte-translation-workflow-theme-dark"),Je(t)&&e.classList.add("rte-translation-workflow-theme-dark")}function Qe(e){for(let t=0;t<e.length;t+=1){const r=e[t];if(!(r.type!=="childList"||r.removedNodes.length===0))for(let n=0;n<r.removedNodes.length;n+=1){const a=r.removedNodes[n];if(a.nodeType!==Node.ELEMENT_NODE)continue;const o=a;if(o.matches?.(S)||o.matches?.(`.${u}`)||o.querySelector?.(S)||o.querySelector?.(`.${u}`))return!0}}return!1}function ae(){Array.from(U).forEach(t=>{t.isConnected||Se(t)})}function T(e,t=!0,r=!0){if(ae(),e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const s=K(e.editorElement);if(s)return s}const n=Ye();if(n)return n;const a=window.getSelection();if(a&&a.rangeCount>0){const s=Ce(a.getRangeAt(0).startContainer)?.closest(S);if(s)return s}const o=document.activeElement;if(o){if(o.matches(S))return o;const s=o.closest(S);if(s)return s}if(r&&x&&x.isConnected)return x;if(!t)return null;const l=document.querySelector(S);return l instanceof HTMLElement?l:null}function Xe(e){const t=e.target;if(t){const n=t.closest(`.${u}`);if(n){const o=Array.from(p.entries()).find(([,l])=>l===n);if(o)return o[0]}const a=t.closest(S);if(a)return a}const r=document.activeElement;if(r){const n=r.closest(`.${u}`);if(n){const o=Array.from(p.entries()).find(([,l])=>l===n);if(o)return o[0]}const a=r.closest(S);if(a)return a}return null}function fe(e,t,r){const n=Ze(e);Array.from(n.querySelectorAll(`.rte-toolbar-button[data-command="${t}"], .editora-toolbar-button[data-command="${t}"]`)).forEach(o=>{o.classList.toggle("active",r),o.setAttribute("data-active",r?"true":"false"),o.setAttribute("aria-pressed",r?"true":"false")})}function we(e){const t=le.get(e);typeof t=="number"&&(window.clearTimeout(t),le.delete(e))}function et(e,t){const r=W(t),n=e.localeRules.find(l=>W(l.locale)===r);if(n)return n;const a=r.split("-")[0],o=e.localeRules.find(l=>W(l.locale).split("-")[0]===a);return o||{locale:r,label:t,minLengthRatio:.5,maxLengthRatio:1.8,requireDifferentFromSource:!0,preserveTokens:!0}}function te(e,t,r,n={}){return Ae+=1,{id:`translation-workflow-issue-${Ae}`,type:e,severity:t,message:r,...n}}function ie(e,t){if(t){e.hasAttribute("data-translation-prev-contenteditable")||e.setAttribute("data-translation-prev-contenteditable",e.hasAttribute("contenteditable")&&e.getAttribute("contenteditable")||"inherit"),e.setAttribute("data-translation-locked","true"),e.setAttribute("contenteditable","false"),e.setAttribute("aria-readonly","true"),e.classList.add("rte-translation-segment-locked");return}if(e.removeAttribute("data-translation-locked"),e.removeAttribute("aria-readonly"),e.classList.remove("rte-translation-segment-locked"),e.hasAttribute("data-translation-prev-contenteditable")){const r=e.getAttribute("data-translation-prev-contenteditable")||"";r==="inherit"?e.setAttribute("contenteditable","true"):e.setAttribute("contenteditable",r),e.removeAttribute("data-translation-prev-contenteditable")}else e.setAttribute("contenteditable","true")}function ce(e,t){return e.querySelector(`[data-translation-segment-id="${Ke(t)}"]`)}function He(e){const t=window.getSelection();if(!t||t.rangeCount===0)return null;const r=Ce(t.getRangeAt(0).startContainer);return!r||!e.contains(r)?null:r.closest("[data-translation-segment-id]")}function tt(e,t){const r=Array.from(e.querySelectorAll(t));if(r.length<=1)return r;const n=new Set(r);return r.filter(a=>{let o=a.parentElement;for(;o&&o!==e;){if(n.has(o))return!1;o=o.parentElement}return!0})}function nt(e,t,r){let n=(r||"").trim();if(!n||t.has(n)){do n=`translation-segment-${_e++}`;while(t.has(n));e.setAttribute("data-translation-segment-id",n)}return n}function me(e,t){if(t.lockedSegmentIds.size===0)return!1;let r=!1;return t.lockedSegmentIds.forEach(n=>{const a=ce(e,n);if(!a)return;ie(a,!0);const o=t.lockedHtmlBySegmentId.get(n);if(typeof o=="string"){a.innerHTML!==o&&(a.innerHTML=o,r=!0);return}t.lockedHtmlBySegmentId.set(n,a.innerHTML)}),r}function M(e,t,r){const n=tt(e,t.segmentSelector),a=[],o=new Set;for(let l=0;l<n.length&&!(a.length>=t.maxSegments);l+=1){const s=n[l],i=nt(s,o,s.getAttribute("data-translation-segment-id")),d=r.lockedSegmentIds.has(i),g=s.getAttribute("data-translation-locked")==="true",w=d||g;if(w)if(r.lockedSegmentIds.add(i),ie(s,!0),!r.lockedHtmlBySegmentId.has(i))r.lockedHtmlBySegmentId.set(i,s.innerHTML);else{const q=r.lockedHtmlBySegmentId.get(i)||"";s.innerHTML!==q&&(s.innerHTML=q)}else r.lockedHtmlBySegmentId.delete(i);const v=t.normalizeText(s.textContent||"");if(!v)continue;r.sourceTextBySegmentId.has(i)||r.sourceTextBySegmentId.set(i,v);const G=r.sourceTextBySegmentId.get(i)||v;a.push({id:i,tagName:s.tagName.toLowerCase(),index:a.length,text:v,sourceText:G,locked:w}),o.add(i)}return Array.from(r.sourceTextBySegmentId.keys()).forEach(l=>{o.has(l)||r.sourceTextBySegmentId.delete(l)}),Array.from(r.lockedSegmentIds.keys()).forEach(l=>{o.has(l)||r.lockedSegmentIds.delete(l)}),Array.from(r.lockedHtmlBySegmentId.keys()).forEach(l=>{(!o.has(l)||!r.lockedSegmentIds.has(l))&&r.lockedHtmlBySegmentId.delete(l)}),(!r.selectedSegmentId||!a.some(l=>l.id===r.selectedSegmentId))&&(r.selectedSegmentId=a[0]?.id||null),a}function b(e,t){c.has(e)||c.set(e,t);let r=P.get(e);return r||(r={sourceLocale:t.sourceLocale,targetLocale:t.targetLocale,selectedSegmentId:null,realtimeEnabled:t.enableRealtime,segments:[],issues:[],sourceTextBySegmentId:new Map,lockedSegmentIds:new Set,lockedHtmlBySegmentId:new Map,snapshot:"",lastRunAt:null},P.set(e,r)),U.add(e),r}function Se(e){we(e);const t=p.get(e);t&&t.remove(),p.delete(e),j.delete(e);const r=P.get(e);r&&(r.lockedSegmentIds.forEach(n=>{const a=ce(e,n);a&&ie(a,!1)}),r.lockedHtmlBySegmentId.clear()),c.delete(e),re.delete(e),P.delete(e),U.delete(e),x===e&&(x=null)}function ye(e){return j.get(e)===!0}function be(e,t){if(!t.classList.contains("show"))return;const r=xe(e).getBoundingClientRect(),n=Math.min(window.innerWidth-20,520),a=Math.max(10,window.innerWidth-n-10),o=Math.min(Math.max(10,r.right-n),a),l=Math.max(10,Math.min(window.innerHeight-10,r.top+12));t.style.width=`${n}px`,t.style.left=`${o}px`,t.style.top=`${l}px`,t.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function H(e,t){const r=e.querySelector(".rte-translation-live");r&&(r.textContent=t)}function rt(e,t){return`${e.innerHTML}::${t.sourceLocale}::${t.targetLocale}::${Array.from(t.lockedSegmentIds).sort().join("|")}`}function ot(e,t,r){const n=[],a=et(r,t.targetLocale);for(let o=0;o<e.length&&!(n.length>=r.maxIssues);o+=1){const l=e[o],s=r.normalizeText(l.sourceText||""),i=r.normalizeText(l.text||"");if(!i){n.push(te("missing-target","error",r.labels.missingTargetMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:"Provide translated content for this segment before export."}));continue}if(a.preserveTokens&&s&&!je(s,i)&&(n.push(te("token-mismatch","error",r.labels.tokenMismatchMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:"Preserve placeholders/tokens exactly (for example {{name}}, %ID%, ${value})."})),n.length>=r.maxIssues)||a.requireDifferentFromSource&&s&&r.normalizeText(s)===r.normalizeText(i)&&(n.push(te("untranslated","warning",r.labels.untranslatedMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:"Translate the segment or mark it intentionally unchanged."})),n.length>=r.maxIssues))break;if(s.length>=r.minSourceLengthForRatio){const d=i.length/Math.max(1,s.length);(d<a.minLengthRatio||d>a.maxLengthRatio)&&n.push(te("length-out-of-range","warning",r.labels.lengthOutOfRangeMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:`Expected ratio for ${a.label}: ${a.minLengthRatio.toFixed(2)} - ${a.maxLengthRatio.toFixed(2)}.`}))}}return n}function Pe(e){const t=c.get(e)||k,r=P.get(e);return{sourceLocale:r?.sourceLocale||t?.sourceLocale||"en-US",targetLocale:r?.targetLocale||t?.targetLocale||"fr-FR",realtimeEnabled:r?.realtimeEnabled===!0,selectedSegmentId:r?.selectedSegmentId||null,segmentCount:r?.segments.length||0,lockedSegmentCount:r?r.segments.filter(n=>n.locked).length:0,issues:r?.issues?r.issues.map(n=>({...n})):[],segments:r?.segments.map(n=>({id:n.id,tagName:n.tagName,index:n.index,sourceLength:n.sourceText.length,targetLength:n.text.length,locked:n.locked}))||[],lastRunAt:r?.lastRunAt||null}}function E(e){const t=P.get(e),r=t&&t.selectedSegmentId?t.segments.find(n=>n.id===t.selectedSegmentId):null;fe(e,"toggleTranslationWorkflowPanel",ye(e)),fe(e,"toggleTranslationRealtime",t?.realtimeEnabled===!0),fe(e,"toggleTranslationSegmentLock",r?.locked===!0)}function at(e,t){const r=ce(e,t);if(!r)return;try{r.scrollIntoView({block:"nearest",inline:"nearest"})}catch{}const n=window.getSelection();if(!(!n||typeof document.createRange!="function"))try{const a=document.createRange();a.selectNodeContents(r),a.collapse(!0),n.removeAllRanges(),n.addRange(a),e.focus({preventScroll:!0})}catch{}}function R(e){const t=p.get(e);if(!t)return;const r=c.get(e)||k;if(!r)return;const n=b(e,r),a=t.querySelector(".rte-translation-source-label");a&&(a.textContent=r.labels.sourceLocaleLabel);const o=t.querySelector(".rte-translation-target-label");o&&(o.textContent=r.labels.targetLocaleLabel);const l=t.querySelector('[data-field="source-locale"]'),s=t.querySelector('[data-field="target-locale"]'),i=r.locales.map(f=>`<option value="${m(f)}">${m(f)}</option>`).join("");l&&(l.innerHTML=i,l.value=n.sourceLocale),s&&(s.innerHTML=i,s.value=n.targetLocale);const d=t.querySelector(".rte-translation-summary");if(d){const f=n.issues.length,B=n.selectedSegmentId?` • ${r.labels.selectedSegmentPrefix}: ${n.selectedSegmentId}`:"";d.textContent=`${r.labels.summaryPrefix}: ${n.sourceLocale} → ${n.targetLocale} • ${f} issue${f===1?"":"s"}${B}`}const g=t.querySelector(".rte-translation-helper");g&&(g.textContent=r.labels.helperText);const w=t.querySelector(".rte-translation-shortcut");w&&(w.textContent=r.labels.shortcutText);const v=t.querySelector('[data-action="run-validation"]');v&&(v.textContent=r.labels.validateText);const G=t.querySelector('[data-action="capture-source"]');G&&(G.textContent=r.labels.captureSourceText);const q=t.querySelector('[data-action="toggle-realtime"]');q&&(q.textContent=n.realtimeEnabled?r.labels.realtimeOnText:r.labels.realtimeOffText,q.setAttribute("aria-pressed",n.realtimeEnabled?"true":"false"));const Y=t.querySelector('[data-action="lock-selected"]'),ue=n.selectedSegmentId&&n.segments.find(f=>f.id===n.selectedSegmentId)||null;Y&&(Y.textContent=ue?.locked?r.labels.unlockSelectedText:r.labels.lockSelectedText,Y.disabled=!ue,Y.setAttribute("aria-pressed",ue?.locked?"true":"false"));const Le=t.querySelector('[data-action="close"]');Le&&Le.setAttribute("aria-label",r.labels.closeText);const Z=t.querySelector(".rte-translation-issues"),F=t.querySelector(".rte-translation-empty");Z&&(Z.setAttribute("aria-label",r.labels.issuesLabel),n.issues.length===0?(Z.innerHTML="",F&&(F.hidden=!1,F.textContent=r.labels.noIssuesText)):(F&&(F.hidden=!0),Z.innerHTML=n.issues.map(f=>`
|
|
2
|
+
<li class="rte-translation-issue ${f.severity==="error"?"error":f.severity==="warning"?"warning":"info"}" role="listitem" data-segment-id="${m(f.segmentId||"")}">
|
|
3
|
+
<p class="rte-translation-issue-message">${m(f.message)}</p>
|
|
4
|
+
${f.suggestion?`<p class="rte-translation-issue-suggestion">${m(f.suggestion)}</p>`:""}
|
|
5
|
+
</li>
|
|
6
|
+
`).join("")));const de=t.querySelector(".rte-translation-segments");de&&(de.setAttribute("aria-label",r.labels.segmentsLabel),de.innerHTML=n.segments.map(f=>{const B=f.id===n.selectedSegmentId?"selected":"",Oe=f.locked?"locked":"";return`
|
|
7
|
+
<li class="rte-translation-segment-item ${B} ${Oe}" role="option" aria-selected="${f.id===n.selectedSegmentId?"true":"false"}" data-segment-id="${m(f.id)}">
|
|
8
|
+
<button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(f.id)}" title="${m(f.text)}">
|
|
9
|
+
<span class="rte-translation-segment-meta">#${f.index+1} • ${m(f.tagName)}</span>
|
|
10
|
+
<span class="rte-translation-segment-text">${m(Ve(f.text,110))}</span>
|
|
11
|
+
</button>
|
|
12
|
+
<button type="button" class="rte-translation-segment-lock" data-action="toggle-lock" data-segment-id="${m(f.id)}" aria-label="${f.locked?r.labels.unlockSegmentAriaLabel:r.labels.lockSegmentAriaLabel}" aria-pressed="${f.locked?"true":"false"}"></button>
|
|
13
|
+
</li>
|
|
14
|
+
`}).join(""));const J=t.querySelector(".rte-translation-source-preview"),Q=t.querySelector(".rte-translation-target-preview");if(J||Q){const f=n.selectedSegmentId&&n.segments.find(B=>B.id===n.selectedSegmentId)||null;J&&(J.textContent=f?.sourceText||"—",J.setAttribute("aria-label",r.labels.sourcePreviewLabel)),Q&&(Q.textContent=f?.text||"—",Q.setAttribute("aria-label",r.labels.targetPreviewLabel))}t.setAttribute("aria-label",r.labels.panelAriaLabel)}function qe(e){const t=c.get(e)||k;if(!t)return;we(e);const r=window.setTimeout(()=>{le.delete(e),L(e,"realtime",!1)},t.debounceMs);le.set(e,r)}function L(e,t,r){const n=c.get(e)||k;if(!n)return[];const a=b(e,n),o=me(e,a);a.segments=M(e,n,a);const l=rt(e,a);if(!r&&a.snapshot===l)return a.issues;a.issues=ot(a.segments,a,n),a.lastRunAt=new Date().toISOString(),a.snapshot=l,R(e),E(e),e.dispatchEvent(new CustomEvent("editora:translation-workflow-validation",{bubbles:!0,detail:{reason:t,state:Pe(e)}}));const s=p.get(e);if(s){if(o)return H(s,n.labels.readonlySegmentMessage),a.issues;H(s,a.issues.length===0?n.labels.noIssuesText:`${a.issues.length} issue${a.issues.length===1?"":"s"} detected.`)}return a.issues}function Be(e){const t=c.get(e)||k;if(!t)return!1;const r=b(e,t),n=M(e,t,r);n.forEach(o=>{r.sourceTextBySegmentId.set(o.id,o.text)}),r.snapshot="",L(e,"capture-source",!0);const a=p.get(e);return a&&H(a,t.labels.sourceCapturedMessage),e.dispatchEvent(new CustomEvent("editora:translation-source-captured",{bubbles:!0,detail:{sourceLocale:r.sourceLocale,segmentCount:n.length}})),!0}function se(e,t,r){const n=c.get(e)||k;if(!n)return!1;const a=b(e,n);a.segments=M(e,n,a);const o=He(e)?.getAttribute("data-translation-segment-id")||null,l=t||o||a.selectedSegmentId||a.segments[0]?.id||null;if(!l)return!1;const s=ce(e,l);if(!s)return!1;const i=typeof r=="boolean"?r:!a.lockedSegmentIds.has(l);return i?(a.lockedSegmentIds.add(l),a.lockedHtmlBySegmentId.set(l,s.innerHTML)):(a.lockedSegmentIds.delete(l),a.lockedHtmlBySegmentId.delete(l)),ie(s,i),a.selectedSegmentId=l,a.snapshot="",L(e,"lock-segment",!0),e.dispatchEvent(new CustomEvent("editora:translation-segment-lock",{bubbles:!0,detail:{segmentId:l,locked:i}})),!0}function De(e,t){const r=c.get(e)||k;if(!r)return!1;const n=b(e,r),a=typeof t=="boolean"?t:!n.realtimeEnabled;return n.realtimeEnabled=a,a?qe(e):we(e),R(e),E(e),!0}function pe(e,t,r=!0){const n=c.get(e)||k;if(!n)return!1;const a=b(e,n);return a.segments=M(e,n,a),a.segments.some(o=>o.id===t)?(a.selectedSegmentId=t,R(e),E(e),r&&at(e,t),!0):!1}function ne(e,t){const r=c.get(e)||k;if(!r)return!1;const n=b(e,r);if(n.segments=M(e,r,n),n.segments.length===0)return!1;const a=Math.max(0,n.segments.findIndex(s=>s.id===n.selectedSegmentId));let o=a;t==="start"?o=0:t==="end"?o=n.segments.length-1:o=C(a+t,0,n.segments.length-1);const l=n.segments[o];return l?pe(e,l.id,!0):!1}function V(e,t=!1){const r=p.get(e);r&&(r.classList.remove("show"),j.set(e,!1),E(e),t&&e.focus({preventScroll:!0}))}function he(e){const t=ut(e);p.forEach((n,a)=>{a!==e&&V(a,!1)}),t.classList.add("show"),j.set(e,!0),L(e,"panel-open",!1),R(e),be(e,t),E(e),t.querySelector('[data-field="target-locale"]')?.focus()}function ze(e,t){const r=ye(e);return(typeof t=="boolean"?t:!r)?he(e):V(e,!1),!0}function lt(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="l"}function st(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="v"}function it(e){const t=e.key.toLowerCase();return(e.metaKey||e.ctrlKey)&&e.altKey&&e.shiftKey&&t==="k"}function ct(e){return e.key.length===1&&!e.metaKey&&!e.ctrlKey&&!e.altKey?!0:e.key==="Backspace"||e.key==="Delete"||e.key==="Enter"}function Ie(e){return e instanceof HTMLElement?e.closest('[data-translation-locked="true"]'):null}function ut(e){const t=p.get(e);if(t)return t;const r=c.get(e)||k||oe();b(e,r);const n=`rte-translation-workflow-panel-${Fe++}`,a=`${n}-source`,o=`${n}-target`,l=document.createElement("section");return l.className=u,l.id=n,l.setAttribute("role","dialog"),l.setAttribute("aria-modal","false"),l.setAttribute("aria-label",r.labels.panelAriaLabel),l.innerHTML=`
|
|
15
|
+
<header class="rte-translation-header">
|
|
16
|
+
<h2 class="rte-translation-title">${m(r.labels.panelTitle)}</h2>
|
|
17
|
+
<button type="button" class="rte-translation-icon-btn" data-action="close" aria-label="${m(r.labels.closeText)}">✕</button>
|
|
18
|
+
</header>
|
|
19
|
+
<div class="rte-translation-body">
|
|
20
|
+
<div class="rte-translation-locales">
|
|
21
|
+
<div class="rte-translation-locale-field">
|
|
22
|
+
<label class="rte-translation-source-label" for="${m(a)}"></label>
|
|
23
|
+
<select id="${m(a)}" class="rte-translation-select" data-field="source-locale"></select>
|
|
24
|
+
</div>
|
|
25
|
+
<div class="rte-translation-locale-field">
|
|
26
|
+
<label class="rte-translation-target-label" for="${m(o)}"></label>
|
|
27
|
+
<select id="${m(o)}" class="rte-translation-select" data-field="target-locale"></select>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
<p class="rte-translation-summary"></p>
|
|
31
|
+
<div class="rte-translation-actions">
|
|
32
|
+
<button type="button" class="rte-translation-btn rte-translation-btn-primary" data-action="run-validation"></button>
|
|
33
|
+
<button type="button" class="rte-translation-btn" data-action="capture-source"></button>
|
|
34
|
+
<button type="button" class="rte-translation-btn" data-action="lock-selected"></button>
|
|
35
|
+
<button type="button" class="rte-translation-btn" data-action="toggle-realtime" aria-pressed="false"></button>
|
|
36
|
+
</div>
|
|
37
|
+
<p class="rte-translation-helper"></p>
|
|
38
|
+
<p class="rte-translation-shortcut"></p>
|
|
39
|
+
<div class="rte-translation-grid">
|
|
40
|
+
<section class="rte-translation-segments-wrap" aria-label="${m(r.labels.segmentsLabel)}">
|
|
41
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.segmentsLabel)}</h3>
|
|
42
|
+
<ul class="rte-translation-segments" role="listbox" tabindex="0" aria-label="${m(r.labels.segmentsLabel)}"></ul>
|
|
43
|
+
</section>
|
|
44
|
+
<section class="rte-translation-preview-wrap">
|
|
45
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.sourcePreviewLabel)} / ${m(r.labels.targetPreviewLabel)}</h3>
|
|
46
|
+
<div class="rte-translation-preview-block">
|
|
47
|
+
<p class="rte-translation-preview-label">${m(r.labels.sourcePreviewLabel)}</p>
|
|
48
|
+
<p class="rte-translation-source-preview"></p>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="rte-translation-preview-block">
|
|
51
|
+
<p class="rte-translation-preview-label">${m(r.labels.targetPreviewLabel)}</p>
|
|
52
|
+
<p class="rte-translation-target-preview"></p>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
</div>
|
|
56
|
+
<section class="rte-translation-issues-wrap">
|
|
57
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.issuesLabel)}</h3>
|
|
58
|
+
<ul class="rte-translation-issues" role="list" aria-label="${m(r.labels.issuesLabel)}"></ul>
|
|
59
|
+
<p class="rte-translation-empty" hidden></p>
|
|
60
|
+
</section>
|
|
61
|
+
</div>
|
|
62
|
+
<div class="rte-translation-live" aria-live="polite" aria-atomic="true"></div>
|
|
63
|
+
`,l.addEventListener("click",s=>{const i=s.target;if(!i)return;const d=i.closest("[data-action]");if(!d){const v=i.closest(".rte-translation-issue[data-segment-id]")?.getAttribute("data-segment-id")||"";v&&pe(e,v,!0);return}const g=d.getAttribute("data-action");if(g==="close"){V(e,!0);return}if(g==="run-validation"){L(e,"panel-button",!0);return}if(g==="capture-source"){Be(e);return}if(g==="lock-selected"){se(e);return}if(g==="toggle-realtime"){De(e);return}if(g==="select-segment"){const w=d.getAttribute("data-segment-id")||"";w&&pe(e,w,!0);return}if(g==="toggle-lock"){const w=d.getAttribute("data-segment-id")||"";w&&se(e,w)}}),l.addEventListener("change",s=>{const i=s.target;if(!(i instanceof HTMLSelectElement))return;const d=c.get(e)||k;if(!d)return;const g=b(e,d);if(i.getAttribute("data-field")==="source-locale"){g.sourceLocale=A(i.value),g.snapshot="",L(e,"source-locale-change",!0);return}i.getAttribute("data-field")==="target-locale"&&(g.targetLocale=A(i.value),g.snapshot="",L(e,"target-locale-change",!0))}),l.addEventListener("keydown",s=>{const i=s.target;if(s.key==="Escape"){s.preventDefault(),V(e,!0);return}!i?.closest(".rte-translation-segments")||!Me.has(s.key)||(s.preventDefault(),s.key==="ArrowUp"?ne(e,-1):s.key==="ArrowDown"?ne(e,1):s.key==="Home"?ne(e,"start"):s.key==="End"&&ne(e,"end"))}),ge(l,e),document.body.appendChild(l),p.set(e,l),j.set(e,!1),R(e),l}function dt(e){k=e,D||(D=t=>{ae();const n=t.target?.closest(S);if(!n)return;const a=c.get(n)||e,o=b(n,a);c.set(n,a),x=n;const l=He(n)?.getAttribute("data-translation-segment-id")||null;l&&(o.selectedSegmentId=l),E(n);const s=p.get(n);s&&(ge(s,n),be(n,s),R(n))},document.addEventListener("focusin",D,!0)),z||(z=t=>{const n=t.target?.closest(S);if(!n)return;const a=c.get(n)||k;if(!a)return;const o=b(n,a),l=me(n,o);if(o.segments=M(n,a,o),!o.realtimeEnabled){if(l){const s=p.get(n);s&&H(s,a.labels.readonlySegmentMessage)}R(n),E(n);return}qe(n)},document.addEventListener("input",z,!0)),O||(O=t=>{const r=t,n=r.target,a=n?.closest(S);if(!a)return;const o=Ie(n);if(!o||!a.contains(o))return;r.preventDefault();const l=p.get(a),s=c.get(a)||k;l&&s&&H(l,s.labels.readonlySegmentMessage)},document.addEventListener("beforeinput",O,!0)),N||(N=t=>{if(t.defaultPrevented)return;const r=t.target;if(r?.closest(`.${u}`)&&t.key!=="Escape"&&!Me.has(t.key))return;const a=t.key==="Escape",o=lt(t),l=st(t),s=it(t),i=Ie(r);if(!a&&!o&&!l&&!s&&!i)return;const d=Xe(t);if(!d)return;const g=c.get(d)||k||e;if(b(d,g),c.set(d,g),x=d,a&&ye(d)){t.preventDefault(),V(d,!0);return}if(i&&d.contains(i)&&ct(t)){t.preventDefault();const w=p.get(d);w&&H(w,g.labels.readonlySegmentMessage);return}if(o){t.preventDefault(),t.stopPropagation(),ze(d);return}if(l){t.preventDefault(),t.stopPropagation(),L(d,"shortcut",!0);return}s&&(t.preventDefault(),t.stopPropagation(),se(d))},document.addEventListener("keydown",N,!0)),I||(I=()=>{ae(),p.forEach((t,r)=>{!r.isConnected||!t.isConnected||(ge(t,r),be(r,t))})},window.addEventListener("scroll",I,!0),window.addEventListener("resize",I)),!_&&typeof MutationObserver<"u"&&document.body&&(_=new MutationObserver(t=>{Qe(t)&&ae(),t.some(n=>n.type==="characterData"?!0:n.type==="childList"&&(n.addedNodes.length>0||n.removedNodes.length>0))&&U.forEach(n=>{const a=P.get(n);if(!a||a.lockedSegmentIds.size===0||!me(n,a))return;a.snapshot="";const l=c.get(n)||k,s=p.get(n);s&&l&&H(s,l.labels.readonlySegmentMessage),l&&(a.segments=M(n,l,a),R(n),E(n))})}),_.observe(document.body,{childList:!0,subtree:!0,characterData:!0}))}function ft(){D&&(document.removeEventListener("focusin",D,!0),D=null),z&&(document.removeEventListener("input",z,!0),z=null),O&&(document.removeEventListener("beforeinput",O,!0),O=null),N&&(document.removeEventListener("keydown",N,!0),N=null),I&&(window.removeEventListener("scroll",I,!0),window.removeEventListener("resize",I),I=null),_&&(_.disconnect(),_=null),p.forEach(t=>t.remove()),p.clear(),Array.from(U).forEach(t=>Se(t)),k=null,x=null}function gt(){if(typeof document>"u"||document.getElementById(ve))return;const e=document.createElement("style");e.id=ve,e.textContent=`
|
|
64
|
+
.rte-toolbar-group-items.${y},
|
|
65
|
+
.editora-toolbar-group-items.${y},
|
|
66
|
+
.rte-toolbar-group-items.${$},
|
|
67
|
+
.editora-toolbar-group-items.${$} {
|
|
68
|
+
display: flex;
|
|
69
|
+
border: 1px solid #cbd5e1;
|
|
70
|
+
border-radius: 4px;
|
|
71
|
+
background: #ffffff;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
75
|
+
.editora-toolbar-group-items.${y} .editora-toolbar-button,
|
|
76
|
+
.rte-toolbar-group-items.${$} .rte-toolbar-button,
|
|
77
|
+
.editora-toolbar-group-items.${$} .editora-toolbar-button {
|
|
78
|
+
border: none;
|
|
79
|
+
border-right: 1px solid #cbd5e1;
|
|
80
|
+
border-radius: 0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
84
|
+
.editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
85
|
+
.rte-toolbar-group-items.${$} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
86
|
+
.editora-toolbar-group-items.${$} .editora-toolbar-item:last-child .editora-toolbar-button {
|
|
87
|
+
border-right: none;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
${h} .rte-toolbar-group-items.${y},
|
|
91
|
+
${h} .editora-toolbar-group-items.${y},
|
|
92
|
+
${h} .rte-toolbar-group-items.${$},
|
|
93
|
+
${h} .editora-toolbar-group-items.${$} {
|
|
94
|
+
border-color: #566275;
|
|
95
|
+
}
|
|
96
|
+
.rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
97
|
+
.editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
98
|
+
.rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
|
|
99
|
+
.editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
|
|
100
|
+
.rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
|
|
101
|
+
.editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
|
|
102
|
+
background: #ccc;
|
|
103
|
+
}
|
|
104
|
+
${h} .rte-toolbar-group-items.${y} .rte-toolbar-button svg,
|
|
105
|
+
${h} .editora-toolbar-group-items.${y} .editora-toolbar-button svg,
|
|
106
|
+
${h} .rte-toolbar-group-items.${$} .rte-toolbar-button svg,
|
|
107
|
+
${h} .editora-toolbar-group-items.${$} .editora-toolbar-button svg
|
|
108
|
+
{
|
|
109
|
+
fill: none;
|
|
110
|
+
}
|
|
111
|
+
${h} .rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
112
|
+
${h} .editora-toolbar-group-items.${y} .editora-toolbar-button
|
|
113
|
+
{
|
|
114
|
+
border-color: #566275;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
${h} .rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
118
|
+
${h} .editora-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
119
|
+
${h} .rte-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
|
|
120
|
+
${h} .editora-toolbar-button[data-command="toggleTranslationSegmentLock"].active,
|
|
121
|
+
${h} .rte-toolbar-button[data-command="toggleTranslationRealtime"].active,
|
|
122
|
+
${h} .editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
|
|
123
|
+
background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.${u} {
|
|
127
|
+
position: fixed;
|
|
128
|
+
z-index: 12000;
|
|
129
|
+
display: none;
|
|
130
|
+
width: min(520px, calc(100vw - 20px));
|
|
131
|
+
max-height: calc(100vh - 20px);
|
|
132
|
+
border: 1px solid #d1d5db;
|
|
133
|
+
border-radius: 14px;
|
|
134
|
+
background: #ffffff;
|
|
135
|
+
color: #0f172a;
|
|
136
|
+
box-shadow: 0 24px 48px rgba(15, 23, 42, 0.24);
|
|
137
|
+
overflow: hidden;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
.${u}.show {
|
|
141
|
+
display: flex;
|
|
142
|
+
flex-direction: column;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.${u}.rte-translation-workflow-theme-dark {
|
|
146
|
+
border-color: #334155;
|
|
147
|
+
background: #0f172a;
|
|
148
|
+
color: #e2e8f0;
|
|
149
|
+
box-shadow: 0 24px 52px rgba(2, 6, 23, 0.68);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.rte-translation-header {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: space-between;
|
|
156
|
+
gap: 8px;
|
|
157
|
+
padding: 12px 14px;
|
|
158
|
+
border-bottom: 1px solid #e2e8f0;
|
|
159
|
+
background: linear-gradient(180deg, #eff6ff 0%, #e2e8f0 100%);
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-header {
|
|
163
|
+
border-color: #1e293b;
|
|
164
|
+
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.rte-translation-title {
|
|
168
|
+
margin: 0;
|
|
169
|
+
font-size: 15px;
|
|
170
|
+
line-height: 1.2;
|
|
171
|
+
font-weight: 700;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.rte-translation-icon-btn {
|
|
175
|
+
border: 1px solid #cbd5e1;
|
|
176
|
+
border-radius: 6px;
|
|
177
|
+
min-height: 34px;
|
|
178
|
+
width: 34px;
|
|
179
|
+
background: #ffffff;
|
|
180
|
+
color: #0f172a;
|
|
181
|
+
font-size: 16px;
|
|
182
|
+
line-height: 1;
|
|
183
|
+
font-weight: 600;
|
|
184
|
+
padding: 0;
|
|
185
|
+
display: inline-flex;
|
|
186
|
+
align-items: center;
|
|
187
|
+
justify-content: center;
|
|
188
|
+
cursor: pointer;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
.rte-translation-icon-btn:hover,
|
|
192
|
+
.rte-translation-icon-btn:focus-visible {
|
|
193
|
+
outline: none;
|
|
194
|
+
border-color: #3b82f6;
|
|
195
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn {
|
|
199
|
+
border-color: #475569;
|
|
200
|
+
background: #0f172a;
|
|
201
|
+
color: #e2e8f0;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:hover,
|
|
205
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn:focus-visible {
|
|
206
|
+
border-color: #60a5fa;
|
|
207
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
.rte-translation-body {
|
|
211
|
+
display: flex;
|
|
212
|
+
flex-direction: column;
|
|
213
|
+
gap: 8px;
|
|
214
|
+
padding: 12px;
|
|
215
|
+
overflow: auto;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.rte-translation-locales {
|
|
219
|
+
display: grid;
|
|
220
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
221
|
+
gap: 8px;
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.rte-translation-locale-field {
|
|
225
|
+
display: grid;
|
|
226
|
+
gap: 4px;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
.rte-translation-source-label,
|
|
230
|
+
.rte-translation-target-label {
|
|
231
|
+
font-size: 12px;
|
|
232
|
+
font-weight: 700;
|
|
233
|
+
color: #334155;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-source-label,
|
|
237
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-target-label {
|
|
238
|
+
color: #cbd5e1;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
.rte-translation-select {
|
|
242
|
+
border: 1px solid #cbd5e1;
|
|
243
|
+
border-radius: 8px;
|
|
244
|
+
min-height: 34px;
|
|
245
|
+
padding: 0 10px;
|
|
246
|
+
font-size: 13px;
|
|
247
|
+
background: #ffffff;
|
|
248
|
+
color: inherit;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
.rte-translation-select:focus-visible {
|
|
252
|
+
border-color: #0e7490;
|
|
253
|
+
box-shadow: 0 0 0 3px rgba(14, 116, 144, 0.18);
|
|
254
|
+
outline: none;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-select {
|
|
258
|
+
border-color: #334155;
|
|
259
|
+
background: #0b1220;
|
|
260
|
+
color: #e2e8f0;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
.rte-translation-summary,
|
|
264
|
+
.rte-translation-helper,
|
|
265
|
+
.rte-translation-shortcut {
|
|
266
|
+
margin: 0;
|
|
267
|
+
font-size: 12px;
|
|
268
|
+
line-height: 1.35;
|
|
269
|
+
color: #475569;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-summary,
|
|
273
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-helper,
|
|
274
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-shortcut {
|
|
275
|
+
color: #94a3b8;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
.rte-translation-actions {
|
|
279
|
+
display: grid;
|
|
280
|
+
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
281
|
+
gap: 8px;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.rte-translation-btn {
|
|
285
|
+
border: 1px solid #cbd5e1;
|
|
286
|
+
border-radius: 8px;
|
|
287
|
+
min-height: 34px;
|
|
288
|
+
padding: 0 8px;
|
|
289
|
+
background: #ffffff;
|
|
290
|
+
color: inherit;
|
|
291
|
+
font-size: 12px;
|
|
292
|
+
font-weight: 700;
|
|
293
|
+
cursor: pointer;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
.rte-translation-btn:disabled {
|
|
297
|
+
opacity: 0.6;
|
|
298
|
+
cursor: not-allowed;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.rte-translation-btn-primary {
|
|
302
|
+
border-color: #0e7490;
|
|
303
|
+
background: #0e7490;
|
|
304
|
+
color: #f8fafc;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
.rte-translation-btn:hover,
|
|
308
|
+
.rte-translation-btn:focus-visible {
|
|
309
|
+
border-color: #94a3b8;
|
|
310
|
+
outline: none;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.rte-translation-btn-primary:hover,
|
|
314
|
+
.rte-translation-btn-primary:focus-visible {
|
|
315
|
+
border-color: #155e75;
|
|
316
|
+
background: #155e75;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-btn {
|
|
320
|
+
border-color: #334155;
|
|
321
|
+
background: #111827;
|
|
322
|
+
color: #e2e8f0;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-btn-primary {
|
|
326
|
+
border-color: #22d3ee;
|
|
327
|
+
background: #0e7490;
|
|
328
|
+
color: #ecfeff;
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
.rte-translation-grid {
|
|
332
|
+
display: grid;
|
|
333
|
+
grid-template-columns: 1fr 1fr;
|
|
334
|
+
gap: 8px;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
.rte-translation-segments-wrap,
|
|
338
|
+
.rte-translation-preview-wrap,
|
|
339
|
+
.rte-translation-issues-wrap {
|
|
340
|
+
border: 1px solid #e2e8f0;
|
|
341
|
+
border-radius: 10px;
|
|
342
|
+
background: #f8fafc;
|
|
343
|
+
padding: 8px;
|
|
344
|
+
min-height: 120px;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segments-wrap,
|
|
348
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-preview-wrap,
|
|
349
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issues-wrap {
|
|
350
|
+
border-color: #334155;
|
|
351
|
+
background: #0b1220;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.rte-translation-subtitle {
|
|
355
|
+
margin: 0 0 6px;
|
|
356
|
+
font-size: 12px;
|
|
357
|
+
font-weight: 700;
|
|
358
|
+
color: #334155;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-subtitle {
|
|
362
|
+
color: #cbd5e1;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
.rte-translation-segments {
|
|
366
|
+
margin: 0;
|
|
367
|
+
padding: 0;
|
|
368
|
+
list-style: none;
|
|
369
|
+
display: grid;
|
|
370
|
+
gap: 6px;
|
|
371
|
+
max-height: 220px;
|
|
372
|
+
overflow: auto;
|
|
373
|
+
outline: none;
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
.rte-translation-segment-item {
|
|
377
|
+
display: grid;
|
|
378
|
+
grid-template-columns: 1fr auto;
|
|
379
|
+
gap: 6px;
|
|
380
|
+
border: 1px solid #cbd5e1;
|
|
381
|
+
border-radius: 8px;
|
|
382
|
+
background: #ffffff;
|
|
383
|
+
padding: 6px;
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
.rte-translation-segment-item.selected {
|
|
387
|
+
border-color: #0e7490;
|
|
388
|
+
box-shadow: 0 0 0 2px rgba(14, 116, 144, 0.16);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
.rte-translation-segment-item.locked {
|
|
392
|
+
border-color: #f59e0b;
|
|
393
|
+
background: #fffbeb;
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item {
|
|
397
|
+
border-color: #334155;
|
|
398
|
+
background: #111827;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item.locked {
|
|
402
|
+
border-color: rgba(245, 158, 11, 0.72);
|
|
403
|
+
background: rgba(120, 53, 15, 0.28);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
.rte-translation-segment-select {
|
|
407
|
+
border: none;
|
|
408
|
+
background: transparent;
|
|
409
|
+
color: inherit;
|
|
410
|
+
text-align: left;
|
|
411
|
+
padding: 0;
|
|
412
|
+
cursor: pointer;
|
|
413
|
+
display: grid;
|
|
414
|
+
gap: 2px;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
.rte-translation-segment-meta {
|
|
418
|
+
font-size: 11px;
|
|
419
|
+
color: #64748b;
|
|
420
|
+
font-weight: 700;
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
.rte-translation-segment-text {
|
|
424
|
+
font-size: 12px;
|
|
425
|
+
color: #334155;
|
|
426
|
+
line-height: 1.3;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-meta {
|
|
430
|
+
color: #94a3b8;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-text {
|
|
434
|
+
color: #e2e8f0;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.rte-translation-segment-lock {
|
|
438
|
+
border: 1px solid #cbd5e1;
|
|
439
|
+
border-radius: 8px;
|
|
440
|
+
width: 28px;
|
|
441
|
+
min-height: 28px;
|
|
442
|
+
background: #ffffff;
|
|
443
|
+
cursor: pointer;
|
|
444
|
+
position: relative;
|
|
445
|
+
color: inherit;
|
|
446
|
+
font-size: 0;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
.rte-translation-segment-lock::before {
|
|
450
|
+
content: '🔒';
|
|
451
|
+
font-size: 14px;
|
|
452
|
+
position: absolute;
|
|
453
|
+
inset: 0;
|
|
454
|
+
display: grid;
|
|
455
|
+
place-items: center;
|
|
456
|
+
opacity: 0.35;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.rte-translation-segment-lock[aria-pressed="true"]::before {
|
|
460
|
+
opacity: 1;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-lock {
|
|
464
|
+
border-color: #334155;
|
|
465
|
+
background: #111827;
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
.rte-translation-preview-block {
|
|
469
|
+
display: grid;
|
|
470
|
+
gap: 4px;
|
|
471
|
+
margin-bottom: 8px;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.rte-translation-preview-label {
|
|
475
|
+
margin: 0;
|
|
476
|
+
font-size: 11px;
|
|
477
|
+
color: #64748b;
|
|
478
|
+
font-weight: 700;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.rte-translation-source-preview,
|
|
482
|
+
.rte-translation-target-preview {
|
|
483
|
+
margin: 0;
|
|
484
|
+
border: 1px solid #cbd5e1;
|
|
485
|
+
border-radius: 8px;
|
|
486
|
+
background: #ffffff;
|
|
487
|
+
padding: 8px;
|
|
488
|
+
font-size: 12px;
|
|
489
|
+
min-height: 56px;
|
|
490
|
+
white-space: pre-wrap;
|
|
491
|
+
line-height: 1.35;
|
|
492
|
+
color: #1f2937;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-preview-label {
|
|
496
|
+
color: #94a3b8;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-source-preview,
|
|
500
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-target-preview {
|
|
501
|
+
border-color: #334155;
|
|
502
|
+
background: #111827;
|
|
503
|
+
color: #e2e8f0;
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.rte-translation-issues {
|
|
507
|
+
margin: 0;
|
|
508
|
+
padding: 0;
|
|
509
|
+
list-style: none;
|
|
510
|
+
display: grid;
|
|
511
|
+
gap: 6px;
|
|
512
|
+
max-height: 200px;
|
|
513
|
+
overflow: auto;
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
.rte-translation-issue {
|
|
517
|
+
border: 1px solid #cbd5e1;
|
|
518
|
+
border-radius: 8px;
|
|
519
|
+
background: #ffffff;
|
|
520
|
+
padding: 8px;
|
|
521
|
+
display: grid;
|
|
522
|
+
gap: 4px;
|
|
523
|
+
cursor: pointer;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
.rte-translation-issue.error {
|
|
527
|
+
border-color: #ef4444;
|
|
528
|
+
background: #fef2f2;
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.rte-translation-issue.warning {
|
|
532
|
+
border-color: #f59e0b;
|
|
533
|
+
background: #fffbeb;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
.rte-translation-issue.info {
|
|
537
|
+
border-color: #0ea5e9;
|
|
538
|
+
background: #f0f9ff;
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue {
|
|
542
|
+
border-color: #334155;
|
|
543
|
+
background: #111827;
|
|
544
|
+
color: #e2e8f0;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.error {
|
|
548
|
+
border-color: rgba(239, 68, 68, 0.7);
|
|
549
|
+
background: rgba(127, 29, 29, 0.28);
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.warning {
|
|
553
|
+
border-color: rgba(245, 158, 11, 0.72);
|
|
554
|
+
background: rgba(120, 53, 15, 0.28);
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.info {
|
|
558
|
+
border-color: rgba(14, 165, 233, 0.7);
|
|
559
|
+
background: rgba(7, 89, 133, 0.28);
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
.rte-translation-issue-message,
|
|
563
|
+
.rte-translation-issue-suggestion {
|
|
564
|
+
margin: 0;
|
|
565
|
+
font-size: 12px;
|
|
566
|
+
line-height: 1.35;
|
|
567
|
+
color: #1f2937;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
.rte-translation-issue-suggestion {
|
|
571
|
+
color: #475569;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue-message {
|
|
575
|
+
color: #e2e8f0;
|
|
576
|
+
}
|
|
577
|
+
|
|
578
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue-suggestion {
|
|
579
|
+
color: #cbd5e1;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
.rte-translation-empty {
|
|
583
|
+
margin: 8px;
|
|
584
|
+
font-size: 12px;
|
|
585
|
+
color: #64748b;
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
.rte-translation-live {
|
|
589
|
+
position: absolute;
|
|
590
|
+
width: 1px;
|
|
591
|
+
height: 1px;
|
|
592
|
+
margin: -1px;
|
|
593
|
+
padding: 0;
|
|
594
|
+
overflow: hidden;
|
|
595
|
+
clip: rect(0 0 0 0);
|
|
596
|
+
border: 0;
|
|
597
|
+
}
|
|
598
|
+
|
|
599
|
+
[data-translation-locked="true"].rte-translation-segment-locked {
|
|
600
|
+
outline: 2px dashed rgba(245, 158, 11, 0.65);
|
|
601
|
+
outline-offset: 2px;
|
|
602
|
+
background: rgba(255, 251, 235, 0.8);
|
|
603
|
+
border-radius: 4px;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
${h} [data-translation-locked="true"].rte-translation-segment-locked {
|
|
607
|
+
outline-color: rgba(245, 158, 11, 0.75);
|
|
608
|
+
background: rgba(120, 53, 15, 0.22);
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
@media (max-width: 920px) {
|
|
612
|
+
.${u} {
|
|
613
|
+
left: 10px !important;
|
|
614
|
+
right: 10px;
|
|
615
|
+
top: 10px !important;
|
|
616
|
+
width: auto !important;
|
|
617
|
+
max-height: calc(100vh - 20px);
|
|
618
|
+
}
|
|
619
|
+
|
|
620
|
+
.rte-translation-locales,
|
|
621
|
+
.rte-translation-actions,
|
|
622
|
+
.rte-translation-grid {
|
|
623
|
+
grid-template-columns: 1fr;
|
|
624
|
+
}
|
|
625
|
+
}
|
|
626
|
+
`,document.head.appendChild(e)}const mt=(e={})=>{const t=oe(e),r=new Set;return gt(),{name:"translationWorkflow",toolbar:[{id:"translationWorkflowGroup",label:"Translation Workflow",type:"group",command:"translationWorkflow",items:[{id:"toggleTranslationWorkflowPanel",label:"Translation Workflow",command:"toggleTranslationWorkflowPanel",shortcut:"Mod-Alt-Shift-l",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4 6.5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v4a2 2 0 0 1-2 2H8l-4 3V6.5Z" stroke="currentColor" stroke-width="1.6"/><path d="M20 17.5a2 2 0 0 1-2 2h-8a2 2 0 0 1-2-2v-1.5" stroke="currentColor" stroke-width="1.6"/><path d="m13 8 2 2m0 0 2-2m-2 2V4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"runTranslationLocaleValidation",label:"Run Locale Validation",command:"runTranslationLocaleValidation",shortcut:"Mod-Alt-Shift-v",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="4.5" y="4" width="12" height="16" rx="2" stroke="currentColor" stroke-width="1.6"/><path d="M8 8h5.5M8 11h4M8 14h3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="m15.5 15.5 1.7 1.7 3.3-3.3" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'},{id:"toggleTranslationSegmentLock",label:"Toggle Segment Lock",command:"toggleTranslationSegmentLock",shortcut:"Mod-Alt-Shift-k",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="5" y="10" width="14" height="10" rx="2" stroke="currentColor" stroke-width="1.6"/><path d="M8.5 10V7.5a3.5 3.5 0 1 1 7 0V10" stroke="currentColor" stroke-width="1.6"/><circle cx="12" cy="15" r="1.2" fill="currentColor"/></svg>'},{id:"toggleTranslationRealtime",label:"Toggle Translation Realtime",command:"toggleTranslationRealtime",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><path d="M4.5 12a7.5 7.5 0 1 1 7.5 7.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"/><path d="M9.5 19.5H5.5v-4" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/><path d="M12 8v4l2.5 2" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"/></svg>'}]}],commands:{translationWorkflow:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;return b(o,l),c.set(o,l),x=o,he(o),!0},openTranslationWorkflowPanel:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;return b(o,l),c.set(o,l),x=o,he(o),!0},toggleTranslationWorkflowPanel:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;return b(o,l),c.set(o,l),x=o,ze(o,typeof n=="boolean"?n:void 0)},runTranslationLocaleValidation:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;return b(o,l),c.set(o,l),x=o,L(o,"command",!0),!0},toggleTranslationRealtime:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;return b(o,l),c.set(o,l),x=o,De(o,typeof n=="boolean"?n:void 0)},toggleTranslationSegmentLock:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;b(o,l),c.set(o,l),x=o;const s=typeof n=="boolean"?n:n?.locked,i=typeof n=="object"?n?.segmentId:void 0;return se(o,i,s)},setTranslationLocales:(n,a)=>{const o=T(a,!1,!1);if(!o||!n||typeof n!="object")return!1;const l=c.get(o)||t,s=b(o,l);return c.set(o,l),typeof n.sourceLocale=="string"&&n.sourceLocale.trim()&&(s.sourceLocale=A(n.sourceLocale)),typeof n.targetLocale=="string"&&n.targetLocale.trim()&&(s.targetLocale=A(n.targetLocale)),s.snapshot="",L(o,"set-locales",!0),!0},captureTranslationSourceSnapshot:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;return b(o,l),c.set(o,l),x=o,Be(o)},setTranslationWorkflowOptions:(n,a)=>{const o=T(a,!1,!1);if(!o||!n||typeof n!="object")return!1;const l=c.get(o)||t,s=re.get(o)||Ge(l),i={...s,...n,labels:{...s.labels||{},...n.labels||{}},localeRules:Array.isArray(n.localeRules)?n.localeRules:s.localeRules,locales:Array.isArray(n.locales)?n.locales:s.locales,normalizeText:n.normalizeText||l.normalizeText},d=oe(i);c.set(o,d),re.set(o,i);const g=b(o,d);return typeof n.enableRealtime=="boolean"&&(g.realtimeEnabled=n.enableRealtime),typeof n.sourceLocale=="string"&&n.sourceLocale.trim()&&(g.sourceLocale=A(n.sourceLocale)),typeof n.targetLocale=="string"&&n.targetLocale.trim()&&(g.targetLocale=A(n.targetLocale)),g.snapshot="",L(o,"set-options",!0),R(o),E(o),!0},getTranslationWorkflowState:(n,a)=>{const o=T(a,!1,!1);if(!o)return!1;const l=c.get(o)||t;b(o,l);const s=Pe(o);if(typeof n=="function")try{n(s)}catch{}return o.__translationWorkflowState=s,o.dispatchEvent(new CustomEvent("editora:translation-workflow-state",{bubbles:!0,detail:s})),!0}},keymap:{"Mod-Alt-Shift-l":"toggleTranslationWorkflowPanel","Mod-Alt-Shift-L":"toggleTranslationWorkflowPanel","Mod-Alt-Shift-v":"runTranslationLocaleValidation","Mod-Alt-Shift-V":"runTranslationLocaleValidation","Mod-Alt-Shift-k":"toggleTranslationSegmentLock","Mod-Alt-Shift-K":"toggleTranslationSegmentLock"},init:function(a){X+=1;const o=this&&typeof this.__pluginConfig=="object"?{...e,...this.__pluginConfig}:e,l=oe(o);dt(l);const s=T(a?.editorElement?{editorElement:a.editorElement}:void 0,!1,!1);if(!s)return;x=s,r.add(s);const i=b(s,l);c.set(s,l),re.set(s,o),i.segments=M(s,l,i),L(s,"init",!0),E(s)},destroy:()=>{r.forEach(n=>Se(n)),r.clear(),X=Math.max(0,X-1),!(X>0)&&ft()}}};exports.TranslationWorkflowPlugin=mt;
|