+
reorder(data, children)"
- @change="(e) => currentRepositoryStore.handleOutlineItemDrag(e, activity.id)"
+ @update="(data: SortableEvent) => reorder(data, children)"
+ @change="(e: ChangeEvent) => onOutlineItemDrop(e, activity.id)"
>
@@ -107,18 +109,20 @@
import { activity as activityUtils } from '@tailor-cms/utils';
import Draggable from 'vuedraggable';
import { size } from 'lodash-es';
+import { useDisplay } from 'vuetify';
+import type { ChangeEvent, SortableEvent } from '@/types/draggable';
import ActivityName from '@/components/common/ActivityName.vue';
import OptionsMenu from '@/components/common/ActivityOptions/ActivityMenu.vue';
import OutlineItem from '@/components/repository/Outline/OutlineItem.vue';
import OutlineItemToolbar from '@/components/common/ActivityOptions/ActivityToolbar.vue';
import type { StoreActivity } from '@/stores/activity';
-import { useDisplay } from 'vuetify';
const { smAndUp } = useDisplay();
const currentRepositoryStore = useCurrentRepository();
const { taxonomy } = storeToRefs(currentRepositoryStore);
+const { onOutlineItemDrop } = currentRepositoryStore;
interface Props {
activity: StoreActivity;
@@ -230,7 +234,7 @@ $background-color: rgb(var(--v-theme-primary-darken-2));
}
}
-.sub-activity {
+.activity-wrapper .activity-wrapper {
margin-left: 1.25rem;
}
diff --git a/apps/frontend/app/composables/useOutlineReorder.ts b/apps/frontend/app/composables/useOutlineReorder.ts
index 8dc521026..9b1fe4b8e 100644
--- a/apps/frontend/app/composables/useOutlineReorder.ts
+++ b/apps/frontend/app/composables/useOutlineReorder.ts
@@ -1,10 +1,12 @@
+import type { SortableEvent } from '@/types/draggable';
import { useActivityStore } from '@/stores/activity';
export const useOutlineReorder =
() =>
- ({ newIndex: newPosition }: { newIndex: number }, items: any[]) => {
+ ({ newIndex }: SortableEvent, items: any[]) => {
+ if (newIndex === undefined) return;
const activityStore = useActivityStore();
- const activity = items[newPosition];
- const context = { items, newPosition };
+ const activity = items[newIndex];
+ const context = { items, newPosition: newIndex };
return activityStore.reorder(activity, context);
};
diff --git a/apps/frontend/app/pages/repository/[[id]]/root/structure.vue b/apps/frontend/app/pages/repository/[[id]]/root/structure.vue
index e667a5aee..13e975651 100644
--- a/apps/frontend/app/pages/repository/[[id]]/root/structure.vue
+++ b/apps/frontend/app/pages/repository/[[id]]/root/structure.vue
@@ -17,11 +17,13 @@
reorder(data, rootActivities)"
- @change="(e) => repositoryStore.handleOutlineItemDrag(e)"
+ @update="(data: SortableEvent) => reorder(data, rootActivities)"
+ @change="(e: ChangeEvent) => repositoryStore.onOutlineItemDrop(e)"
>
{
if (activityId) {
repositoryStore.selectActivity(parseInt(activityId as string, 10));
} else if (rootActivities.value.length) {
- repositoryStore.selectActivity(rootActivities.value[0].id);
+ repositoryStore.selectActivity(rootActivities.value[0]!.id);
} else {
// If there are no activities
return;
}
const isFirstActivitySelected =
selectedActivity.value &&
- rootActivities.value[0].id === selectedActivity.value.id;
+ rootActivities.value[0]!.id === selectedActivity.value.id;
if (!isFirstActivitySelected) {
scrollToActivity(selectedActivity.value as StoreActivity, 200);
}
@@ -150,6 +153,10 @@ onMounted(() => {
diff --git a/packages/core-components/src/index.ts b/packages/core-components/src/index.ts
index 4e2eb5e88..4b694eb99 100644
--- a/packages/core-components/src/index.ts
+++ b/packages/core-components/src/index.ts
@@ -5,7 +5,6 @@ export { default as Discussion } from './components/Discussion/index.vue';
export { default as ElementList } from './components/ElementList.vue';
export { default as AddElement } from './components/AddElement/index.vue';
export { default as InlineActivator } from './components/AddElement/InlineActivator.vue';
-export { default as TailorTreeview } from './components/TailorTreeview/index.vue';
export { default as UserAvatar } from './components/UserAvatar.vue';
export { default as ActiveUsers } from './components/ActiveUsers.vue';
export { default as SelectElement } from './components/SelectElement/index.vue';
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index b80f087bd..357f91b3a 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -409,6 +409,9 @@ importers:
'@tailor-cms/utils':
specifier: workspace:*
version: link:../../packages/utils
+ '@types/sortablejs':
+ specifier: ^1.15.9
+ version: 1.15.9
'@vee-validate/i18n':
specifier: ^4.15.1
version: 4.15.1
@@ -5116,6 +5119,9 @@ packages:
'@types/shimmer@1.2.0':
resolution: {integrity: sha512-UE7oxhQLLd9gub6JKIAhDq06T0F6FnztwMNRvYgjeQSBeMc1ZG/tA47EwfduvkuQS8apbkM/lpLpWsaCeYsXVg==}
+ '@types/sortablejs@1.15.9':
+ resolution: {integrity: sha512-7HP+rZGE2p886PKV9c9OJzLBI6BBJu1O7lJGYnPyG3fS4/duUCcngkNCjsLwIMV+WMqANe3tt4irrXHSIe68OQ==}
+
'@types/tmp@0.2.6':
resolution: {integrity: sha512-chhaNf2oKHlRkDGt+tiKE2Z5aJ6qalm7Z9rlLdBwmOiAAf09YQvvoLXjWK4HWPF1xU/fqvMgfNfpVoBscA/tKA==}
@@ -16743,6 +16749,8 @@ snapshots:
'@types/shimmer@1.2.0': {}
+ '@types/sortablejs@1.15.9': {}
+
'@types/tmp@0.2.6': {}
'@types/tough-cookie@4.0.5': {}