Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix: don't allow moving items without a group

thecodrrec16a02eb959
diff --git a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx
index 68207f5dd..80d50ccf1 100644
--- a/apps/web/src/components/dialogs/toolbar-config-dialog.tsx
+++ b/apps/web/src/components/dialogs/toolbar-config-dialog.tsx
@@ -527,7 +527,12 @@ function moveItem(items: TreeNode[], fromId: string, toId: string): TreeNode[] {
// depth accordingly.
if (movingToGroup) fromItem.depth = toItem.depth + 1;
- return arrayMove(items, fromIndex, toIndex);
+ const newArray = arrayMove(items, fromIndex, toIndex);
+
+ // do not allow moving an item if there's no group over it
+ if (!isGroup(getItemGroup(newArray, fromItem))) return items;
+
+ return newArray;
}
function removeGroup(items: TreeNode[], groupId: string): TreeNode[] {
diff --git a/apps/web/src/utils/toast.tsx b/apps/web/src/utils/toast.tsx
index 93cbce964..248b8f5c0 100644
--- a/apps/web/src/utils/toast.tsx
+++ b/apps/web/src/utils/toast.tsx
@@ -15,7 +15,7 @@ function showToast(
type: ToastType,
message: string,
actions?: ToastAction[],
- hideAfter?: number
+ hideAfter: number = 5000
): { hide: () => void } {
if (appstore.get().isFocusMode) return { hide: () => {} }; // TODO