@editora/plugins 1.0.7 → 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 +72 -4
- package/dist/_commonjsHelpers-BH3jXuIh.js +1 -0
- package/dist/_commonjsHelpers-ByX85dGu.mjs +33 -0
- package/dist/anchor.cjs.js +11 -11
- package/dist/anchor.esm.js +130 -107
- package/dist/anchoredPopover-BzqGPOAE.js +1 -0
- package/dist/anchoredPopover-Dts0IrgU.mjs +106 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1070 -0
- package/dist/background-color.cjs.js +3 -3
- package/dist/background-color.esm.js +116 -119
- 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/code.cjs.js +82 -102
- package/dist/code.esm.js +1172 -662
- package/dist/comments.cjs.js +10 -10
- package/dist/comments.esm.js +195 -177
- 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/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/documentManager-CTqRftU8.mjs +8369 -0
- package/dist/documentManager-Jf0RbSks.js +17 -0
- package/dist/embed-iframe.cjs.js +2 -2
- package/dist/embed-iframe.esm.js +8 -5
- package/dist/emojis.cjs.js +64 -39
- package/dist/emojis.esm.js +133 -104
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +56 -0
- package/dist/html2canvas.esm-B5qzocYs.js +5 -0
- package/dist/html2canvas.esm-BWVIUcAF.mjs +4802 -0
- package/dist/{index-Bskk414V.mjs → index-BFsKNTTj.mjs} +50 -50
- 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-Cz1qItab.js → index.es-CE_A4QSm.js} +5 -5
- package/dist/{index.es-DEcRmSTY.mjs → index.es-DQ78mYYo.mjs} +4 -3
- package/dist/index.esm.js +111 -75
- package/dist/jspdf.es.min-BoS80556.js +77 -0
- package/dist/jspdf.es.min-DQCoX5yh.mjs +7889 -0
- package/dist/link.cjs.js +6 -6
- package/dist/link.esm.js +41 -39
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +151 -112
- package/dist/media-manager.cjs.js +15 -15
- package/dist/media-manager.esm.js +227 -206
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +726 -0
- package/dist/merge-tag.cjs.js +44 -12
- package/dist/merge-tag.esm.js +368 -241
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +85 -77
- 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/special-characters.cjs.js +83 -45
- package/dist/special-characters.esm.js +149 -100
- package/dist/spell-check.cjs.js +9 -9
- package/dist/spell-check.esm.js +235 -216
- package/dist/template.cjs.js +14 -14
- package/dist/template.esm.js +157 -131
- package/dist/text-color.cjs.js +9 -9
- package/dist/text-color.esm.js +131 -115
- 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 +849 -1
- package/package.json +105 -6
- package/dist/colorSelectionApply-C0iOfMWb.js +0 -1
- package/dist/colorSelectionApply-D8r_gV32.mjs +0 -63
- package/dist/documentManager-DRUc1-Cs.mjs +0 -37581
- package/dist/documentManager-_tQQfQi9.js +0 -317
- package/dist/index-D3pJyAsj.js +0 -1
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const $=".rte-content, .editora-content",d='[data-theme="dark"], .dark, .editora-theme-dark, .rte-theme-dark',l="rte-version-diff-overlay",U="rte-version-diff-styles",ae={title:"Version Diff",baseline:"Baseline",current:"Current",noChanges:"No changes detected between baseline and current content.",loading:"Preparing diff...",tabInline:"Inline Diff",tabSideBySide:"Side by Side",refresh:"Refresh",setBaseline:"Set Current as Baseline",close:"Close",mode:"Mode",ignoreWhitespace:"Ignore whitespace",largeDocFallback:"Large document fallback mode applied for performance."},w=new WeakMap,V=new WeakMap;let j=0,S=null,z=null,R=null,M=null,H=null,D=null;function u(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function le(e){return{...ae,...e||{}}}function N(e,i=!0){if(e?.contentElement instanceof HTMLElement)return e.contentElement;if(e?.editorElement instanceof HTMLElement){const t=e.editorElement;if(t.matches($))return t;const o=t.querySelector($);if(o instanceof HTMLElement)return o}const n=window.getSelection();if(n&&n.rangeCount>0){const t=n.getRangeAt(0).startContainer,f=(t.nodeType===Node.ELEMENT_NODE?t:t.parentElement)?.closest($);if(f)return f}const r=document.activeElement;if(r){if(r.matches($))return r;const t=r.closest($);if(t)return t}return D&&D.isConnected?D:i?document.querySelector($):null}function O(e){return e.closest("[data-editora-editor], .rte-editor, .editora-editor, editora-editor")||e}function K(e){if(!e)return!1;const i=e.getAttribute("data-theme")||e.getAttribute("theme");if(i&&i.toLowerCase()==="dark")return!0;const n=e.classList;return n.contains("dark")||n.contains("editora-theme-dark")||n.contains("rte-theme-dark")}function Y(e){const i=O(e);if(K(i))return!0;const n=i.closest("[data-theme], [theme], .dark, .editora-theme-dark, .rte-theme-dark");return!!(K(n)||K(document.documentElement)||K(document.body))}function fe(e){const i=document.createElement("textarea");return i.innerHTML=e,i.value}function W(e){const n=O(e).getAttribute("data-initial-content");return n?fe(n):e.innerHTML}function Z(e){return e.replace(/\r\n?/g,`
|
|
2
|
+
`)}function J(e){const i=document.createElement("div"),n=e.replace(/<br\s*\/?>/gi,`
|
|
3
|
+
`).replace(/<\/(p|div|h1|h2|h3|h4|h5|h6|li|tr|blockquote|pre|section|article)>/gi,`$&
|
|
4
|
+
`);i.innerHTML=n;const r=i.textContent||"";return Z(r).replace(/\u00a0/g," ").replace(/\n{3,}/g,`
|
|
5
|
+
|
|
6
|
+
`).trim()}function Q(e,i,n){let r=Z(e);if(n&&(r=r.replace(/[ \t]+/g," ").replace(/\n{3,}/g,`
|
|
7
|
+
|
|
8
|
+
`).trim()),!r)return[];if(i==="line")return r.split(`
|
|
9
|
+
`);if(n)return r.split(/\s+/).filter(Boolean);const t=[],o=r.split(`
|
|
10
|
+
`);return o.forEach((f,g)=>{const c=f.split(/[ \t]+/).filter(Boolean);t.push(...c),g<o.length-1&&t.push(`
|
|
11
|
+
`)}),t}function de(e,i,n){if(e.length===0)return"";if(i==="line")return e.join(`
|
|
12
|
+
`);if(n)return e.join(" ");let r="";for(let t=0;t<e.length;t+=1){const o=e[t];if(o===`
|
|
13
|
+
`){r=r.replace(/[ \t]+$/g,""),r+=`
|
|
14
|
+
`;continue}r.length>0&&!r.endsWith(`
|
|
15
|
+
`)&&(r+=" "),r+=o}return r}function ce(e,i,n){const r=[];return e.forEach(t=>{const o=r[r.length-1];if(o&&o.type===t.type){o.tokens.push(t.token);return}r.push({type:t.type,tokens:[t.token]})}),r.map(t=>({type:t.type,value:de(t.tokens,i,n),count:t.tokens.length}))}function ue(e,i){let n=0;for(;n<e.length&&n<i.length&&e[n]===i[n];)n+=1;let r=e.length-1,t=i.length-1;for(;r>=n&&t>=n&&e[r]===i[t];)r-=1,t-=1;const o=e.slice(0,n),f=r<e.length-1?e.slice(r+1):[],g=n<=r?e.slice(n,r+1):[],c=n<=t?i.slice(n,t+1):[];return{prefix:o,suffix:f,aMiddle:g,bMiddle:c}}function pe(e,i,n,r,t,o){if(e.length===0&&i.length===0)return{segments:[],insertedCount:0,deletedCount:0,equalCount:0,usedFallback:!1};const{prefix:f,suffix:g,aMiddle:c,bMiddle:b}=ue(e,i);let m=[];f.forEach(a=>m.push({type:"equal",token:a}));const F=c.length*b.length,T=c.length>o||b.length>o||F>t;if(T)c.forEach(a=>m.push({type:"delete",token:a})),b.forEach(a=>m.push({type:"insert",token:a}));else{const a=Array.from({length:c.length+1},()=>new Uint32Array(b.length+1));for(let y=c.length-1;y>=0;y-=1){const B=a[y],I=a[y+1];for(let k=b.length-1;k>=0;k-=1)B[k]=c[y]===b[k]?I[k+1]+1:Math.max(I[k],B[k+1])}let h=0,p=0;for(;h<c.length&&p<b.length;)c[h]===b[p]?(m.push({type:"equal",token:c[h]}),h+=1,p+=1):a[h+1][p]>=a[h][p+1]?(m.push({type:"delete",token:c[h]}),h+=1):(m.push({type:"insert",token:b[p]}),p+=1);for(;h<c.length;)m.push({type:"delete",token:c[h]}),h+=1;for(;p<b.length;)m.push({type:"insert",token:b[p]}),p+=1}g.forEach(a=>m.push({type:"equal",token:a}));const q=ce(m,n,r);let A=0,L=0,P=0;return q.forEach(a=>{a.type==="insert"&&(A+=a.count),a.type==="delete"&&(L+=a.count),a.type==="equal"&&(P+=a.count)}),{segments:q,insertedCount:A,deletedCount:L,equalCount:P,usedFallback:T}}function ee(e){return u(e.value).replace(/\n/g,`
|
|
16
|
+
`)}function be(e,i){return e.length===0?`<p class="rte-version-diff-empty">${u(i.noChanges)}</p>`:e.map(n=>`<span class="${n.type==="equal"?"rte-version-diff-equal":n.type==="insert"?"rte-version-diff-insert":"rte-version-diff-delete"}">${ee(n)}</span>`).join("")}function he(e,i){if(e.length===0){const t=`<p class="rte-version-diff-empty">${u(i.noChanges)}</p>`;return{baselineHtml:t,currentHtml:t}}const n=[],r=[];return e.forEach(t=>{const o=ee(t);if(t.type==="equal"){n.push(`<span class="rte-version-diff-equal">${o}</span>`),r.push(`<span class="rte-version-diff-equal">${o}</span>`);return}if(t.type==="delete"){n.push(`<span class="rte-version-diff-delete">${o}</span>`);return}r.push(`<span class="rte-version-diff-insert">${o}</span>`)}),{baselineHtml:n.join(""),currentHtml:r.join("")}}function ve(e){const i=e.metaKey||e.ctrlKey,r=(typeof e.key=="string"?e.key:"").toLowerCase(),t=typeof e.code=="string"?e.code.toLowerCase():"",o=i&&e.altKey&&!e.shiftKey&&(r==="d"||t==="keyd"),f=!e.metaKey&&!e.ctrlKey&&!e.altKey&&!e.shiftKey&&(r==="f8"||t==="f8");return o||f}function me(){if(typeof document>"u"||document.getElementById(U))return;const e=document.createElement("style");e.id=U,e.textContent=`
|
|
17
|
+
.${l} {
|
|
18
|
+
position: fixed;
|
|
19
|
+
inset: 0;
|
|
20
|
+
background: rgba(15, 23, 42, 0.55);
|
|
21
|
+
z-index: 2147483646;
|
|
22
|
+
display: flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
padding: 20px;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
.rte-version-diff-dialog {
|
|
29
|
+
width: min(980px, 96vw);
|
|
30
|
+
max-height: min(90vh, 860px);
|
|
31
|
+
background: #ffffff;
|
|
32
|
+
color: #0f172a;
|
|
33
|
+
border: 1px solid #d7dee8;
|
|
34
|
+
border-radius: 8px;
|
|
35
|
+
display: flex;
|
|
36
|
+
flex-direction: column;
|
|
37
|
+
box-shadow: 0 24px 48px rgba(15, 23, 42, 0.3);
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.rte-version-diff-header,
|
|
42
|
+
.rte-version-diff-footer {
|
|
43
|
+
padding: 12px 14px;
|
|
44
|
+
border-bottom: 1px solid #e2e8f0;
|
|
45
|
+
background: #f8fafc;
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
gap: 10px;
|
|
49
|
+
flex-wrap: wrap;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.rte-version-diff-footer {
|
|
53
|
+
border-top: 1px solid #e2e8f0;
|
|
54
|
+
border-bottom: none;
|
|
55
|
+
justify-content: space-between;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.rte-version-diff-title {
|
|
59
|
+
margin: 0;
|
|
60
|
+
font-size: 16px;
|
|
61
|
+
font-weight: 700;
|
|
62
|
+
flex: 1;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.rte-version-diff-controls {
|
|
66
|
+
display: flex;
|
|
67
|
+
align-items: center;
|
|
68
|
+
gap: 10px;
|
|
69
|
+
flex-wrap: wrap;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.rte-version-diff-select,
|
|
73
|
+
.rte-version-diff-btn {
|
|
74
|
+
border: 1px solid #cbd5e1;
|
|
75
|
+
background: #ffffff;
|
|
76
|
+
color: #0f172a;
|
|
77
|
+
border-radius: 6px;
|
|
78
|
+
min-height: 34px;
|
|
79
|
+
padding: 6px 10px;
|
|
80
|
+
font-size: 13px;
|
|
81
|
+
cursor: pointer;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.rte-version-diff-btn:hover,
|
|
85
|
+
.rte-version-diff-btn:focus-visible,
|
|
86
|
+
.rte-version-diff-select:focus-visible {
|
|
87
|
+
outline: none;
|
|
88
|
+
border-color: #3b82f6;
|
|
89
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.rte-version-diff-btn-primary {
|
|
93
|
+
background: #2563eb;
|
|
94
|
+
border-color: #2563eb;
|
|
95
|
+
color: #ffffff;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
.rte-version-diff-btn-primary:hover {
|
|
99
|
+
background: #1d4ed8;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.rte-version-diff-close-btn {
|
|
103
|
+
border: 1px solid #cbd5e1;
|
|
104
|
+
border-radius: 6px;
|
|
105
|
+
min-height: 34px;
|
|
106
|
+
min-width: 34px;
|
|
107
|
+
width: 34px;
|
|
108
|
+
height: 34px;
|
|
109
|
+
padding: 0;
|
|
110
|
+
display: inline-flex;
|
|
111
|
+
align-items: center;
|
|
112
|
+
justify-content: center;
|
|
113
|
+
background: #ffffff;
|
|
114
|
+
color: #0f172a;
|
|
115
|
+
font-size: 16px;
|
|
116
|
+
line-height: 1;
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.rte-version-diff-close-btn:hover,
|
|
121
|
+
.rte-version-diff-close-btn:focus-visible {
|
|
122
|
+
border-color: #3b82f6;
|
|
123
|
+
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
|
|
124
|
+
background: #ffffff;
|
|
125
|
+
outline: none;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
.rte-version-diff-tabs {
|
|
129
|
+
display: flex;
|
|
130
|
+
gap: 6px;
|
|
131
|
+
border-bottom: 1px solid #e2e8f0;
|
|
132
|
+
background: #f8fafc;
|
|
133
|
+
padding: 8px 14px;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
.rte-version-diff-tab {
|
|
137
|
+
border: 1px solid #cbd5e1;
|
|
138
|
+
background: #ffffff;
|
|
139
|
+
color: #0f172a;
|
|
140
|
+
border-radius: 6px;
|
|
141
|
+
min-height: 32px;
|
|
142
|
+
padding: 4px 10px;
|
|
143
|
+
font-size: 13px;
|
|
144
|
+
cursor: pointer;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
.rte-version-diff-tab[aria-selected="true"] {
|
|
148
|
+
background: #dbeafe;
|
|
149
|
+
border-color: #60a5fa;
|
|
150
|
+
color: #1e3a8a;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.rte-version-diff-body {
|
|
154
|
+
flex: 1;
|
|
155
|
+
overflow: auto;
|
|
156
|
+
padding: 10px 14px 14px;
|
|
157
|
+
background: #ffffff;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.rte-version-diff-summary {
|
|
161
|
+
font-size: 12px;
|
|
162
|
+
color: #475569;
|
|
163
|
+
margin-bottom: 10px;
|
|
164
|
+
display: flex;
|
|
165
|
+
gap: 14px;
|
|
166
|
+
flex-wrap: wrap;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.rte-version-diff-panel {
|
|
170
|
+
display: none;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
.rte-version-diff-panel.active {
|
|
174
|
+
display: block;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
.rte-version-diff-inline,
|
|
178
|
+
.rte-version-diff-side-pane {
|
|
179
|
+
border: 1px solid #dbe3ec;
|
|
180
|
+
border-radius: 6px;
|
|
181
|
+
padding: 10px;
|
|
182
|
+
min-height: 140px;
|
|
183
|
+
max-height: 50vh;
|
|
184
|
+
overflow: auto;
|
|
185
|
+
white-space: pre-wrap;
|
|
186
|
+
word-break: break-word;
|
|
187
|
+
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
|
|
188
|
+
font-size: 12px;
|
|
189
|
+
line-height: 1.5;
|
|
190
|
+
background: #ffffff;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
.rte-version-diff-side-grid {
|
|
194
|
+
display: grid;
|
|
195
|
+
grid-template-columns: 1fr 1fr;
|
|
196
|
+
gap: 10px;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.rte-version-diff-pane-title {
|
|
200
|
+
margin: 0 0 6px;
|
|
201
|
+
font-size: 12px;
|
|
202
|
+
font-weight: 700;
|
|
203
|
+
color: #334155;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
.rte-version-diff-equal { color: inherit; }
|
|
207
|
+
.rte-version-diff-insert {
|
|
208
|
+
background: rgba(22, 163, 74, 0.18);
|
|
209
|
+
color: #14532d;
|
|
210
|
+
border-radius: 2px;
|
|
211
|
+
}
|
|
212
|
+
.rte-version-diff-delete {
|
|
213
|
+
background: rgba(220, 38, 38, 0.18);
|
|
214
|
+
color: #7f1d1d;
|
|
215
|
+
text-decoration: line-through;
|
|
216
|
+
border-radius: 2px;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
.rte-version-diff-empty {
|
|
220
|
+
margin: 0;
|
|
221
|
+
color: #64748b;
|
|
222
|
+
font-size: 13px;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
${d} .rte-version-diff-dialog,
|
|
226
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-dialog {
|
|
227
|
+
background: #1f2937;
|
|
228
|
+
color: #e5e7eb;
|
|
229
|
+
border-color: #334155;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
${d} .rte-version-diff-header,
|
|
233
|
+
${d} .rte-version-diff-footer,
|
|
234
|
+
${d} .rte-version-diff-tabs,
|
|
235
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-header,
|
|
236
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-footer,
|
|
237
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-tabs {
|
|
238
|
+
background: #111827;
|
|
239
|
+
border-color: #334155;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
${d} .rte-version-diff-body,
|
|
243
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-body {
|
|
244
|
+
background: #1f2937;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
${d} .rte-version-diff-select,
|
|
248
|
+
${d} .rte-version-diff-btn,
|
|
249
|
+
${d} .rte-version-diff-tab,
|
|
250
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-select,
|
|
251
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-btn,
|
|
252
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-tab {
|
|
253
|
+
background: #0f172a;
|
|
254
|
+
color: #e5e7eb;
|
|
255
|
+
border-color: #475569;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
${d} .rte-version-diff-close-btn,
|
|
259
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-close-btn {
|
|
260
|
+
background: #0f172a;
|
|
261
|
+
border-color: #475569;
|
|
262
|
+
color: #e2e8f0;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
${d} .rte-version-diff-close-btn:hover,
|
|
266
|
+
${d} .rte-version-diff-close-btn:focus-visible,
|
|
267
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-close-btn:hover,
|
|
268
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-close-btn:focus-visible {
|
|
269
|
+
border-color: #60a5fa;
|
|
270
|
+
box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
|
|
271
|
+
outline: none;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
${d} .rte-version-diff-tab[aria-selected="true"],
|
|
275
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-tab[aria-selected="true"] {
|
|
276
|
+
background: #1e3a8a;
|
|
277
|
+
border-color: #3b82f6;
|
|
278
|
+
color: #dbeafe;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
${d} .rte-version-diff-inline,
|
|
282
|
+
${d} .rte-version-diff-side-pane,
|
|
283
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-inline,
|
|
284
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-side-pane {
|
|
285
|
+
background: #0f172a;
|
|
286
|
+
border-color: #334155;
|
|
287
|
+
color: #e5e7eb;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
${d} .rte-version-diff-pane-title,
|
|
291
|
+
${d} .rte-version-diff-summary,
|
|
292
|
+
${d} .rte-version-diff-empty,
|
|
293
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-pane-title,
|
|
294
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-summary,
|
|
295
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-empty {
|
|
296
|
+
color: #94a3b8;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
${d} .rte-version-diff-insert,
|
|
300
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-insert {
|
|
301
|
+
background: rgba(22, 163, 74, 0.25);
|
|
302
|
+
color: #bbf7d0;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
${d} .rte-version-diff-delete,
|
|
306
|
+
.${l}.rte-version-diff-theme-dark .rte-version-diff-delete {
|
|
307
|
+
background: rgba(220, 38, 38, 0.25);
|
|
308
|
+
color: #fecaca;
|
|
309
|
+
}
|
|
310
|
+
:is(${d}) .rte-toolbar-item .rte-toolbar-button[data-command="openVersionDiff"] svg{
|
|
311
|
+
fill: none;
|
|
312
|
+
}
|
|
313
|
+
`,document.head.appendChild(e)}async function ge(e,i,n){if(n!=null)return n;if(typeof i.getBaselineHtml=="function"){const o=O(e),f=await Promise.resolve(i.getBaselineHtml({editor:e,editorRoot:o}));if(typeof f=="string")return f}const r=w.get(e);if(typeof r=="string")return r;if(typeof i.baselineHtml=="string")return i.baselineHtml;const t=W(e);return w.set(e,t),t}function ye(e){e.querySelector('button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')?.focus()}function ke(e,i){if(e.key!=="Tab")return;const n=Array.from(i.querySelectorAll('button:not([disabled]), select:not([disabled]), input:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')).filter(f=>!f.hasAttribute("disabled"));if(n.length===0)return;const r=n[0],t=n[n.length-1],o=document.activeElement;e.shiftKey&&o===r?(e.preventDefault(),t.focus()):!e.shiftKey&&o===t&&(e.preventDefault(),r.focus())}function te(){z&&(z(),z=null)}function X(e){!e||w.has(e)||w.set(e,W(e))}function xe(e){return{baselineHtml:e.baselineHtml,getBaselineHtml:e.getBaselineHtml,mode:e.mode||"word",ignoreWhitespace:e.ignoreWhitespace!==!1,maxTokens:Math.max(200,e.maxTokens??1200),maxMatrixSize:Math.max(5e4,e.maxMatrixSize??1e6),labels:le(e.labels)}}function re(e,i,n){te(),D=e,V.set(e,i);const r=document.createElement("div");r.className=l,Y(e)&&r.classList.add("rte-version-diff-theme-dark");const t=document.createElement("section");t.className="rte-version-diff-dialog",t.setAttribute("role","dialog"),t.setAttribute("aria-modal","true"),t.setAttribute("aria-labelledby","rte-version-diff-title");const o=i.labels;let f=n?.mode||i.mode,g=n?.ignoreWhitespace??i.ignoreWhitespace,c="inline";t.innerHTML=`
|
|
314
|
+
<header class="rte-version-diff-header">
|
|
315
|
+
<h2 id="rte-version-diff-title" class="rte-version-diff-title">${u(o.title)}</h2>
|
|
316
|
+
<div class="rte-version-diff-controls">
|
|
317
|
+
<label>
|
|
318
|
+
<span>${u(o.mode)}:</span>
|
|
319
|
+
<select class="rte-version-diff-select" aria-label="${u(o.mode)}">
|
|
320
|
+
<option value="word">Word</option>
|
|
321
|
+
<option value="line">Line</option>
|
|
322
|
+
</select>
|
|
323
|
+
</label>
|
|
324
|
+
<label class="rte-version-diff-checkbox">
|
|
325
|
+
<input type="checkbox" class="rte-version-diff-ignore-ws" ${g?"checked":""}>
|
|
326
|
+
${u(o.ignoreWhitespace)}
|
|
327
|
+
</label>
|
|
328
|
+
<button type="button" class="rte-version-diff-btn rte-version-diff-set-baseline" aria-label="${u(o.setBaseline)}">${u(o.setBaseline)}</button>
|
|
329
|
+
<button type="button" class="rte-version-diff-btn" data-action="refresh" aria-label="${u(o.refresh)}">${u(o.refresh)}</button>
|
|
330
|
+
<button type="button" class="rte-version-diff-btn rte-version-diff-close-btn" data-action="close" aria-label="${u(o.close)}">✕</button>
|
|
331
|
+
</div>
|
|
332
|
+
</header>
|
|
333
|
+
|
|
334
|
+
<div class="rte-version-diff-tabs" role="tablist" aria-label="Diff views">
|
|
335
|
+
<button type="button" role="tab" class="rte-version-diff-tab" data-tab="inline" aria-selected="true">${u(o.tabInline)}</button>
|
|
336
|
+
<button type="button" role="tab" class="rte-version-diff-tab" data-tab="side" aria-selected="false">${u(o.tabSideBySide)}</button>
|
|
337
|
+
</div>
|
|
338
|
+
|
|
339
|
+
<main class="rte-version-diff-body">
|
|
340
|
+
<div class="rte-version-diff-summary" aria-live="polite"></div>
|
|
341
|
+
<section class="rte-version-diff-panel active" data-panel="inline" role="tabpanel">
|
|
342
|
+
<div class="rte-version-diff-inline" aria-label="Inline diff result"></div>
|
|
343
|
+
</section>
|
|
344
|
+
<section class="rte-version-diff-panel" data-panel="side" role="tabpanel">
|
|
345
|
+
<div class="rte-version-diff-side-grid">
|
|
346
|
+
<div>
|
|
347
|
+
<h3 class="rte-version-diff-pane-title">${u(o.baseline)}</h3>
|
|
348
|
+
<div class="rte-version-diff-side-pane" data-side="baseline" aria-label="${u(o.baseline)}"></div>
|
|
349
|
+
</div>
|
|
350
|
+
<div>
|
|
351
|
+
<h3 class="rte-version-diff-pane-title">${u(o.current)}</h3>
|
|
352
|
+
<div class="rte-version-diff-side-pane" data-side="current" aria-label="${u(o.current)}"></div>
|
|
353
|
+
</div>
|
|
354
|
+
</div>
|
|
355
|
+
</section>
|
|
356
|
+
</main>
|
|
357
|
+
|
|
358
|
+
<footer class="rte-version-diff-footer">
|
|
359
|
+
<small>Shortcut: Ctrl/Cmd + Alt + D (fallback: F8)</small>
|
|
360
|
+
<small>Esc: close</small>
|
|
361
|
+
</footer>
|
|
362
|
+
`,r.appendChild(t),document.body.appendChild(r);const b=t.querySelector(".rte-version-diff-select");b.value=f;const m=t.querySelector(".rte-version-diff-ignore-ws"),F=t.querySelector(".rte-version-diff-summary"),T=t.querySelector(".rte-version-diff-inline"),q=t.querySelector('[data-side="baseline"]'),A=t.querySelector('[data-side="current"]');let L=0;const P=()=>{const s=`<p class="rte-version-diff-empty">${u(o.loading)}</p>`;T.innerHTML=s,q.innerHTML=s,A.innerHTML=s,F.textContent=""},a=async s=>{L+=1;const v=L;r.classList.toggle("rte-version-diff-theme-dark",Y(e)),P();const x=e.innerHTML;let E="";try{E=await ge(e,i,s??n?.baselineHtml)}catch{E=w.get(e)??W(e)}if(v!==L||!r.isConnected)return;const ne=J(E),ie=J(x),oe=Q(ne,f,g),se=Q(ie,f,g),C=pe(oe,se,f,g,i.maxMatrixSize,i.maxTokens),_=he(C.segments,o);T.innerHTML=be(C.segments,o),q.innerHTML=_.baselineHtml,A.innerHTML=_.currentHtml;const G=[`+${C.insertedCount} inserted`,`-${C.deletedCount} deleted`,`${C.equalCount} unchanged`];C.usedFallback&&G.push(o.largeDocFallback),F.textContent=G.join(" | ")},h=s=>{c=s,t.querySelectorAll(".rte-version-diff-tab").forEach(v=>{const x=v.getAttribute("data-tab")===s;v.setAttribute("aria-selected",x?"true":"false"),v.tabIndex=x?0:-1}),t.querySelectorAll(".rte-version-diff-panel").forEach(v=>{v.classList.toggle("active",v.getAttribute("data-panel")===s)})},p=()=>{r.removeEventListener("keydown",I,!0),r.removeEventListener("click",B),document.removeEventListener("keydown",y,!0),r.parentNode&&r.parentNode.removeChild(r),z=null,e.focus({preventScroll:!0})},y=s=>{s.key==="Escape"&&(s.preventDefault(),s.stopPropagation(),p())},B=s=>{s.target===r&&p()},I=s=>{if(s.key==="Escape"){s.preventDefault(),p();return}if(ke(s,t),s.target&&s.target.classList.contains("rte-version-diff-tab")&&(s.key==="ArrowRight"||s.key==="ArrowLeft")){s.preventDefault();const v=c==="inline"?"side":"inline";h(v),t.querySelector(`.rte-version-diff-tab[data-tab="${v}"]`)?.focus()}};t.addEventListener("click",s=>{const v=s.target,x=v.getAttribute("data-action");if(x==="close"){p();return}if(x==="refresh"){a();return}const E=v.getAttribute("data-tab");(E==="inline"||E==="side")&&h(E)}),b.addEventListener("change",()=>{f=b.value==="line"?"line":"word",a()}),m.addEventListener("change",()=>{g=m.checked,a()}),t.querySelector(".rte-version-diff-set-baseline").addEventListener("click",()=>{w.set(e,e.innerHTML),a(e.innerHTML)}),r.addEventListener("keydown",I,!0),r.addEventListener("click",B),document.addEventListener("keydown",y,!0),z=p,ye(t),a()}function $e(e){R=e,!S&&(S=i=>{if(!ve(i))return;if(document.querySelector(`.${l}`)){i.preventDefault();return}if(!!i.target?.closest("input, textarea, select"))return;const t=N(void 0,!1);if(!t||t.getAttribute("contenteditable")==="false")return;i.preventDefault(),i.stopPropagation();const o=V.get(t)||R||e;re(t,o)},document.addEventListener("keydown",S,!0))}function Ee(){S&&(document.removeEventListener("keydown",S,!0),S=null,R=null)}function we(){M||(M=e=>{const n=e.target?.closest($);n&&(D=n,X(n))},document.addEventListener("focusin",M,!0)),H||(H=e=>{const r=e.target?.closest($);r&&r.getAttribute("contenteditable")!=="false"&&(D=r,X(r))},document.addEventListener("beforeinput",H,!0))}function Le(){M&&(document.removeEventListener("focusin",M,!0),M=null),H&&(document.removeEventListener("beforeinput",H,!0),H=null)}const Ce=(e={})=>{const i=xe(e);return me(),{name:"versionDiff",toolbar:[{id:"versionDiff",label:"Version Diff",command:"openVersionDiff",icon:'<svg width="24" height="24" viewBox="0 0 24 24" fill="none" focusable="false" aria-hidden="true"><rect x="3.5" y="4.5" width="7" height="15" rx="1.5" stroke="currentColor" stroke-width="1.8"></rect><rect x="13.5" y="4.5" width="7" height="15" rx="1.5" stroke="currentColor" stroke-width="1.8"></rect><path d="M5.5 12h3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path><path d="M15.5 12h3m-1.5-1.5v3" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"></path></svg>'}],commands:{openVersionDiff:(n,r)=>{const t=N(r);return t?(V.set(t,i),re(t,i,n),!0):!1},setVersionDiffBaseline:(n,r)=>{const t=N(r);if(!t)return!1;V.set(t,i);const o=typeof n=="string"?n:typeof n?.html=="string"?n.html:t.innerHTML;return w.set(t,o),!0}},keymap:{"Mod-Alt-d":"openVersionDiff","Mod-Alt-D":"openVersionDiff",F8:"openVersionDiff"},init:()=>{j+=1,$e(i),we()},destroy:()=>{j=Math.max(0,j-1),j===0&&(te(),Ee(),Le())}}};exports.VersionDiffPlugin=Ce;
|