@editora/core 1.0.1 → 1.0.2
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 +9 -0
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs +475 -0
- package/dist/A11yCheckerPlugin.native-CZKpi3uF.mjs.map +1 -0
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs +340 -0
- package/dist/AnchorPlugin.native-7es9PVZ9.mjs.map +1 -0
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs +449 -0
- package/dist/BackgroundColorPlugin.native-Dip5uqTg.mjs.map +1 -0
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs +48 -0
- package/dist/BlockquotePlugin.native-JFmOLsxN.mjs.map +1 -0
- package/dist/BoldPlugin.native-BAzzoqU5.mjs +45 -0
- package/dist/BoldPlugin.native-BAzzoqU5.mjs.map +1 -0
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs +79 -0
- package/dist/CapitalizationPlugin.native-DOMsh5R7.mjs.map +1 -0
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs +153 -0
- package/dist/ChecklistPlugin.native-Dccs3nLe.mjs.map +1 -0
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs +27 -0
- package/dist/ClearFormattingPlugin.native-BZPDHswo.mjs.map +1 -0
- package/dist/CodePlugin.native-DD9xFIid.mjs +1679 -0
- package/dist/CodePlugin.native-DD9xFIid.mjs.map +1 -0
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs +326 -0
- package/dist/CodeSamplePlugin.native-DMbEdO9j.mjs.map +1 -0
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs +473 -0
- package/dist/CommentsPlugin.native-2zQV8Ia4.mjs.map +1 -0
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs +59 -0
- package/dist/DirectionPlugin.native-Be7wCzkI.mjs.map +1 -0
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs +116 -0
- package/dist/DocumentManagerPlugin.native-BvZL5CSG.mjs.map +1 -0
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs +461 -0
- package/dist/EmbedIframePlugin.native-ifr9KLdN.mjs.map +1 -0
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs +1033 -0
- package/dist/EmojisPlugin.native-D6mJSnSR.mjs.map +1 -0
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs +106 -0
- package/dist/FontFamilyPlugin.native-BzS_9qbM.mjs.map +1 -0
- package/dist/FontSizePlugin.native-DkLMLPue.mjs +186 -0
- package/dist/FontSizePlugin.native-DkLMLPue.mjs.map +1 -0
- package/dist/FootnotePlugin.native-BciVc9W6.mjs +128 -0
- package/dist/FootnotePlugin.native-BciVc9W6.mjs.map +1 -0
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs +77 -0
- package/dist/FullscreenPlugin.native-ChXyxeNw.mjs.map +1 -0
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs +64 -0
- package/dist/HeadingPlugin.native-DrLYwQnQ.mjs.map +1 -0
- package/dist/HistoryPlugin.native-DoDRifCf.mjs +89 -0
- package/dist/HistoryPlugin.native-DoDRifCf.mjs.map +1 -0
- package/dist/IndentPlugin.native-CbFugPoi.mjs +133 -0
- package/dist/IndentPlugin.native-CbFugPoi.mjs.map +1 -0
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs +43 -0
- package/dist/ItalicPlugin.native-CQjjDyUL.mjs.map +1 -0
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs +73 -0
- package/dist/LineHeightPlugin.native-CWQT2FIa.mjs.map +1 -0
- package/dist/LinkPlugin.native-BdAOV-iu.mjs +206 -0
- package/dist/LinkPlugin.native-BdAOV-iu.mjs.map +1 -0
- package/dist/ListPlugin.native-CLFU5AUQ.mjs +59 -0
- package/dist/ListPlugin.native-CLFU5AUQ.mjs.map +1 -0
- package/dist/MathPlugin.native-DE_ii-LA.mjs +182 -0
- package/dist/MathPlugin.native-DE_ii-LA.mjs.map +1 -0
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs +533 -0
- package/dist/MediaManagerPlugin.native-DaYFDzNM.mjs.map +1 -0
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs +178 -0
- package/dist/MergeTagPlugin.native-CrxyThyn.mjs.map +1 -0
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs +172 -0
- package/dist/PageBreakPlugin.native-DDjcDyRW.mjs.map +1 -0
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs +322 -0
- package/dist/PreviewPlugin.native-DBvfpmIv.mjs.map +1 -0
- package/dist/PrintPlugin.native-BUpm52VJ.mjs +311 -0
- package/dist/PrintPlugin.native-BUpm52VJ.mjs.map +1 -0
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs +731 -0
- package/dist/SpecialCharactersPlugin.native-x7a2SWXc.mjs.map +1 -0
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs +465 -0
- package/dist/SpellCheckPlugin.native-B7yTh0iE.mjs.map +1 -0
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs +43 -0
- package/dist/StrikethroughPlugin.native-ChaZLaXw.mjs.map +1 -0
- package/dist/TablePlugin.native-EEWXn1-s.mjs +491 -0
- package/dist/TablePlugin.native-EEWXn1-s.mjs.map +1 -0
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs +564 -0
- package/dist/TemplatePlugin.native-BlSn1c9h.mjs.map +1 -0
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs +97 -0
- package/dist/TextAlignmentPlugin.native-CQIs1m7R.mjs.map +1 -0
- package/dist/TextColorPlugin.native-D6SmTglm.mjs +432 -0
- package/dist/TextColorPlugin.native-D6SmTglm.mjs.map +1 -0
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs +35 -0
- package/dist/UnderlinePlugin.native-QpIcK4L2.mjs.map +1 -0
- package/dist/documentManager-irzj9n3V.mjs +37627 -0
- package/dist/documentManager-irzj9n3V.mjs.map +1 -0
- package/dist/editorContainerHelpers-C7kdWnS0.mjs +27 -0
- package/dist/editorContainerHelpers-C7kdWnS0.mjs.map +1 -0
- package/dist/editora.min.js +14 -12
- package/dist/editora.min.js.map +1 -1
- package/dist/editora.umd.js +14 -12
- package/dist/editora.umd.js.map +1 -1
- package/dist/index-BF5RBhL9.js +4 -0
- package/dist/index-BF5RBhL9.js.map +1 -0
- package/dist/{index-BS4zT-KN.mjs → index-BPsf460l.mjs} +286 -162
- package/dist/index-BPsf460l.mjs.map +1 -0
- package/dist/index.cjs.js +3 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es-CuicffkQ.mjs +6665 -0
- package/dist/index.es-CuicffkQ.mjs.map +1 -0
- package/dist/index.esm.js +117 -112
- package/dist/index.esm.js.map +1 -1
- package/dist/plugin-loader.js +55 -0
- package/dist/plugin-loader.js.map +1 -0
- package/dist/purify.es-CKpwg8Tk.mjs +471 -0
- package/dist/purify.es-CKpwg8Tk.mjs.map +1 -0
- package/dist/webcomponent-core.js +1243 -0
- package/dist/webcomponent-core.js.map +1 -0
- package/dist/webcomponent-core.min.css +1 -0
- package/dist/webcomponent-core.min.js +597 -0
- package/dist/webcomponent-core.min.js.map +1 -0
- package/dist/webcomponent.cjs.js +1 -1
- package/dist/webcomponent.esm.js +3 -3
- package/dist/webcomponent.js +1286 -0
- package/dist/webcomponent.js.map +1 -0
- package/dist/webcomponent.min.css +1 -0
- package/dist/webcomponent.min.js +337 -334
- package/dist/webcomponent.min.js.map +1 -1
- package/package.json +16 -4
- package/dist/index-BK2lHfHK.js +0 -2
- package/dist/index-BK2lHfHK.js.map +0 -1
- package/dist/index-BS4zT-KN.mjs.map +0 -1
- package/dist/webcomponent.umd.js +0 -4073
- package/dist/webcomponent.umd.js.map +0 -1
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
const i = () => ({
|
|
2
|
+
name: "document-manager",
|
|
3
|
+
toolbar: [
|
|
4
|
+
{
|
|
5
|
+
label: "Import Word",
|
|
6
|
+
command: "importWord",
|
|
7
|
+
icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z"></path><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z"></path></svg>',
|
|
8
|
+
type: "button"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
label: "Export Word",
|
|
12
|
+
command: "exportWord",
|
|
13
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',
|
|
14
|
+
type: "button"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
label: "Export PDF",
|
|
18
|
+
command: "exportPdf",
|
|
19
|
+
icon: '<svg width="24" height="24" focusable="false"><path fill-rule="evenodd" clip-rule="evenodd" d="M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z"></path><path d="M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z"></path></svg>',
|
|
20
|
+
type: "button"
|
|
21
|
+
}
|
|
22
|
+
],
|
|
23
|
+
commands: {
|
|
24
|
+
importWord: () => {
|
|
25
|
+
const d = () => {
|
|
26
|
+
const e = window.getSelection();
|
|
27
|
+
if (e && e.rangeCount > 0) {
|
|
28
|
+
let r = e.getRangeAt(0).startContainer;
|
|
29
|
+
for (; r && r !== document.body; ) {
|
|
30
|
+
if (r.nodeType === Node.ELEMENT_NODE) {
|
|
31
|
+
const l = r;
|
|
32
|
+
if (l.getAttribute("contenteditable") === "true")
|
|
33
|
+
return l;
|
|
34
|
+
}
|
|
35
|
+
r = r.parentNode;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
const n = document.activeElement;
|
|
39
|
+
if ((n == null ? void 0 : n.getAttribute("contenteditable")) === "true")
|
|
40
|
+
return n;
|
|
41
|
+
const t = n == null ? void 0 : n.closest('[contenteditable="true"]');
|
|
42
|
+
return t || document.querySelector('[contenteditable="true"]');
|
|
43
|
+
}, o = document.createElement("input");
|
|
44
|
+
return o.type = "file", o.accept = ".docx", o.onchange = async (e) => {
|
|
45
|
+
var t;
|
|
46
|
+
const n = (t = e.target.files) == null ? void 0 : t[0];
|
|
47
|
+
if (n)
|
|
48
|
+
try {
|
|
49
|
+
const r = d();
|
|
50
|
+
if (r) {
|
|
51
|
+
const { importFromWord: l } = await import("./documentManager-irzj9n3V.mjs").then((c) => c.d), a = await l(n);
|
|
52
|
+
r.innerHTML = a, r.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
53
|
+
}
|
|
54
|
+
} catch (r) {
|
|
55
|
+
console.error("Import failed:", r), alert("Failed to import Word document. Please check the console for details.");
|
|
56
|
+
}
|
|
57
|
+
}, o.click(), !0;
|
|
58
|
+
},
|
|
59
|
+
exportWord: async () => {
|
|
60
|
+
const d = () => {
|
|
61
|
+
const o = window.getSelection();
|
|
62
|
+
if (o && o.rangeCount > 0) {
|
|
63
|
+
let t = o.getRangeAt(0).startContainer;
|
|
64
|
+
for (; t && t !== document.body; ) {
|
|
65
|
+
if (t.nodeType === Node.ELEMENT_NODE && t.getAttribute("contenteditable") === "true")
|
|
66
|
+
return t;
|
|
67
|
+
t = t.parentNode;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const e = document.activeElement;
|
|
71
|
+
return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
const o = d();
|
|
75
|
+
if (o) {
|
|
76
|
+
const e = o.innerHTML, { exportToWord: n } = await import("./documentManager-irzj9n3V.mjs").then((t) => t.d);
|
|
77
|
+
await n(e, "document.docx");
|
|
78
|
+
}
|
|
79
|
+
return !0;
|
|
80
|
+
} catch (o) {
|
|
81
|
+
return console.error("Export failed:", o), alert("Failed to export to Word. Please check the console for details."), !1;
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
exportPdf: async () => {
|
|
85
|
+
const d = () => {
|
|
86
|
+
const o = window.getSelection();
|
|
87
|
+
if (o && o.rangeCount > 0) {
|
|
88
|
+
let t = o.getRangeAt(0).startContainer;
|
|
89
|
+
for (; t && t !== document.body; ) {
|
|
90
|
+
if (t.nodeType === Node.ELEMENT_NODE && t.getAttribute("contenteditable") === "true")
|
|
91
|
+
return t;
|
|
92
|
+
t = t.parentNode;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
const e = document.activeElement;
|
|
96
|
+
return (e == null ? void 0 : e.getAttribute("contenteditable")) === "true" ? e : (e == null ? void 0 : e.closest('[contenteditable="true"]')) || document.querySelector('[contenteditable="true"]');
|
|
97
|
+
};
|
|
98
|
+
try {
|
|
99
|
+
const o = d();
|
|
100
|
+
if (o) {
|
|
101
|
+
const e = o.innerHTML, { exportToPdf: n } = await import("./documentManager-irzj9n3V.mjs").then((t) => t.d);
|
|
102
|
+
await n(e, "document.pdf", o);
|
|
103
|
+
} else
|
|
104
|
+
console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
|
|
105
|
+
return !0;
|
|
106
|
+
} catch (o) {
|
|
107
|
+
return console.error("PDF Export: Export failed:", o), alert("Failed to export to PDF. Please check the console for details."), !1;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
keymap: {}
|
|
112
|
+
});
|
|
113
|
+
export {
|
|
114
|
+
i as DocumentManagerPlugin
|
|
115
|
+
};
|
|
116
|
+
//# sourceMappingURL=DocumentManagerPlugin.native-BvZL5CSG.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DocumentManagerPlugin.native-BvZL5CSG.mjs","sources":["../../plugins/document-manager/src/DocumentManagerPlugin.native.ts"],"sourcesContent":["import type { Plugin } from '@editora/core';\n\n/**\n * DocumentManagerPlugin - Native implementation for document import/export\n * \n * Features:\n * - Import from Microsoft Word (.docx) using mammoth library\n * - Export to Microsoft Word (.docx) via API server\n * - Export to PDF using jsPDF and html2canvas\n * \n * Commands:\n * - importWord: Opens file picker to import .docx files and convert to HTML\n * - exportWord: Sends HTML content to API server for .docx conversion\n * - exportPdf: Generates PDF using canvas rendering\n * \n * UI/UX Features:\n * - File picker with .docx filter for import\n * - Async operations with proper error handling\n * - User-friendly error alerts\n * - Professional icons matching React implementation\n * \n * Dependencies:\n * - mammoth: Word document parsing\n * - jsPDF: PDF generation\n * - html2canvas: HTML to canvas conversion for PDF\n * \n * Configuration:\n * Use setDocumentManagerConfig() to configure API endpoints for Word export\n */\nexport const DocumentManagerPlugin = (): Plugin => {\n return {\n name: 'document-manager',\n \n toolbar: [\n {\n label: 'Import Word',\n command: 'importWord',\n icon: '<svg width=\"24\" height=\"24\" focusable=\"false\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 3h7.4L19 7.6V15h-2V9h-4V5H5c0-1.1.9-2 2-2Z\"></path><path d=\"M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z\"></path><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M11.4 18.2a1 1 0 0 0 1.2 1.6l1.4-1V22a1 1 0 1 0 2 0v-3.1l1.4 1a1 1 0 0 0 1.2-1.7L15 15.8l-3.6 2.4Z\"></path></svg>',\n type: 'button'\n },\n {\n label: 'Export Word',\n command: 'exportWord',\n icon: '<svg width=\"24\" height=\"24\" focusable=\"false\"><path d=\"M9.5 7A1.5 1.5 0 0 1 11 8.4v7.1A1.5 1.5 0 0 1 9.6 17H2.5A1.5 1.5 0 0 1 1 15.6V8.5A1.5 1.5 0 0 1 2.4 7h7.1Zm-1 2.8-1 2.6-1-2.5v-.1a.6.6 0 0 0-1 0l-.1.1-.9 2.5-1-2.5v-.1a.6.6 0 0 0-1 .4v.1l1.5 4v.1a.6.6 0 0 0 1 0v-.1l1-2.5.9 2.5v.1a.6.6 0 0 0 1 0H8l1.6-4v-.2a.6.6 0 0 0-1.1-.4Z\"></path><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2ZM15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z\"></path></svg>',\n type: 'button'\n },\n {\n label: 'Export PDF',\n command: 'exportPdf',\n icon: '<svg width=\"24\" height=\"24\" focusable=\"false\"><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M7 3h7.4L19 7.6V17h-2V9h-4V5H7v3H5V5c0-1.1.9-2 2-2Z\"></path><path d=\"M2.6 15.2v-1.9h1c.6 0 1-.2 1.4-.5.3-.3.5-.7.5-1.2s-.2-.9-.5-1.2a2 2 0 0 0-1.3-.4H1v5.2h1.6Zm.4-3h-.4v-1.1h.5l.6.1.2.5c0 .1 0 .3-.2.4l-.7.1Zm5.7 3 1-.1c.3 0 .5-.2.7-.4l.5-.8c.2-.3.2-.7.2-1.3v-1l-.5-.8c-.2-.3-.4-.5-.7-.6L8.7 10H6.3v5.2h2.4Zm-.4-1.1H8v-3h.4c.5 0 .8.2 1 .4l.2 1.1-.1 1-.3.3-.8.2Zm5.3 1.2V13h2v-1h-2v-1H16V10h-4v5.2h1.6Z\"></path><path fill-rule=\"evenodd\" clip-rule=\"evenodd\" d=\"M15 17a1 1 0 1 0-2 0v3.1l-1.4-1a1 1 0 1 0-1.2 1.7l3.6 2.4 3.6-2.4a1 1 0 0 0-1.2-1.6l-1.4 1V17Z\"></path></svg>',\n type: 'button'\n }\n ],\n \n commands: {\n importWord: () => {\n // Helper to find active editor\n const findActiveEditor = (): HTMLElement | null => {\n const selection = window.getSelection();\n if (selection && selection.rangeCount > 0) {\n let node: Node | null = selection.getRangeAt(0).startContainer;\n while (node && node !== document.body) {\n if (node.nodeType === Node.ELEMENT_NODE) {\n const element = node as HTMLElement;\n if (element.getAttribute('contenteditable') === 'true') {\n return element;\n }\n }\n node = node.parentNode;\n }\n }\n const activeElement = document.activeElement;\n if (activeElement?.getAttribute('contenteditable') === 'true') {\n return activeElement as HTMLElement;\n }\n const editor = activeElement?.closest('[contenteditable=\"true\"]');\n if (editor) return editor as HTMLElement;\n return document.querySelector('[contenteditable=\"true\"]');\n };\n \n const input = document.createElement('input');\n input.type = 'file';\n input.accept = '.docx';\n \n input.onchange = async (event) => {\n const file = (event.target as HTMLInputElement).files?.[0];\n if (file) {\n try {\n const editorElement = findActiveEditor();\n if (editorElement) {\n const { importFromWord } = await import('./documentManager');\n const htmlContent = await importFromWord(file);\n editorElement.innerHTML = htmlContent;\n editorElement.dispatchEvent(new Event('input', { bubbles: true }));\n }\n } catch (error) {\n console.error('Import failed:', error);\n alert('Failed to import Word document. Please check the console for details.');\n }\n }\n };\n \n input.click();\n return true;\n },\n \n exportWord: async () => {\n const findActiveEditor = (): HTMLElement | null => {\n const selection = window.getSelection();\n if (selection && selection.rangeCount > 0) {\n let node: Node | null = selection.getRangeAt(0).startContainer;\n while (node && node !== document.body) {\n if (node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).getAttribute('contenteditable') === 'true') {\n return node as HTMLElement;\n }\n node = node.parentNode;\n }\n }\n const activeElement = document.activeElement;\n if (activeElement?.getAttribute('contenteditable') === 'true') return activeElement as HTMLElement;\n const editor = activeElement?.closest('[contenteditable=\"true\"]');\n return (editor as HTMLElement) || document.querySelector('[contenteditable=\"true\"]');\n };\n \n try {\n const editorElement = findActiveEditor();\n if (editorElement) {\n const htmlContent = editorElement.innerHTML;\n const { exportToWord } = await import('./documentManager');\n await exportToWord(htmlContent, 'document.docx');\n }\n return true;\n } catch (error) {\n console.error('Export failed:', error);\n alert('Failed to export to Word. Please check the console for details.');\n return false;\n }\n },\n \n exportPdf: async () => {\n const findActiveEditor = (): HTMLElement | null => {\n const selection = window.getSelection();\n if (selection && selection.rangeCount > 0) {\n let node: Node | null = selection.getRangeAt(0).startContainer;\n while (node && node !== document.body) {\n if (node.nodeType === Node.ELEMENT_NODE && (node as HTMLElement).getAttribute('contenteditable') === 'true') {\n return node as HTMLElement;\n }\n node = node.parentNode;\n }\n }\n const activeElement = document.activeElement;\n if (activeElement?.getAttribute('contenteditable') === 'true') return activeElement as HTMLElement;\n const editor = activeElement?.closest('[contenteditable=\"true\"]');\n return (editor as HTMLElement) || document.querySelector('[contenteditable=\"true\"]');\n };\n \n try {\n const editorElement = findActiveEditor();\n if (editorElement) {\n const htmlContent = editorElement.innerHTML;\n const { exportToPdf } = await import('./documentManager');\n await exportToPdf(htmlContent, 'document.pdf', editorElement);\n } else {\n console.error('PDF Export: No editor element found');\n alert('No active editor found. Please click in the editor area first.');\n }\n return true;\n } catch (error) {\n console.error('PDF Export: Export failed:', error);\n alert('Failed to export to PDF. Please check the console for details.');\n return false;\n }\n }\n },\n \n keymap: {}\n };\n};\n"],"names":["DocumentManagerPlugin","findActiveEditor","selection","node","element","activeElement","editor","input","event","_a","file","editorElement","importFromWord","n","htmlContent","error","exportToWord","exportToPdf"],"mappings":"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"}
|
|
@@ -0,0 +1,461 @@
|
|
|
1
|
+
const D = [
|
|
2
|
+
{ label: "Inline Value", value: "inline" },
|
|
3
|
+
{ label: "Responsive - 21x9", value: "21x9" },
|
|
4
|
+
{ label: "Responsive - 16x9", value: "16x9" },
|
|
5
|
+
{ label: "Responsive - 4x3", value: "4x3" },
|
|
6
|
+
{ label: "Responsive - 1x1", value: "1x1" }
|
|
7
|
+
], b = /* @__PURE__ */ new WeakMap(), c = (e) => (b.has(e) || b.set(e, {
|
|
8
|
+
dialogElement: null,
|
|
9
|
+
activeTab: "general",
|
|
10
|
+
formData: {
|
|
11
|
+
src: "",
|
|
12
|
+
selectedSize: "inline",
|
|
13
|
+
width: "100%",
|
|
14
|
+
height: "400px",
|
|
15
|
+
constrainProportions: !0,
|
|
16
|
+
name: "",
|
|
17
|
+
title: "",
|
|
18
|
+
longDescription: "",
|
|
19
|
+
descriptionUrl: "",
|
|
20
|
+
showBorder: !0,
|
|
21
|
+
enableScrollbar: !0
|
|
22
|
+
}
|
|
23
|
+
}), b.get(e)), A = () => ({
|
|
24
|
+
name: "embedIframe",
|
|
25
|
+
toolbar: [
|
|
26
|
+
{
|
|
27
|
+
label: "Embed Content",
|
|
28
|
+
command: "openEmbedIframeDialog",
|
|
29
|
+
icon: '<svg width="24" height="24" focusable="false"><path d="M19 6V5H5v14h2A13 13 0 0 1 19 6Zm0 1.4c-.8.8-1.6 2.4-2.2 4.6H19V7.4Zm0 5.6h-2.4c-.4 1.8-.6 3.8-.6 6h3v-6Zm-4 6c0-2.2.2-4.2.6-6H13c-.7 1.8-1.1 3.8-1.1 6h3Zm-4 0c0-2.2.4-4.2 1-6H9.6A12 12 0 0 0 8 19h3ZM4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm11.8 9c.4-1.9 1-3.4 1.8-4.5a9.2 9.2 0 0 0-4 4.5h2.2Zm-3.4 0a12 12 0 0 1 2.8-4 12 12 0 0 0-5 4h2.2Z" fill-rule="nonzero"></path></svg>',
|
|
30
|
+
shortcut: "Mod-Shift-e",
|
|
31
|
+
type: "button"
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
commands: {
|
|
35
|
+
openEmbedIframeDialog: (e) => (k(e), !0)
|
|
36
|
+
},
|
|
37
|
+
keymap: {
|
|
38
|
+
"Mod-Shift-e": "openEmbedIframeDialog"
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
function k(e) {
|
|
42
|
+
if (!e) {
|
|
43
|
+
const o = document.activeElement;
|
|
44
|
+
o && o.closest("[data-editora-editor]") && (e = o.closest("[data-editora-editor]"));
|
|
45
|
+
}
|
|
46
|
+
if (e || (e = document.querySelector("[data-editora-editor]")), !e) {
|
|
47
|
+
console.warn("Editor element not found");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const t = c(e);
|
|
51
|
+
t.formData = {
|
|
52
|
+
src: "",
|
|
53
|
+
selectedSize: "inline",
|
|
54
|
+
width: "100%",
|
|
55
|
+
height: "400px",
|
|
56
|
+
constrainProportions: !0,
|
|
57
|
+
name: "",
|
|
58
|
+
title: "",
|
|
59
|
+
longDescription: "",
|
|
60
|
+
descriptionUrl: "",
|
|
61
|
+
showBorder: !0,
|
|
62
|
+
enableScrollbar: !0
|
|
63
|
+
}, t.activeTab = "general";
|
|
64
|
+
const a = document.createElement("div");
|
|
65
|
+
a.className = "rte-dialog-overlay", a.onclick = u;
|
|
66
|
+
const r = document.createElement("div");
|
|
67
|
+
r.className = "rte-dialog-content embed-iframe-dialog", r.onclick = (o) => o.stopPropagation(), r.innerHTML = `
|
|
68
|
+
<div class="rte-dialog-header">
|
|
69
|
+
<h3>Embed Iframe</h3>
|
|
70
|
+
<button class="rte-dialog-close">×</button>
|
|
71
|
+
</div>
|
|
72
|
+
<div class="rte-dialog-body">
|
|
73
|
+
<div class="rte-vertical-tabs">
|
|
74
|
+
<div class="rte-tab-buttons">
|
|
75
|
+
<button class="rte-tab-button active" data-tab="general">General</button>
|
|
76
|
+
<button class="rte-tab-button" data-tab="advanced">Advanced</button>
|
|
77
|
+
</div>
|
|
78
|
+
<div class="rte-tab-content">
|
|
79
|
+
<div class="rte-tab-panel" data-panel="general" style="display: block;">
|
|
80
|
+
<div class="rte-form-group">
|
|
81
|
+
<label class="rte-form-label">Source</label>
|
|
82
|
+
<input type="url" class="rte-form-input" id="iframe-src" placeholder="https://example.com" required />
|
|
83
|
+
</div>
|
|
84
|
+
<div class="rte-form-group">
|
|
85
|
+
<label class="rte-form-label">Size</label>
|
|
86
|
+
<select class="rte-form-select" id="iframe-size">
|
|
87
|
+
${D.map((o) => `<option value="${o.value}">${o.label}</option>`).join("")}
|
|
88
|
+
</select>
|
|
89
|
+
</div>
|
|
90
|
+
<div class="rte-form-row" id="dimensions-row">
|
|
91
|
+
<div class="rte-form-group">
|
|
92
|
+
<label class="rte-form-label">Width</label>
|
|
93
|
+
<input type="text" class="rte-form-input" id="iframe-width" placeholder="100%" value="100%" />
|
|
94
|
+
</div>
|
|
95
|
+
<div class="rte-form-group">
|
|
96
|
+
<label class="rte-form-label">Height</label>
|
|
97
|
+
<input type="text" class="rte-form-input" id="iframe-height" placeholder="400px" value="400px" />
|
|
98
|
+
</div>
|
|
99
|
+
<div class="rte-form-group constrain-group">
|
|
100
|
+
<button type="button" class="rte-constrain-btn locked" id="constrain-btn" title="Unlock proportions">🔒</button>
|
|
101
|
+
</div>
|
|
102
|
+
</div>
|
|
103
|
+
</div>
|
|
104
|
+
<div class="rte-tab-panel" data-panel="advanced" style="display: none;">
|
|
105
|
+
<div class="rte-form-group">
|
|
106
|
+
<label class="rte-form-label">Name</label>
|
|
107
|
+
<input type="text" class="rte-form-input" id="iframe-name" placeholder="Iframe name" />
|
|
108
|
+
</div>
|
|
109
|
+
<div class="rte-form-group">
|
|
110
|
+
<label class="rte-form-label">Title</label>
|
|
111
|
+
<input type="text" class="rte-form-input" id="iframe-title" placeholder="Iframe title" />
|
|
112
|
+
</div>
|
|
113
|
+
<div class="rte-form-group">
|
|
114
|
+
<label class="rte-form-label">Long Description</label>
|
|
115
|
+
<textarea class="rte-form-textarea" id="iframe-longdesc" placeholder="Detailed description of the iframe content" rows="3"></textarea>
|
|
116
|
+
</div>
|
|
117
|
+
<div class="rte-form-group">
|
|
118
|
+
<label class="rte-form-label">Description URL</label>
|
|
119
|
+
<input type="url" class="rte-form-input" id="iframe-desc-url" placeholder="https://example.com/description" />
|
|
120
|
+
</div>
|
|
121
|
+
<div class="rte-form-group">
|
|
122
|
+
<label class="rte-checkbox-label">
|
|
123
|
+
<input type="checkbox" id="iframe-border" checked />
|
|
124
|
+
Show iframe border
|
|
125
|
+
</label>
|
|
126
|
+
</div>
|
|
127
|
+
<div class="rte-form-group">
|
|
128
|
+
<label class="rte-checkbox-label">
|
|
129
|
+
<input type="checkbox" id="iframe-scrollbar" checked />
|
|
130
|
+
Enable scrollbar
|
|
131
|
+
</label>
|
|
132
|
+
</div>
|
|
133
|
+
</div>
|
|
134
|
+
</div>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<div class="rte-dialog-footer">
|
|
138
|
+
<button type="button" class="rte-btn rte-btn-secondary" id="cancel-btn">Cancel</button>
|
|
139
|
+
<button type="submit" class="rte-btn rte-btn-primary" id="save-btn">Save</button>
|
|
140
|
+
</div>
|
|
141
|
+
`, a.appendChild(r), document.body.appendChild(a), t.dialogElement = a, q(r, e), R(), setTimeout(() => {
|
|
142
|
+
var o;
|
|
143
|
+
(o = r.querySelector("#iframe-src")) == null || o.focus();
|
|
144
|
+
}, 100);
|
|
145
|
+
}
|
|
146
|
+
function q(e, t) {
|
|
147
|
+
var l, i, d, m;
|
|
148
|
+
c(t), (l = e.querySelector(".rte-dialog-close")) == null || l.addEventListener("click", () => u(t)), e.querySelectorAll(".rte-tab-button").forEach((n) => {
|
|
149
|
+
n.addEventListener("click", (f) => {
|
|
150
|
+
const s = f.target.getAttribute("data-tab");
|
|
151
|
+
s && E(e, s, t);
|
|
152
|
+
});
|
|
153
|
+
});
|
|
154
|
+
const a = e.querySelector("#iframe-size");
|
|
155
|
+
a == null || a.addEventListener("change", (n) => $(e, n.target.value, t));
|
|
156
|
+
const r = e.querySelector("#iframe-width"), o = e.querySelector("#iframe-height");
|
|
157
|
+
r == null || r.addEventListener("input", (n) => C(e, n.target.value, t)), o == null || o.addEventListener("input", (n) => L(e, n.target.value, t)), (i = e.querySelector("#constrain-btn")) == null || i.addEventListener("click", () => z(e, t)), (d = e.querySelector("#cancel-btn")) == null || d.addEventListener("click", () => u(t)), (m = e.querySelector("#save-btn")) == null || m.addEventListener("click", () => I(e, t));
|
|
158
|
+
}
|
|
159
|
+
function E(e, t, a) {
|
|
160
|
+
const r = c(a);
|
|
161
|
+
r.activeTab = t, e.querySelectorAll(".rte-tab-button").forEach((o) => {
|
|
162
|
+
o.classList.toggle("active", o.getAttribute("data-tab") === t);
|
|
163
|
+
}), e.querySelectorAll(".rte-tab-panel").forEach((o) => {
|
|
164
|
+
o.style.display = o.getAttribute("data-panel") === t ? "block" : "none";
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function $(e, t, a) {
|
|
168
|
+
const r = c(a);
|
|
169
|
+
r.formData.selectedSize = t;
|
|
170
|
+
const o = e.querySelector("#dimensions-row"), l = e.querySelector("#iframe-width"), i = e.querySelector("#iframe-height");
|
|
171
|
+
t === "inline" ? (o.style.display = "flex", l.value = "100%", i.value = "400px", r.formData.width = "100%", r.formData.height = "400px") : (o.style.display = "none", r.formData.width = "100%", r.formData.height = "auto");
|
|
172
|
+
}
|
|
173
|
+
function C(e, t, a) {
|
|
174
|
+
const r = c(a);
|
|
175
|
+
if (r.formData.width = t, r.formData.constrainProportions && r.formData.selectedSize === "inline") {
|
|
176
|
+
const o = parseFloat(t);
|
|
177
|
+
if (!isNaN(o)) {
|
|
178
|
+
const l = o * 9 / 16;
|
|
179
|
+
r.formData.height = `${l}px`;
|
|
180
|
+
const i = e.querySelector("#iframe-height");
|
|
181
|
+
i && (i.value = r.formData.height);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function L(e, t, a) {
|
|
186
|
+
const r = c(a);
|
|
187
|
+
if (r.formData.height = t, r.formData.constrainProportions && r.formData.selectedSize === "inline") {
|
|
188
|
+
const o = parseFloat(t);
|
|
189
|
+
if (!isNaN(o)) {
|
|
190
|
+
const l = o * 16 / 9;
|
|
191
|
+
r.formData.width = `${l}px`;
|
|
192
|
+
const i = e.querySelector("#iframe-width");
|
|
193
|
+
i && (i.value = r.formData.width);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
function z(e, t) {
|
|
198
|
+
const a = c(t);
|
|
199
|
+
a.formData.constrainProportions = !a.formData.constrainProportions;
|
|
200
|
+
const r = e.querySelector("#constrain-btn");
|
|
201
|
+
r && (r.textContent = a.formData.constrainProportions ? "🔒" : "🔓", r.className = `rte-constrain-btn ${a.formData.constrainProportions ? "locked" : "unlocked"}`, r.title = a.formData.constrainProportions ? "Unlock proportions" : "Lock proportions");
|
|
202
|
+
}
|
|
203
|
+
function I(e, t) {
|
|
204
|
+
var s, p, h, g, v, x, y, w, S;
|
|
205
|
+
const a = c(t), r = (s = e.querySelector("#iframe-src")) == null ? void 0 : s.value.trim();
|
|
206
|
+
if (!r) {
|
|
207
|
+
alert("Please enter a source URL");
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
if (!r.startsWith("https://") && !r.startsWith("http://")) {
|
|
211
|
+
alert("Please enter a valid URL starting with https:// or http://");
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
const o = (p = e.querySelector("#iframe-name")) == null ? void 0 : p.value.trim(), l = (h = e.querySelector("#iframe-title")) == null ? void 0 : h.value.trim(), i = (g = e.querySelector("#iframe-longdesc")) == null ? void 0 : g.value.trim();
|
|
215
|
+
(v = e.querySelector("#iframe-desc-url")) == null || v.value.trim();
|
|
216
|
+
const d = (y = (x = e.querySelector("#iframe-border")) == null ? void 0 : x.checked) != null ? y : !0, m = (S = (w = e.querySelector("#iframe-scrollbar")) == null ? void 0 : w.checked) != null ? S : !0;
|
|
217
|
+
let n = a.formData.width, f = a.formData.height;
|
|
218
|
+
a.formData.selectedSize !== "inline" && (n = "100%", f = "auto"), P(t, {
|
|
219
|
+
src: r,
|
|
220
|
+
width: n,
|
|
221
|
+
height: f,
|
|
222
|
+
aspectRatio: a.formData.selectedSize,
|
|
223
|
+
name: o || void 0,
|
|
224
|
+
title: l || void 0,
|
|
225
|
+
longDescription: i || void 0,
|
|
226
|
+
showBorder: d,
|
|
227
|
+
enableScrollbar: m
|
|
228
|
+
}), u(t);
|
|
229
|
+
}
|
|
230
|
+
function P(e, t) {
|
|
231
|
+
const a = e.querySelector('[contenteditable="true"]');
|
|
232
|
+
a && (a.focus(), setTimeout(() => {
|
|
233
|
+
const r = [
|
|
234
|
+
`src="${t.src}"`,
|
|
235
|
+
`width="${t.width}"`,
|
|
236
|
+
`height="${t.height}"`,
|
|
237
|
+
"allowfullscreen",
|
|
238
|
+
`frameborder="${t.showBorder ? "1" : "0"}"`,
|
|
239
|
+
`scrolling="${t.enableScrollbar ? "auto" : "no"}"`
|
|
240
|
+
];
|
|
241
|
+
t.name && r.push(`name="${t.name}"`), t.title && r.push(`title="${t.title}"`), t.longDescription && r.push(`longdesc="${t.longDescription}"`);
|
|
242
|
+
const o = [];
|
|
243
|
+
t.aspectRatio !== "inline" && o.push(`rte-iframe-${t.aspectRatio}`);
|
|
244
|
+
const l = o.length > 0 ? `class="${o.join(" ")}"` : "", i = `data-aspect-ratio="${t.aspectRatio}"`, d = `<iframe ${r.join(" ")} ${l} ${i}></iframe>`;
|
|
245
|
+
if (!document.execCommand("insertHTML", !1, d)) {
|
|
246
|
+
const n = window.getSelection();
|
|
247
|
+
if (n && n.rangeCount > 0) {
|
|
248
|
+
const f = n.getRangeAt(0);
|
|
249
|
+
f.deleteContents();
|
|
250
|
+
const s = document.createElement("div");
|
|
251
|
+
s.innerHTML = d;
|
|
252
|
+
const p = document.createDocumentFragment();
|
|
253
|
+
for (; s.firstChild; )
|
|
254
|
+
p.appendChild(s.firstChild);
|
|
255
|
+
f.insertNode(p);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}, 10));
|
|
259
|
+
}
|
|
260
|
+
function u(e) {
|
|
261
|
+
const t = c(e);
|
|
262
|
+
t.dialogElement && (document.body.removeChild(t.dialogElement), t.dialogElement = null);
|
|
263
|
+
}
|
|
264
|
+
function R() {
|
|
265
|
+
if (document.getElementById("embed-iframe-dialog-styles")) return;
|
|
266
|
+
const e = document.createElement("style");
|
|
267
|
+
e.id = "embed-iframe-dialog-styles", e.textContent = `
|
|
268
|
+
/* Embed Iframe Dialog Styles */
|
|
269
|
+
.embed-iframe-dialog {
|
|
270
|
+
max-width: 600px;
|
|
271
|
+
width: 100%;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.rte-vertical-tabs {
|
|
275
|
+
display: flex;
|
|
276
|
+
gap: 20px;
|
|
277
|
+
min-height: 400px;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.rte-tab-buttons {
|
|
281
|
+
display: flex;
|
|
282
|
+
flex-direction: column;
|
|
283
|
+
width: 120px;
|
|
284
|
+
border-right: 1px solid #e1e5e9;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
.rte-tab-button {
|
|
288
|
+
padding: 12px 16px;
|
|
289
|
+
border: none;
|
|
290
|
+
background: none;
|
|
291
|
+
text-align: left;
|
|
292
|
+
cursor: pointer;
|
|
293
|
+
font-size: 14px;
|
|
294
|
+
font-weight: 500;
|
|
295
|
+
color: #666;
|
|
296
|
+
border-right: 3px solid transparent;
|
|
297
|
+
transition: all 0.2s ease;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
.rte-tab-button:hover {
|
|
301
|
+
background-color: #f8f9fa;
|
|
302
|
+
color: #333;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.rte-tab-button.active {
|
|
306
|
+
background-color: #e3f2fd;
|
|
307
|
+
color: #1976d2;
|
|
308
|
+
border-right-color: #1976d2;
|
|
309
|
+
font-weight: 600;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
.rte-tab-content {
|
|
313
|
+
flex: 1;
|
|
314
|
+
padding: 0 0 0 20px;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
.rte-tab-panel {
|
|
318
|
+
padding: 0;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
.rte-form-group {
|
|
322
|
+
margin-bottom: 16px;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
.rte-form-label {
|
|
326
|
+
display: block;
|
|
327
|
+
margin-bottom: 6px;
|
|
328
|
+
font-size: 14px;
|
|
329
|
+
font-weight: 500;
|
|
330
|
+
color: #333;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
.rte-form-textarea,
|
|
334
|
+
.rte-form-select {
|
|
335
|
+
width: 100%;
|
|
336
|
+
padding: 8px 12px;
|
|
337
|
+
border: 1px solid #ccc;
|
|
338
|
+
border-radius: 4px;
|
|
339
|
+
font-size: 14px;
|
|
340
|
+
transition: border-color 0.2s ease;
|
|
341
|
+
box-sizing: border-box;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
.rte-form-textarea:focus,
|
|
345
|
+
.rte-form-select:focus {
|
|
346
|
+
outline: none;
|
|
347
|
+
border-color: #0066cc;
|
|
348
|
+
box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.2);
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
.rte-form-textarea {
|
|
352
|
+
resize: vertical;
|
|
353
|
+
min-height: 80px;
|
|
354
|
+
font-family: inherit;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
.rte-form-row {
|
|
358
|
+
display: flex;
|
|
359
|
+
gap: 12px;
|
|
360
|
+
align-items: flex-end;
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
.rte-form-row .rte-form-group {
|
|
364
|
+
flex: 1;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
.rte-form-row .constrain-group {
|
|
368
|
+
flex: 0 0 auto;
|
|
369
|
+
margin-bottom: 0;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
.rte-constrain-btn {
|
|
373
|
+
padding: 8px 12px;
|
|
374
|
+
border: 1px solid #ddd;
|
|
375
|
+
background: white;
|
|
376
|
+
border-radius: 4px;
|
|
377
|
+
cursor: pointer;
|
|
378
|
+
font-size: 18px;
|
|
379
|
+
transition: all 0.2s ease;
|
|
380
|
+
height: 38px;
|
|
381
|
+
width: 48px;
|
|
382
|
+
display: flex;
|
|
383
|
+
align-items: center;
|
|
384
|
+
justify-content: center;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.rte-constrain-btn:hover {
|
|
388
|
+
background-color: #f5f5f5;
|
|
389
|
+
border-color: #1976d2;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.rte-constrain-btn.locked {
|
|
393
|
+
background-color: #e3f2fd;
|
|
394
|
+
border-color: #1976d2;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
.rte-checkbox-label {
|
|
398
|
+
display: flex;
|
|
399
|
+
align-items: center;
|
|
400
|
+
gap: 8px;
|
|
401
|
+
font-size: 14px;
|
|
402
|
+
color: #333;
|
|
403
|
+
cursor: pointer;
|
|
404
|
+
padding: 4px 0;
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
.rte-checkbox-label input[type="checkbox"] {
|
|
408
|
+
width: 18px;
|
|
409
|
+
height: 18px;
|
|
410
|
+
cursor: pointer;
|
|
411
|
+
accent-color: #0066cc;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
.rte-checkbox-label:hover {
|
|
415
|
+
color: #000;
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/* Responsive iframe classes */
|
|
419
|
+
.rte-iframe-21x9,
|
|
420
|
+
.rte-iframe-16x9,
|
|
421
|
+
.rte-iframe-4x3,
|
|
422
|
+
.rte-iframe-1x1 {
|
|
423
|
+
position: relative;
|
|
424
|
+
width: 100%;
|
|
425
|
+
padding-bottom: 56.25%;
|
|
426
|
+
height: 0;
|
|
427
|
+
overflow: hidden;
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
.rte-iframe-21x9 {
|
|
431
|
+
padding-bottom: 42.857%;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.rte-iframe-16x9 {
|
|
435
|
+
padding-bottom: 56.25%;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
.rte-iframe-4x3 {
|
|
439
|
+
padding-bottom: 75%;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.rte-iframe-1x1 {
|
|
443
|
+
padding-bottom: 100%;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.rte-iframe-21x9 iframe,
|
|
447
|
+
.rte-iframe-16x9 iframe,
|
|
448
|
+
.rte-iframe-4x3 iframe,
|
|
449
|
+
.rte-iframe-1x1 iframe {
|
|
450
|
+
position: absolute;
|
|
451
|
+
top: 0;
|
|
452
|
+
left: 0;
|
|
453
|
+
width: 100%;
|
|
454
|
+
height: 100%;
|
|
455
|
+
}
|
|
456
|
+
`, document.head.appendChild(e);
|
|
457
|
+
}
|
|
458
|
+
export {
|
|
459
|
+
A as EmbedIframePlugin
|
|
460
|
+
};
|
|
461
|
+
//# sourceMappingURL=EmbedIframePlugin.native-ifr9KLdN.mjs.map
|