@editora/core 1.0.6 → 1.0.8
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/dist/{AnchorPlugin.native-C1Rw5m04.mjs → AnchorPlugin.native-BcYGEtd9.mjs} +129 -105
- package/dist/ApprovalWorkflowPlugin.native-C3jtAYjG.mjs +1076 -0
- package/dist/{BackgroundColorPlugin.native-BE-p9DRd.mjs → BackgroundColorPlugin.native-50iAT9xU.mjs} +119 -122
- package/dist/BlocksLibraryPlugin.native-HMWKxWNs.mjs +1327 -0
- package/dist/CitationsPlugin.native-BnU0qCwR.mjs +1464 -0
- package/dist/CodePlugin.native-DlpTPdkd.mjs +2691 -0
- package/dist/{CommentsPlugin.native-tMnWn8a2.mjs → CommentsPlugin.native-DPSqTkiv.mjs} +153 -135
- package/dist/ConditionalContentPlugin.native-CfhY46rU.mjs +1367 -0
- package/dist/ContentRulesPlugin.native-nBLQ8QFZ.mjs +1099 -0
- package/dist/DataBindingPlugin.native-jQ1JPRTp.mjs +917 -0
- package/dist/DocSchemaPlugin.native-CHOge18O.mjs +1325 -0
- package/dist/{DocumentManagerPlugin.native-BvZL5CSG.mjs → DocumentManagerPlugin.native-C2cs_1w4.mjs} +43 -43
- package/dist/{EmbedIframePlugin.native-CSWIB1jm.mjs → EmbedIframePlugin.native-DKJx2OS7.mjs} +61 -58
- package/dist/{EmojisPlugin.native-DxTm_DL-.mjs → EmojisPlugin.native-CitxxlWX.mjs} +135 -104
- package/dist/{LinkPlugin.native-CS2g-G18.mjs → LinkPlugin.native-DYCIcdTm.mjs} +47 -45
- package/dist/{MathPlugin.native-KUxz0o8C.mjs → MathPlugin.native-f_mDp8VL.mjs} +149 -108
- package/dist/{MediaManagerPlugin.native-CgP5iInD.mjs → MediaManagerPlugin.native-BiXiK8FC.mjs} +238 -217
- package/dist/MentionPlugin.native-BMDlOqur.mjs +734 -0
- package/dist/MergeTagPlugin.native-C3eOfEgw.mjs +559 -0
- package/dist/PIIRedactionPlugin.native-DcsjmtV1.mjs +1396 -0
- package/dist/{PageBreakPlugin.native-CGiQxXqR.mjs → PageBreakPlugin.native-DijGuHJZ.mjs} +86 -77
- package/dist/{PreviewPlugin.native-DBvfpmIv.mjs → PreviewPlugin.native-WuIwOAOR.mjs} +30 -30
- package/dist/SlashCommandsPlugin.native-CmxvMEaE.mjs +755 -0
- package/dist/SmartPastePlugin.native-BOKKtF07.mjs +1398 -0
- package/dist/{SpecialCharactersPlugin.native-DANrbExJ.mjs → SpecialCharactersPlugin.native-CZDato89.mjs} +143 -98
- package/dist/{SpellCheckPlugin.native-C8bPvRHy.mjs → SpellCheckPlugin.native-BZB9AewP.mjs} +239 -219
- package/dist/{TemplatePlugin.native-4lKEm-WY.mjs → TemplatePlugin.native-CrpfKRJ8.mjs} +167 -143
- package/dist/{TextColorPlugin.native-Clgtb50j.mjs → TextColorPlugin.native-Bwl_bSmc.mjs} +134 -118
- package/dist/TrackChangesPlugin.native-Bghu2q4a.mjs +761 -0
- package/dist/TranslationWorkflowPlugin.native-Bz6jDGvj.mjs +1728 -0
- package/dist/VersionDiffPlugin.native-Bvxgy--t.mjs +776 -0
- package/dist/_commonjsHelpers-DOllISpa.mjs +32 -0
- package/dist/anchoredPopover-Bxds0VoB.mjs +110 -0
- package/dist/documentManager-vQ1VkbUY.mjs +8418 -0
- package/dist/editora.min.js +13 -13
- package/dist/editora.umd.js +13 -13
- package/dist/html2canvas.esm-AYkPY5LS.mjs +4803 -0
- package/dist/index-BslAFzmv.mjs +16544 -0
- package/dist/index-D1LOqg5C.js +10 -0
- package/dist/{index-OwnkG39N.mjs → index-DqC57IEH.mjs} +438 -328
- package/dist/index.cjs.js +1 -1
- package/dist/{index.es-CuicffkQ.mjs → index.es-BYD2KEo6.mjs} +5 -4
- package/dist/index.esm.js +2 -2
- package/dist/jspdf.es.min-BJGtOnRT.mjs +7890 -0
- package/dist/plugin-loader.js +77 -40
- package/dist/webcomponent-core.js +456 -346
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +87 -107
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +503 -356
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +6003 -658
- package/package.json +2 -2
- package/dist/CodePlugin.native-B263UI8O.mjs +0 -2173
- package/dist/MergeTagPlugin.native-DIGWhdnF.mjs +0 -419
- package/dist/colorSelectionApply-CK1My9N2.mjs +0 -67
- package/dist/documentManager-irzj9n3V.mjs +0 -37627
- package/dist/index-CqWQFb3D.js +0 -10
|
@@ -1,419 +0,0 @@
|
|
|
1
|
-
const D = {
|
|
2
|
-
USER: {
|
|
3
|
-
name: "User",
|
|
4
|
-
tags: [
|
|
5
|
-
{ key: "first_name", label: "First Name", category: "User", preview: "John" },
|
|
6
|
-
{ key: "last_name", label: "Last Name", category: "User", preview: "Doe" },
|
|
7
|
-
{ key: "email", label: "Email", category: "User", preview: "john@example.com" },
|
|
8
|
-
{ key: "phone", label: "Phone", category: "User", preview: "+1-555-1234" },
|
|
9
|
-
{ key: "full_name", label: "Full Name", category: "User", preview: "John Doe" },
|
|
10
|
-
{ key: "username", label: "Username", category: "User", preview: "johndoe" }
|
|
11
|
-
]
|
|
12
|
-
},
|
|
13
|
-
COMPANY: {
|
|
14
|
-
name: "Company",
|
|
15
|
-
tags: [
|
|
16
|
-
{ key: "company_name", label: "Company Name", category: "Company", preview: "Acme Corp" },
|
|
17
|
-
{ key: "company_address", label: "Company Address", category: "Company", preview: "123 Main St" },
|
|
18
|
-
{ key: "company_phone", label: "Company Phone", category: "Company", preview: "+1-555-0000" },
|
|
19
|
-
{ key: "company_email", label: "Company Email", category: "Company", preview: "info@acme.com" }
|
|
20
|
-
]
|
|
21
|
-
},
|
|
22
|
-
DATE: {
|
|
23
|
-
name: "Date",
|
|
24
|
-
tags: [
|
|
25
|
-
{ key: "today", label: "Today", category: "Date", preview: (/* @__PURE__ */ new Date()).toLocaleDateString() },
|
|
26
|
-
{ key: "tomorrow", label: "Tomorrow", category: "Date", preview: new Date(Date.now() + 864e5).toLocaleDateString() },
|
|
27
|
-
{ key: "next_week", label: "Next Week", category: "Date", preview: new Date(Date.now() + 6048e5).toLocaleDateString() }
|
|
28
|
-
]
|
|
29
|
-
},
|
|
30
|
-
CUSTOM: {
|
|
31
|
-
name: "Custom",
|
|
32
|
-
tags: []
|
|
33
|
-
}
|
|
34
|
-
}, v = ".rte-content, .editora-content", K = '[data-theme="dark"], .dark, .editora-theme-dark', A = Object.keys(D), Y = A.reduce(
|
|
35
|
-
(t, e) => (t[e] = D[e].tags.map((r) => {
|
|
36
|
-
var n;
|
|
37
|
-
return {
|
|
38
|
-
...r,
|
|
39
|
-
searchIndex: `${r.label} ${r.key} ${r.category} ${"description" in r && (n = r.description) != null ? n : ""}`.toLowerCase()
|
|
40
|
-
};
|
|
41
|
-
}), t),
|
|
42
|
-
{}
|
|
43
|
-
);
|
|
44
|
-
let j = !1, H = !1, E = null, w = null, k = null, P = !1;
|
|
45
|
-
function R() {
|
|
46
|
-
if (j || typeof document == "undefined") return;
|
|
47
|
-
j = !0;
|
|
48
|
-
const t = document.createElement("style");
|
|
49
|
-
t.id = "merge-tag-plugin-styles", t.textContent = `
|
|
50
|
-
.rte-merge-tag-overlay {
|
|
51
|
-
--rte-mt-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
52
|
-
--rte-mt-dialog-bg: #ffffff;
|
|
53
|
-
--rte-mt-dialog-text: #101828;
|
|
54
|
-
--rte-mt-border: #d6dbe4;
|
|
55
|
-
--rte-mt-subtle-bg: #f7f9fc;
|
|
56
|
-
--rte-mt-subtle-hover: #eef2f7;
|
|
57
|
-
--rte-mt-muted-text: #5f6b7d;
|
|
58
|
-
--rte-mt-accent: #1976d2;
|
|
59
|
-
--rte-mt-accent-strong: #1565c0;
|
|
60
|
-
position: fixed;
|
|
61
|
-
inset: 0;
|
|
62
|
-
background-color: var(--rte-mt-overlay-bg);
|
|
63
|
-
backdrop-filter: blur(2px);
|
|
64
|
-
display: flex;
|
|
65
|
-
align-items: center;
|
|
66
|
-
justify-content: center;
|
|
67
|
-
z-index: 10000;
|
|
68
|
-
padding: 16px;
|
|
69
|
-
box-sizing: border-box;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.rte-merge-tag-overlay.rte-ui-theme-dark {
|
|
73
|
-
--rte-mt-overlay-bg: rgba(2, 8, 20, 0.72);
|
|
74
|
-
--rte-mt-dialog-bg: #202938;
|
|
75
|
-
--rte-mt-dialog-text: #e8effc;
|
|
76
|
-
--rte-mt-border: #49566c;
|
|
77
|
-
--rte-mt-subtle-bg: #2a3444;
|
|
78
|
-
--rte-mt-subtle-hover: #344256;
|
|
79
|
-
--rte-mt-muted-text: #a5b1c5;
|
|
80
|
-
--rte-mt-accent: #58a6ff;
|
|
81
|
-
--rte-mt-accent-strong: #4598f4;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.rte-merge-tag-dialog {
|
|
85
|
-
background: var(--rte-mt-dialog-bg);
|
|
86
|
-
color: var(--rte-mt-dialog-text);
|
|
87
|
-
border: 1px solid var(--rte-mt-border);
|
|
88
|
-
border-radius: 12px;
|
|
89
|
-
box-shadow: 0 24px 48px rgba(10, 15, 24, 0.28);
|
|
90
|
-
width: 500px;
|
|
91
|
-
max-width: 90vw;
|
|
92
|
-
max-height: 80vh;
|
|
93
|
-
display: flex;
|
|
94
|
-
flex-direction: column;
|
|
95
|
-
overflow: hidden;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.rte-merge-tag-header { padding: 16px; border-bottom: 1px solid var(--rte-mt-border); display:flex; justify-content:space-between; align-items:center; }
|
|
99
|
-
.rte-merge-tag-body { padding: 16px; overflow-y:auto; flex:1; }
|
|
100
|
-
.rte-merge-tag-input { width:100%; padding:10px; border:1px solid var(--rte-mt-border); border-radius:4px; background:var(--rte-mt-subtle-bg); color:var(--rte-mt-dialog-text); }
|
|
101
|
-
.rte-merge-tag-tabs { display:flex; gap:8px; margin: 12px 0; }
|
|
102
|
-
.rte-merge-tag-tab { padding:8px 12px; background:none; border:none; cursor:pointer; color:var(--rte-mt-muted-text); border-bottom:3px solid transparent; }
|
|
103
|
-
.rte-merge-tag-tab.active { color:var(--rte-mt-accent); border-bottom-color:var(--rte-mt-accent); }
|
|
104
|
-
.rte-merge-tag-list { border:1px solid var(--rte-mt-border); border-radius:4px; max-height:300px; overflow-y:auto; margin-bottom:12px; background:var(--rte-mt-subtle-bg); }
|
|
105
|
-
.rte-merge-tag-item { padding:8px 12px; border-bottom:1px solid var(--rte-mt-border); cursor:pointer; transition:background-color 0.16s; color:var(--rte-mt-dialog-text); }
|
|
106
|
-
.rte-merge-tag-item:last-child { border-bottom: none; }
|
|
107
|
-
.rte-merge-tag-item.selected, .rte-merge-tag-item:hover { background-color:var(--rte-mt-subtle-hover); }
|
|
108
|
-
.rte-merge-tag-item-label { font-weight: 600; }
|
|
109
|
-
.rte-merge-tag-item-preview { font-size: 12px; color: var(--rte-mt-muted-text); margin-top: 2px; }
|
|
110
|
-
.rte-merge-tag-empty { padding: 24px; text-align: center; color: var(--rte-mt-muted-text); }
|
|
111
|
-
.rte-merge-tag-preview { padding:8px; background:var(--rte-mt-subtle-bg); border-radius:4px; font-family:monospace; font-size:12px; color:var(--rte-mt-dialog-text); }
|
|
112
|
-
.rte-merge-tag-footer { padding:12px 16px; border-top:1px solid var(--rte-mt-border); display:flex; gap:8px; justify-content:flex-end; background:var(--rte-mt-subtle-bg); }
|
|
113
|
-
.rte-merge-tag-btn-primary { padding:8px 16px; border:none; border-radius:4px; background:var(--rte-mt-accent); color:#fff; cursor:pointer; }
|
|
114
|
-
.rte-merge-tag-btn-primary:hover { background: var(--rte-mt-accent-strong); }
|
|
115
|
-
.rte-merge-tag-btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
|
|
116
|
-
.rte-merge-tag-btn-secondary { padding:8px 16px; border:1px solid var(--rte-mt-border); border-radius:4px; background:var(--rte-mt-subtle-bg); color:var(--rte-mt-dialog-text); cursor:pointer; }
|
|
117
|
-
|
|
118
|
-
.rte-merge-tag {
|
|
119
|
-
display: inline-flex;
|
|
120
|
-
align-items: center;
|
|
121
|
-
white-space: nowrap;
|
|
122
|
-
user-select: none;
|
|
123
|
-
background-color: #e3f2fd;
|
|
124
|
-
border: 1px solid #bbdefb;
|
|
125
|
-
border-radius: 3px;
|
|
126
|
-
padding: 1px 6px;
|
|
127
|
-
margin: 0 2px;
|
|
128
|
-
color: #1976d2;
|
|
129
|
-
font-weight: 600;
|
|
130
|
-
line-height: 1.3;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
:is([data-theme="dark"], .dark, .editora-theme-dark) .rte-merge-tag {
|
|
134
|
-
background: #223247;
|
|
135
|
-
border-color: #3f5f84;
|
|
136
|
-
color: #8dc4ff;
|
|
137
|
-
}
|
|
138
|
-
`, document.head.appendChild(t);
|
|
139
|
-
}
|
|
140
|
-
function $() {
|
|
141
|
-
H || typeof document == "undefined" || (H = !0, document.addEventListener("focusin", (t) => {
|
|
142
|
-
const e = t.target, r = e == null ? void 0 : e.closest(v);
|
|
143
|
-
r && (E = r);
|
|
144
|
-
}), document.addEventListener("selectionchange", () => {
|
|
145
|
-
const t = V();
|
|
146
|
-
t && (E = t);
|
|
147
|
-
}));
|
|
148
|
-
}
|
|
149
|
-
function V() {
|
|
150
|
-
const t = window.getSelection();
|
|
151
|
-
if (!t || t.rangeCount === 0) return null;
|
|
152
|
-
const r = t.getRangeAt(0).startContainer, n = r.nodeType === Node.ELEMENT_NODE ? r : r.parentElement;
|
|
153
|
-
return (n == null ? void 0 : n.closest(v)) || null;
|
|
154
|
-
}
|
|
155
|
-
function J() {
|
|
156
|
-
const t = V();
|
|
157
|
-
if (t) return t;
|
|
158
|
-
const e = document.activeElement, r = e == null ? void 0 : e.closest(v);
|
|
159
|
-
return r || (E != null && E.isConnected ? E : document.querySelector(v));
|
|
160
|
-
}
|
|
161
|
-
function Q(t) {
|
|
162
|
-
const e = t.parentNode;
|
|
163
|
-
if (!e) return;
|
|
164
|
-
const r = window.getSelection();
|
|
165
|
-
if (!r) return;
|
|
166
|
-
const n = document.createRange(), o = Array.from(e.childNodes).indexOf(t);
|
|
167
|
-
o < 0 || (n.setStart(e, o), n.setEnd(e, o + 1), r.removeAllRanges(), r.addRange(n));
|
|
168
|
-
}
|
|
169
|
-
function B(t, e) {
|
|
170
|
-
var r;
|
|
171
|
-
t instanceof Text && t.data.length !== 0 && (e ? (t.data.startsWith(" ") || t.data.startsWith(" ")) && t.deleteData(0, 1) : (t.data.endsWith(" ") || t.data.endsWith(" ")) && t.deleteData(t.data.length - 1, 1), t.data.length === 0 && ((r = t.parentNode) == null || r.removeChild(t)));
|
|
172
|
-
}
|
|
173
|
-
function G(t, e) {
|
|
174
|
-
const r = window.getSelection();
|
|
175
|
-
if (!r) return;
|
|
176
|
-
const n = document.createRange(), i = Math.max(0, Math.min(e, t.childNodes.length));
|
|
177
|
-
n.setStart(t, i), n.collapse(!0), r.removeAllRanges(), r.addRange(n);
|
|
178
|
-
}
|
|
179
|
-
function Z(t, e) {
|
|
180
|
-
var d;
|
|
181
|
-
const r = t.parentNode;
|
|
182
|
-
if (!r) return !1;
|
|
183
|
-
const i = Array.from(r.childNodes).indexOf(t);
|
|
184
|
-
if (i < 0) return !1;
|
|
185
|
-
const o = t.previousSibling, c = t.nextSibling;
|
|
186
|
-
r.removeChild(t), e === "Backspace" ? (B(c, !0), G(r, i)) : (B(o, !1), G(r, i));
|
|
187
|
-
const g = r instanceof HTMLElement ? r.closest(v) : ((d = r.parentElement) == null ? void 0 : d.closest(v)) || null;
|
|
188
|
-
return g && g.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
189
|
-
}
|
|
190
|
-
function ee(t) {
|
|
191
|
-
if (t.collapsed || !(t.startContainer instanceof HTMLElement || t.startContainer instanceof Text) || t.startContainer !== t.endContainer || t.endOffset !== t.startOffset + 1) return null;
|
|
192
|
-
const e = t.startContainer;
|
|
193
|
-
if (!(e instanceof Element || e instanceof DocumentFragment)) return null;
|
|
194
|
-
const r = e.childNodes[t.startOffset];
|
|
195
|
-
return r instanceof HTMLElement && r.classList.contains("rte-merge-tag") ? r : null;
|
|
196
|
-
}
|
|
197
|
-
function te(t, e) {
|
|
198
|
-
if (!t.collapsed) return null;
|
|
199
|
-
const { startContainer: r, startOffset: n } = t, i = (o) => o instanceof HTMLElement && o.classList.contains("rte-merge-tag") ? o : null;
|
|
200
|
-
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
201
|
-
const o = r;
|
|
202
|
-
return e === "Backspace" && n > 0 ? i(o.childNodes[n - 1] || null) : e === "Delete" ? i(o.childNodes[n] || null) : null;
|
|
203
|
-
}
|
|
204
|
-
if (r.nodeType === Node.TEXT_NODE) {
|
|
205
|
-
const o = r;
|
|
206
|
-
return e === "Backspace" ? n === 0 ? i(o.previousSibling) : n === 1 && (o.data[0] === " " || o.data[0] === " ") && o.previousSibling instanceof HTMLElement && o.previousSibling.classList.contains("rte-merge-tag") ? o.previousSibling : null : n === o.data.length ? i(o.nextSibling) : null;
|
|
207
|
-
}
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
function q() {
|
|
211
|
-
P || typeof document == "undefined" || (P = !0, document.addEventListener("click", (t) => {
|
|
212
|
-
const e = t.target, r = e == null ? void 0 : e.closest(".rte-merge-tag");
|
|
213
|
-
if (!r) return;
|
|
214
|
-
const n = r.closest(v);
|
|
215
|
-
n && (t.preventDefault(), t.stopPropagation(), n.focus({ preventScroll: !0 }), Q(r));
|
|
216
|
-
}), document.addEventListener("keydown", (t) => {
|
|
217
|
-
if (t.key !== "Backspace" && t.key !== "Delete") return;
|
|
218
|
-
const e = window.getSelection();
|
|
219
|
-
if (!e || e.rangeCount === 0) return;
|
|
220
|
-
const r = e.getRangeAt(0), n = J();
|
|
221
|
-
if (!n || !n.contains(r.commonAncestorContainer)) return;
|
|
222
|
-
let i = ee(r);
|
|
223
|
-
i || (i = te(r, t.key)), i && (t.preventDefault(), t.stopPropagation(), Z(i, t.key));
|
|
224
|
-
}));
|
|
225
|
-
}
|
|
226
|
-
function re(t) {
|
|
227
|
-
return t ? !!t.closest(K) : !1;
|
|
228
|
-
}
|
|
229
|
-
function ne() {
|
|
230
|
-
k && (k(), k = null), w = null;
|
|
231
|
-
}
|
|
232
|
-
function W(t) {
|
|
233
|
-
const e = document.createRange();
|
|
234
|
-
return e.selectNodeContents(t), e.collapse(!1), e;
|
|
235
|
-
}
|
|
236
|
-
function ae(t, e) {
|
|
237
|
-
const r = window.getSelection(), n = e ? e.cloneRange() : W(t), o = n.startContainer.isConnected && n.endContainer.isConnected && t.contains(n.commonAncestorContainer) ? n : W(t);
|
|
238
|
-
return r && (r.removeAllRanges(), r.addRange(o)), o;
|
|
239
|
-
}
|
|
240
|
-
function oe(t) {
|
|
241
|
-
const e = document.createElement("span");
|
|
242
|
-
return e.className = "rte-merge-tag", e.setAttribute("contenteditable", "false"), e.setAttribute("data-key", t.key), e.setAttribute("data-category", t.category), e.setAttribute("data-label", t.label), e.setAttribute("aria-label", `Merge tag: ${t.label}`), e.textContent = `{{ ${t.label} }}`, e;
|
|
243
|
-
}
|
|
244
|
-
function ie(t, e, r) {
|
|
245
|
-
const n = window.getSelection();
|
|
246
|
-
if (!n) return !1;
|
|
247
|
-
t.focus({ preventScroll: !0 });
|
|
248
|
-
const i = ae(t, e), o = i.startContainer.nodeType === Node.ELEMENT_NODE ? i.startContainer : i.startContainer.parentElement, c = o == null ? void 0 : o.closest(".rte-merge-tag");
|
|
249
|
-
c && t.contains(c) && (i.setStartAfter(c), i.setEndAfter(c));
|
|
250
|
-
try {
|
|
251
|
-
i.deleteContents();
|
|
252
|
-
const g = oe(r), d = document.createTextNode(" "), u = document.createDocumentFragment();
|
|
253
|
-
u.appendChild(g), u.appendChild(d), i.insertNode(u);
|
|
254
|
-
const f = document.createRange();
|
|
255
|
-
return f.setStartAfter(d), f.collapse(!0), n.removeAllRanges(), n.addRange(f), t.dispatchEvent(new Event("input", { bubbles: !0 })), !0;
|
|
256
|
-
} catch (g) {
|
|
257
|
-
return console.error("Failed to insert merge tag:", g), !1;
|
|
258
|
-
}
|
|
259
|
-
}
|
|
260
|
-
function le(t, e) {
|
|
261
|
-
const r = Y[t], n = e.trim().toLowerCase();
|
|
262
|
-
return n ? r.filter((i) => i.searchIndex.includes(n)) : r;
|
|
263
|
-
}
|
|
264
|
-
function se(t) {
|
|
265
|
-
ne(), R();
|
|
266
|
-
const e = {
|
|
267
|
-
category: "USER",
|
|
268
|
-
searchTerm: "",
|
|
269
|
-
filteredTags: Y.USER,
|
|
270
|
-
selectedIndex: 0,
|
|
271
|
-
savedRange: (() => {
|
|
272
|
-
const a = window.getSelection();
|
|
273
|
-
if (!a || a.rangeCount === 0) return null;
|
|
274
|
-
const l = a.getRangeAt(0);
|
|
275
|
-
return t.contains(l.commonAncestorContainer) ? l.cloneRange() : null;
|
|
276
|
-
})(),
|
|
277
|
-
searchRaf: null
|
|
278
|
-
}, r = document.createElement("div");
|
|
279
|
-
r.className = "rte-merge-tag-overlay", r.setAttribute("role", "dialog"), r.setAttribute("aria-modal", "true"), re(t) && r.classList.add("rte-ui-theme-dark");
|
|
280
|
-
const n = document.createElement("div");
|
|
281
|
-
n.className = "rte-merge-tag-dialog";
|
|
282
|
-
const i = document.createElement("div");
|
|
283
|
-
i.className = "rte-merge-tag-header", i.innerHTML = `
|
|
284
|
-
<h2 style="margin:0; font-size:18px; font-weight:700;">Insert Merge Tag</h2>
|
|
285
|
-
<button class="rte-merge-tag-close" aria-label="Close" style="background:none;border:none;color:inherit;cursor:pointer;font-size:20px;">✕</button>
|
|
286
|
-
`;
|
|
287
|
-
const o = document.createElement("div");
|
|
288
|
-
o.className = "rte-merge-tag-body";
|
|
289
|
-
const c = document.createElement("input");
|
|
290
|
-
c.type = "text", c.className = "rte-merge-tag-input", c.placeholder = "Search merge tags...", c.setAttribute("aria-label", "Search merge tags");
|
|
291
|
-
const g = document.createElement("div");
|
|
292
|
-
g.className = "rte-merge-tag-tabs", A.forEach((a) => {
|
|
293
|
-
const l = document.createElement("button");
|
|
294
|
-
l.type = "button", l.className = "rte-merge-tag-tab", l.setAttribute("data-category", a), l.textContent = D[a].name, g.appendChild(l);
|
|
295
|
-
});
|
|
296
|
-
const d = document.createElement("div");
|
|
297
|
-
d.className = "rte-merge-tag-list";
|
|
298
|
-
const u = document.createElement("div");
|
|
299
|
-
u.className = "rte-merge-tag-preview", o.appendChild(c), o.appendChild(g), o.appendChild(d), o.appendChild(u);
|
|
300
|
-
const f = document.createElement("div");
|
|
301
|
-
f.className = "rte-merge-tag-footer";
|
|
302
|
-
const x = document.createElement("button");
|
|
303
|
-
x.type = "button", x.className = "rte-merge-tag-btn-secondary", x.textContent = "Cancel";
|
|
304
|
-
const p = document.createElement("button");
|
|
305
|
-
p.type = "button", p.className = "rte-merge-tag-btn-primary", p.textContent = "Insert", f.appendChild(x), f.appendChild(p), n.appendChild(i), n.appendChild(o), n.appendChild(f), r.appendChild(n), document.body.appendChild(r), w = r;
|
|
306
|
-
const I = () => {
|
|
307
|
-
g.querySelectorAll(".rte-merge-tag-tab").forEach((l) => {
|
|
308
|
-
const m = l.dataset.category === e.category;
|
|
309
|
-
l.classList.toggle("active", m);
|
|
310
|
-
});
|
|
311
|
-
}, N = () => {
|
|
312
|
-
if (e.filteredTags.length === 0) {
|
|
313
|
-
e.selectedIndex = -1;
|
|
314
|
-
return;
|
|
315
|
-
}
|
|
316
|
-
e.selectedIndex < 0 && (e.selectedIndex = 0), e.selectedIndex >= e.filteredTags.length && (e.selectedIndex = e.filteredTags.length - 1);
|
|
317
|
-
}, M = () => {
|
|
318
|
-
N();
|
|
319
|
-
const a = e.selectedIndex >= 0 ? e.filteredTags[e.selectedIndex] : null;
|
|
320
|
-
if (!a) {
|
|
321
|
-
u.style.display = "none", p.disabled = !0;
|
|
322
|
-
return;
|
|
323
|
-
}
|
|
324
|
-
u.style.display = "block", u.innerHTML = `<strong>Preview:</strong> {{ ${a.label} }}`, p.disabled = !1;
|
|
325
|
-
}, X = () => {
|
|
326
|
-
if (e.selectedIndex < 0) return;
|
|
327
|
-
const a = d.querySelector(`.rte-merge-tag-item[data-index="${e.selectedIndex}"]`);
|
|
328
|
-
a == null || a.scrollIntoView({ block: "nearest" });
|
|
329
|
-
}, h = () => {
|
|
330
|
-
if (e.filteredTags = le(e.category, e.searchTerm), e.filteredTags.length > 0 && e.selectedIndex < 0 && (e.selectedIndex = 0), N(), d.innerHTML = "", e.filteredTags.length === 0) {
|
|
331
|
-
const l = document.createElement("div");
|
|
332
|
-
l.className = "rte-merge-tag-empty", l.textContent = "No merge tags found", d.appendChild(l), M();
|
|
333
|
-
return;
|
|
334
|
-
}
|
|
335
|
-
const a = document.createDocumentFragment();
|
|
336
|
-
e.filteredTags.forEach((l, m) => {
|
|
337
|
-
const s = document.createElement("div");
|
|
338
|
-
s.className = "rte-merge-tag-item", s.setAttribute("data-index", String(m)), s.classList.toggle("selected", m === e.selectedIndex);
|
|
339
|
-
const S = document.createElement("div");
|
|
340
|
-
if (S.className = "rte-merge-tag-item-label", S.textContent = l.label, s.appendChild(S), l.preview) {
|
|
341
|
-
const L = document.createElement("div");
|
|
342
|
-
L.className = "rte-merge-tag-item-preview", L.textContent = l.preview, s.appendChild(L);
|
|
343
|
-
}
|
|
344
|
-
a.appendChild(s);
|
|
345
|
-
}), d.appendChild(a), M(), X();
|
|
346
|
-
}, O = () => {
|
|
347
|
-
e.searchRaf !== null && cancelAnimationFrame(e.searchRaf), e.searchRaf = requestAnimationFrame(() => {
|
|
348
|
-
e.searchRaf = null, e.searchTerm = c.value, e.selectedIndex = 0, h();
|
|
349
|
-
});
|
|
350
|
-
}, b = () => {
|
|
351
|
-
e.searchRaf !== null && (cancelAnimationFrame(e.searchRaf), e.searchRaf = null), r.remove(), w === r && (w = null, k = null);
|
|
352
|
-
}, T = () => {
|
|
353
|
-
if (N(), e.selectedIndex < 0) return;
|
|
354
|
-
const a = e.filteredTags[e.selectedIndex];
|
|
355
|
-
ie(t, e.savedRange, a) && b();
|
|
356
|
-
}, _ = (a) => {
|
|
357
|
-
const m = a.target.closest(".rte-merge-tag-tab");
|
|
358
|
-
if (!m) return;
|
|
359
|
-
const s = m.dataset.category;
|
|
360
|
-
!s || !A.includes(s) || (e.category = s, e.searchTerm = "", c.value = "", e.selectedIndex = 0, I(), h());
|
|
361
|
-
}, F = (a) => {
|
|
362
|
-
const m = a.target.closest(".rte-merge-tag-item");
|
|
363
|
-
if (!m) return;
|
|
364
|
-
const s = Number(m.dataset.index || "-1");
|
|
365
|
-
Number.isNaN(s) || s < 0 || s >= e.filteredTags.length || (e.selectedIndex = s, h());
|
|
366
|
-
}, U = (a) => {
|
|
367
|
-
const m = a.target.closest(".rte-merge-tag-item");
|
|
368
|
-
if (!m) return;
|
|
369
|
-
const s = Number(m.dataset.index || "-1");
|
|
370
|
-
Number.isNaN(s) || s < 0 || s >= e.filteredTags.length || (e.selectedIndex = s, T());
|
|
371
|
-
}, C = (a) => {
|
|
372
|
-
if (a.key === "Escape") {
|
|
373
|
-
a.preventDefault(), b();
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
if (a.key === "ArrowDown") {
|
|
377
|
-
if (a.preventDefault(), e.filteredTags.length === 0) return;
|
|
378
|
-
e.selectedIndex = Math.min(e.filteredTags.length - 1, e.selectedIndex + 1), h();
|
|
379
|
-
return;
|
|
380
|
-
}
|
|
381
|
-
if (a.key === "ArrowUp") {
|
|
382
|
-
if (a.preventDefault(), e.filteredTags.length === 0) return;
|
|
383
|
-
e.selectedIndex = Math.max(0, e.selectedIndex - 1), h();
|
|
384
|
-
return;
|
|
385
|
-
}
|
|
386
|
-
a.key === "Enter" && (a.preventDefault(), T());
|
|
387
|
-
}, z = (a) => {
|
|
388
|
-
a.target === r && b();
|
|
389
|
-
}, y = i.querySelector(".rte-merge-tag-close");
|
|
390
|
-
g.addEventListener("click", _), d.addEventListener("click", F), d.addEventListener("dblclick", U), c.addEventListener("input", O), c.addEventListener("keydown", C), r.addEventListener("click", z), n.addEventListener("keydown", C), y == null || y.addEventListener("click", b), x.addEventListener("click", b), p.addEventListener("click", T), k = () => {
|
|
391
|
-
g.removeEventListener("click", _), d.removeEventListener("click", F), d.removeEventListener("dblclick", U), c.removeEventListener("input", O), c.removeEventListener("keydown", C), r.removeEventListener("click", z), n.removeEventListener("keydown", C), y == null || y.removeEventListener("click", b), x.removeEventListener("click", b), p.removeEventListener("click", T), e.searchRaf !== null && (cancelAnimationFrame(e.searchRaf), e.searchRaf = null), r.remove();
|
|
392
|
-
}, I(), h(), setTimeout(() => {
|
|
393
|
-
c.focus();
|
|
394
|
-
}, 0);
|
|
395
|
-
}
|
|
396
|
-
const ce = () => ({
|
|
397
|
-
name: "mergeTag",
|
|
398
|
-
init: () => {
|
|
399
|
-
R(), $(), q();
|
|
400
|
-
},
|
|
401
|
-
toolbar: [
|
|
402
|
-
{
|
|
403
|
-
label: "Merge Tag",
|
|
404
|
-
command: "insertMergeTag",
|
|
405
|
-
icon: "{{ }}"
|
|
406
|
-
}
|
|
407
|
-
],
|
|
408
|
-
commands: {
|
|
409
|
-
insertMergeTag: () => {
|
|
410
|
-
R(), $(), q();
|
|
411
|
-
const t = J();
|
|
412
|
-
return t ? (se(t), !0) : !1;
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
export {
|
|
417
|
-
ce as MergeTagPlugin
|
|
418
|
-
};
|
|
419
|
-
//# sourceMappingURL=MergeTagPlugin.native-DIGWhdnF.mjs.map
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
const i = "p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";
|
|
2
|
-
function d(e) {
|
|
3
|
-
return !!e.cloneContents().querySelector(i);
|
|
4
|
-
}
|
|
5
|
-
function s(e, n) {
|
|
6
|
-
var r, a;
|
|
7
|
-
const t = (e == null ? void 0 : e.nodeType) === Node.ELEMENT_NODE ? e : (r = e == null ? void 0 : e.parentElement) != null ? r : null;
|
|
8
|
-
return (t == null ? void 0 : t.closest('[contenteditable="true"]')) || ((a = n()) == null ? void 0 : a.querySelector('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
9
|
-
}
|
|
10
|
-
function c(e, n) {
|
|
11
|
-
const t = s(e, n);
|
|
12
|
-
t && t.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
13
|
-
}
|
|
14
|
-
function f(e, n) {
|
|
15
|
-
let r = e.startContainer.nodeType === Node.TEXT_NODE ? e.startContainer.parentElement : e.startContainer;
|
|
16
|
-
for (; r && r !== document.body; ) {
|
|
17
|
-
if (r.classList.contains(n)) {
|
|
18
|
-
const a = document.createRange();
|
|
19
|
-
if (a.selectNodeContents(r), a.compareBoundaryPoints(Range.START_TO_START, e) <= 0 && a.compareBoundaryPoints(Range.END_TO_END, e) >= 0)
|
|
20
|
-
return r;
|
|
21
|
-
}
|
|
22
|
-
r = r.parentElement;
|
|
23
|
-
}
|
|
24
|
-
return null;
|
|
25
|
-
}
|
|
26
|
-
function m(e) {
|
|
27
|
-
try {
|
|
28
|
-
if (e.savedRange) {
|
|
29
|
-
const o = window.getSelection();
|
|
30
|
-
o && (o.removeAllRanges(), o.addRange(e.savedRange.cloneRange()));
|
|
31
|
-
}
|
|
32
|
-
const n = window.getSelection();
|
|
33
|
-
if (!n || n.rangeCount === 0 || n.isCollapsed)
|
|
34
|
-
return !1;
|
|
35
|
-
const t = n.getRangeAt(0);
|
|
36
|
-
if (t.collapsed)
|
|
37
|
-
return !1;
|
|
38
|
-
const r = f(t, e.className);
|
|
39
|
-
if (r)
|
|
40
|
-
return e.styleProperty === "backgroundColor" ? r.style.backgroundColor = e.color : r.style.color = e.color, c(r, e.getActiveEditorRoot), !0;
|
|
41
|
-
const a = s(
|
|
42
|
-
t.commonAncestorContainer,
|
|
43
|
-
e.getActiveEditorRoot
|
|
44
|
-
);
|
|
45
|
-
a == null || a.focus({ preventScroll: !0 });
|
|
46
|
-
try {
|
|
47
|
-
document.execCommand("styleWithCSS", !1, "true");
|
|
48
|
-
} catch (o) {
|
|
49
|
-
}
|
|
50
|
-
let l = !1;
|
|
51
|
-
if (e.commands.forEach((o) => {
|
|
52
|
-
l || (l = document.execCommand(o, !1, e.color));
|
|
53
|
-
}), !l && !d(t)) {
|
|
54
|
-
const o = document.createElement("span");
|
|
55
|
-
e.styleProperty === "backgroundColor" ? o.style.backgroundColor = e.color : o.style.color = e.color, o.className = e.className;
|
|
56
|
-
const u = t.extractContents();
|
|
57
|
-
o.appendChild(u), t.insertNode(o), t.setStartAfter(o), t.collapse(!0), n.removeAllRanges(), n.addRange(t), l = !0;
|
|
58
|
-
}
|
|
59
|
-
return l ? (c(t.commonAncestorContainer, e.getActiveEditorRoot), !0) : (e.warnMessage && console.warn(e.warnMessage), !1);
|
|
60
|
-
} catch (n) {
|
|
61
|
-
return e.warnMessage ? console.error(e.warnMessage, n) : console.error("[ColorApply] Failed to apply color", n), !1;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export {
|
|
65
|
-
m as a
|
|
66
|
-
};
|
|
67
|
-
//# sourceMappingURL=colorSelectionApply-CK1My9N2.mjs.map
|