@editora/plugins 1.0.19 → 1.0.21
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/dist/{CodePlugin.native-Bwf25lLX.js → CodePlugin.native-CKJo7IFG.js} +8 -8
- package/dist/{CodePlugin.native-Cpp4u3Jl.mjs → CodePlugin.native-D8gGxB8i.mjs} +59 -60
- package/dist/a11y-checker.cjs.js +1 -1
- package/dist/a11y-checker.esm.js +18 -18
- package/dist/anchor.cjs.js +6 -6
- package/dist/anchor.esm.js +57 -57
- package/dist/blockquote.cjs.js +1 -1
- package/dist/blockquote.esm.js +31 -31
- package/dist/capitalization.cjs.js +1 -1
- package/dist/capitalization.esm.js +25 -25
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +30 -30
- package/dist/code.cjs.js +1 -1
- package/dist/code.esm.js +1 -1
- package/dist/collaboration.cjs.js +8 -8
- package/dist/collaboration.esm.js +1279 -1169
- package/dist/comments.cjs.js +1 -1
- package/dist/comments.esm.js +1 -1
- package/dist/direction.cjs.js +1 -1
- package/dist/direction.esm.js +26 -26
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +1 -1
- package/dist/{documentManager-yjRBab4v.mjs → documentManager-BL98a7YZ.mjs} +402 -404
- package/dist/{documentManager-BDz6tovy.js → documentManager-r8t7yZEd.js} +9 -9
- package/dist/enterprise.cjs.js +1 -1
- package/dist/enterprise.esm.js +1 -1
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +26 -26
- package/dist/{index-Bm1eqYHh.mjs → index-B-VitI3v.mjs} +23 -22
- package/dist/{index-CoflqYuK.js → index-D5xugkYA.js} +2 -2
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +2 -2
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +48 -51
- package/dist/purify.es-B6PsRpEV.js +3 -0
- package/dist/purify.es-DmCsrgBd.mjs +1480 -0
- package/dist/sanitizeHtml-CDoBlNTk.js +1 -0
- package/dist/sanitizeHtml-CtLy8um-.mjs +16 -0
- package/dist/spell-check.cjs.js +2 -2
- package/dist/spell-check.esm.js +19 -19
- package/dist/table.cjs.js +14 -14
- package/dist/table.esm.js +158 -150
- package/dist/template.cjs.js +20 -21
- package/dist/template.esm.js +176 -724
- package/package.json +6 -4
package/dist/enterprise.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./mentions.cjs.js"),t=require("./track-changes.cjs.js"),o=require("./version-diff.cjs.js"),l=require("./conditional-content.cjs.js"),r=require("./data-binding.cjs.js"),g=require("./content-rules.cjs.js"),u=require("./citations.cjs.js"),s=require("./approval-workflow.cjs.js"),c=require("./pii-redaction.cjs.js"),P=require("./smart-paste.cjs.js"),m=require("./blocks-library.cjs.js"),C=require("./doc-schema.cjs.js"),d=require("./translation-workflow.cjs.js"),p=require("./slash-commands.cjs.js"),M=require("./spell-check.cjs.js"),T=require("./a11y-checker.cjs.js"),q=require("./comments.cjs.js"),f=require("./merge-tag.cjs.js"),e=require("./template.cjs.js"),n=require("./media-manager.cjs.js"),i=require("./index-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("./mentions.cjs.js"),t=require("./track-changes.cjs.js"),o=require("./version-diff.cjs.js"),l=require("./conditional-content.cjs.js"),r=require("./data-binding.cjs.js"),g=require("./content-rules.cjs.js"),u=require("./citations.cjs.js"),s=require("./approval-workflow.cjs.js"),c=require("./pii-redaction.cjs.js"),P=require("./smart-paste.cjs.js"),m=require("./blocks-library.cjs.js"),C=require("./doc-schema.cjs.js"),d=require("./translation-workflow.cjs.js"),p=require("./slash-commands.cjs.js"),M=require("./spell-check.cjs.js"),T=require("./a11y-checker.cjs.js"),q=require("./comments.cjs.js"),f=require("./merge-tag.cjs.js"),e=require("./template.cjs.js"),n=require("./media-manager.cjs.js"),i=require("./index-D5xugkYA.js"),k=require("./collaboration.cjs.js");exports.MentionPlugin=a.MentionPlugin;exports.TrackChangesPlugin=t.TrackChangesPlugin;exports.VersionDiffPlugin=o.VersionDiffPlugin;exports.ConditionalContentPlugin=l.ConditionalContentPlugin;exports.DataBindingPlugin=r.DataBindingPlugin;exports.ContentRulesPlugin=g.ContentRulesPlugin;exports.CitationsPlugin=u.CitationsPlugin;exports.ApprovalWorkflowPlugin=s.ApprovalWorkflowPlugin;exports.PIIRedactionPlugin=c.PIIRedactionPlugin;exports.SmartPastePlugin=P.SmartPastePlugin;exports.BlocksLibraryPlugin=m.BlocksLibraryPlugin;exports.DocSchemaPlugin=C.DocSchemaPlugin;exports.TranslationWorkflowPlugin=d.TranslationWorkflowPlugin;exports.SlashCommandsPlugin=p.SlashCommandsPlugin;exports.SpellCheckPlugin=M.SpellCheckPlugin;exports.A11yCheckerPlugin=T.A11yCheckerPlugin;exports.CommentsPlugin=q.CommentsPlugin;exports.MergeTagPlugin=f.MergeTagPlugin;exports.PREDEFINED_TEMPLATES=e.PREDEFINED_TEMPLATES;exports.TemplatePlugin=e.TemplatePlugin;exports.addCustomTemplate=e.addCustomTemplate;exports.getAllTemplates=e.getAllTemplates;exports.getTemplateCategories=e.getTemplateCategories;exports.getTemplatesByCategory=e.getTemplatesByCategory;exports.sanitizeTemplate=e.sanitizeTemplate;exports.searchTemplates=e.searchTemplates;exports.validateTemplate=e.validateTemplate;exports.MediaManagerPlugin=n.MediaManagerPlugin;exports.getMediaManagerConfig=n.getMediaManagerConfig;exports.setMediaManagerConfig=n.setMediaManagerConfig;exports.DocumentManagerPlugin=i.DocumentManagerPlugin;exports.getDocumentManagerConfig=i.getDocumentManagerConfig;exports.setDocumentManagerConfig=i.setDocumentManagerConfig;exports.CollaborationPlugin=k.CollaborationPlugin;
|
package/dist/enterprise.esm.js
CHANGED
|
@@ -18,7 +18,7 @@ import { CommentsPlugin as L } from "./comments.esm.js";
|
|
|
18
18
|
import { MergeTagPlugin as z } from "./merge-tag.esm.js";
|
|
19
19
|
import { PREDEFINED_TEMPLATES as N, TemplatePlugin as V, addCustomTemplate as _, getAllTemplates as j, getTemplateCategories as q, getTemplatesByCategory as G, sanitizeTemplate as H, searchTemplates as J, validateTemplate as K } from "./template.esm.js";
|
|
20
20
|
import { MediaManagerPlugin as Q, getMediaManagerConfig as U, setMediaManagerConfig as X } from "./media-manager.esm.js";
|
|
21
|
-
import { D as Z, g as $, s as ee } from "./index-
|
|
21
|
+
import { D as Z, g as $, s as ee } from "./index-B-VitI3v.mjs";
|
|
22
22
|
import { CollaborationPlugin as re } from "./collaboration.esm.js";
|
|
23
23
|
export {
|
|
24
24
|
v as A11yCheckerPlugin,
|
package/dist/font-family.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("./historyHelpers-Cu8Pk7m1.js"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const p=require("./historyHelpers-Cu8Pk7m1.js"),h=()=>({name:"fontFamily",marks:{fontFamily:{attrs:{family:{default:null}},parseDOM:[{tag:'span[style*="font-family"]',getAttrs:e=>{const t=e.style.fontFamily;return t?{family:t}:!1}},{tag:"font[face]",getAttrs:e=>{const t=e.getAttribute("face");return t?{family:t}:!1}}],toDOM:e=>["span",{style:`font-family: ${e.attrs?.family}`},0]}},toolbar:[{label:"Font Family",command:"setFontFamily",type:"inline-menu",options:[{label:"Arial",value:"Arial, sans-serif"},{label:"Times New Roman",value:"Times New Roman, serif"},{label:"Courier New",value:"Courier New, monospace"},{label:"Georgia",value:"Georgia, serif"},{label:"Verdana",value:"Verdana, sans-serif"},{label:"Helvetica",value:"Helvetica, Arial, sans-serif"},{label:"Trebuchet MS",value:"Trebuchet MS, sans-serif"},{label:"Impact",value:"Impact, sans-serif"}],icon:'<svg fill="#000000" width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path d="M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16H9.307zm-1.239 9L10.5 6.515 12.932 13H8.068z"></path></g></svg>'}],commands:{setFontFamily:e=>{if(!e)return!1;try{return b(e),!0}catch(n){return console.error("Failed to set font family:",n),!1}}},keymap:{"Mod-Shift-f":"setFontFamily"}}),g="p,div,li,ul,ol,table,thead,tbody,tfoot,tr,td,th,h1,h2,h3,h4,h5,h6,blockquote,pre";function S(e){return!!e.cloneContents().querySelector(g)}function f(e){return(e.nodeType===Node.ELEMENT_NODE?e:e.parentElement)?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')}function u(e){e&&e.dispatchEvent(new Event("input",{bubbles:!0}))}function A(e,n){const t=document.createElement("span");for(const o of Array.from(e.attributes))o.name==="face"||o.name==="style"||t.setAttribute(o.name,o.value);const r=e.getAttribute("style");for(r&&t.setAttribute("style",r),t.style.fontFamily=n,t.classList.add("rte-font-family");e.firstChild;)t.appendChild(e.firstChild);e.parentNode?.replaceChild(t,e)}function F(e){e.querySelectorAll("span").forEach(t=>{t.childElementCount>0||(t.textContent||"").trim().length>0||t.remove()})}function C(e,n,t){if(S(e))return!1;const r=document.createElement("span");r.style.fontFamily=t,r.className="rte-font-family";try{e.surroundContents(r)}catch{const l=e.extractContents();r.appendChild(l),e.insertNode(r)}const o=document.createRange();return o.selectNodeContents(r),n.removeAllRanges(),n.addRange(o),!0}function b(e){const n=window.getSelection();if(!n||n.rangeCount===0)return;const t=f(n.getRangeAt(0).commonAncestorContainer),r=t?t.innerHTML:null;v(e),t&&r!==null&&p.recordDomHistory(t,r)}function v(e){const n=window.getSelection();if(!n||n.rangeCount===0)return;const t=n.getRangeAt(0),r=t.cloneRange(),o=f(t.commonAncestorContainer);if(t.collapsed)return;const l=t.commonAncestorContainer,s=N(l);if(s&&E(t,s)){s.style.fontFamily=e,s.classList.add("rte-font-family");const a=document.createRange();a.selectNodeContents(s),n.removeAllRanges(),n.addRange(a),u(o);return}if(!o)return;const m=new Set(Array.from(o.querySelectorAll("font[face]"))),d=new Set(Array.from(o.querySelectorAll("span[style*='font-family']")));o.focus({preventScroll:!0});try{document.execCommand("styleWithCSS",!1,"true")}catch{}const y=e.split(",").map(a=>a.trim().replace(/^['"]|['"]$/g,"")).filter(Boolean)[0]||"Arial";let i=document.execCommand("fontName",!1,y),c=!1;Array.from(o.querySelectorAll("font[face]")).forEach(a=>{m.has(a)||(A(a,e),c=!0)}),Array.from(o.querySelectorAll("span[style*='font-family']")).forEach(a=>{d.has(a)||(a.style.fontFamily=e,a.classList.add("rte-font-family"),c=!0)}),i||(i=C(r,n,e)),(i||c)&&(F(o),u(o))}function N(e){let n=e;for(;n;){if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(t.tagName==="SPAN"&&t.style.fontFamily)return t}n=n.parentNode}return null}function E(e,n){const t=e.startContainer,r=e.endContainer,o=n.contains(t)||t.nodeType===Node.TEXT_NODE&&t.parentElement===n,l=n.contains(r)||r.nodeType===Node.TEXT_NODE&&r.parentElement===n;return o&&l}exports.FontFamilyPlugin=h;
|
package/dist/font-family.esm.js
CHANGED
|
@@ -40,7 +40,7 @@ const R = () => ({
|
|
|
40
40
|
{ label: "Trebuchet MS", value: "Trebuchet MS, sans-serif" },
|
|
41
41
|
{ label: "Impact", value: "Impact, sans-serif" }
|
|
42
42
|
],
|
|
43
|
-
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g
|
|
43
|
+
icon: '<svg fill="#000000" width="24px" height="24px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g><path d="M15 4h7v2h-7zm1 4h6v2h-6zm2 4h4v2h-4zM9.307 4l-6 16h2.137l1.875-5h6.363l1.875 5h2.137l-6-16H9.307zm-1.239 9L10.5 6.515 12.932 13H8.068z"></path></g></svg>'
|
|
44
44
|
}
|
|
45
45
|
],
|
|
46
46
|
commands: {
|
|
@@ -66,16 +66,16 @@ function m(e) {
|
|
|
66
66
|
function f(e) {
|
|
67
67
|
e && e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
68
68
|
}
|
|
69
|
-
function
|
|
69
|
+
function A(e, n) {
|
|
70
70
|
const t = document.createElement("span");
|
|
71
71
|
for (const o of Array.from(e.attributes))
|
|
72
72
|
o.name === "face" || o.name === "style" || t.setAttribute(o.name, o.value);
|
|
73
|
-
const
|
|
74
|
-
for (
|
|
73
|
+
const a = e.getAttribute("style");
|
|
74
|
+
for (a && t.setAttribute("style", a), t.style.fontFamily = n, t.classList.add("rte-font-family"); e.firstChild; )
|
|
75
75
|
t.appendChild(e.firstChild);
|
|
76
76
|
e.parentNode?.replaceChild(t, e);
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function S(e) {
|
|
79
79
|
e.querySelectorAll("span").forEach((t) => {
|
|
80
80
|
t.childElementCount > 0 || (t.textContent || "").trim().length > 0 || t.remove();
|
|
81
81
|
});
|
|
@@ -83,34 +83,34 @@ function A(e) {
|
|
|
83
83
|
function C(e, n, t) {
|
|
84
84
|
if (g(e))
|
|
85
85
|
return !1;
|
|
86
|
-
const
|
|
87
|
-
|
|
86
|
+
const a = document.createElement("span");
|
|
87
|
+
a.style.fontFamily = t, a.className = "rte-font-family";
|
|
88
88
|
try {
|
|
89
|
-
e.surroundContents(
|
|
89
|
+
e.surroundContents(a);
|
|
90
90
|
} catch {
|
|
91
91
|
const l = e.extractContents();
|
|
92
|
-
|
|
92
|
+
a.appendChild(l), e.insertNode(a);
|
|
93
93
|
}
|
|
94
94
|
const o = document.createRange();
|
|
95
|
-
return o.selectNodeContents(
|
|
95
|
+
return o.selectNodeContents(a), n.removeAllRanges(), n.addRange(o), !0;
|
|
96
96
|
}
|
|
97
97
|
function F(e) {
|
|
98
98
|
const n = window.getSelection();
|
|
99
99
|
if (!n || n.rangeCount === 0) return;
|
|
100
|
-
const t = m(n.getRangeAt(0).commonAncestorContainer),
|
|
101
|
-
b(e), t &&
|
|
100
|
+
const t = m(n.getRangeAt(0).commonAncestorContainer), a = t ? t.innerHTML : null;
|
|
101
|
+
b(e), t && a !== null && p(t, a);
|
|
102
102
|
}
|
|
103
103
|
function b(e) {
|
|
104
104
|
const n = window.getSelection();
|
|
105
105
|
if (!n || n.rangeCount === 0) return;
|
|
106
|
-
const t = n.getRangeAt(0),
|
|
106
|
+
const t = n.getRangeAt(0), a = t.cloneRange(), o = m(t.commonAncestorContainer);
|
|
107
107
|
if (t.collapsed)
|
|
108
108
|
return;
|
|
109
|
-
const l = t.commonAncestorContainer,
|
|
110
|
-
if (
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
|
|
109
|
+
const l = t.commonAncestorContainer, s = v(l);
|
|
110
|
+
if (s && N(t, s)) {
|
|
111
|
+
s.style.fontFamily = e, s.classList.add("rte-font-family");
|
|
112
|
+
const r = document.createRange();
|
|
113
|
+
r.selectNodeContents(s), n.removeAllRanges(), n.addRange(r), f(o);
|
|
114
114
|
return;
|
|
115
115
|
}
|
|
116
116
|
if (!o) return;
|
|
@@ -126,17 +126,17 @@ function b(e) {
|
|
|
126
126
|
document.execCommand("styleWithCSS", !1, "true");
|
|
127
127
|
} catch {
|
|
128
128
|
}
|
|
129
|
-
const y = e.split(",").map((
|
|
130
|
-
let
|
|
129
|
+
const y = e.split(",").map((r) => r.trim().replace(/^['"]|['"]$/g, "")).filter(Boolean)[0] || "Arial";
|
|
130
|
+
let i = document.execCommand("fontName", !1, y), c = !1;
|
|
131
131
|
Array.from(
|
|
132
132
|
o.querySelectorAll("font[face]")
|
|
133
|
-
).forEach((
|
|
134
|
-
u.has(
|
|
133
|
+
).forEach((r) => {
|
|
134
|
+
u.has(r) || (A(r, e), c = !0);
|
|
135
135
|
}), Array.from(
|
|
136
136
|
o.querySelectorAll("span[style*='font-family']")
|
|
137
|
-
).forEach((
|
|
138
|
-
d.has(
|
|
139
|
-
}),
|
|
137
|
+
).forEach((r) => {
|
|
138
|
+
d.has(r) || (r.style.fontFamily = e, r.classList.add("rte-font-family"), c = !0);
|
|
139
|
+
}), i || (i = C(a, n, e)), (i || c) && (S(o), f(o));
|
|
140
140
|
}
|
|
141
141
|
function v(e) {
|
|
142
142
|
let n = e;
|
|
@@ -151,7 +151,7 @@ function v(e) {
|
|
|
151
151
|
return null;
|
|
152
152
|
}
|
|
153
153
|
function N(e, n) {
|
|
154
|
-
const t = e.startContainer,
|
|
154
|
+
const t = e.startContainer, a = e.endContainer, o = n.contains(t) || t.nodeType === Node.TEXT_NODE && t.parentElement === n, l = n.contains(a) || a.nodeType === Node.TEXT_NODE && a.parentElement === n;
|
|
155
155
|
return o && l;
|
|
156
156
|
}
|
|
157
157
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { s } from "./sanitizeHtml-CtLy8um-.mjs";
|
|
2
|
+
import { getGlobalApiConfig as p, buildApiUrl as m, getGlobalApiHeaders as f } from "./shared-config.esm.js";
|
|
3
|
+
const d = "rte-document-manager-styles", b = `
|
|
3
4
|
.rte-toolbar-button[data-busy="true"],
|
|
4
5
|
.rte-docmgr-toolbar-button[data-busy="true"] {
|
|
5
6
|
position: relative;
|
|
@@ -29,13 +30,13 @@ const d = "rte-document-manager-styles", f = `
|
|
|
29
30
|
to { transform: rotate(360deg); }
|
|
30
31
|
}
|
|
31
32
|
`;
|
|
32
|
-
function
|
|
33
|
+
function h() {
|
|
33
34
|
if (typeof document > "u" || document.getElementById(d)) return;
|
|
34
35
|
const n = document.createElement("style");
|
|
35
|
-
n.id = d, n.textContent =
|
|
36
|
+
n.id = d, n.textContent = b, document.head.appendChild(n);
|
|
36
37
|
}
|
|
37
38
|
async function c(n) {
|
|
38
|
-
|
|
39
|
+
h();
|
|
39
40
|
const t = typeof window < "u" ? window.__editoraLastCommandButton : null;
|
|
40
41
|
t && (t.disabled = !0, t.setAttribute("data-busy", "true"), t.setAttribute("aria-busy", "true"));
|
|
41
42
|
try {
|
|
@@ -44,7 +45,7 @@ async function c(n) {
|
|
|
44
45
|
t && (t.disabled = !1, t.removeAttribute("data-busy"), t.removeAttribute("aria-busy"));
|
|
45
46
|
}
|
|
46
47
|
}
|
|
47
|
-
const
|
|
48
|
+
const E = () => ({
|
|
48
49
|
name: "document-manager",
|
|
49
50
|
toolbar: [
|
|
50
51
|
{
|
|
@@ -93,8 +94,8 @@ const v = () => ({
|
|
|
93
94
|
try {
|
|
94
95
|
const e = n();
|
|
95
96
|
if (e) {
|
|
96
|
-
const { importFromWord: a } = await import("./documentManager-
|
|
97
|
-
e.innerHTML = i, e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
97
|
+
const { importFromWord: a } = await import("./documentManager-BL98a7YZ.mjs"), i = await a(r);
|
|
98
|
+
e.innerHTML = s(i), e.dispatchEvent(new Event("input", { bubbles: !0 }));
|
|
98
99
|
}
|
|
99
100
|
} catch (e) {
|
|
100
101
|
console.error("Import failed:", e), alert("Failed to import Word document. Please check the console for details.");
|
|
@@ -119,7 +120,7 @@ const v = () => ({
|
|
|
119
120
|
try {
|
|
120
121
|
const t = n();
|
|
121
122
|
if (t) {
|
|
122
|
-
const o = t.innerHTML, { exportToWord: r } = await import("./documentManager-
|
|
123
|
+
const o = t.innerHTML, { exportToWord: r } = await import("./documentManager-BL98a7YZ.mjs");
|
|
123
124
|
await r(o, "document.docx");
|
|
124
125
|
}
|
|
125
126
|
return !0;
|
|
@@ -146,7 +147,7 @@ const v = () => ({
|
|
|
146
147
|
try {
|
|
147
148
|
const t = n();
|
|
148
149
|
if (t) {
|
|
149
|
-
const o = t.innerHTML, { exportToPdf: r } = await import("./documentManager-
|
|
150
|
+
const o = t.innerHTML, { exportToPdf: r } = await import("./documentManager-BL98a7YZ.mjs");
|
|
150
151
|
await r(o, "document.pdf", t);
|
|
151
152
|
} else
|
|
152
153
|
console.error("PDF Export: No editor element found"), alert("No active editor found. Please click in the editor area first.");
|
|
@@ -158,7 +159,7 @@ const v = () => ({
|
|
|
158
159
|
}
|
|
159
160
|
},
|
|
160
161
|
keymap: {}
|
|
161
|
-
}),
|
|
162
|
+
}), g = {
|
|
162
163
|
apiEndpoints: {
|
|
163
164
|
exportWord: "/documents/export-word"
|
|
164
165
|
},
|
|
@@ -170,25 +171,25 @@ const v = () => ({
|
|
|
170
171
|
useClientSideFallback: !0
|
|
171
172
|
// Enable fallback by default
|
|
172
173
|
};
|
|
173
|
-
let l = { ...
|
|
174
|
-
function
|
|
174
|
+
let l = { ...g };
|
|
175
|
+
function A(n) {
|
|
175
176
|
l = { ...l, ...n };
|
|
176
177
|
}
|
|
177
178
|
function u() {
|
|
178
179
|
return { ...l };
|
|
179
180
|
}
|
|
180
|
-
function
|
|
181
|
-
const t = u(), o =
|
|
182
|
-
return
|
|
181
|
+
function w(n) {
|
|
182
|
+
const t = u(), o = p(), r = t.apiUrl || o.apiUrl;
|
|
183
|
+
return m(r, t.apiEndpoints[n]);
|
|
183
184
|
}
|
|
184
|
-
function
|
|
185
|
-
const n =
|
|
185
|
+
function x() {
|
|
186
|
+
const n = f(), o = u().headers || {};
|
|
186
187
|
return { ...n, ...o };
|
|
187
188
|
}
|
|
188
189
|
export {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
190
|
+
E as D,
|
|
191
|
+
w as a,
|
|
192
|
+
x as b,
|
|
192
193
|
u as g,
|
|
193
|
-
|
|
194
|
+
A as s
|
|
194
195
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const l=require("./shared-config.cjs.js"),u="rte-document-manager-styles",
|
|
1
|
+
"use strict";const p=require("./sanitizeHtml-CDoBlNTk.js"),l=require("./shared-config.cjs.js"),u="rte-document-manager-styles",m=`
|
|
2
2
|
.rte-toolbar-button[data-busy="true"],
|
|
3
3
|
.rte-docmgr-toolbar-button[data-busy="true"] {
|
|
4
4
|
position: relative;
|
|
@@ -27,4 +27,4 @@
|
|
|
27
27
|
@keyframes rte-docmgr-spin {
|
|
28
28
|
to { transform: rotate(360deg); }
|
|
29
29
|
}
|
|
30
|
-
`;function
|
|
30
|
+
`;function f(){if(typeof document>"u"||document.getElementById(u))return;const n=document.createElement("style");n.id=u,n.textContent=m,document.head.appendChild(n)}async function s(n){f();const e=typeof window<"u"?window.__editoraLastCommandButton:null;e&&(e.disabled=!0,e.setAttribute("data-busy","true"),e.setAttribute("aria-busy","true"));try{return await n()}finally{e&&(e.disabled=!1,e.removeAttribute("data-busy"),e.removeAttribute("aria-busy"))}}const h=()=>({name:"document-manager",toolbar:[{label:"Import Word",command:"importWord",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>',type:"button"},{label:"Export Word",command:"exportWord",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>',type:"button"},{label:"Export PDF",command:"exportPdf",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>',type:"button"}],commands:{importWord:()=>{const n=()=>{const o=window.getSelection();if(o&&o.rangeCount>0){let i=o.getRangeAt(0).startContainer;for(;i&&i!==document.body;){if(i.nodeType===Node.ELEMENT_NODE){const a=i;if(a.getAttribute("contenteditable")==="true")return a}i=i.parentNode}}const r=document.activeElement;if(r?.getAttribute("contenteditable")==="true")return r;const t=r?.closest('[contenteditable="true"]');return t||document.querySelector('[contenteditable="true"]')},e=document.createElement("input");return e.type="file",e.accept=".docx",e.onchange=async o=>{const r=o.target.files?.[0];if(r)try{const t=n();if(t){const{importFromWord:i}=await Promise.resolve().then(()=>require("./documentManager-r8t7yZEd.js")),a=await i(r);t.innerHTML=p.sanitizeHtml(a),t.dispatchEvent(new Event("input",{bubbles:!0}))}}catch(t){console.error("Import failed:",t),alert("Failed to import Word document. Please check the console for details.")}},e.click(),!0},exportWord:async()=>{const n=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE&&t.getAttribute("contenteditable")==="true")return t;t=t.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};return s(async()=>{try{const e=n();if(e){const o=e.innerHTML,{exportToWord:r}=await Promise.resolve().then(()=>require("./documentManager-r8t7yZEd.js"));await r(o,"document.docx")}return!0}catch(e){return console.error("Export failed:",e),alert("Failed to export to Word. Please check the console for details."),!1}})},exportPdf:async()=>{const n=()=>{const e=window.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0).startContainer;for(;t&&t!==document.body;){if(t.nodeType===Node.ELEMENT_NODE&&t.getAttribute("contenteditable")==="true")return t;t=t.parentNode}}const o=document.activeElement;return o?.getAttribute("contenteditable")==="true"?o:o?.closest('[contenteditable="true"]')||document.querySelector('[contenteditable="true"]')};return s(async()=>{try{const e=n();if(e){const o=e.innerHTML,{exportToPdf:r}=await Promise.resolve().then(()=>require("./documentManager-r8t7yZEd.js"));await r(o,"document.pdf",e)}else console.error("PDF Export: No editor element found"),alert("No active editor found. Please click in the editor area first.");return!0}catch(e){return console.error("PDF Export: Export failed:",e),alert("Failed to export to PDF. Please check the console for details."),!1}})}},keymap:{}}),b={apiEndpoints:{exportWord:"/documents/export-word"},headers:{},useClientSideFallback:!0};let d={...b};function g(n){d={...d,...n}}function c(){return{...d}}function v(n){const e=c(),o=l.getGlobalApiConfig(),r=e.apiUrl||o.apiUrl;return l.buildApiUrl(r,e.apiEndpoints[n])}function y(){const n=l.getGlobalApiHeaders(),o=c().headers||{};return{...n,...o}}exports.DocumentManagerPlugin=h;exports.getApiHeaders=y;exports.getApiUrl=v;exports.getDocumentManagerConfig=c;exports.setDocumentManagerConfig=g;
|
package/dist/index.cjs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./heading.cjs.js"),r=require("./bold.cjs.js"),o=require("./italic.cjs.js"),u=require("./underline.cjs.js"),a=require("./strikethrough.cjs.js"),g=require("./list.cjs.js"),s=require("./checklist.cjs.js"),P=require("./history.cjs.js"),c=require("./link.cjs.js"),m=require("./blockquote.cjs.js"),C=require("./clear-formatting.cjs.js"),d=require("./CodePlugin.native-
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("./heading.cjs.js"),r=require("./bold.cjs.js"),o=require("./italic.cjs.js"),u=require("./underline.cjs.js"),a=require("./strikethrough.cjs.js"),g=require("./list.cjs.js"),s=require("./checklist.cjs.js"),P=require("./history.cjs.js"),c=require("./link.cjs.js"),m=require("./blockquote.cjs.js"),C=require("./clear-formatting.cjs.js"),d=require("./CodePlugin.native-CKJo7IFG.js"),q=require("./table.cjs.js"),p=require("./font-size.cjs.js"),h=require("./format-painter.cjs.js"),k=require("./font-family.cjs.js"),f=require("./text-alignment.cjs.js"),T=require("./text-color.cjs.js"),M=require("./background-color.cjs.js"),b=require("./line-height.cjs.js"),S=require("./indent.cjs.js"),A=require("./direction.cjs.js"),D=require("./capitalization.cjs.js"),F=require("./math.cjs.js"),y=require("./special-characters.cjs.js"),B=require("./emojis.cjs.js"),E=require("./embed-iframe.cjs.js"),I=require("./anchor.cjs.js"),v=require("./mentions.cjs.js"),L=require("./track-changes.cjs.js"),w=require("./version-diff.cjs.js"),H=require("./conditional-content.cjs.js"),z=require("./data-binding.cjs.js"),R=require("./content-rules.cjs.js"),x=require("./citations.cjs.js"),G=require("./approval-workflow.cjs.js"),W=require("./pii-redaction.cjs.js"),_=require("./smart-paste.cjs.js"),j=require("./blocks-library.cjs.js"),U=require("./doc-schema.cjs.js"),N=require("./translation-workflow.cjs.js"),V=require("./slash-commands.cjs.js"),n=require("./media-manager.cjs.js"),t=require("./index-D5xugkYA.js"),O=require("./preview.cjs.js"),J=require("./fullscreen.cjs.js"),K=require("./print.cjs.js"),Q=require("./page-break.cjs.js"),X=require("./footnote.cjs.js"),Y=require("./code-sample.cjs.js"),Z=require("./merge-tag.cjs.js"),e=require("./template.cjs.js"),$=require("./comments.cjs.js"),ee=require("./collaboration.cjs.js"),ie=require("./spell-check.cjs.js"),ne=require("./a11y-checker.cjs.js"),i=require("./shared-config.cjs.js");exports.HeadingPlugin=l.HeadingPlugin;exports.BoldPlugin=r.BoldPlugin;exports.ItalicPlugin=o.ItalicPlugin;exports.UnderlinePlugin=u.UnderlinePlugin;exports.StrikethroughPlugin=a.StrikethroughPlugin;exports.ListPlugin=g.ListPlugin;exports.ChecklistPlugin=s.ChecklistPlugin;exports.HistoryPlugin=P.HistoryPlugin;exports.LinkPlugin=c.LinkPlugin;exports.BlockquotePlugin=m.BlockquotePlugin;exports.ClearFormattingPlugin=C.ClearFormattingPlugin;exports.CodePlugin=d.CodePlugin;exports.TablePlugin=q.TablePlugin;exports.FontSizePlugin=p.FontSizePlugin;exports.FormatPainterPlugin=h.FormatPainterPlugin;exports.FontFamilyPlugin=k.FontFamilyPlugin;exports.TextAlignmentPlugin=f.TextAlignmentPlugin;exports.TextColorPlugin=T.TextColorPlugin;exports.BackgroundColorPlugin=M.BackgroundColorPlugin;exports.LineHeightPlugin=b.LineHeightPlugin;exports.IndentPlugin=S.IndentPlugin;exports.DirectionPlugin=A.DirectionPlugin;exports.CapitalizationPlugin=D.CapitalizationPlugin;exports.MathPlugin=F.MathPlugin;exports.SpecialCharactersPlugin=y.SpecialCharactersPlugin;exports.EmojisPlugin=B.EmojisPlugin;exports.EmbedIframePlugin=E.EmbedIframePlugin;exports.AnchorPlugin=I.AnchorPlugin;exports.MentionPlugin=v.MentionPlugin;exports.TrackChangesPlugin=L.TrackChangesPlugin;exports.VersionDiffPlugin=w.VersionDiffPlugin;exports.ConditionalContentPlugin=H.ConditionalContentPlugin;exports.DataBindingPlugin=z.DataBindingPlugin;exports.ContentRulesPlugin=R.ContentRulesPlugin;exports.CitationsPlugin=x.CitationsPlugin;exports.ApprovalWorkflowPlugin=G.ApprovalWorkflowPlugin;exports.PIIRedactionPlugin=W.PIIRedactionPlugin;exports.SmartPastePlugin=_.SmartPastePlugin;exports.BlocksLibraryPlugin=j.BlocksLibraryPlugin;exports.DocSchemaPlugin=U.DocSchemaPlugin;exports.TranslationWorkflowPlugin=N.TranslationWorkflowPlugin;exports.SlashCommandsPlugin=V.SlashCommandsPlugin;exports.MediaManagerPlugin=n.MediaManagerPlugin;exports.getMediaManagerConfig=n.getMediaManagerConfig;exports.setMediaManagerConfig=n.setMediaManagerConfig;exports.DocumentManagerPlugin=t.DocumentManagerPlugin;exports.getDocumentManagerConfig=t.getDocumentManagerConfig;exports.setDocumentManagerConfig=t.setDocumentManagerConfig;exports.PreviewPlugin=O.PreviewPlugin;exports.FullscreenPlugin=J.FullscreenPlugin;exports.PrintPlugin=K.PrintPlugin;exports.PageBreakPlugin=Q.PageBreakPlugin;exports.FootnotePlugin=X.FootnotePlugin;exports.CodeSamplePlugin=Y.CodeSamplePlugin;exports.MergeTagPlugin=Z.MergeTagPlugin;exports.PREDEFINED_TEMPLATES=e.PREDEFINED_TEMPLATES;exports.TemplatePlugin=e.TemplatePlugin;exports.addCustomTemplate=e.addCustomTemplate;exports.getAllTemplates=e.getAllTemplates;exports.getTemplateCategories=e.getTemplateCategories;exports.getTemplatesByCategory=e.getTemplatesByCategory;exports.sanitizeTemplate=e.sanitizeTemplate;exports.searchTemplates=e.searchTemplates;exports.validateTemplate=e.validateTemplate;exports.CommentsPlugin=$.CommentsPlugin;exports.CollaborationPlugin=ee.CollaborationPlugin;exports.SpellCheckPlugin=ie.SpellCheckPlugin;exports.A11yCheckerPlugin=ne.A11yCheckerPlugin;exports.buildApiUrl=i.buildApiUrl;exports.getGlobalApiConfig=i.getGlobalApiConfig;exports.getGlobalApiHeaders=i.getGlobalApiHeaders;exports.setGlobalApiConfig=i.setGlobalApiConfig;
|
package/dist/index.esm.js
CHANGED
|
@@ -9,7 +9,7 @@ import { HistoryPlugin as C } from "./history.esm.js";
|
|
|
9
9
|
import { LinkPlugin as d } from "./link.esm.js";
|
|
10
10
|
import { BlockquotePlugin as h } from "./blockquote.esm.js";
|
|
11
11
|
import { ClearFormattingPlugin as k } from "./clear-formatting.esm.js";
|
|
12
|
-
import { C as D } from "./CodePlugin.native-
|
|
12
|
+
import { C as D } from "./CodePlugin.native-D8gGxB8i.mjs";
|
|
13
13
|
import { TablePlugin as b } from "./table.esm.js";
|
|
14
14
|
import { FontSizePlugin as B } from "./font-size.esm.js";
|
|
15
15
|
import { FormatPainterPlugin as y } from "./format-painter.esm.js";
|
|
@@ -41,7 +41,7 @@ import { DocSchemaPlugin as Fo } from "./doc-schema.esm.js";
|
|
|
41
41
|
import { TranslationWorkflowPlugin as Eo } from "./translation-workflow.esm.js";
|
|
42
42
|
import { SlashCommandsPlugin as Io } from "./slash-commands.esm.js";
|
|
43
43
|
import { MediaManagerPlugin as Ho, getMediaManagerConfig as vo, setMediaManagerConfig as wo } from "./media-manager.esm.js";
|
|
44
|
-
import { D as Go, g as Ro, s as Uo } from "./index-
|
|
44
|
+
import { D as Go, g as Ro, s as Uo } from "./index-B-VitI3v.mjs";
|
|
45
45
|
import { PreviewPlugin as jo } from "./preview.esm.js";
|
|
46
46
|
import { FullscreenPlugin as No } from "./fullscreen.esm.js";
|
|
47
47
|
import { PrintPlugin as _o } from "./print.esm.js";
|
package/dist/preview.cjs.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./dialogHelpers-zU6zpMIA.js");let
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const v=require("./dialogHelpers-zU6zpMIA.js"),h=require("./sanitizeHtml-CDoBlNTk.js");let a=!1,s=null;const w=()=>{if(typeof document>"u")return;const r="rte-preview-plugin-styles";if(document.getElementById(r))return;const t=document.createElement("style");t.id=r,t.textContent=`
|
|
2
2
|
/* Preview Editor Dialog Styles */
|
|
3
3
|
.rte-preview-editor-overlay {
|
|
4
4
|
position: fixed !important;
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
font-size: 14px;
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
`,document.head.appendChild(t)},u=()=>{const
|
|
220
|
+
`,document.head.appendChild(t)},u=()=>{const r=window.getSelection();if(r&&r.rangeCount>0){let e=r.getRangeAt(0).startContainer;for(;e&&e!==document.body;){if(e.nodeType===Node.ELEMENT_NODE){const i=e;if(i.getAttribute("contenteditable")==="true")return i}e=e.parentNode}}const t=document.activeElement;if(t){if(t.getAttribute("contenteditable")==="true")return t;const e=t.closest('[contenteditable="true"]');if(e)return e}return document.querySelector('[contenteditable="true"]')},f=()=>{const r=u();if(!r)return"";const t=r.cloneNode(!0);return[".rte-floating-toolbar",".rte-selection-marker",".rte-toolbar",".rte-resize-handle","[data-rte-internal]"].forEach(i=>{t.querySelectorAll(i).forEach(n=>n.remove())}),t.innerHTML},b=r=>{const t=document.createElement("template");return t.innerHTML=h.sanitizeHtml(r),t.content.querySelectorAll("*").forEach(e=>{e.setAttribute("contenteditable","false")}),t.innerHTML},x=()=>{if(typeof window>"u"||a)return;a=!0,w();const r=f(),t=b(r),e=document.createElement("div");v.initDialogOverlay(e),e.className="rte-preview-editor-overlay",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e.setAttribute("aria-labelledby","preview-editor-title");const i=document.createElement("div");i.className="rte-preview-editor-modal";const n=document.createElement("div");n.className="rte-preview-editor-header",n.innerHTML=`
|
|
221
221
|
<h2 id="preview-editor-title">Preview Editor</h2>
|
|
222
222
|
<div class="rte-preview-editor-header-actions">
|
|
223
223
|
<button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
|
|
@@ -227,4 +227,4 @@
|
|
|
227
227
|
</svg>
|
|
228
228
|
</button>
|
|
229
229
|
</div>
|
|
230
|
-
`;const
|
|
230
|
+
`;const l=document.createElement("div");l.className="rte-preview-editor-body";const p=document.createElement("div");p.className="rte-preview-editor-content";const c=document.createElement("div");c.className="rte-preview-editor-light-editor",c.innerHTML=t,p.appendChild(c),l.appendChild(p),i.appendChild(n),i.appendChild(l),e.appendChild(i);const d=()=>{e.parentNode&&e.parentNode.removeChild(e),a=!1,s=null,document.removeEventListener("keydown",g)};s=d;const g=o=>{o.key==="Escape"&&(o.preventDefault(),o.stopPropagation(),d())},m=n.querySelector(".rte-preview-editor-close-btn");m&&m.addEventListener("click",o=>{o.preventDefault(),o.stopPropagation(),d()}),e.addEventListener("click",o=>{o.target===e&&d()}),document.addEventListener("keydown",g),document.body.appendChild(e)},y=()=>({name:"preview",toolbar:[{label:"Preview",command:"togglePreview",icon:'<svg fill="#000000" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M91.3,43.8C90.6,42.8,74.4,19,46,19C17.6,19,1.4,42.8,0.7,43.8c-0.9,1.3-0.9,3.1,0,4.5 C1.4,49.2,17.6,73,46,73c28.4,0,44.6-23.8,45.3-24.8C92.2,46.9,92.2,45.1,91.3,43.8z M46,65C26.7,65,13.5,51.4,9,46 c4.5-5.5,17.6-19,37-19c19.3,0,32.5,13.6,37,19C78.4,51.5,65.3,65,46,65z M48.3,29.6c-4.4-0.6-8.7,0.5-12.3,3.2c0,0,0,0,0,0 c-7.3,5.5-8.8,15.9-3.3,23.2c2.7,3.6,6.5,5.8,10.9,6.5c0.8,0.1,1.6,0.2,2.3,0.2c3.6,0,7-1.2,9.9-3.3c7.3-5.5,8.8-15.9,3.3-23.2 C56.6,32.5,52.7,30.2,48.3,29.6z M52.3,54.5c-2.2,1.7-5,2.4-7.8,2c-2.8-0.4-5.3-1.9-7-4.1C34.1,47.7,35,41,39.7,37.5 c2.2-1.7,5-2.4,7.8-2c2.8,0.4,5.3,1.9,7,4.1C57.9,44.3,57,51,52.3,54.5z M51.9,40c0.8,0.7,1.2,1.8,1.2,2.8c0,1-0.4,2.1-1.2,2.8 c-0.7,0.7-1.8,1.2-2.8,1.2c-1.1,0-2.1-0.4-2.8-1.2c-0.8-0.8-1.2-1.8-1.2-2.8c0-1.1,0.4-2.1,1.2-2.8c0.7-0.8,1.8-1.2,2.8-1.2 C50.2,38.9,51.2,39.3,51.9,40z"></path> </g></svg>'}],commands:{togglePreview:()=>(a?s?.():x(),!0)},keymap:{}});exports.PreviewPlugin=y;
|
package/dist/preview.esm.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { i as v } from "./dialogHelpers-5d5BuOCW.mjs";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
import { s as h } from "./sanitizeHtml-CtLy8um-.mjs";
|
|
3
|
+
let a = !1, s = null;
|
|
4
|
+
const w = () => {
|
|
4
5
|
if (typeof document > "u") return;
|
|
5
|
-
const
|
|
6
|
-
if (document.getElementById(
|
|
6
|
+
const r = "rte-preview-plugin-styles";
|
|
7
|
+
if (document.getElementById(r)) return;
|
|
7
8
|
const t = document.createElement("style");
|
|
8
|
-
t.id =
|
|
9
|
+
t.id = r, t.textContent = `
|
|
9
10
|
/* Preview Editor Dialog Styles */
|
|
10
11
|
.rte-preview-editor-overlay {
|
|
11
12
|
position: fixed !important;
|
|
@@ -225,15 +226,15 @@ const h = () => {
|
|
|
225
226
|
}
|
|
226
227
|
}
|
|
227
228
|
`, document.head.appendChild(t);
|
|
228
|
-
},
|
|
229
|
-
const
|
|
230
|
-
if (
|
|
231
|
-
let e =
|
|
229
|
+
}, u = () => {
|
|
230
|
+
const r = window.getSelection();
|
|
231
|
+
if (r && r.rangeCount > 0) {
|
|
232
|
+
let e = r.getRangeAt(0).startContainer;
|
|
232
233
|
for (; e && e !== document.body; ) {
|
|
233
234
|
if (e.nodeType === Node.ELEMENT_NODE) {
|
|
234
|
-
const
|
|
235
|
-
if (
|
|
236
|
-
return
|
|
235
|
+
const i = e;
|
|
236
|
+
if (i.getAttribute("contenteditable") === "true")
|
|
237
|
+
return i;
|
|
237
238
|
}
|
|
238
239
|
e = e.parentNode;
|
|
239
240
|
}
|
|
@@ -246,37 +247,33 @@ const h = () => {
|
|
|
246
247
|
if (e) return e;
|
|
247
248
|
}
|
|
248
249
|
return document.querySelector('[contenteditable="true"]');
|
|
249
|
-
},
|
|
250
|
-
const
|
|
251
|
-
if (!
|
|
252
|
-
const t =
|
|
250
|
+
}, f = () => {
|
|
251
|
+
const r = u();
|
|
252
|
+
if (!r) return "";
|
|
253
|
+
const t = r.cloneNode(!0);
|
|
253
254
|
return [
|
|
254
255
|
".rte-floating-toolbar",
|
|
255
256
|
".rte-selection-marker",
|
|
256
257
|
".rte-toolbar",
|
|
257
258
|
".rte-resize-handle",
|
|
258
259
|
"[data-rte-internal]"
|
|
259
|
-
].forEach((
|
|
260
|
-
t.querySelectorAll(
|
|
260
|
+
].forEach((i) => {
|
|
261
|
+
t.querySelectorAll(i).forEach((n) => n.remove());
|
|
261
262
|
}), t.innerHTML;
|
|
262
|
-
},
|
|
263
|
-
const t = document.createElement("
|
|
264
|
-
return t.innerHTML =
|
|
265
|
-
|
|
266
|
-
).forEach((r) => r.remove()), t.querySelectorAll("*").forEach((r) => {
|
|
267
|
-
Array.from(r.attributes).forEach((o) => {
|
|
268
|
-
o.name.startsWith("on") && r.removeAttribute(o.name), (o.name === "href" || o.name === "src") && o.value.startsWith("javascript:") && r.removeAttribute(o.name), o.name.toLowerCase() === "contenteditable" && r.removeAttribute(o.name);
|
|
269
|
-
}), r.setAttribute("contenteditable", "false");
|
|
263
|
+
}, x = (r) => {
|
|
264
|
+
const t = document.createElement("template");
|
|
265
|
+
return t.innerHTML = h(r), t.content.querySelectorAll("*").forEach((e) => {
|
|
266
|
+
e.setAttribute("contenteditable", "false");
|
|
270
267
|
}), t.innerHTML;
|
|
271
268
|
}, b = () => {
|
|
272
|
-
if (typeof window > "u" ||
|
|
273
|
-
|
|
274
|
-
const
|
|
269
|
+
if (typeof window > "u" || a) return;
|
|
270
|
+
a = !0, w();
|
|
271
|
+
const r = f(), t = x(r), e = document.createElement("div");
|
|
275
272
|
v(e), e.className = "rte-preview-editor-overlay", e.setAttribute("role", "dialog"), e.setAttribute("aria-modal", "true"), e.setAttribute("aria-labelledby", "preview-editor-title");
|
|
273
|
+
const i = document.createElement("div");
|
|
274
|
+
i.className = "rte-preview-editor-modal";
|
|
276
275
|
const n = document.createElement("div");
|
|
277
|
-
n.className = "rte-preview-editor-
|
|
278
|
-
const r = document.createElement("div");
|
|
279
|
-
r.className = "rte-preview-editor-header", r.innerHTML = `
|
|
276
|
+
n.className = "rte-preview-editor-header", n.innerHTML = `
|
|
280
277
|
<h2 id="preview-editor-title">Preview Editor</h2>
|
|
281
278
|
<div class="rte-preview-editor-header-actions">
|
|
282
279
|
<button class="rte-preview-editor-close-btn" aria-label="Close preview editor">
|
|
@@ -287,38 +284,38 @@ const h = () => {
|
|
|
287
284
|
</button>
|
|
288
285
|
</div>
|
|
289
286
|
`;
|
|
290
|
-
const
|
|
291
|
-
|
|
292
|
-
const c = document.createElement("div");
|
|
293
|
-
c.className = "rte-preview-editor-content";
|
|
287
|
+
const l = document.createElement("div");
|
|
288
|
+
l.className = "rte-preview-editor-body";
|
|
294
289
|
const p = document.createElement("div");
|
|
295
|
-
p.className = "rte-preview-editor-
|
|
296
|
-
const
|
|
297
|
-
|
|
290
|
+
p.className = "rte-preview-editor-content";
|
|
291
|
+
const c = document.createElement("div");
|
|
292
|
+
c.className = "rte-preview-editor-light-editor", c.innerHTML = t, p.appendChild(c), l.appendChild(p), i.appendChild(n), i.appendChild(l), e.appendChild(i);
|
|
293
|
+
const d = () => {
|
|
294
|
+
e.parentNode && e.parentNode.removeChild(e), a = !1, s = null, document.removeEventListener("keydown", m);
|
|
298
295
|
};
|
|
299
|
-
s =
|
|
300
|
-
const m = (
|
|
301
|
-
|
|
302
|
-
}, g =
|
|
303
|
-
g && g.addEventListener("click", (
|
|
304
|
-
|
|
305
|
-
}), e.addEventListener("click", (
|
|
306
|
-
|
|
296
|
+
s = d;
|
|
297
|
+
const m = (o) => {
|
|
298
|
+
o.key === "Escape" && (o.preventDefault(), o.stopPropagation(), d());
|
|
299
|
+
}, g = n.querySelector(".rte-preview-editor-close-btn");
|
|
300
|
+
g && g.addEventListener("click", (o) => {
|
|
301
|
+
o.preventDefault(), o.stopPropagation(), d();
|
|
302
|
+
}), e.addEventListener("click", (o) => {
|
|
303
|
+
o.target === e && d();
|
|
307
304
|
}), document.addEventListener("keydown", m), document.body.appendChild(e);
|
|
308
|
-
},
|
|
305
|
+
}, k = () => ({
|
|
309
306
|
name: "preview",
|
|
310
307
|
toolbar: [
|
|
311
308
|
{
|
|
312
309
|
label: "Preview",
|
|
313
310
|
command: "togglePreview",
|
|
314
|
-
icon: '<svg fill="#000000" version="1.1"
|
|
311
|
+
icon: '<svg fill="#000000" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="24px" height="24px" viewBox="0 0 92 92" enable-background="new 0 0 92 92" xml:space="preserve"><g stroke-width="0"></g><g stroke-linecap="round" stroke-linejoin="round"></g><g> <path d="M91.3,43.8C90.6,42.8,74.4,19,46,19C17.6,19,1.4,42.8,0.7,43.8c-0.9,1.3-0.9,3.1,0,4.5 C1.4,49.2,17.6,73,46,73c28.4,0,44.6-23.8,45.3-24.8C92.2,46.9,92.2,45.1,91.3,43.8z M46,65C26.7,65,13.5,51.4,9,46 c4.5-5.5,17.6-19,37-19c19.3,0,32.5,13.6,37,19C78.4,51.5,65.3,65,46,65z M48.3,29.6c-4.4-0.6-8.7,0.5-12.3,3.2c0,0,0,0,0,0 c-7.3,5.5-8.8,15.9-3.3,23.2c2.7,3.6,6.5,5.8,10.9,6.5c0.8,0.1,1.6,0.2,2.3,0.2c3.6,0,7-1.2,9.9-3.3c7.3-5.5,8.8-15.9,3.3-23.2 C56.6,32.5,52.7,30.2,48.3,29.6z M52.3,54.5c-2.2,1.7-5,2.4-7.8,2c-2.8-0.4-5.3-1.9-7-4.1C34.1,47.7,35,41,39.7,37.5 c2.2-1.7,5-2.4,7.8-2c2.8,0.4,5.3,1.9,7,4.1C57.9,44.3,57,51,52.3,54.5z M51.9,40c0.8,0.7,1.2,1.8,1.2,2.8c0,1-0.4,2.1-1.2,2.8 c-0.7,0.7-1.8,1.2-2.8,1.2c-1.1,0-2.1-0.4-2.8-1.2c-0.8-0.8-1.2-1.8-1.2-2.8c0-1.1,0.4-2.1,1.2-2.8c0.7-0.8,1.8-1.2,2.8-1.2 C50.2,38.9,51.2,39.3,51.9,40z"></path> </g></svg>'
|
|
315
312
|
}
|
|
316
313
|
],
|
|
317
314
|
commands: {
|
|
318
|
-
togglePreview: () => (
|
|
315
|
+
togglePreview: () => (a ? s?.() : b(), !0)
|
|
319
316
|
},
|
|
320
317
|
keymap: {}
|
|
321
318
|
});
|
|
322
319
|
export {
|
|
323
|
-
|
|
320
|
+
k as PreviewPlugin
|
|
324
321
|
};
|