Spaces:
Runtime error
Runtime error
fix searchbox position
Browse files
src/lib/CodeMirrorSearch/CodeMirrorSearch.svelte
CHANGED
|
@@ -114,6 +114,18 @@ https://codemirror.net/docs/ref/#search
|
|
| 114 |
onMount(() => {
|
| 115 |
searchTxt = getSelectedText(view);
|
| 116 |
searchTxtEl.focus();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
return reset;
|
| 118 |
});
|
| 119 |
</script>
|
|
|
|
| 114 |
onMount(() => {
|
| 115 |
searchTxt = getSelectedText(view);
|
| 116 |
searchTxtEl.focus();
|
| 117 |
+
|
| 118 |
+
// Switch from absolute to fixed and preserve position
|
| 119 |
+
if (el) {
|
| 120 |
+
const rect = el.getBoundingClientRect();
|
| 121 |
+
el.style.position = 'fixed';
|
| 122 |
+
el.style.top = rect.top + 'px';
|
| 123 |
+
el.style.left = rect.left + 'px';
|
| 124 |
+
el.style.right = 'auto'; // Remove right if present
|
| 125 |
+
el.classList.remove('absolute');
|
| 126 |
+
el.classList.add('fixed');
|
| 127 |
+
}
|
| 128 |
+
|
| 129 |
return reset;
|
| 130 |
});
|
| 131 |
</script>
|