99 <NcAppNavigation :class =" {loading: loading.notes, 'icon-error': error}" >
1010 <NcAppNavigationNew
1111 v-show =" !loading.notes && !error"
12- :text =" t('notes', 'New note')"
13- @click =" onNewNote"
12+ :text =" t('notes', 'New category')"
13+ @click =" onNewCategory"
14+ @dragover.native =" onNewCategoryDragOver"
15+ @drop.native =" onNewCategoryDrop"
1416 >
15- <PlusIcon slot =" icon" :size =" 20" />
17+ <FolderPlusIcon slot =" icon" :size =" 20" />
1618 </NcAppNavigationNew >
1719
1820 <template #list >
19- <CategoriesList v-show =" !loading.notes"
20- v-if =" numNotes"
21- />
21+ <CategoriesList v-show =" !loading.notes" />
2222 </template >
2323
2424 <template #footer >
@@ -54,16 +54,18 @@ import NcContent from '@nextcloud/vue/components/NcContent'
5454import { loadState } from ' @nextcloud/initial-state'
5555import { showSuccess , TOAST_UNDO_TIMEOUT , TOAST_PERMANENT_TIMEOUT } from ' @nextcloud/dialogs'
5656import ' @nextcloud/dialogs/style.css'
57+ import { emit } from ' @nextcloud/event-bus'
5758
58- import PlusIcon from ' vue-material-design-icons/Plus.vue'
5959import CogIcon from ' vue-material-design-icons/CogOutline.vue'
60+ import FolderPlusIcon from ' vue-material-design-icons/FolderPlus.vue'
6061
6162import AppSettings from ' ./components/AppSettings.vue'
6263import CategoriesList from ' ./components/CategoriesList.vue'
6364import EditorHint from ' ./components/Modal/EditorHint.vue'
6465
6566import { config } from ' ./config.js'
66- import { fetchNotes , noteExists , createNote , undoDeleteNote } from ' ./NotesService.js'
67+ import { fetchNotes , noteExists , undoDeleteNote } from ' ./NotesService.js'
68+ import { getDraggedNoteId , isNoteDrag } from ' ./Util.js'
6769import store from ' ./store.js'
6870
6971export default {
@@ -79,7 +81,7 @@ export default {
7981 NcAppNavigationNew,
8082 NcAppNavigationItem,
8183 NcContent,
82- PlusIcon ,
84+ FolderPlusIcon ,
8385 },
8486
8587 data () {
@@ -89,7 +91,6 @@ export default {
8991 },
9092 loading: {
9193 notes: true ,
92- create: false ,
9394 },
9495 error: false ,
9596 undoNotification: null ,
@@ -227,20 +228,28 @@ export default {
227228 this .settingsVisible = true
228229 },
229230
230- onNewNote () {
231- if (this .loading .create ) {
231+ onNewCategory () {
232+ emit (' notes:category:new' )
233+ },
234+
235+ onNewCategoryDragOver (event ) {
236+ if (! isNoteDrag (event )) {
232237 return
233238 }
234- this .loading .create = true
235- createNote (store .getters .getSelectedCategory ())
236- .then (note => {
237- this .routeToNote (note .id , { new: null })
238- })
239- .catch (() => {
240- })
241- .finally (() => {
242- this .loading .create = false
243- })
239+ event .preventDefault ()
240+ if (event .dataTransfer ) {
241+ event .dataTransfer .dropEffect = ' move'
242+ }
243+ },
244+
245+ onNewCategoryDrop (event ) {
246+ const noteId = getDraggedNoteId (event , noteId => store .getters .getNote (noteId))
247+ if (noteId === null ) {
248+ return
249+ }
250+ event .preventDefault ()
251+ event .stopPropagation ()
252+ emit (' notes:category:new' , { noteId })
244253 },
245254
246255 onNoteDeleted (note ) {
@@ -325,4 +334,19 @@ export default {
325334 padding-inline-start : 3px ;
326335 margin : 0 3px ;
327336}
337+
338+ :deep(.app-navigation__body ) {
339+ overflow : hidden !important ;
340+ flex : 0 0 auto ;
341+ }
342+
343+ :deep(.app-navigation__content ) {
344+ min-height : 0 ;
345+ }
346+
347+ :deep(.app-navigation__list ) {
348+ flex : 1 1 auto ;
349+ min-height : 0 ;
350+ height : auto !important ;
351+ }
328352 </style >
0 commit comments