File tree Expand file tree Collapse file tree 3 files changed +43
-6
lines changed
Expand file tree Collapse file tree 3 files changed +43
-6
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,7 @@ import AppSettings from './components/AppSettings'
3636import NavigationList from ' ./components/NavigationList'
3737import NotesService from ' ./NotesService'
3838import store from ' ./store'
39+ import { openNavbar } from ' ./nextcloud'
3940
4041export default {
4142 name: ' App' ,
@@ -164,10 +165,8 @@ export default {
164165
165166 onSearch (query ) {
166167 this .filter .search = query
167- // TODO move the following from jQuery to plain JS
168- if ($ (' #app-navigation-toggle' ).css (' display' ) !== ' none' && ! $ (' body' ).hasClass (' snapjs-left' )) {
169- $ (' #app-navigation-toggle' ).click ()
170- }
168+
169+ openNavbar ()
171170 },
172171
173172 onResetSearch () {
@@ -192,8 +191,11 @@ export default {
192191
193192 onSelectCategory (category ) {
194193 this .filter .category = category
195- // TODO move the following from jQuery to plain JS
196- $ (' #app-navigation > ul' ).animate ({ scrollTop: 0 }, ' fast' )
194+
195+ const appNavigation = document .querySelector (' #app-navigation > ul' )
196+ if (appNavigation) {
197+ appNavigation .scrollTop = 0
198+ }
197199 },
198200
199201 onClose (event ) {
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ import TheEditor from './EditorEasyMDE'
6161import ThePreview from ' ./EditorMarkdownIt'
6262import NotesService from ' ../NotesService'
6363import store from ' ../store'
64+ import { closeNavbar } from ' ../nextcloud'
6465
6566export default {
6667 name: ' Note' ,
@@ -130,6 +131,9 @@ export default {
130131 methods: {
131132 fetchData () {
132133 store .commit (' setSidebarOpen' , false )
134+
135+ closeNavbar ()
136+
133137 this .onUpdateTitle (this .title )
134138 this .loading = true
135139 this .preview = false
Original file line number Diff line number Diff line change 1+ /**
2+ * global nextcloud helpers
3+ */
4+
5+ const closeNavbar = ( ) => {
6+ const navigationToggle = document . getElementById ( 'app-navigation-toggle' )
7+ const navOpen = document . body . classList . contains ( 'nav-open' )
8+
9+ if (
10+ navigationToggle
11+ && navigationToggle . style . display !== 'none'
12+ && navOpen
13+ ) {
14+ navigationToggle . click ( )
15+ }
16+ }
17+
18+ const openNavbar = ( ) => {
19+ const navigationToggle = document . getElementById ( 'app-navigation-toggle' )
20+ const navOpen = document . body . classList . contains ( 'nav-open' )
21+
22+ if (
23+ navigationToggle
24+ && navigationToggle . style . display !== 'none'
25+ && ! navOpen
26+ ) {
27+ navigationToggle . click ( )
28+ }
29+ }
30+
31+ export { closeNavbar , openNavbar }
You can’t perform that action at this time.
0 commit comments