@editora/core 1.0.3 → 1.0.4
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 +34 -0
- package/dist/{A11yCheckerPlugin.native-CZKpi3uF.mjs → A11yCheckerPlugin.native-BRdGYMju.mjs} +225 -173
- package/dist/AnchorPlugin.native-C1Rw5m04.mjs +404 -0
- package/dist/BackgroundColorPlugin.native-BE-p9DRd.mjs +489 -0
- package/dist/ChecklistPlugin.native-nuSSEFNI.mjs +309 -0
- package/dist/ClearFormattingPlugin.native-Bq_XcTh2.mjs +140 -0
- package/dist/{CodePlugin.native-CK9d8rmt.mjs → CodePlugin.native-0Zari_zp.mjs} +329 -310
- package/dist/CodeSamplePlugin.native-B-KS1pOl.mjs +384 -0
- package/dist/CommentsPlugin.native-tMnWn8a2.mjs +723 -0
- package/dist/DirectionPlugin.native-CDnbdNyl.mjs +130 -0
- package/dist/{EmbedIframePlugin.native-ifr9KLdN.mjs → EmbedIframePlugin.native-CSWIB1jm.mjs} +154 -50
- package/dist/{EmojisPlugin.native-D6mJSnSR.mjs → EmojisPlugin.native-DxTm_DL-.mjs} +156 -103
- package/dist/FontFamilyPlugin.native-j8hMTbg4.mjs +158 -0
- package/dist/FontSizePlugin.native-B_jCh7dY.mjs +286 -0
- package/dist/FootnotePlugin.native-D730OGRm.mjs +425 -0
- package/dist/HistoryPlugin.native-DCrPdeSW.mjs +257 -0
- package/dist/IndentPlugin.native-BHixp8sP.mjs +150 -0
- package/dist/LineHeightPlugin.native-CM7iXdQj.mjs +151 -0
- package/dist/{LinkPlugin.native-BdAOV-iu.mjs → LinkPlugin.native-CS2g-G18.mjs} +128 -53
- package/dist/{ListPlugin.native-CLFU5AUQ.mjs → ListPlugin.native-V7EZC1lM.mjs} +59 -12
- package/dist/MathPlugin.native-KUxz0o8C.mjs +251 -0
- package/dist/MediaManagerPlugin.native-CgP5iInD.mjs +970 -0
- package/dist/MergeTagPlugin.native-CU9LtsfD.mjs +416 -0
- package/dist/PageBreakPlugin.native-CGiQxXqR.mjs +297 -0
- package/dist/{PrintPlugin.native-BUpm52VJ.mjs → PrintPlugin.native-7qt5v7L5.mjs} +10 -10
- package/dist/{SpecialCharactersPlugin.native-x7a2SWXc.mjs → SpecialCharactersPlugin.native-DANrbExJ.mjs} +143 -97
- package/dist/SpellCheckPlugin.native-C8bPvRHy.mjs +1019 -0
- package/dist/StrikethroughPlugin.native-0Be7j49s.mjs +73 -0
- package/dist/{TablePlugin.native-EEWXn1-s.mjs → TablePlugin.native-DrHX-efe.mjs} +149 -145
- package/dist/TemplatePlugin.native-4lKEm-WY.mjs +578 -0
- package/dist/TextAlignmentPlugin.native-sM_1s00t.mjs +108 -0
- package/dist/{TextColorPlugin.native-D6SmTglm.mjs → TextColorPlugin.native-Clgtb50j.mjs} +173 -92
- package/dist/colorSelectionApply-CK1My9N2.mjs +67 -0
- package/dist/core.css +1 -1
- package/dist/editora.min.js +31 -29
- package/dist/editora.umd.js +31 -29
- package/dist/index-CqWQFb3D.js +10 -0
- package/dist/index-OwnkG39N.mjs +2227 -0
- package/dist/index.cjs.js +14 -18
- package/dist/index.esm.js +204 -521
- package/dist/plugin-loader.js +26 -26
- package/dist/webcomponent-core.js +1286 -295
- package/dist/webcomponent-core.min.css +1 -1
- package/dist/webcomponent-core.min.js +100 -75
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +1 -1
- package/dist/webcomponent.js +1252 -261
- package/dist/webcomponent.min.css +1 -1
- package/dist/webcomponent.min.js +3616 -2109
- package/index.d.ts +355 -0
- package/package.json +19 -17
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +0 -1
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +0 -340
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +0 -1
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +0 -449
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +0 -1
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +0 -1
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +0 -1
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +0 -1
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +0 -153
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +0 -1
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +0 -27
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +0 -1
- package/dist/CodePlugin.native-CK9d8rmt.mjs.map +0 -1
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +0 -326
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +0 -1
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +0 -473
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +0 -1
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +0 -59
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +0 -1
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +0 -1
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +0 -1
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +0 -1
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +0 -106
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +0 -1
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +0 -186
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +0 -1
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +0 -128
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +0 -1
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +0 -1
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +0 -1
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +0 -89
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +0 -1
- package/dist/IndentPlugin.native-CbFugPoi.mjs +0 -133
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +0 -1
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +0 -1
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +0 -73
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +0 -1
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +0 -1
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +0 -1
- package/dist/MathPlugin.native-DE_ii-LA.mjs +0 -182
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +0 -1
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +0 -533
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +0 -1
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +0 -178
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +0 -1
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +0 -172
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +0 -1
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +0 -1
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +0 -1
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +0 -1
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +0 -465
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +0 -1
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +0 -43
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +0 -1
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +0 -1
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +0 -564
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +0 -1
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +0 -97
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +0 -1
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +0 -1
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +0 -1
- package/dist/documentManager-irzj9n3V.mjs.map +0 -1
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +0 -1
- package/dist/editora.min.js.map +0 -1
- package/dist/editora.umd.js.map +0 -1
- package/dist/index-BF5RBhL9.js +0 -4
- package/dist/index-BF5RBhL9.js.map +0 -1
- package/dist/index-BPsf460l.mjs +0 -1243
- package/dist/index-BPsf460l.mjs.map +0 -1
- package/dist/index.cjs.js.map +0 -1
- package/dist/index.es-CuicffkQ.mjs.map +0 -1
- package/dist/index.esm.js.map +0 -1
- package/dist/plugin-loader.js.map +0 -1
- package/dist/purify.es-CKpwg8Tk.mjs.map +0 -1
- package/dist/webcomponent-core.js.map +0 -1
- package/dist/webcomponent-core.min.js.map +0 -1
- package/dist/webcomponent.cjs.js.map +0 -1
- package/dist/webcomponent.esm.js.map +0 -1
- package/dist/webcomponent.js.map +0 -1
- package/dist/webcomponent.min.js.map +0 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { a as h } from "./colorSelectionApply-CK1My9N2.mjs";
|
|
2
|
+
let r = null, p = null, f = null, i = "#000000";
|
|
3
|
+
const s = '[data-theme="dark"], .dark, .editora-theme-dark', k = [
|
|
3
4
|
"#000000",
|
|
4
5
|
"#ffffff",
|
|
5
6
|
"#808080",
|
|
@@ -13,64 +14,80 @@ const y = [
|
|
|
13
14
|
"#800080",
|
|
14
15
|
"#ffc0cb"
|
|
15
16
|
];
|
|
16
|
-
function
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return
|
|
25
|
-
const t = o.getRangeAt(0), l = t.startContainer.nodeType === Node.TEXT_NODE ? t.startContainer.parentElement : t.startContainer, c = t.endContainer.nodeType === Node.TEXT_NODE ? t.endContainer.parentElement : t.endContainer;
|
|
26
|
-
let n = null, a = l;
|
|
27
|
-
for (; a && a !== document.body; ) {
|
|
28
|
-
if (a.classList.contains("rte-text-color")) {
|
|
29
|
-
const s = document.createRange();
|
|
30
|
-
if (s.selectNodeContents(a), s.compareBoundaryPoints(Range.START_TO_START, t) <= 0 && s.compareBoundaryPoints(Range.END_TO_END, t) >= 0) {
|
|
31
|
-
n = a;
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
a = a.parentElement;
|
|
17
|
+
function m() {
|
|
18
|
+
const e = window.getSelection();
|
|
19
|
+
if (e && e.rangeCount > 0) {
|
|
20
|
+
const l = e.getRangeAt(0).startContainer, c = l.nodeType === Node.ELEMENT_NODE ? l : l.parentElement;
|
|
21
|
+
if (c) {
|
|
22
|
+
const n = c.closest(
|
|
23
|
+
'[data-editora-editor="true"], .rte-editor, .editora-editor'
|
|
24
|
+
);
|
|
25
|
+
if (n) return n;
|
|
36
26
|
}
|
|
37
|
-
if (n)
|
|
38
|
-
return n.style.color = e, !0;
|
|
39
|
-
const p = document.createElement("span");
|
|
40
|
-
p.style.color = e, p.className = "rte-text-color";
|
|
41
|
-
const h = t.extractContents();
|
|
42
|
-
return p.appendChild(h), t.insertNode(p), t.setStartAfter(p), t.collapse(!0), o.removeAllRanges(), o.addRange(t), !0;
|
|
43
|
-
} catch (o) {
|
|
44
|
-
return console.error("Failed to set text color:", o), !1;
|
|
45
27
|
}
|
|
28
|
+
const t = document.activeElement;
|
|
29
|
+
return t ? t.closest(
|
|
30
|
+
'[data-editora-editor="true"], .rte-editor, .editora-editor'
|
|
31
|
+
) : null;
|
|
32
|
+
}
|
|
33
|
+
function y(e) {
|
|
34
|
+
const t = m();
|
|
35
|
+
if (t) {
|
|
36
|
+
const o = t.querySelector(
|
|
37
|
+
`[data-command="${e}"]`
|
|
38
|
+
);
|
|
39
|
+
if (o) return o;
|
|
40
|
+
}
|
|
41
|
+
return document.querySelector(`[data-command="${e}"]`);
|
|
42
|
+
}
|
|
43
|
+
function v(e) {
|
|
44
|
+
if (e != null && e.closest(s)) return !0;
|
|
45
|
+
const t = window.getSelection();
|
|
46
|
+
if (t && t.rangeCount > 0) {
|
|
47
|
+
const l = t.getRangeAt(0).startContainer, c = l.nodeType === Node.ELEMENT_NODE ? l : l.parentElement;
|
|
48
|
+
if (c != null && c.closest(s)) return !0;
|
|
49
|
+
}
|
|
50
|
+
const o = document.activeElement;
|
|
51
|
+
return o != null && o.closest(s) ? !0 : document.body.matches(s) || document.documentElement.matches(s);
|
|
46
52
|
}
|
|
47
|
-
function
|
|
53
|
+
function d(e) {
|
|
54
|
+
return h({
|
|
55
|
+
color: e,
|
|
56
|
+
className: "rte-text-color",
|
|
57
|
+
styleProperty: "color",
|
|
58
|
+
commands: ["foreColor"],
|
|
59
|
+
savedRange: f,
|
|
60
|
+
getActiveEditorRoot: m,
|
|
61
|
+
warnMessage: "[TextColor] Could not apply color for current selection"
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
function w() {
|
|
48
65
|
const e = window.getSelection();
|
|
49
66
|
if (!e || e.rangeCount === 0) return "#000000";
|
|
50
|
-
let
|
|
51
|
-
for (;
|
|
52
|
-
if (
|
|
53
|
-
const l =
|
|
67
|
+
let o = e.getRangeAt(0).startContainer;
|
|
68
|
+
for (; o && o !== document.body; ) {
|
|
69
|
+
if (o.nodeType === Node.ELEMENT_NODE) {
|
|
70
|
+
const l = o, c = l.style.color || window.getComputedStyle(l).color;
|
|
54
71
|
if (c && c !== "rgb(0, 0, 0)")
|
|
55
|
-
return
|
|
72
|
+
return C(c);
|
|
56
73
|
}
|
|
57
|
-
|
|
74
|
+
o = o.parentNode;
|
|
58
75
|
}
|
|
59
76
|
return "#000000";
|
|
60
77
|
}
|
|
61
|
-
function
|
|
78
|
+
function C(e) {
|
|
62
79
|
if (e.startsWith("#")) return e;
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
const
|
|
66
|
-
return "#" + [
|
|
67
|
-
const
|
|
68
|
-
return
|
|
80
|
+
const t = e.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
|
81
|
+
if (!t) return "#000000";
|
|
82
|
+
const o = parseInt(t[1]), l = parseInt(t[2]), c = parseInt(t[3]);
|
|
83
|
+
return "#" + [o, l, c].map((n) => {
|
|
84
|
+
const u = n.toString(16);
|
|
85
|
+
return u.length === 1 ? "0" + u : u;
|
|
69
86
|
}).join("");
|
|
70
87
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
|
|
88
|
+
function E(e) {
|
|
89
|
+
const t = window.getSelection();
|
|
90
|
+
t && t.rangeCount > 0 && (f = t.getRangeAt(0).cloneRange()), i = w(), r = document.createElement("div"), r.className = "rte-inline-color-picker", v(e) && r.classList.add("rte-theme-dark"), r.addEventListener("click", (l) => l.stopPropagation()), r.innerHTML = `
|
|
74
91
|
<div class="rte-color-picker-header">
|
|
75
92
|
<span class="rte-color-picker-title">Text Color</span>
|
|
76
93
|
<button class="rte-color-picker-close" aria-label="Close">×</button>
|
|
@@ -87,7 +104,7 @@ function C(e) {
|
|
|
87
104
|
<div class="rte-color-section">
|
|
88
105
|
<label class="rte-color-section-label">Colors</label>
|
|
89
106
|
<div class="rte-color-palette">
|
|
90
|
-
${
|
|
107
|
+
${k.map((l) => `
|
|
91
108
|
<button
|
|
92
109
|
class="rte-color-swatch ${i === l ? "selected" : ""}"
|
|
93
110
|
style="background-color: ${l}; ${l === "#ffffff" ? "border: 1px solid #ccc;" : ""}"
|
|
@@ -121,70 +138,70 @@ function C(e) {
|
|
|
121
138
|
</div>
|
|
122
139
|
</div>
|
|
123
140
|
`;
|
|
124
|
-
const
|
|
125
|
-
r.style.position = "absolute", r.style.top = `${
|
|
141
|
+
const o = e.getBoundingClientRect();
|
|
142
|
+
r.style.position = "absolute", r.style.top = `${o.bottom + window.scrollY + 4}px`, r.style.left = `${o.left + window.scrollX}px`, r.style.zIndex = "10000", document.body.appendChild(r), p = e, T();
|
|
126
143
|
}
|
|
127
|
-
function
|
|
144
|
+
function T() {
|
|
128
145
|
if (!r) return;
|
|
129
146
|
const e = r.querySelector(".rte-color-picker-close");
|
|
130
|
-
e == null || e.addEventListener("click", () =>
|
|
147
|
+
e == null || e.addEventListener("click", () => a()), r.querySelectorAll(".rte-color-swatch").forEach((c) => {
|
|
131
148
|
c.addEventListener("click", () => {
|
|
132
149
|
const n = c.getAttribute("data-color");
|
|
133
|
-
n && (i = n,
|
|
150
|
+
n && (i = n, d(n), a());
|
|
134
151
|
});
|
|
135
152
|
});
|
|
136
|
-
const
|
|
137
|
-
|
|
153
|
+
const o = r.querySelector(".rte-color-input-native");
|
|
154
|
+
o == null || o.addEventListener("change", (c) => {
|
|
138
155
|
const n = c.target.value;
|
|
139
|
-
i = n,
|
|
156
|
+
i = n, d(n), a();
|
|
140
157
|
});
|
|
141
158
|
const l = r.querySelector(".rte-color-input-text");
|
|
142
159
|
l == null || l.addEventListener("change", (c) => {
|
|
143
160
|
const n = c.target.value;
|
|
144
|
-
/^#[0-9A-Fa-f]{6}$/.test(n) && (i = n,
|
|
145
|
-
}),
|
|
161
|
+
/^#[0-9A-Fa-f]{6}$/.test(n) && (i = n, d(n), a());
|
|
162
|
+
}), o == null || o.addEventListener("input", (c) => {
|
|
146
163
|
const n = c.target.value;
|
|
147
|
-
i = n, x(n), b(n),
|
|
164
|
+
i = n, x(n), b(n), L(n);
|
|
148
165
|
}), l == null || l.addEventListener("input", (c) => {
|
|
149
166
|
const n = c.target.value;
|
|
150
|
-
/^#[0-9A-Fa-f]{6}$/.test(n) && (i = n, x(n), b(n),
|
|
167
|
+
/^#[0-9A-Fa-f]{6}$/.test(n) && (i = n, x(n), b(n), S(n));
|
|
151
168
|
});
|
|
152
169
|
}
|
|
153
170
|
function x(e) {
|
|
154
171
|
if (!r) return;
|
|
155
|
-
const
|
|
156
|
-
|
|
172
|
+
const t = r.querySelector(".rte-color-preview-box"), o = r.querySelector(".rte-color-preview-label");
|
|
173
|
+
t && (t.style.backgroundColor = e, t.style.border = e === "#ffffff" ? "1px solid #ccc" : "none"), o && (o.textContent = e.toUpperCase());
|
|
157
174
|
}
|
|
158
175
|
function b(e) {
|
|
159
176
|
if (!r) return;
|
|
160
|
-
r.querySelectorAll(".rte-color-swatch").forEach((
|
|
161
|
-
|
|
177
|
+
r.querySelectorAll(".rte-color-swatch").forEach((o) => {
|
|
178
|
+
o.getAttribute("data-color") === e ? o.classList.add("selected") : o.classList.remove("selected");
|
|
162
179
|
});
|
|
163
180
|
}
|
|
164
|
-
function
|
|
181
|
+
function S(e) {
|
|
165
182
|
if (!r) return;
|
|
166
|
-
const
|
|
167
|
-
|
|
183
|
+
const t = r.querySelector(".rte-color-input-native");
|
|
184
|
+
t && (t.value = e);
|
|
168
185
|
}
|
|
169
|
-
function
|
|
186
|
+
function L(e) {
|
|
170
187
|
if (!r) return;
|
|
171
|
-
const
|
|
172
|
-
|
|
188
|
+
const t = r.querySelector(".rte-color-input-text");
|
|
189
|
+
t && (t.value = e);
|
|
173
190
|
}
|
|
174
|
-
function
|
|
175
|
-
r && (r.remove(), r = null),
|
|
191
|
+
function a() {
|
|
192
|
+
r && (r.remove(), r = null), p = null, f = null;
|
|
176
193
|
}
|
|
177
|
-
function
|
|
194
|
+
function $() {
|
|
178
195
|
if (r)
|
|
179
|
-
return
|
|
180
|
-
const e =
|
|
181
|
-
return e ? (
|
|
196
|
+
return a(), !0;
|
|
197
|
+
const e = y("openTextColorPicker");
|
|
198
|
+
return e ? (E(e), !0) : !1;
|
|
182
199
|
}
|
|
183
|
-
function
|
|
200
|
+
function g() {
|
|
184
201
|
if (!window.__textColorPluginInitialized && (window.__textColorPluginInitialized = !0, document.addEventListener("click", (e) => {
|
|
185
|
-
if (r &&
|
|
186
|
-
const
|
|
187
|
-
!r.contains(
|
|
202
|
+
if (r && p) {
|
|
203
|
+
const t = e.target;
|
|
204
|
+
!r.contains(t) && !p.contains(t) && a();
|
|
188
205
|
}
|
|
189
206
|
}), !document.getElementById("text-color-plugin-styles"))) {
|
|
190
207
|
const e = document.createElement("style");
|
|
@@ -373,11 +390,75 @@ function m() {
|
|
|
373
390
|
.rte-btn-secondary:hover {
|
|
374
391
|
background-color: #eeeeee;
|
|
375
392
|
}
|
|
393
|
+
|
|
394
|
+
.rte-inline-color-picker.rte-theme-dark {
|
|
395
|
+
background: #1f2937;
|
|
396
|
+
border: 1px solid #4b5563;
|
|
397
|
+
box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-picker-header {
|
|
401
|
+
border-bottom-color: #3b4657;
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-picker-title {
|
|
405
|
+
color: #e2e8f0;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-picker-close {
|
|
409
|
+
color: #94a3b8;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-picker-close:hover {
|
|
413
|
+
color: #f8fafc;
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-preview-section {
|
|
417
|
+
background-color: #111827;
|
|
418
|
+
border-color: #4b5563;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-preview-label {
|
|
422
|
+
color: #cbd5e1;
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-section-label {
|
|
426
|
+
color: #9fb0c6;
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-swatch {
|
|
430
|
+
border-color: #4b5563;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-swatch:hover {
|
|
434
|
+
border-color: #7a8ba5;
|
|
435
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-swatch.selected {
|
|
439
|
+
border-color: #58a6ff;
|
|
440
|
+
box-shadow: 0 0 0 1px rgba(88, 166, 255, 0.4);
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-input-native,
|
|
444
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-input-text {
|
|
445
|
+
background: #111827;
|
|
446
|
+
border-color: #4b5563;
|
|
447
|
+
color: #e2e8f0;
|
|
448
|
+
}
|
|
449
|
+
|
|
450
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-input-text::placeholder {
|
|
451
|
+
color: #94a3b8;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.rte-inline-color-picker.rte-theme-dark .rte-color-input-text:focus {
|
|
455
|
+
border-color: #58a6ff;
|
|
456
|
+
}
|
|
376
457
|
`, document.head.appendChild(e);
|
|
377
458
|
}
|
|
378
459
|
}
|
|
379
|
-
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded",
|
|
380
|
-
const
|
|
460
|
+
document.readyState === "loading" ? document.addEventListener("DOMContentLoaded", g) : setTimeout(g, 100);
|
|
461
|
+
const A = () => ({
|
|
381
462
|
name: "textColor",
|
|
382
463
|
marks: {
|
|
383
464
|
textColor: {
|
|
@@ -388,24 +469,24 @@ const R = () => ({
|
|
|
388
469
|
{
|
|
389
470
|
tag: "span[style*=color]",
|
|
390
471
|
getAttrs: (e) => {
|
|
391
|
-
const
|
|
392
|
-
return
|
|
472
|
+
const o = (e.getAttribute("style") || "").match(/color:\s*([^;]+)/);
|
|
473
|
+
return o ? { color: o[1] } : null;
|
|
393
474
|
}
|
|
394
475
|
},
|
|
395
476
|
{
|
|
396
477
|
tag: "font[color]",
|
|
397
478
|
getAttrs: (e) => {
|
|
398
|
-
const
|
|
399
|
-
return
|
|
479
|
+
const t = e.getAttribute("color");
|
|
480
|
+
return t ? { color: t } : null;
|
|
400
481
|
}
|
|
401
482
|
}
|
|
402
483
|
],
|
|
403
484
|
toDOM: (e) => {
|
|
404
|
-
var
|
|
485
|
+
var t;
|
|
405
486
|
return [
|
|
406
487
|
"span",
|
|
407
488
|
{
|
|
408
|
-
style: `color: ${((
|
|
489
|
+
style: `color: ${((t = e.attrs) == null ? void 0 : t.color) || "#000000"}`,
|
|
409
490
|
class: "rte-text-color"
|
|
410
491
|
},
|
|
411
492
|
0
|
|
@@ -421,12 +502,12 @@ const R = () => ({
|
|
|
421
502
|
}
|
|
422
503
|
],
|
|
423
504
|
commands: {
|
|
424
|
-
openTextColorPicker: () =>
|
|
425
|
-
setTextColor: (e) => e ?
|
|
505
|
+
openTextColorPicker: () => $(),
|
|
506
|
+
setTextColor: (e) => e ? d(e) : !1
|
|
426
507
|
},
|
|
427
508
|
keymap: {}
|
|
428
509
|
});
|
|
429
510
|
export {
|
|
430
|
-
|
|
511
|
+
A as TextColorPlugin
|
|
431
512
|
};
|
|
432
|
-
//# sourceMappingURL=TextColorPlugin.native-
|
|
513
|
+
//# sourceMappingURL=TextColorPlugin.native-Clgtb50j.mjs.map
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
package/dist/core.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.rte-table,table{border-collapse:collapse;width:100%;margin:1rem 0;border:1px solid #ddd;font-size:14px;line-height:1.4;position:relative}.rte-table td,.rte-table th,table td,table th{border:1px solid #ddd;padding:8px 12px;min-width:80px;vertical-align:top;position:relative;user-select:none}.rte-table td:focus,.rte-table th:focus,table td:focus,table th:focus{outline:2px solid #007acc;outline-offset:-2px}.rte-table th,table th{background-color:#f8f9fa;font-weight:600;text-align:left}.rte-table td p,table td p{margin:0;padding:0}.rte-table td p:empty:before,table td p:empty:before{content:"";display:inline-block}.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before{content:"Type here...";color:#999;font-style:italic;pointer-events:none}.rte-table tr:hover,table tr:hover{background-color:#f8f9fa}.rte-table td.selected,table td.selected{background-color:#e3f2fd;border-color:#2196f3}.table-toolbar{background:#fff;border:1px solid #d0d0d0;border-radius:4px;box-shadow:0 2px 8px #0000001a;padding:4px;display:flex;align-items:center;gap:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;min-width:max-content}.toolbar-section{display:flex;align-items:center;gap:2px}.toolbar-divider{width:1px;height:20px;background:#e0e0e0;margin:0 4px}.toolbar-icon-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid transparent;background:transparent;cursor:pointer;color:#333;border-radius:3px;transition:all .2s ease;flex-shrink:0;font-size:14px;line-height:1}.toolbar-icon-btn svg{width:16px;height:16px}.toolbar-icon-btn:hover:not(:disabled){background:#f0f0f0;border-color:#d0d0d0;color:#06c}.toolbar-icon-btn:active:not(:disabled){background:#e8f0ff;border-color:#06c;transform:scale(.95)}.toolbar-icon-btn:disabled{opacity:.4;cursor:not-allowed;color:#ccc}.toolbar-icon-btn-danger{color:#d32f2f}.toolbar-icon-btn-danger:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-danger:active:not(:disabled){background:#ffebee}.toolbar-icon-btn-delete{color:#d32f2f}.toolbar-icon-btn-delete:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-delete:active:not(:disabled){background:#ffebee}.resize-handle{opacity:0;transition:all .15s ease}.resize-handle:hover{opacity:1}td:hover>.resize-handle,th:hover>.resize-handle{opacity:1}.table-resize-handle{position:absolute;bottom:-4px;right:-4px;width:12px;height:12px;background:transparent;cursor:nwse-resize;z-index:10;transition:background .15s ease}.table-resize-handle:after{content:"";position:absolute;bottom:0;right:0;width:8px;height:8px;background:#0066cc4d;border-bottom:2px solid #0066cc;border-right:2px solid #0066cc;border-radius:0 0 2px;opacity:0;transition:opacity .15s ease}.table-resize-handle:hover:after{opacity:1}.rte-table:hover .table-resize-handle:after,table:hover .table-resize-handle:after{opacity:1}@media(max-width:768px){.rte-table,table{font-size:12px}.rte-table td,.rte-table th,table td,table th{padding:4px 6px;min-width:60px}.table-toolbar{padding:3px;gap:0;max-width:90vw;overflow-x:auto}.toolbar-icon-btn{width:26px;height:26px}.toolbar-divider{height:18px}}@media print{.rte-table,table{border:1px solid #000}.rte-table td,.rte-table th,table td,table th{border:1px solid #000;padding:4px}.table-toolbar{display:none}}
|
|
1
|
+
.rte-table,table{border-collapse:collapse;width:100%;margin:1rem 0;border:1px solid #ddd;font-size:14px;line-height:1.4;position:relative}.rte-table td,.rte-table th,table td,table th{border:1px solid #ddd;padding:8px 12px;min-width:80px;vertical-align:top;position:relative;user-select:none}.rte-table td:focus,.rte-table th:focus,table td:focus,table th:focus{outline:2px solid #007acc;outline-offset:-2px}.rte-table th,table th{background-color:#f8f9fa;font-weight:600;text-align:left}.rte-table td p,table td p{margin:0;padding:0}.rte-table td p:empty:before,table td p:empty:before{content:"";display:inline-block}.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before{content:"Type here...";color:#999;font-style:italic;pointer-events:none}.rte-table tr:hover,table tr:hover{background-color:#f8f9fa}.rte-table td.selected,table td.selected{background-color:#e3f2fd;border-color:#2196f3}.table-toolbar{background:#fff;border:1px solid #d0d0d0;border-radius:4px;box-shadow:0 2px 8px #0000001a;padding:4px;display:flex;align-items:center;gap:0;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,sans-serif;min-width:max-content}.toolbar-section{display:flex;align-items:center;gap:2px}.toolbar-divider{width:1px;height:20px;background:#e0e0e0;margin:0 4px}.toolbar-icon-btn{display:flex;align-items:center;justify-content:center;width:28px;height:28px;padding:0;border:1px solid transparent;background:transparent;cursor:pointer;color:#333;border-radius:3px;transition:all .2s ease;flex-shrink:0;font-size:14px;line-height:1}.toolbar-icon-btn svg{width:16px;height:16px}.toolbar-icon-btn:hover:not(:disabled){background:#f0f0f0;border-color:#d0d0d0;color:#06c}.toolbar-icon-btn:active:not(:disabled){background:#e8f0ff;border-color:#06c;transform:scale(.95)}.toolbar-icon-btn:disabled{opacity:.4;cursor:not-allowed;color:#ccc}.toolbar-icon-btn-danger{color:#d32f2f}.toolbar-icon-btn-danger:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-danger:active:not(:disabled){background:#ffebee}.toolbar-icon-btn-delete{color:#d32f2f}.toolbar-icon-btn-delete:hover:not(:disabled){background:#fff3f3;border-color:#fcc;color:#d32f2f}.toolbar-icon-btn-delete:active:not(:disabled){background:#ffebee}.resize-handle{opacity:0;transition:all .15s ease}.resize-handle:hover{opacity:1}td:hover>.resize-handle,th:hover>.resize-handle{opacity:1}.table-resize-handle{position:absolute;bottom:-4px;right:-4px;width:12px;height:12px;background:transparent;cursor:nwse-resize;z-index:10;transition:background .15s ease}.table-resize-handle:after{content:"";position:absolute;bottom:0;right:0;width:8px;height:8px;background:#0066cc4d;border-bottom:2px solid #0066cc;border-right:2px solid #0066cc;border-radius:0 0 2px;opacity:0;transition:opacity .15s ease}.table-resize-handle:hover:after{opacity:1}.rte-table:hover .table-resize-handle:after,table:hover .table-resize-handle:after{opacity:1}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table,table){border-color:#607088;background:#24303c;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td,.rte-table th,table td,table th){border-color:#607088;color:#e6eefb}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table th,table th){background:linear-gradient(180deg,#3b4553,#333d4a);color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table tr:hover,table tr:hover){background-color:#58a6ff1f}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td.selected,table td.selected){background-color:#58a6ff47;border-color:#79beff}:is([data-theme=dark],.dark,.editora-theme-dark) :is(.rte-table td[contenteditable]:empty:before,table td[contenteditable]:empty:before){color:#94a3b8}:is([data-theme=dark],.dark,.editora-theme-dark) .table-toolbar{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}.table-toolbar.rte-theme-dark{background:linear-gradient(180deg,#2f3844,#2a323c);border-color:#4d596b;box-shadow:0 8px 20px #00000073}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-divider{background:#4d596b}.table-toolbar.rte-theme-dark .toolbar-divider{background:#4d596b}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn{color:#d7deea;border-color:transparent}.table-toolbar.rte-theme-dark .toolbar-icon-btn{color:#d7deea;border-color:transparent}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg{color:currentColor;fill:currentColor}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg{color:currentColor;fill:currentColor}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [stroke=black i]{stroke:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill="#000000" i],:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill="#000000" i],.table-toolbar.rte-theme-dark .toolbar-icon-btn svg [fill=black i]{fill:currentColor!important}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}.table-toolbar.rte-theme-dark .toolbar-icon-btn:hover:not(:disabled){background:#3a4554;border-color:#607088;color:#f3f8ff}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}.table-toolbar.rte-theme-dark .toolbar-icon-btn:active:not(:disabled){background:#4a95de;border-color:#67adf4;color:#0f1b2a}:is([data-theme=dark],.dark,.editora-theme-dark) .toolbar-icon-btn:disabled{color:#7f8ca1}.table-toolbar.rte-theme-dark .toolbar-icon-btn:disabled{color:#7f8ca1}@media(max-width:768px){.rte-table,table{font-size:12px}.rte-table td,.rte-table th,table td,table th{padding:4px 6px;min-width:60px}.table-toolbar{padding:3px;gap:0;max-width:90vw;overflow-x:auto}.toolbar-icon-btn{width:26px;height:26px}.toolbar-divider{height:18px}}@media print{.rte-table,table{border:1px solid #000}.rte-table td,.rte-table th,table td,table th{border:1px solid #000;padding:4px}.table-toolbar{display:none}}
|