@editora/plugins 1.0.8 → 1.0.10
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 +27 -0
- package/dist/_commonjsHelpers-6763f629.js +1 -0
- package/dist/_commonjsHelpers-c5d32002.mjs +30 -0
- package/dist/a11y-checker.cjs.js +12 -12
- package/dist/a11y-checker.esm.js +98 -80
- package/dist/anchor.cjs.js +12 -12
- package/dist/anchor.esm.js +128 -115
- package/dist/anchoredPopover-33f1358d.mjs +109 -0
- package/dist/anchoredPopover-8151d535.js +1 -0
- package/dist/approval-workflow.cjs.js +447 -0
- package/dist/approval-workflow.esm.js +1111 -0
- package/dist/background-color.cjs.js +2 -2
- package/dist/background-color.esm.js +68 -55
- package/dist/blockquote.esm.js +2 -1
- package/dist/blocks-library.cjs.js +442 -0
- package/dist/blocks-library.esm.js +1384 -0
- package/dist/capitalization.esm.js +2 -1
- package/dist/checklist.cjs.js +1 -1
- package/dist/checklist.esm.js +82 -58
- package/dist/citations.cjs.js +548 -0
- package/dist/citations.esm.js +1530 -0
- package/dist/clear-formatting.cjs.js +1 -1
- package/dist/clear-formatting.esm.js +33 -27
- package/dist/code-sample.cjs.js +14 -14
- package/dist/code-sample.esm.js +93 -82
- package/dist/code.cjs.js +32 -32
- package/dist/code.esm.js +653 -594
- package/dist/comments.cjs.js +6 -6
- package/dist/comments.esm.js +158 -116
- package/dist/conditional-content.cjs.js +626 -0
- package/dist/conditional-content.esm.js +1421 -0
- package/dist/content-rules.cjs.js +408 -0
- package/dist/content-rules.esm.js +1147 -0
- package/dist/data-binding.cjs.js +321 -0
- package/dist/data-binding.esm.js +953 -0
- package/dist/direction.esm.js +18 -9
- package/dist/doc-schema.cjs.js +398 -0
- package/dist/doc-schema.esm.js +1378 -0
- package/dist/document-manager.cjs.js +1 -1
- package/dist/document-manager.esm.js +5 -4
- package/dist/documentManager-25b6203c.mjs +9122 -0
- package/dist/documentManager-b69e7054.js +17 -0
- package/dist/{editorContainerHelpers-C7kdWnS0.mjs → editorContainerHelpers-69585c07.mjs} +2 -1
- package/dist/embed-iframe.cjs.js +4 -4
- package/dist/embed-iframe.esm.js +81 -73
- package/dist/emojis.cjs.js +8 -8
- package/dist/emojis.esm.js +77 -65
- package/dist/enterprise.cjs.js +1 -0
- package/dist/enterprise.esm.js +58 -0
- package/dist/font-family.cjs.js +1 -1
- package/dist/font-family.esm.js +47 -39
- package/dist/font-size.cjs.js +1 -1
- package/dist/font-size.esm.js +53 -37
- package/dist/footnote.cjs.js +2 -2
- package/dist/footnote.esm.js +117 -76
- package/dist/history.cjs.js +1 -1
- package/dist/history.esm.js +92 -70
- package/dist/html2canvas.esm-09133e29.js +22 -0
- package/dist/{html2canvas.esm-BWVIUcAF.mjs → html2canvas.esm-1a1724a1.mjs} +225 -141
- package/dist/indent.cjs.js +1 -1
- package/dist/indent.esm.js +24 -12
- package/dist/index-656d224b.js +231 -0
- package/dist/index-6a8c48bb.js +1 -0
- package/dist/index-d027b7e2.mjs +16859 -0
- package/dist/{index-BFsKNTTj.mjs → index-f04538f2.mjs} +71 -70
- package/dist/index.cjs.js +1 -1
- package/dist/index.es-730f2d98.mjs +5775 -0
- package/dist/index.es-dd40173b.js +18 -0
- package/dist/index.esm.js +124 -93
- package/dist/italic.cjs.js +1 -1
- package/dist/italic.esm.js +9 -8
- package/dist/jspdf.es.min-90db2c97.js +243 -0
- package/dist/{jspdf.es.min-DQCoX5yh.mjs → jspdf.es.min-c36a4fd8.mjs} +4682 -3658
- package/dist/line-height.cjs.js +1 -1
- package/dist/line-height.esm.js +24 -11
- package/dist/link.cjs.js +5 -5
- package/dist/link.esm.js +30 -24
- package/dist/list.cjs.js +1 -1
- package/dist/list.esm.js +25 -20
- package/dist/lite.cjs.js +1 -1
- package/dist/lite.esm.js +61 -59
- package/dist/math.cjs.js +21 -21
- package/dist/math.esm.js +146 -139
- package/dist/media-manager.cjs.js +38 -38
- package/dist/media-manager.esm.js +325 -308
- package/dist/mentions.cjs.js +105 -0
- package/dist/mentions.esm.js +774 -0
- package/dist/merge-tag.cjs.js +2 -2
- package/dist/merge-tag.esm.js +216 -177
- package/dist/page-break.cjs.js +2 -2
- package/dist/page-break.esm.js +67 -51
- package/dist/pii-redaction.cjs.js +436 -0
- package/dist/pii-redaction.esm.js +1447 -0
- package/dist/preview.cjs.js +3 -3
- package/dist/preview.esm.js +37 -32
- package/dist/print.cjs.js +4 -4
- package/dist/print.esm.js +20 -17
- package/dist/{purify.es-DHhaBdbu.mjs → purify.es-35a15df8.mjs} +19 -9
- package/dist/{purify.es-T2a3nLiC.js → purify.es-a8d731c6.js} +1 -1
- package/dist/slash-commands.cjs.js +90 -0
- package/dist/slash-commands.esm.js +788 -0
- package/dist/smart-paste.cjs.js +398 -0
- package/dist/smart-paste.esm.js +1444 -0
- package/dist/special-characters.cjs.js +7 -7
- package/dist/special-characters.esm.js +69 -61
- package/dist/spell-check.cjs.js +5 -5
- package/dist/spell-check.esm.js +123 -97
- package/dist/strikethrough.cjs.js +1 -1
- package/dist/strikethrough.esm.js +19 -14
- package/dist/style.css +1 -0
- package/dist/table.cjs.js +4 -4
- package/dist/table.esm.js +225 -191
- package/dist/template.cjs.js +11 -11
- package/dist/template.esm.js +153 -124
- package/dist/text-alignment.cjs.js +1 -1
- package/dist/text-alignment.esm.js +27 -21
- package/dist/text-color.cjs.js +3 -3
- package/dist/text-color.esm.js +87 -70
- package/dist/track-changes.cjs.js +77 -0
- package/dist/track-changes.esm.js +817 -0
- package/dist/translation-workflow.cjs.js +626 -0
- package/dist/translation-workflow.esm.js +1794 -0
- package/dist/version-diff.cjs.js +362 -0
- package/dist/version-diff.esm.js +797 -0
- package/index.d.ts +798 -0
- package/package.json +114 -9
- package/dist/_commonjsHelpers-BH3jXuIh.js +0 -1
- package/dist/_commonjsHelpers-ByX85dGu.mjs +0 -33
- package/dist/anchoredPopover-BzqGPOAE.js +0 -1
- package/dist/anchoredPopover-Dts0IrgU.mjs +0 -106
- package/dist/documentManager-CTqRftU8.mjs +0 -8369
- package/dist/documentManager-Jf0RbSks.js +0 -17
- package/dist/html2canvas.esm-B5qzocYs.js +0 -5
- package/dist/index-CvJk4DKa.js +0 -221
- package/dist/index-D3CycEFU.mjs +0 -16543
- package/dist/index-tqLTHcO6.js +0 -1
- package/dist/index.es-CE_A4QSm.js +0 -5
- package/dist/index.es-DQ78mYYo.mjs +0 -6665
- package/dist/jspdf.es.min-BoS80556.js +0 -77
- package/dist/plugins.css +0 -1
- /package/dist/{editorContainerHelpers-CFbfiOJI.js → editorContainerHelpers-36b8ddf3.js} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./shared-config.cjs.js");let
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});require("./shared-config.cjs.js");let R=null,m=null,s=null,H=[],_=!1,A=null,U=0,F=0,M=0,q=0,B=1,D=null;const O='[data-theme="dark"], .dark, .editora-theme-dark',I=(t,e)=>{const r=a=>{a.key!=="Escape"||!t.isConnected||(a.preventDefault(),a.stopPropagation(),e())};return document.addEventListener("keydown",r,!0),()=>{document.removeEventListener("keydown",r,!0)}},Y=()=>{if(typeof document>"u"||document.getElementById("rte-media-dialog-styles"))return;const t=document.createElement("style");t.id="rte-media-dialog-styles",t.textContent=`
|
|
2
2
|
.rte-media-overlay {
|
|
3
3
|
--rte-media-overlay-bg: rgba(15, 23, 36, 0.56);
|
|
4
4
|
--rte-media-bg: #ffffff;
|
|
@@ -376,7 +376,7 @@
|
|
|
376
376
|
}
|
|
377
377
|
|
|
378
378
|
.media-floating-toolbar.rte-ui-theme-dark,
|
|
379
|
-
${
|
|
379
|
+
${O} .media-floating-toolbar {
|
|
380
380
|
--rte-media-toolbar-bg: #24303f;
|
|
381
381
|
--rte-media-toolbar-border: #4a5a71;
|
|
382
382
|
--rte-media-toolbar-text: #d9e6fb;
|
|
@@ -424,27 +424,27 @@
|
|
|
424
424
|
margin: 0 2px;
|
|
425
425
|
background: var(--rte-media-toolbar-separator);
|
|
426
426
|
}
|
|
427
|
-
`,document.head.appendChild(
|
|
427
|
+
`,document.head.appendChild(t)},Z=()=>{const t=window.getSelection();if(!t||t.rangeCount===0)return null;const e=t.anchorNode,r=e instanceof HTMLElement?e:e==null?void 0:e.parentElement;return(r==null?void 0:r.closest(".rte-content, .editora-content"))||null},K=t=>{if(t)return t;const e=Z();if(e)return e;if(D)return D;const r=document.activeElement;return r?r.closest(".rte-content, .editora-content")||r:null},G=t=>{const e=K(t);return e?!!e.closest(O):!1},N=t=>{Y();const e=document.createElement("div");return e.className="rte-media-overlay",G(t)&&e.classList.add("rte-ui-theme-dark"),e},P=(t=!1)=>{const e=document.createElement("div");return e.className=t?"rte-media-dialog rte-media-dialog-compact":"rte-media-dialog",e.setAttribute("role","dialog"),e.setAttribute("aria-modal","true"),e},W=(t,e)=>{const r=window.getSelection();r&&r.rangeCount>0&&(R=r.getRangeAt(0).cloneRange());const a=N(e),o=P();let n="upload",d="",p="",c="",v="";const h=()=>{o.innerHTML=`
|
|
428
428
|
<div class="rte-media-header">
|
|
429
|
-
<h2 class="rte-media-title">Insert ${
|
|
429
|
+
<h2 class="rte-media-title">Insert ${t==="image"?"Image":"Video"}</h2>
|
|
430
430
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
431
431
|
</div>
|
|
432
432
|
|
|
433
433
|
<div class="rte-media-tabs">
|
|
434
|
-
<button class="tab-upload rte-media-tab ${
|
|
435
|
-
<button class="tab-url rte-media-tab ${
|
|
434
|
+
<button class="tab-upload rte-media-tab ${n==="upload"?"active":""}" type="button">Upload</button>
|
|
435
|
+
<button class="tab-url rte-media-tab ${n==="url"?"active":""}" type="button">URL</button>
|
|
436
436
|
</div>
|
|
437
437
|
|
|
438
438
|
<div class="rte-media-body">
|
|
439
|
-
${
|
|
439
|
+
${n==="upload"?`
|
|
440
440
|
<div id="upload-section">
|
|
441
441
|
<div class="dropzone rte-media-dropzone">
|
|
442
442
|
<div class="rte-media-dropzone-icon">📁</div>
|
|
443
|
-
<p class="rte-media-dropzone-title">Drag and drop your ${
|
|
443
|
+
<p class="rte-media-dropzone-title">Drag and drop your ${t} here</p>
|
|
444
444
|
<p class="rte-media-muted">or click to browse</p>
|
|
445
445
|
<p class="rte-media-hint">Max file size: 50MB</p>
|
|
446
446
|
</div>
|
|
447
|
-
<input type="file" id="file-input" accept="${
|
|
447
|
+
<input type="file" id="file-input" accept="${t==="image"?"image/*":"video/*"}" style="display: none;">
|
|
448
448
|
<div id="upload-progress" class="rte-media-progress" style="display: none;">
|
|
449
449
|
<div class="rte-media-progress-track">
|
|
450
450
|
<div id="progress-bar" class="rte-media-progress-bar"></div>
|
|
@@ -456,29 +456,29 @@
|
|
|
456
456
|
<div id="url-section">
|
|
457
457
|
<div class="rte-media-field">
|
|
458
458
|
<label class="rte-media-label">URL</label>
|
|
459
|
-
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${
|
|
459
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/${t}.${t==="image"?"jpg":"mp4"}" value="${d}">
|
|
460
460
|
</div>
|
|
461
|
-
${
|
|
461
|
+
${t==="image"?`
|
|
462
462
|
<div class="rte-media-field">
|
|
463
463
|
<label class="rte-media-label">Alt Text (for accessibility)</label>
|
|
464
|
-
<input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${
|
|
464
|
+
<input type="text" id="alt-input" class="rte-media-input" placeholder="Describe the image" value="${v}">
|
|
465
465
|
</div>
|
|
466
466
|
`:""}
|
|
467
467
|
<div class="rte-media-grid">
|
|
468
468
|
<div class="rte-media-field">
|
|
469
469
|
<label class="rte-media-label">Width (px)</label>
|
|
470
|
-
<input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${
|
|
470
|
+
<input type="number" id="width-input" class="rte-media-input" placeholder="Auto" value="${p}">
|
|
471
471
|
</div>
|
|
472
472
|
<div class="rte-media-field">
|
|
473
473
|
<label class="rte-media-label">Height (px)</label>
|
|
474
|
-
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${
|
|
474
|
+
<input type="number" id="height-input" class="rte-media-input" placeholder="Auto" value="${c}">
|
|
475
475
|
</div>
|
|
476
476
|
</div>
|
|
477
477
|
${d?`
|
|
478
478
|
<div class="rte-media-field">
|
|
479
479
|
<label class="rte-media-label">Preview</label>
|
|
480
480
|
<div class="rte-media-preview">
|
|
481
|
-
${
|
|
481
|
+
${t==="image"?`<img src="${d}" alt="Preview">`:`<video src="${d}" controls></video>`}
|
|
482
482
|
</div>
|
|
483
483
|
</div>
|
|
484
484
|
`:""}
|
|
@@ -488,36 +488,36 @@
|
|
|
488
488
|
|
|
489
489
|
<div class="rte-media-footer">
|
|
490
490
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
491
|
-
<button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d&&
|
|
491
|
+
<button id="insert-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!d&&n==="url"?"disabled":""}>Insert</button>
|
|
492
492
|
</div>
|
|
493
|
-
`};
|
|
493
|
+
`};h(),a.appendChild(o),document.body.appendChild(a);let w=()=>{};const f=()=>{w(),a.parentNode&&a.parentNode.removeChild(a)};w=I(a,f);const y=()=>{if(!d)return;const i=t==="image"?document.createElement("img"):document.createElement("video");i.src=d,i.setAttribute("data-media-type",t),t==="image"&&v&&(i.alt=v),p&&(i.style.width=`${p}px`,i.setAttribute("width",p)),c&&(i.style.height=`${c}px`,i.setAttribute("height",c)),t==="video"&&(i.controls=!0),!p&&!c?i.style.cssText="max-width: 100%; height: auto; display: block; margin: 1em 0; cursor: pointer;":i.style.cssText=`display: block; margin: 1em 0; cursor: pointer; ${p?`width: ${p}px;`:"max-width: 100%;"} ${c?`height: ${c}px;`:"height: auto;"}`,R&&(R.deleteContents(),R.insertNode(i)),f()},x=async i=>{const b=o.querySelector("#upload-progress"),g=o.querySelector("#progress-bar"),L=o.querySelector("#progress-text");if(b&&g&&L){b.style.display="block";let E=0;const u=setInterval(()=>{E+=Math.random()*30,E>90&&(E=90),g.style.width=`${E}%`},200);try{const k=new FileReader;k.onload=()=>{clearInterval(u),g.style.width="100%",L.textContent="Upload complete",setTimeout(()=>{d=k.result,n="url",h(),l()},500)},k.readAsDataURL(i)}catch{clearInterval(u),L.textContent="Upload failed"}}},l=()=>{const i=o.querySelector(".close-btn"),b=o.querySelector(".cancel-btn"),g=o.querySelector("#insert-btn"),L=o.querySelector(".tab-upload"),E=o.querySelector(".tab-url");if(i==null||i.addEventListener("click",f),b==null||b.addEventListener("click",f),g==null||g.addEventListener("click",y),L==null||L.addEventListener("click",()=>{n="upload",h(),l()}),E==null||E.addEventListener("click",()=>{n="url",h(),l()}),n==="upload"){const u=o.querySelector(".dropzone"),k=o.querySelector("#file-input");u==null||u.addEventListener("click",()=>k==null?void 0:k.click()),u==null||u.addEventListener("dragover",S=>{S.preventDefault(),u.classList.add("is-dragover")}),u==null||u.addEventListener("dragleave",()=>{u.classList.remove("is-dragover")}),u==null||u.addEventListener("drop",S=>{var T;S.preventDefault(),u.classList.remove("is-dragover");const C=(T=S.dataTransfer)==null?void 0:T.files[0];C&&x(C)}),k==null||k.addEventListener("change",S=>{var T;const C=(T=S.target.files)==null?void 0:T[0];C&&x(C)})}if(n==="url"){const u=o.querySelector("#url-input"),k=o.querySelector("#alt-input"),S=o.querySelector("#width-input"),C=o.querySelector("#height-input");u==null||u.addEventListener("input",()=>{d=u.value,h(),l()}),k==null||k.addEventListener("input",()=>{v=k.value}),S==null||S.addEventListener("input",()=>{p=S.value}),C==null||C.addEventListener("input",()=>{c=C.value})}};l(),a.addEventListener("click",i=>{i.target===a&&f()})},J=()=>{["nw","ne","sw","se"].forEach(e=>{const r=document.createElement("div");r.className=`media-resize-handle-${e}`,r.style.cssText=`
|
|
494
494
|
position: fixed;
|
|
495
495
|
width: 10px;
|
|
496
496
|
height: 10px;
|
|
497
497
|
background: #007bff;
|
|
498
498
|
border: 2px solid white;
|
|
499
499
|
border-radius: 50%;
|
|
500
|
-
cursor: ${
|
|
500
|
+
cursor: ${e}-resize;
|
|
501
501
|
z-index: 10001;
|
|
502
502
|
display: none;
|
|
503
503
|
box-shadow: 0 1px 3px rgba(0,0,0,0.3);
|
|
504
|
-
`,r.setAttribute("data-position",
|
|
504
|
+
`,r.setAttribute("data-position",e),document.body.appendChild(r),H.push(r)})},z=()=>{if(!m){H.forEach(r=>r.style.display="none");return}const t=m.getBoundingClientRect(),e={nw:{x:t.left-5,y:t.top-5},ne:{x:t.right-5,y:t.top-5},sw:{x:t.left-5,y:t.bottom-5},se:{x:t.right-5,y:t.bottom-5}};H.forEach(r=>{const a=r.getAttribute("data-position"),o=e[a];r.style.left=`${o.x}px`,r.style.top=`${o.y}px`,r.style.display="block"})},Q=t=>{const e=N(t),r=P(!0);r.innerHTML=`
|
|
505
505
|
<div class="rte-media-header">
|
|
506
506
|
<h2 class="rte-media-title">Edit Alt Text</h2>
|
|
507
507
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
508
508
|
</div>
|
|
509
509
|
<div class="rte-media-body">
|
|
510
510
|
<label class="rte-media-label">Alternative Text (for accessibility)</label>
|
|
511
|
-
<textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${
|
|
511
|
+
<textarea id="alt-text-input" class="rte-media-textarea" placeholder="Describe the image for screen readers...">${t.alt||""}</textarea>
|
|
512
512
|
<p class="rte-media-helper">Good alt text is descriptive and concise. It helps users with visual impairments understand your content.</p>
|
|
513
513
|
</div>
|
|
514
514
|
<div class="rte-media-footer">
|
|
515
515
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
516
516
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
517
517
|
</div>
|
|
518
|
-
`,
|
|
518
|
+
`,e.appendChild(r),document.body.appendChild(e);const a=r.querySelector("#alt-text-input"),o=r.querySelector(".close-btn"),n=r.querySelector(".cancel-btn"),d=r.querySelector(".save-btn");let p=()=>{};const c=()=>{p(),e.parentNode&&e.parentNode.removeChild(e)};p=I(e,c),o.addEventListener("click",c),n.addEventListener("click",c),e.addEventListener("click",v=>{v.target===e&&c()}),d.addEventListener("click",()=>{t.alt=a.value,c()}),a.focus(),a.select()},ee=t=>{const e=t.closest("a"),r=(e==null?void 0:e.getAttribute("href"))||"",a=(e==null?void 0:e.getAttribute("target"))||"_self",o=(e==null?void 0:e.getAttribute("title"))||"",n=N(t),d=P(!0);d.innerHTML=`
|
|
519
519
|
<div class="rte-media-header">
|
|
520
|
-
<h2 class="rte-media-title">${
|
|
520
|
+
<h2 class="rte-media-title">${e?"Edit Link":"Add Link"}</h2>
|
|
521
521
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
522
522
|
</div>
|
|
523
523
|
<div class="rte-media-body">
|
|
@@ -527,33 +527,33 @@
|
|
|
527
527
|
</div>
|
|
528
528
|
<div class="rte-media-field">
|
|
529
529
|
<label class="rte-media-label">Title (tooltip)</label>
|
|
530
|
-
<input id="link-title" type="text" class="rte-media-input" value="${
|
|
530
|
+
<input id="link-title" type="text" class="rte-media-input" value="${o}" placeholder="Optional tooltip text" />
|
|
531
531
|
</div>
|
|
532
532
|
<label class="rte-media-checkbox-label">
|
|
533
|
-
<input id="link-target" type="checkbox" ${
|
|
533
|
+
<input id="link-target" type="checkbox" ${a==="_blank"?"checked":""} />
|
|
534
534
|
Open in new window/tab
|
|
535
535
|
</label>
|
|
536
536
|
</div>
|
|
537
537
|
<div class="rte-media-footer rte-media-footer-spread">
|
|
538
|
-
${
|
|
538
|
+
${e?'<button class="remove-link-btn rte-media-btn rte-media-btn-danger" type="button">Remove Link</button>':'<span class="rte-media-spacer"></span>'}
|
|
539
539
|
<div class="rte-media-actions">
|
|
540
540
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
541
541
|
<button class="save-btn rte-media-btn rte-media-btn-primary" type="button">Save</button>
|
|
542
542
|
</div>
|
|
543
543
|
</div>
|
|
544
|
-
`,
|
|
544
|
+
`,n.appendChild(d),document.body.appendChild(n);const p=d.querySelector("#link-url"),c=d.querySelector("#link-title"),v=d.querySelector("#link-target"),h=d.querySelector(".close-btn"),w=d.querySelector(".cancel-btn"),f=d.querySelector(".save-btn"),y=d.querySelector(".remove-link-btn");let x=()=>{};const l=()=>{x(),n.parentNode&&n.parentNode.removeChild(n)};x=I(n,l),h.addEventListener("click",l),w.addEventListener("click",l),n.addEventListener("click",i=>{i.target===n&&l()}),f.addEventListener("click",()=>{const i=p.value.trim();if(i){const b=i.startsWith("http")?i:`https://${i}`;if(e)e.setAttribute("href",b),e.setAttribute("target",v.checked?"_blank":"_self"),v.checked?e.setAttribute("rel","noopener noreferrer"):e.removeAttribute("rel"),c.value.trim()?e.setAttribute("title",c.value.trim()):e.removeAttribute("title");else{const g=document.createElement("a");g.href=b,g.target=v.checked?"_blank":"_self",v.checked&&(g.rel="noopener noreferrer"),c.value.trim()&&(g.title=c.value.trim()),t.replaceWith(g),g.appendChild(t)}l(),s&&m&&V(m)}}),y==null||y.addEventListener("click",()=>{e&&confirm("Remove link from this media?")&&(e.replaceWith(t),l(),s&&m&&V(m))}),p.focus()},te=t=>{const e=N(t),r=P();let a="url",o=t.src;const n=()=>{r.innerHTML=`
|
|
545
545
|
<div class="rte-media-header">
|
|
546
546
|
<h2 class="rte-media-title">Replace Image</h2>
|
|
547
547
|
<button class="close-btn rte-media-close-btn" type="button" aria-label="Close">×</button>
|
|
548
548
|
</div>
|
|
549
549
|
|
|
550
550
|
<div class="rte-media-tabs">
|
|
551
|
-
<button class="tab-upload rte-media-tab ${
|
|
552
|
-
<button class="tab-url rte-media-tab ${
|
|
551
|
+
<button class="tab-upload rte-media-tab ${a==="upload"?"active":""}" type="button">Upload</button>
|
|
552
|
+
<button class="tab-url rte-media-tab ${a==="url"?"active":""}" type="button">URL</button>
|
|
553
553
|
</div>
|
|
554
554
|
|
|
555
555
|
<div class="rte-media-body">
|
|
556
|
-
${
|
|
556
|
+
${a==="upload"?`
|
|
557
557
|
<div id="upload-section">
|
|
558
558
|
<div class="dropzone rte-media-dropzone">
|
|
559
559
|
<div class="rte-media-dropzone-icon">📁</div>
|
|
@@ -572,13 +572,13 @@
|
|
|
572
572
|
<div id="url-section">
|
|
573
573
|
<div class="rte-media-field">
|
|
574
574
|
<label class="rte-media-label">Image URL</label>
|
|
575
|
-
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${
|
|
575
|
+
<input type="text" id="url-input" class="rte-media-input" placeholder="https://example.com/image.jpg" value="${o}">
|
|
576
576
|
</div>
|
|
577
|
-
${
|
|
577
|
+
${o?`
|
|
578
578
|
<div class="rte-media-field">
|
|
579
579
|
<label class="rte-media-label">Preview</label>
|
|
580
580
|
<div class="rte-media-preview">
|
|
581
|
-
<img src="${
|
|
581
|
+
<img src="${o}" alt="Preview" onerror="this.parentElement.innerHTML='<p class="rte-media-muted">Failed to load image</p>'">
|
|
582
582
|
</div>
|
|
583
583
|
</div>
|
|
584
584
|
`:""}
|
|
@@ -588,9 +588,9 @@
|
|
|
588
588
|
|
|
589
589
|
<div class="rte-media-footer">
|
|
590
590
|
<button class="cancel-btn rte-media-btn rte-media-btn-secondary" type="button">Cancel</button>
|
|
591
|
-
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!a
|
|
591
|
+
<button id="replace-btn" class="rte-media-btn rte-media-btn-primary" type="button" ${!o&&a==="url"?"disabled":""}>Replace</button>
|
|
592
592
|
</div>
|
|
593
|
-
`};
|
|
593
|
+
`};n(),e.appendChild(r),document.body.appendChild(e);let d=()=>{};const p=()=>{d(),e.parentNode&&e.parentNode.removeChild(e)};d=I(e,p);const c=()=>{o&&(t.src=o,p())},v=async w=>{const f=r.querySelector("#upload-progress"),y=r.querySelector("#progress-bar"),x=r.querySelector("#progress-text");if(f&&y&&x){f.style.display="block";let l=0;const i=setInterval(()=>{l+=Math.random()*30,l>90&&(l=90),y.style.width=`${l}%`},200);try{const b=new FileReader;b.onload=()=>{clearInterval(i),y.style.width="100%",x.textContent="Upload complete",setTimeout(()=>{o=b.result,a="url",n(),h()},500)},b.readAsDataURL(w)}catch{clearInterval(i),x.textContent="Upload failed"}}},h=()=>{const w=r.querySelector(".close-btn"),f=r.querySelector(".cancel-btn"),y=r.querySelector("#replace-btn"),x=r.querySelector(".tab-upload"),l=r.querySelector(".tab-url");if(w==null||w.addEventListener("click",p),f==null||f.addEventListener("click",p),y==null||y.addEventListener("click",c),x==null||x.addEventListener("click",()=>{a="upload",n(),h()}),l==null||l.addEventListener("click",()=>{a="url",n(),h()}),a==="upload"){const i=r.querySelector(".dropzone"),b=r.querySelector("#file-input");i==null||i.addEventListener("click",()=>b==null?void 0:b.click()),i==null||i.addEventListener("dragover",g=>{g.preventDefault(),i.classList.add("is-dragover")}),i==null||i.addEventListener("dragleave",()=>{i.classList.remove("is-dragover")}),i==null||i.addEventListener("drop",g=>{var E;g.preventDefault(),i.classList.remove("is-dragover");const L=(E=g.dataTransfer)==null?void 0:E.files[0];L&&v(L)}),b==null||b.addEventListener("change",g=>{var E;const L=(E=g.target.files)==null?void 0:E[0];L&&v(L)})}if(a==="url"){const i=r.querySelector("#url-input");i==null||i.addEventListener("input",()=>{o=i.value,n(),h()})}};h(),e.addEventListener("click",w=>{w.target===e&&p()})},$=()=>{if(!s||!m)return;const t=s.offsetHeight||40,e=m.offsetTop,r=m.offsetLeft,a=m.offsetWidth,o=e-t-8,n=r+a/2-(s.offsetWidth||120)/2;s.style.top=`${o}px`,s.style.left=`${n}px`,setTimeout(()=>{s&&(s.style.display="flex")},100)},V=t=>{var p,c,v,h,w,f,y,x;s&&(s._cleanup&&s._cleanup(),s.remove());const e=t.parentElement;if(e){const l=e.style.position;(!l||l==="static")&&(e.style.position="relative",e._originalPosition=l),s=document.createElement("div"),s.className="media-floating-toolbar",G(t)&&s.classList.add("rte-ui-theme-dark"),e.insertBefore(s,e.firstChild),$()}const r=s;if(!r)return;const a=t.tagName==="IMG",o=t.closest("a");r.innerHTML=`
|
|
594
594
|
<button class="media-floating-toolbar-btn btn-align-left" title="Align Left" type="button">
|
|
595
595
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="17" y1="10" x2="3" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="17" y1="18" x2="3" y2="18"></line></svg>
|
|
596
596
|
</button>
|
|
@@ -601,14 +601,14 @@
|
|
|
601
601
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><line x1="21" y1="10" x2="7" y2="10"></line><line x1="21" y1="6" x2="3" y2="6"></line><line x1="21" y1="14" x2="3" y2="14"></line><line x1="21" y1="18" x2="7" y2="18"></line></svg>
|
|
602
602
|
</button>
|
|
603
603
|
<div class="media-floating-toolbar-separator" aria-hidden="true"></div>
|
|
604
|
-
${
|
|
604
|
+
${a?`
|
|
605
605
|
<button class="media-floating-toolbar-btn btn-alt" title="Edit Alt Text" type="button">
|
|
606
606
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"></path></svg>
|
|
607
607
|
</button>`:""}
|
|
608
|
-
<button class="media-floating-toolbar-btn btn-link" title="${
|
|
608
|
+
<button class="media-floating-toolbar-btn btn-link" title="${o?"Edit/Remove Link":"Add Link"}" type="button">
|
|
609
609
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71"></path><path d="M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71"></path></svg>
|
|
610
610
|
</button>
|
|
611
|
-
${
|
|
611
|
+
${a?`
|
|
612
612
|
<button class="media-floating-toolbar-btn btn-replace" title="Replace Image" type="button">
|
|
613
613
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="3" y="3" width="18" height="18" rx="2" ry="2"></rect><circle cx="8.5" cy="8.5" r="1.5"></circle><polyline points="21 15 16 10 5 21"></polyline></svg>
|
|
614
614
|
</button>`:""}
|
|
@@ -616,4 +616,4 @@
|
|
|
616
616
|
<button class="media-floating-toolbar-btn btn-remove" title="Remove" type="button">
|
|
617
617
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="3 6 5 6 21 6"></polyline><path d="M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path></svg>
|
|
618
618
|
</button>
|
|
619
|
-
`,setTimeout(()=>{
|
|
619
|
+
`,setTimeout(()=>{$()},0);const n=()=>$();let d=t.parentElement;for(;d;)d.addEventListener("scroll",n),d=d.parentElement;window.addEventListener("scroll",n),window.addEventListener("resize",n),r._cleanup=()=>{let l=t.parentElement;for(;l;)l.removeEventListener("scroll",n),l=l.parentElement;window.removeEventListener("scroll",n),window.removeEventListener("resize",n)},(p=r.querySelector(".btn-align-left"))==null||p.addEventListener("click",()=>{t.style.display="block",t.style.marginLeft="0",t.style.marginRight="auto",$()}),(c=r.querySelector(".btn-align-center"))==null||c.addEventListener("click",()=>{t.style.display="block",t.style.marginLeft="auto",t.style.marginRight="auto",$()}),(v=r.querySelector(".btn-align-right"))==null||v.addEventListener("click",()=>{t.style.display="block",t.style.marginLeft="auto",t.style.marginRight="0",$()}),(h=r.querySelector(".btn-alt"))==null||h.addEventListener("click",()=>{t.tagName==="IMG"&&Q(t)}),(w=r.querySelector(".btn-link"))==null||w.addEventListener("click",()=>{ee(t)}),(f=r.querySelector(".btn-replace"))==null||f.addEventListener("click",()=>{t.tagName==="IMG"&&te(t)}),(y=r.querySelector(".btn-resize"))==null||y.addEventListener("click",()=>{const l=prompt("Enter width in pixels:",String(t.width||t.offsetWidth));if(l&&!isNaN(parseInt(l))){const i=parseInt(l);t.style.width=`${i}px`,t.setAttribute("width",String(i)),z(),$()}}),(x=r.querySelector(".btn-remove"))==null||x.addEventListener("click",()=>{confirm("Remove this media?")&&(t.remove(),s&&(s._cleanup&&s._cleanup(),s.remove(),s=null),m=null,z())}),r._cleanup=()=>{window.removeEventListener("scroll",$),window.removeEventListener("resize",$)}},X=t=>{D=t||null,J(),document.addEventListener("click",e=>{const r=e.target;if(r.tagName==="IMG"||r.tagName==="VIDEO"){const a=r;let o=!1;if(D?o=D.contains(a):o=!!a.closest('[contenteditable="true"]'),o){e.preventDefault(),e.stopPropagation(),m=a,m.style.display="block",V(a),z();return}}if(!r.closest(".btn-link, .btn-resize, .btn-remove")&&s&&!r.closest("button")){if(s._cleanup&&s._cleanup(),s.remove(),s=null,m&&m.parentElement){const a=m.parentElement;a._originalPosition!==void 0&&(a.style.position=a._originalPosition,delete a._originalPosition)}m=null,z()}}),H.forEach(e=>{e.addEventListener("mousedown",r=>{if(!m)return;r.preventDefault(),r.stopPropagation(),_=!0,A=e.getAttribute("data-position"),U=r.clientX,F=r.clientY;const a=m.getBoundingClientRect();M=a.width,q=a.height,B=M/q,document.body.style.userSelect="none",document.body.style.cursor=`${A}-resize`})}),document.addEventListener("mousemove",e=>{if(!_||!m||!A)return;const r=e.clientX-U,a=e.clientY-F;let o=M,n=q;switch(A){case"se":o=M+r,n=q+a;break;case"sw":o=M-r,n=q+a;break;case"ne":o=M+r,n=q-a;break;case"nw":o=M-r,n=q-a;break}Math.abs(r)>Math.abs(a)?n=o/B:o=n*B,o=Math.max(50,o),n=Math.max(50,n),m.style.width=`${o}px`,m.style.height=`${n}px`,m.setAttribute("width",String(Math.round(o))),m.setAttribute("height",String(Math.round(n))),z(),$()}),document.addEventListener("mouseup",()=>{_&&(_=!1,A=null,document.body.style.userSelect="",document.body.style.cursor="")}),window.addEventListener("scroll",z),window.addEventListener("resize",z)};typeof window<"u"&&!window.__mediaManagerInitialized&&(window.__mediaManagerInitialized=!0,X());const re=()=>({name:"image",initialize:t=>{const e=t==null?void 0:t.editorElement;X(e)},toolbar:[{label:"Image",command:"insertImage",icon:'<svg width="24px" height="24px" viewBox="0 0 32 32" enable-background="new 0 0 32 32"><g><rect fill="none" height="22" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2" width="30" x="1" y="5"></rect><polygon fill="none" points="31,27 21,17 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><polygon fill="none" points="18,20 9,11 1,19 1,27 11,27" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></polygon><circle cx="19" cy="11" fill="none" r="2" stroke="#000000" stroke-linejoin="round" stroke-miterlimit="10" stroke-width="2"></circle></g></svg>'},{label:"Video",command:"insertVideo",icon:'<svg width="24" height="24" focusable="false"><path d="M4 3h16c.6 0 1 .4 1 1v16c0 .6-.4 1-1 1H4a1 1 0 0 1-1-1V4c0-.6.4-1 1-1Zm1 2v14h14V5H5Zm4.8 2.6 5.6 4a.5.5 0 0 1 0 .8l-5.6 4A.5.5 0 0 1 9 16V8a.5.5 0 0 1 .8-.4Z" fill-rule="nonzero"></path></svg>'}],commands:{insertImage:(t,e)=>{const r=(e==null?void 0:e.contentElement)instanceof HTMLElement?e.contentElement:void 0;return W("image",r),!0},insertVideo:(t,e)=>{const r=(e==null?void 0:e.contentElement)instanceof HTMLElement?e.contentElement:void 0;return W("video",r),!0}},keymap:{"Mod-Shift-i":"insertImage"}}),ae={apiEndpoints:{upload:"/media/upload",library:"/media/library",delete:"/media/library"},maxFileSize:10*1024*1024,allowedTypes:["image/jpeg","image/png","image/gif","video/mp4","video/webm"],headers:{}};let j={...ae};function ie(t){j={...j,...t}}function oe(){return{...j}}exports.MediaManagerPlugin=re;exports.getMediaManagerConfig=oe;exports.setMediaManagerConfig=ie;
|