mirror of
https://github.com/pocketbase/pocketbase.git
synced 2026-11-04 02:57:26 +01:00
minor ui base component fixes and shablon update
This commit is contained in:
1 parent
32fa2ddf77
commit
9f1a4bcfa5
11 files changed
+35
-17
No files matched your search
@@ -307,6 +307,12 @@ window.app.components.codeEditor = function(propsArg = {}) {
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent "Tab trap"
|
||||
if (!props.singleLine && e.key == "Escape" && !dropdown?.isConnected) {
|
||||
editorContent?.blur();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!props.singleLine && e.key == "Tab") {
|
||||
e.preventDefault();
|
||||
const selection = window.getSelection();
|
||||
|
||||
@@ -64,9 +64,15 @@ document.addEventListener(
|
||||
|
||||
dropdown.addEventListener("toggle", (e) => {
|
||||
if (e.newState == "open") {
|
||||
// in case the dropdown is manually controlled and don't have a popovertarget
|
||||
dropdown.__dropdownSource = e.source;
|
||||
dropdown.__dropdownSource?.setAttribute("data-popover-state", true);
|
||||
|
||||
updatePopovertargetsData(e.target.id, true);
|
||||
document.addEventListener("keydown", onKeydown);
|
||||
} else {
|
||||
dropdown.__dropdownSource?.setAttribute("data-popover-state", false);
|
||||
|
||||
updatePopovertargetsData(e.target.id, false);
|
||||
document.removeEventListener("keydown", onKeydown);
|
||||
}
|
||||
|
||||
+10
-4
@@ -75,10 +75,6 @@ window.app.components.sortable = function(propsArg = {}) {
|
||||
}
|
||||
});
|
||||
|
||||
listEl.addEventListener("dragend", (e) => {
|
||||
clearDragData();
|
||||
});
|
||||
|
||||
// drop
|
||||
// ---
|
||||
// prevent default to allow drop
|
||||
@@ -115,6 +111,12 @@ window.app.components.sortable = function(propsArg = {}) {
|
||||
|
||||
props.onchange(clone, fromIndex, toIndex);
|
||||
});
|
||||
|
||||
// note: using document because it could be an outside dragged element
|
||||
listEl._documentDragend = function() {
|
||||
clearDragData();
|
||||
};
|
||||
document.addEventListener("dragend", listEl._documentDragend);
|
||||
}
|
||||
|
||||
function childIndex(children, child) {
|
||||
@@ -151,6 +153,10 @@ window.app.components.sortable = function(propsArg = {}) {
|
||||
},
|
||||
onunmount: (listEl) => {
|
||||
watchers.forEach((w) => w?.unwatch());
|
||||
|
||||
if (listEl._documentDragend) {
|
||||
document.removeEventListener("dragend", listEl._documentDragend);
|
||||
}
|
||||
},
|
||||
},
|
||||
(el) => {
|
||||
|
||||
Reference in new issue
Block a user