@editora/plugins 1.0.10 → 1.0.12
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/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +80 -98
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +115 -128
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +40 -40
- package/dist/approval-workflow.esm.js +208 -249
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +55 -68
- package/dist/blockquote.esm.js +1 -2
- package/dist/blocks-library.cjs.js +45 -45
- package/dist/blocks-library.esm.js +178 -245
- package/dist/capitalization.esm.js +1 -2
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +58 -82
- package/dist/citations.cjs.js +37 -37
- package/dist/citations.esm.js +439 -512
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +27 -33
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +82 -93
- package/dist/code.cjs.js +119 -42
- package/dist/code.esm.js +2560 -760
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +116 -158
- package/dist/conditional-content.cjs.js +90 -90
- package/dist/conditional-content.esm.js +371 -432
- package/dist/content-rules.cjs.js +7 -7
- package/dist/content-rules.esm.js +105 -159
- package/dist/data-binding.cjs.js +46 -46
- package/dist/data-binding.esm.js +328 -368
- package/dist/direction.esm.js +9 -18
- package/dist/doc-schema.cjs.js +29 -29
- package/dist/doc-schema.esm.js +240 -308
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +4 -5
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/{editorContainerHelpers-69585c07.mjs → editorContainerHelpers-C7kdWnS0.mjs} +1 -2
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +73 -81
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +65 -77
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +54 -56
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +39 -47
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +37 -53
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +76 -117
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +70 -92
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/{html2canvas.esm-1a1724a1.mjs → html2canvas.esm-BWVIUcAF.mjs} +141 -225
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +12 -24
- package/dist/{index-f04538f2.mjs → index-BFsKNTTj.mjs} +70 -71
- package/dist/index-CvJk4DKa.js +221 -0
- package/dist/index-D3CycEFU.mjs +16543 -0
- package/dist/index-tqLTHcO6.js +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-CE_A4QSm.js +5 -0
- package/dist/index.es-DQ78mYYo.mjs +6665 -0
- package/dist/index.esm.js +125 -128
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +8 -9
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/{jspdf.es.min-c36a4fd8.mjs → jspdf.es.min-DQCoX5yh.mjs} +3658 -4682
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +11 -24
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +24 -30
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +20 -25
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +59 -61
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +139 -146
- package/dist/media-manager.cjs.js +31 -31
- package/dist/media-manager.esm.js +285 -300
- package/dist/mentions.cjs.js +9 -9
- package/dist/mentions.esm.js +238 -286
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +177 -216
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +33 -49
- package/dist/pii-redaction.cjs.js +19 -19
- package/dist/pii-redaction.esm.js +393 -463
- package/dist/plugins.css +1 -0
- package/dist/preview.esm.js +5 -10
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +17 -20
- package/dist/{purify.es-35a15df8.mjs → purify.es-DHhaBdbu.mjs} +9 -19
- package/dist/{purify.es-a8d731c6.js → purify.es-T2a3nLiC.js} +1 -1
- package/dist/slash-commands.cjs.js +2 -2
- package/dist/slash-commands.esm.js +39 -75
- package/dist/smart-paste.cjs.js +27 -27
- package/dist/smart-paste.esm.js +280 -336
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +61 -69
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +97 -123
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +14 -19
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +191 -225
- package/dist/template.cjs.js +21 -20
- package/dist/template.esm.js +715 -196
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +21 -27
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +70 -87
- package/dist/track-changes.cjs.js +2 -2
- package/dist/track-changes.esm.js +100 -162
- package/dist/translation-workflow.cjs.js +74 -74
- package/dist/translation-workflow.esm.js +602 -678
- package/dist/version-diff.cjs.js +14 -14
- package/dist/version-diff.esm.js +128 -157
- package/package.json +1 -1
- package/dist/_commonjsHelpers-6763f629.js +0 -1
- package/dist/_commonjsHelpers-c5d32002.mjs +0 -30
- package/dist/anchoredPopover-33f1358d.mjs +0 -109
- package/dist/anchoredPopover-8151d535.js +0 -1
- package/dist/documentManager-25b6203c.mjs +0 -9122
- package/dist/documentManager-b69e7054.js +0 -17
- package/dist/html2canvas.esm-09133e29.js +0 -22
- package/dist/index-656d224b.js +0 -231
- package/dist/index-6a8c48bb.js +0 -1
- package/dist/index-d027b7e2.mjs +0 -16859
- package/dist/index.es-730f2d98.mjs +0 -5775
- package/dist/index.es-dd40173b.js +0 -18
- package/dist/jspdf.es.min-90db2c97.js +0 -243
- package/dist/style.css +0 -1
- /package/dist/{editorContainerHelpers-36b8ddf3.js → editorContainerHelpers-CFbfiOJI.js} +0 -0
|
@@ -1,20 +1,20 @@
|
|
|
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",d="rte-translation-workflow-panel",y="translation-workflow",v="translationWorkflow",k=':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."},u=new WeakMap,oe=new WeakMap,D=new WeakMap,p=new Map,Y=new WeakMap,se=new WeakMap,Z=new Set;let ee=0,_e=0,Ae=0,Fe=0,w=null,x=null,O=null,N=null,_=null,F=null,I=null,W=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 q(e,n,t){return Number.isFinite(e)?Math.max(n,Math.min(t,e)):n}function E(e){return(e||"").trim()||"en-US"}function j(e){return e.trim().toLowerCase()}function Ke(e){return e.replace(/"/g,""")}function Ve(e,n=120){return e.length<=n?e:`${e.slice(0,Math.max(0,n-1)).trimEnd()}…`}function Re(e){const n=e.match(/\{\{[^{}]+\}\}|%[A-Z0-9_]+%|\$\{[^{}]+\}/gi);return!n||n.length===0?[]:n.map(t=>t.trim()).filter(Boolean)}function je(e,n){const t=Re(e).sort(),r=Re(n).sort();if(t.length!==r.length)return!1;for(let a=0;a<t.length;a+=1)if(t[a]!==r[a])return!1;return!0}function Ue(e,n){const t=Array.isArray(n)&&n.length>0?n:Ee,r=[],a=new Set;return t.forEach(o=>{const l=j(o.locale||"");if(!l)return;const s=l;a.has(s)||(a.add(s),r.push({locale:s,label:(o.label||l).trim()||l,minLengthRatio:q(Number(o.minLengthRatio??.5),.1,3),maxLengthRatio:q(Number(o.maxLengthRatio??1.8),.2,4),requireDifferentFromSource:o.requireDifferentFromSource!==!1,preserveTokens:o.preserveTokens!==!1}))}),e.forEach(o=>{const l=j(o);if(a.has(l))return;const s=Ee.find(i=>l.startsWith(i.locale));r.push(s?{...s,locale:l,label:o}:{locale:l,label:o,minLengthRatio:.5,maxLengthRatio:1.8,requireDifferentFromSource:!0,preserveTokens:!0})}),r}function ae(e={}){const n=e.normalizeText||We,t=E(e.sourceLocale||"en-US"),r=E(e.targetLocale||"fr-FR"),a=new Set([t,r]);(Array.isArray(e.locales)?e.locales:[]).forEach(s=>{if(typeof s!="string")return;const i=E(s);i&&a.add(i)});const o=Array.from(a),l=Ue(o,e.localeRules);return{sourceLocale:t,targetLocale:r,locales:o,localeRules:l,enableRealtime:e.enableRealtime!==!1,debounceMs:q(Number(e.debounceMs??260),60,2e3),maxIssues:q(Number(e.maxIssues??120),5,1e3),maxSegments:q(Number(e.maxSegments??600),20,3e3),minSourceLengthForRatio:q(Number(e.minSourceLengthForRatio??8),2,100),segmentSelector:(e.segmentSelector||$e).trim()||$e,labels:{...Ne,...e.labels||{}},normalizeText:n}}function Ge(e){return{sourceLocale:e.sourceLocale,targetLocale:e.targetLocale,locales:[...e.locales],localeRules:e.localeRules.map(n=>({locale:n.locale,label:n.label,minLengthRatio:n.minLengthRatio,maxLengthRatio:n.maxLengthRatio,requireDifferentFromSource:n.requireDifferentFromSource,preserveTokens:n.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 we(e){return e.closest(ke)||e}function U(e){if(!e)return null;if(e.matches(S))return e;const n=e.querySelector(S);return n instanceof HTMLElement?n:null}function Ye(){if(typeof window>"u")return null;const e=window[Te];if(!(e instanceof HTMLElement))return null;window[Te]=null;const n=U(e);if(n)return n;const t=e.closest(ke);if(t){const a=U(t);if(a)return a}const r=e.closest(S);return r instanceof HTMLElement?r:null}function Ze(e){const n=e.closest("[data-editora-editor]");if(n&&U(n)===e)return n;let t=e;for(;t;){if(t.matches(ke)&&(t===e||U(t)===e))return t;t=t.parentElement}return we(e)}function Ce(e){return e?e.nodeType===Node.ELEMENT_NODE?e:e.parentElement:null}function te(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 n=we(e);if(te(n))return!0;const t=n.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return te(t)?!0:te(document.documentElement)||te(document.body)}function ge(e,n){e.classList.remove("rte-translation-workflow-theme-dark"),Je(n)&&e.classList.add("rte-translation-workflow-theme-dark")}function Qe(e){var n,t,r,a;for(let o=0;o<e.length;o+=1){const l=e[o];if(!(l.type!=="childList"||l.removedNodes.length===0))for(let s=0;s<l.removedNodes.length;s+=1){const i=l.removedNodes[s];if(i.nodeType!==Node.ELEMENT_NODE)continue;const c=i;if((n=c.matches)!=null&&n.call(c,S)||(t=c.matches)!=null&&t.call(c,`.${d}`)||(r=c.querySelector)!=null&&r.call(c,S)||(a=c.querySelector)!=null&&a.call(c,`.${d}`))return!0}}return!1}function le(){Array.from(Z).forEach(n=>{n.isConnected||Se(n)})}function T(e,n=!0,t=!0){var s;if(le(),(e==null?void 0:e.contentElement)instanceof HTMLElement)return e.contentElement;if((e==null?void 0:e.editorElement)instanceof HTMLElement){const i=U(e.editorElement);if(i)return i}const r=Ye();if(r)return r;const a=window.getSelection();if(a&&a.rangeCount>0){const i=(s=Ce(a.getRangeAt(0).startContainer))==null?void 0:s.closest(S);if(i)return i}const o=document.activeElement;if(o){if(o.matches(S))return o;const i=o.closest(S);if(i)return i}if(t&&x&&x.isConnected)return x;if(!n)return null;const l=document.querySelector(S);return l instanceof HTMLElement?l:null}function Xe(e){const n=e.target;if(n){const r=n.closest(`.${d}`);if(r){const o=Array.from(p.entries()).find(([,l])=>l===r);if(o)return o[0]}const a=n.closest(S);if(a)return a}const t=document.activeElement;if(t){const r=t.closest(`.${d}`);if(r){const o=Array.from(p.entries()).find(([,l])=>l===r);if(o)return o[0]}const a=t.closest(S);if(a)return a}return null}function fe(e,n,t){const r=Ze(e);Array.from(r.querySelectorAll(`.rte-toolbar-button[data-command="${n}"], .editora-toolbar-button[data-command="${n}"]`)).forEach(o=>{o.classList.toggle("active",t),o.setAttribute("data-active",t?"true":"false"),o.setAttribute("aria-pressed",t?"true":"false")})}function xe(e){const n=se.get(e);typeof n=="number"&&(window.clearTimeout(n),se.delete(e))}function et(e,n){const t=j(n),r=e.localeRules.find(l=>j(l.locale)===t);if(r)return r;const a=t.split("-")[0],o=e.localeRules.find(l=>j(l.locale).split("-")[0]===a);return o||{locale:t,label:n,minLengthRatio:.5,maxLengthRatio:1.8,requireDifferentFromSource:!0,preserveTokens:!0}}function ne(e,n,t,r={}){return Ae+=1,{id:`translation-workflow-issue-${Ae}`,type:e,severity:n,message:t,...r}}function ce(e,n){if(n){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 t=e.getAttribute("data-translation-prev-contenteditable")||"";t==="inherit"?e.setAttribute("contenteditable","true"):e.setAttribute("contenteditable",t),e.removeAttribute("data-translation-prev-contenteditable")}else e.setAttribute("contenteditable","true")}function ue(e,n){return e.querySelector(`[data-translation-segment-id="${Ke(n)}"]`)}function He(e){const n=window.getSelection();if(!n||n.rangeCount===0)return null;const t=Ce(n.getRangeAt(0).startContainer);return!t||!e.contains(t)?null:t.closest("[data-translation-segment-id]")}function tt(e,n){const t=Array.from(e.querySelectorAll(n));if(t.length<=1)return t;const r=new Set(t);return t.filter(a=>{let o=a.parentElement;for(;o&&o!==e;){if(r.has(o))return!1;o=o.parentElement}return!0})}function nt(e,n,t){let r=(t||"").trim();if(!r||n.has(r)){do r=`translation-segment-${_e++}`;while(n.has(r));e.setAttribute("data-translation-segment-id",r)}return r}function me(e,n){if(n.lockedSegmentIds.size===0)return!1;let t=!1;return n.lockedSegmentIds.forEach(r=>{const a=ue(e,r);if(!a)return;ce(a,!0);const o=n.lockedHtmlBySegmentId.get(r);if(typeof o=="string"){a.innerHTML!==o&&(a.innerHTML=o,t=!0);return}n.lockedHtmlBySegmentId.set(r,a.innerHTML)}),t}function M(e,n,t){var l;const r=tt(e,n.segmentSelector),a=[],o=new Set;for(let s=0;s<r.length&&!(a.length>=n.maxSegments);s+=1){const i=r[s],c=nt(i,o,i.getAttribute("data-translation-segment-id")),g=t.lockedSegmentIds.has(c),h=i.getAttribute("data-translation-locked")==="true",R=g||h;if(R)if(t.lockedSegmentIds.add(c),ce(i,!0),!t.lockedHtmlBySegmentId.has(c))t.lockedHtmlBySegmentId.set(c,i.innerHTML);else{const H=t.lockedHtmlBySegmentId.get(c)||"";i.innerHTML!==H&&(i.innerHTML=H)}else t.lockedHtmlBySegmentId.delete(c);const C=n.normalizeText(i.textContent||"");if(!C)continue;t.sourceTextBySegmentId.has(c)||t.sourceTextBySegmentId.set(c,C);const K=t.sourceTextBySegmentId.get(c)||C;a.push({id:c,tagName:i.tagName.toLowerCase(),index:a.length,text:C,sourceText:K,locked:R}),o.add(c)}return Array.from(t.sourceTextBySegmentId.keys()).forEach(s=>{o.has(s)||t.sourceTextBySegmentId.delete(s)}),Array.from(t.lockedSegmentIds.keys()).forEach(s=>{o.has(s)||t.lockedSegmentIds.delete(s)}),Array.from(t.lockedHtmlBySegmentId.keys()).forEach(s=>{(!o.has(s)||!t.lockedSegmentIds.has(s))&&t.lockedHtmlBySegmentId.delete(s)}),(!t.selectedSegmentId||!a.some(s=>s.id===t.selectedSegmentId))&&(t.selectedSegmentId=((l=a[0])==null?void 0:l.id)||null),a}function b(e,n){u.has(e)||u.set(e,n);let t=D.get(e);return t||(t={sourceLocale:n.sourceLocale,targetLocale:n.targetLocale,selectedSegmentId:null,realtimeEnabled:n.enableRealtime,segments:[],issues:[],sourceTextBySegmentId:new Map,lockedSegmentIds:new Set,lockedHtmlBySegmentId:new Map,snapshot:"",lastRunAt:null},D.set(e,t)),Z.add(e),t}function Se(e){xe(e);const n=p.get(e);n&&n.remove(),p.delete(e),Y.delete(e);const t=D.get(e);t&&(t.lockedSegmentIds.forEach(r=>{const a=ue(e,r);a&&ce(a,!1)}),t.lockedHtmlBySegmentId.clear()),u.delete(e),oe.delete(e),D.delete(e),Z.delete(e),x===e&&(x=null)}function ye(e){return Y.get(e)===!0}function be(e,n){if(!n.classList.contains("show"))return;const t=we(e).getBoundingClientRect(),r=Math.min(window.innerWidth-20,520),a=Math.max(10,window.innerWidth-r-10),o=Math.min(Math.max(10,t.right-r),a),l=Math.max(10,Math.min(window.innerHeight-10,t.top+12));n.style.width=`${r}px`,n.style.left=`${o}px`,n.style.top=`${l}px`,n.style.maxHeight=`${Math.max(260,window.innerHeight-20)}px`}function B(e,n){const t=e.querySelector(".rte-translation-live");t&&(t.textContent=n)}function rt(e,n){return`${e.innerHTML}::${n.sourceLocale}::${n.targetLocale}::${Array.from(n.lockedSegmentIds).sort().join("|")}`}function ot(e,n,t){const r=[],a=et(t,n.targetLocale);for(let o=0;o<e.length&&!(r.length>=t.maxIssues);o+=1){const l=e[o],s=t.normalizeText(l.sourceText||""),i=t.normalizeText(l.text||"");if(!i){r.push(ne("missing-target","error",t.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)&&(r.push(ne("token-mismatch","error",t.labels.tokenMismatchMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:"Preserve placeholders/tokens exactly (for example {{name}}, %ID%, ${value})."})),r.length>=t.maxIssues)||a.requireDifferentFromSource&&s&&t.normalizeText(s)===t.normalizeText(i)&&(r.push(ne("untranslated","warning",t.labels.untranslatedMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:"Translate the segment or mark it intentionally unchanged."})),r.length>=t.maxIssues))break;if(s.length>=t.minSourceLengthForRatio){const c=i.length/Math.max(1,s.length);(c<a.minLengthRatio||c>a.maxLengthRatio)&&r.push(ne("length-out-of-range","warning",t.labels.lengthOutOfRangeMessage,{segmentId:l.id,sourceText:s,targetText:i,suggestion:`Expected ratio for ${a.label}: ${a.minLengthRatio.toFixed(2)} - ${a.maxLengthRatio.toFixed(2)}.`}))}}return r}function Pe(e){const n=u.get(e)||w,t=D.get(e);return{sourceLocale:(t==null?void 0:t.sourceLocale)||(n==null?void 0:n.sourceLocale)||"en-US",targetLocale:(t==null?void 0:t.targetLocale)||(n==null?void 0:n.targetLocale)||"fr-FR",realtimeEnabled:(t==null?void 0:t.realtimeEnabled)===!0,selectedSegmentId:(t==null?void 0:t.selectedSegmentId)||null,segmentCount:(t==null?void 0:t.segments.length)||0,lockedSegmentCount:t?t.segments.filter(r=>r.locked).length:0,issues:t!=null&&t.issues?t.issues.map(r=>({...r})):[],segments:(t==null?void 0:t.segments.map(r=>({id:r.id,tagName:r.tagName,index:r.index,sourceLength:r.sourceText.length,targetLength:r.text.length,locked:r.locked})))||[],lastRunAt:(t==null?void 0:t.lastRunAt)||null}}function $(e){const n=D.get(e),t=n&&n.selectedSegmentId?n.segments.find(r=>r.id===n.selectedSegmentId):null;fe(e,"toggleTranslationWorkflowPanel",ye(e)),fe(e,"toggleTranslationRealtime",(n==null?void 0:n.realtimeEnabled)===!0),fe(e,"toggleTranslationSegmentLock",(t==null?void 0:t.locked)===!0)}function at(e,n){const t=ue(e,n);if(!t)return;try{t.scrollIntoView({block:"nearest",inline:"nearest"})}catch{}const r=window.getSelection();if(!(!r||typeof document.createRange!="function"))try{const a=document.createRange();a.selectNodeContents(t),a.collapse(!0),r.removeAllRanges(),r.addRange(a),e.focus({preventScroll:!0})}catch{}}function A(e){const n=p.get(e);if(!n)return;const t=u.get(e)||w;if(!t)return;const r=b(e,t),a=n.querySelector(".rte-translation-source-label");a&&(a.textContent=t.labels.sourceLocaleLabel);const o=n.querySelector(".rte-translation-target-label");o&&(o.textContent=t.labels.targetLocaleLabel);const l=n.querySelector('[data-field="source-locale"]'),s=n.querySelector('[data-field="target-locale"]'),i=t.locales.map(f=>`<option value="${m(f)}">${m(f)}</option>`).join("");l&&(l.innerHTML=i,l.value=r.sourceLocale),s&&(s.innerHTML=i,s.value=r.targetLocale);const c=n.querySelector(".rte-translation-summary");if(c){const f=r.issues.length,z=r.selectedSegmentId?` • ${t.labels.selectedSegmentPrefix}: ${r.selectedSegmentId}`:"";c.textContent=`${t.labels.summaryPrefix}: ${r.sourceLocale} → ${r.targetLocale} • ${f} issue${f===1?"":"s"}${z}`}const g=n.querySelector(".rte-translation-helper");g&&(g.textContent=t.labels.helperText);const h=n.querySelector(".rte-translation-shortcut");h&&(h.textContent=t.labels.shortcutText);const R=n.querySelector('[data-action="run-validation"]');R&&(R.textContent=t.labels.validateText);const C=n.querySelector('[data-action="capture-source"]');C&&(C.textContent=t.labels.captureSourceText);const K=n.querySelector('[data-action="toggle-realtime"]');K&&(K.textContent=r.realtimeEnabled?t.labels.realtimeOnText:t.labels.realtimeOffText,K.setAttribute("aria-pressed",r.realtimeEnabled?"true":"false"));const H=n.querySelector('[data-action="lock-selected"]'),P=r.selectedSegmentId&&r.segments.find(f=>f.id===r.selectedSegmentId)||null;H&&(H.textContent=P!=null&&P.locked?t.labels.unlockSelectedText:t.labels.lockSelectedText,H.disabled=!P,H.setAttribute("aria-pressed",P!=null&&P.locked?"true":"false"));const Le=n.querySelector('[data-action="close"]');Le&&Le.setAttribute("aria-label",t.labels.closeText);const J=n.querySelector(".rte-translation-issues"),V=n.querySelector(".rte-translation-empty");J&&(J.setAttribute("aria-label",t.labels.issuesLabel),r.issues.length===0?(J.innerHTML="",V&&(V.hidden=!1,V.textContent=t.labels.noIssuesText)):(V&&(V.hidden=!0),J.innerHTML=r.issues.map(f=>`
|
|
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
2
|
<li class="rte-translation-issue ${f.severity==="error"?"error":f.severity==="warning"?"warning":"info"}" role="listitem" data-segment-id="${m(f.segmentId||"")}">
|
|
3
3
|
<p class="rte-translation-issue-message">${m(f.message)}</p>
|
|
4
4
|
${f.suggestion?`<p class="rte-translation-issue-suggestion">${m(f.suggestion)}</p>`:""}
|
|
5
5
|
</li>
|
|
6
|
-
`).join("")));const de=
|
|
7
|
-
<li class="rte-translation-segment-item ${
|
|
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
8
|
<button type="button" class="rte-translation-segment-select" data-action="select-segment" data-segment-id="${m(f.id)}" title="${m(f.text)}">
|
|
9
9
|
<span class="rte-translation-segment-meta">#${f.index+1} • ${m(f.tagName)}</span>
|
|
10
10
|
<span class="rte-translation-segment-text">${m(Ve(f.text,110))}</span>
|
|
11
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?
|
|
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
13
|
</li>
|
|
14
|
-
`}).join(""));const
|
|
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
15
|
<header class="rte-translation-header">
|
|
16
|
-
<h2 class="rte-translation-title">${m(
|
|
17
|
-
<button type="button" class="rte-translation-icon-btn" data-action="close" aria-label="${m(
|
|
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
18
|
</header>
|
|
19
19
|
<div class="rte-translation-body">
|
|
20
20
|
<div class="rte-translation-locales">
|
|
@@ -37,34 +37,34 @@
|
|
|
37
37
|
<p class="rte-translation-helper"></p>
|
|
38
38
|
<p class="rte-translation-shortcut"></p>
|
|
39
39
|
<div class="rte-translation-grid">
|
|
40
|
-
<section class="rte-translation-segments-wrap" aria-label="${m(
|
|
41
|
-
<h3 class="rte-translation-subtitle">${m(
|
|
42
|
-
<ul class="rte-translation-segments" role="listbox" tabindex="0" aria-label="${m(
|
|
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
43
|
</section>
|
|
44
44
|
<section class="rte-translation-preview-wrap">
|
|
45
|
-
<h3 class="rte-translation-subtitle">${m(
|
|
45
|
+
<h3 class="rte-translation-subtitle">${m(r.labels.sourcePreviewLabel)} / ${m(r.labels.targetPreviewLabel)}</h3>
|
|
46
46
|
<div class="rte-translation-preview-block">
|
|
47
|
-
<p class="rte-translation-preview-label">${m(
|
|
47
|
+
<p class="rte-translation-preview-label">${m(r.labels.sourcePreviewLabel)}</p>
|
|
48
48
|
<p class="rte-translation-source-preview"></p>
|
|
49
49
|
</div>
|
|
50
50
|
<div class="rte-translation-preview-block">
|
|
51
|
-
<p class="rte-translation-preview-label">${m(
|
|
51
|
+
<p class="rte-translation-preview-label">${m(r.labels.targetPreviewLabel)}</p>
|
|
52
52
|
<p class="rte-translation-target-preview"></p>
|
|
53
53
|
</div>
|
|
54
54
|
</section>
|
|
55
55
|
</div>
|
|
56
56
|
<section class="rte-translation-issues-wrap">
|
|
57
|
-
<h3 class="rte-translation-subtitle">${m(
|
|
58
|
-
<ul class="rte-translation-issues" role="list" aria-label="${m(
|
|
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
59
|
<p class="rte-translation-empty" hidden></p>
|
|
60
60
|
</section>
|
|
61
61
|
</div>
|
|
62
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
|
|
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
64
|
.rte-toolbar-group-items.${y},
|
|
65
65
|
.editora-toolbar-group-items.${y},
|
|
66
|
-
.rte-toolbar-group-items.${
|
|
67
|
-
.editora-toolbar-group-items.${
|
|
66
|
+
.rte-toolbar-group-items.${$},
|
|
67
|
+
.editora-toolbar-group-items.${$} {
|
|
68
68
|
display: flex;
|
|
69
69
|
border: 1px solid #cbd5e1;
|
|
70
70
|
border-radius: 4px;
|
|
@@ -73,8 +73,8 @@
|
|
|
73
73
|
|
|
74
74
|
.rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
75
75
|
.editora-toolbar-group-items.${y} .editora-toolbar-button,
|
|
76
|
-
.rte-toolbar-group-items.${
|
|
77
|
-
.editora-toolbar-group-items.${
|
|
76
|
+
.rte-toolbar-group-items.${$} .rte-toolbar-button,
|
|
77
|
+
.editora-toolbar-group-items.${$} .editora-toolbar-button {
|
|
78
78
|
border: none;
|
|
79
79
|
border-right: 1px solid #cbd5e1;
|
|
80
80
|
border-radius: 0;
|
|
@@ -82,15 +82,15 @@
|
|
|
82
82
|
|
|
83
83
|
.rte-toolbar-group-items.${y} .rte-toolbar-item:last-child .rte-toolbar-button,
|
|
84
84
|
.editora-toolbar-group-items.${y} .editora-toolbar-item:last-child .editora-toolbar-button,
|
|
85
|
-
.rte-toolbar-group-items.${
|
|
86
|
-
.editora-toolbar-group-items.${
|
|
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
87
|
border-right: none;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
${
|
|
91
|
-
${
|
|
92
|
-
${
|
|
93
|
-
${
|
|
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
94
|
border-color: #566275;
|
|
95
95
|
}
|
|
96
96
|
.rte-toolbar-button[data-command="toggleTranslationWorkflowPanel"].active,
|
|
@@ -101,29 +101,29 @@
|
|
|
101
101
|
.editora-toolbar-button[data-command="toggleTranslationRealtime"].active {
|
|
102
102
|
background: #ccc;
|
|
103
103
|
}
|
|
104
|
-
${
|
|
105
|
-
${
|
|
106
|
-
${
|
|
107
|
-
${
|
|
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
108
|
{
|
|
109
109
|
fill: none;
|
|
110
110
|
}
|
|
111
|
-
${
|
|
112
|
-
${
|
|
111
|
+
${h} .rte-toolbar-group-items.${y} .rte-toolbar-button,
|
|
112
|
+
${h} .editora-toolbar-group-items.${y} .editora-toolbar-button
|
|
113
113
|
{
|
|
114
114
|
border-color: #566275;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
${
|
|
118
|
-
${
|
|
119
|
-
${
|
|
120
|
-
${
|
|
121
|
-
${
|
|
122
|
-
${
|
|
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
123
|
background: linear-gradient(180deg, #5eaaf6 0%, #4a95de 100%);
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
.${
|
|
126
|
+
.${u} {
|
|
127
127
|
position: fixed;
|
|
128
128
|
z-index: 12000;
|
|
129
129
|
display: none;
|
|
@@ -137,12 +137,12 @@
|
|
|
137
137
|
overflow: hidden;
|
|
138
138
|
}
|
|
139
139
|
|
|
140
|
-
.${
|
|
140
|
+
.${u}.show {
|
|
141
141
|
display: flex;
|
|
142
142
|
flex-direction: column;
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
.${
|
|
145
|
+
.${u}.rte-translation-workflow-theme-dark {
|
|
146
146
|
border-color: #334155;
|
|
147
147
|
background: #0f172a;
|
|
148
148
|
color: #e2e8f0;
|
|
@@ -159,7 +159,7 @@
|
|
|
159
159
|
background: linear-gradient(180deg, #eff6ff 0%, #e2e8f0 100%);
|
|
160
160
|
}
|
|
161
161
|
|
|
162
|
-
.${
|
|
162
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-header {
|
|
163
163
|
border-color: #1e293b;
|
|
164
164
|
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
|
|
165
165
|
}
|
|
@@ -195,14 +195,14 @@
|
|
|
195
195
|
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
.${
|
|
198
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-icon-btn {
|
|
199
199
|
border-color: #475569;
|
|
200
200
|
background: #0f172a;
|
|
201
201
|
color: #e2e8f0;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
.${
|
|
205
|
-
.${
|
|
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
206
|
border-color: #60a5fa;
|
|
207
207
|
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
208
208
|
}
|
|
@@ -233,8 +233,8 @@
|
|
|
233
233
|
color: #334155;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
.${
|
|
237
|
-
.${
|
|
236
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-source-label,
|
|
237
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-target-label {
|
|
238
238
|
color: #cbd5e1;
|
|
239
239
|
}
|
|
240
240
|
|
|
@@ -254,7 +254,7 @@
|
|
|
254
254
|
outline: none;
|
|
255
255
|
}
|
|
256
256
|
|
|
257
|
-
.${
|
|
257
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-select {
|
|
258
258
|
border-color: #334155;
|
|
259
259
|
background: #0b1220;
|
|
260
260
|
color: #e2e8f0;
|
|
@@ -269,9 +269,9 @@
|
|
|
269
269
|
color: #475569;
|
|
270
270
|
}
|
|
271
271
|
|
|
272
|
-
.${
|
|
273
|
-
.${
|
|
274
|
-
.${
|
|
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
275
|
color: #94a3b8;
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -316,13 +316,13 @@
|
|
|
316
316
|
background: #155e75;
|
|
317
317
|
}
|
|
318
318
|
|
|
319
|
-
.${
|
|
319
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-btn {
|
|
320
320
|
border-color: #334155;
|
|
321
321
|
background: #111827;
|
|
322
322
|
color: #e2e8f0;
|
|
323
323
|
}
|
|
324
324
|
|
|
325
|
-
.${
|
|
325
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-btn-primary {
|
|
326
326
|
border-color: #22d3ee;
|
|
327
327
|
background: #0e7490;
|
|
328
328
|
color: #ecfeff;
|
|
@@ -344,9 +344,9 @@
|
|
|
344
344
|
min-height: 120px;
|
|
345
345
|
}
|
|
346
346
|
|
|
347
|
-
.${
|
|
348
|
-
.${
|
|
349
|
-
.${
|
|
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
350
|
border-color: #334155;
|
|
351
351
|
background: #0b1220;
|
|
352
352
|
}
|
|
@@ -358,7 +358,7 @@
|
|
|
358
358
|
color: #334155;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
-
.${
|
|
361
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-subtitle {
|
|
362
362
|
color: #cbd5e1;
|
|
363
363
|
}
|
|
364
364
|
|
|
@@ -393,12 +393,12 @@
|
|
|
393
393
|
background: #fffbeb;
|
|
394
394
|
}
|
|
395
395
|
|
|
396
|
-
.${
|
|
396
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item {
|
|
397
397
|
border-color: #334155;
|
|
398
398
|
background: #111827;
|
|
399
399
|
}
|
|
400
400
|
|
|
401
|
-
.${
|
|
401
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-item.locked {
|
|
402
402
|
border-color: rgba(245, 158, 11, 0.72);
|
|
403
403
|
background: rgba(120, 53, 15, 0.28);
|
|
404
404
|
}
|
|
@@ -426,11 +426,11 @@
|
|
|
426
426
|
line-height: 1.3;
|
|
427
427
|
}
|
|
428
428
|
|
|
429
|
-
.${
|
|
429
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-meta {
|
|
430
430
|
color: #94a3b8;
|
|
431
431
|
}
|
|
432
432
|
|
|
433
|
-
.${
|
|
433
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-text {
|
|
434
434
|
color: #e2e8f0;
|
|
435
435
|
}
|
|
436
436
|
|
|
@@ -460,7 +460,7 @@
|
|
|
460
460
|
opacity: 1;
|
|
461
461
|
}
|
|
462
462
|
|
|
463
|
-
.${
|
|
463
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-segment-lock {
|
|
464
464
|
border-color: #334155;
|
|
465
465
|
background: #111827;
|
|
466
466
|
}
|
|
@@ -492,12 +492,12 @@
|
|
|
492
492
|
color: #1f2937;
|
|
493
493
|
}
|
|
494
494
|
|
|
495
|
-
.${
|
|
495
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-preview-label {
|
|
496
496
|
color: #94a3b8;
|
|
497
497
|
}
|
|
498
498
|
|
|
499
|
-
.${
|
|
500
|
-
.${
|
|
499
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-source-preview,
|
|
500
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-target-preview {
|
|
501
501
|
border-color: #334155;
|
|
502
502
|
background: #111827;
|
|
503
503
|
color: #e2e8f0;
|
|
@@ -538,23 +538,23 @@
|
|
|
538
538
|
background: #f0f9ff;
|
|
539
539
|
}
|
|
540
540
|
|
|
541
|
-
.${
|
|
541
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue {
|
|
542
542
|
border-color: #334155;
|
|
543
543
|
background: #111827;
|
|
544
544
|
color: #e2e8f0;
|
|
545
545
|
}
|
|
546
546
|
|
|
547
|
-
.${
|
|
547
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.error {
|
|
548
548
|
border-color: rgba(239, 68, 68, 0.7);
|
|
549
549
|
background: rgba(127, 29, 29, 0.28);
|
|
550
550
|
}
|
|
551
551
|
|
|
552
|
-
.${
|
|
552
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.warning {
|
|
553
553
|
border-color: rgba(245, 158, 11, 0.72);
|
|
554
554
|
background: rgba(120, 53, 15, 0.28);
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
.${
|
|
557
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue.info {
|
|
558
558
|
border-color: rgba(14, 165, 233, 0.7);
|
|
559
559
|
background: rgba(7, 89, 133, 0.28);
|
|
560
560
|
}
|
|
@@ -571,11 +571,11 @@
|
|
|
571
571
|
color: #475569;
|
|
572
572
|
}
|
|
573
573
|
|
|
574
|
-
.${
|
|
574
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue-message {
|
|
575
575
|
color: #e2e8f0;
|
|
576
576
|
}
|
|
577
577
|
|
|
578
|
-
.${
|
|
578
|
+
.${u}.rte-translation-workflow-theme-dark .rte-translation-issue-suggestion {
|
|
579
579
|
color: #cbd5e1;
|
|
580
580
|
}
|
|
581
581
|
|
|
@@ -603,13 +603,13 @@
|
|
|
603
603
|
border-radius: 4px;
|
|
604
604
|
}
|
|
605
605
|
|
|
606
|
-
${
|
|
606
|
+
${h} [data-translation-locked="true"].rte-translation-segment-locked {
|
|
607
607
|
outline-color: rgba(245, 158, 11, 0.75);
|
|
608
608
|
background: rgba(120, 53, 15, 0.22);
|
|
609
609
|
}
|
|
610
610
|
|
|
611
611
|
@media (max-width: 920px) {
|
|
612
|
-
.${
|
|
612
|
+
.${u} {
|
|
613
613
|
left: 10px !important;
|
|
614
614
|
right: 10px;
|
|
615
615
|
top: 10px !important;
|
|
@@ -623,4 +623,4 @@
|
|
|
623
623
|
grid-template-columns: 1fr;
|
|
624
624
|
}
|
|
625
625
|
}
|
|
626
|
-
`,document.head.appendChild(e)}const mt=(e={})=>{const
|
|
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;
|