@kerkhoff-ict/solora 2.0.4 → 2.0.6
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/index.js +3 -33
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1753,7 +1753,9 @@ function initCodeblocks() {
|
|
|
1753
1753
|
const minimizeBtn = block.querySelector(".minimize-btn");
|
|
1754
1754
|
const preContent = block.querySelector(".pre-content");
|
|
1755
1755
|
if (!pre || !preContent) return;
|
|
1756
|
-
if (copyBtn
|
|
1756
|
+
if (copyBtn && copyBtn.classList.contains("btn-in-pre")) {
|
|
1757
|
+
preContent.insertBefore(copyBtn, preContent.firstChild);
|
|
1758
|
+
}
|
|
1757
1759
|
if (copyBtn && !copyBtn.dataset.bound) {
|
|
1758
1760
|
copyBtn.dataset.bound = "true";
|
|
1759
1761
|
copyBtn.addEventListener("click", async () => {
|
|
@@ -1775,7 +1777,6 @@ function initCodeblocks() {
|
|
|
1775
1777
|
} else {
|
|
1776
1778
|
pre.innerHTML = import_prismjs.default.highlight(code, import_prismjs.default.languages[lang], lang);
|
|
1777
1779
|
}
|
|
1778
|
-
if (block.classList.contains("draggable")) makeDraggable(block);
|
|
1779
1780
|
if (closeBtn) closeBtn.addEventListener("click", () => {
|
|
1780
1781
|
block.style.transition = "opacity 0.3s ease, transform 0.3s ease";
|
|
1781
1782
|
block.style.opacity = 0;
|
|
@@ -1845,37 +1846,6 @@ function initMaximizeButton(block, maximizeBtn) {
|
|
|
1845
1846
|
}
|
|
1846
1847
|
});
|
|
1847
1848
|
}
|
|
1848
|
-
function makeDraggable(element) {
|
|
1849
|
-
const header = element.querySelector(".pre-top");
|
|
1850
|
-
if (!header) return;
|
|
1851
|
-
let offsetX = 0, offsetY = 0, isDragging = false;
|
|
1852
|
-
header.style.cursor = "move";
|
|
1853
|
-
header.addEventListener("mousedown", onMouseDown);
|
|
1854
|
-
header.querySelectorAll("span, button").forEach((btn) => {
|
|
1855
|
-
btn.addEventListener("mousedown", (e) => e.stopPropagation());
|
|
1856
|
-
});
|
|
1857
|
-
function onMouseDown(e) {
|
|
1858
|
-
isDragging = true;
|
|
1859
|
-
const rect = element.getBoundingClientRect();
|
|
1860
|
-
offsetX = e.clientX - rect.left;
|
|
1861
|
-
offsetY = e.clientY - rect.top;
|
|
1862
|
-
Object.assign(element.style, { width: `${rect.width}px`, position: "absolute", zIndex: 9999 });
|
|
1863
|
-
document.addEventListener("mousemove", onMouseMove);
|
|
1864
|
-
document.addEventListener("mouseup", onMouseUp);
|
|
1865
|
-
}
|
|
1866
|
-
function onMouseMove(e) {
|
|
1867
|
-
if (element.dataset.isFullscreen === "true" || !isDragging) return;
|
|
1868
|
-
const left = e.clientX - offsetX;
|
|
1869
|
-
const top = e.clientY - offsetY;
|
|
1870
|
-
Object.assign(element.style, { left: `${left}px`, top: `${top}px` });
|
|
1871
|
-
element.dataset.currentRect = JSON.stringify({ top, left, width: element.offsetWidth, height: element.offsetHeight });
|
|
1872
|
-
}
|
|
1873
|
-
function onMouseUp() {
|
|
1874
|
-
isDragging = false;
|
|
1875
|
-
document.removeEventListener("mousemove", onMouseMove);
|
|
1876
|
-
document.removeEventListener("mouseup", onMouseUp);
|
|
1877
|
-
}
|
|
1878
|
-
}
|
|
1879
1849
|
|
|
1880
1850
|
// src/components/dropdown.js
|
|
1881
1851
|
function initDropdowns() {
|