Skip to content

Commit

Permalink
Merge pull request #61 from n1crack/development
Browse files Browse the repository at this point in the history
update state when closing treeview by clicking outside, add fullscreen shortcut
  • Loading branch information
n1crack authored Jun 16, 2024
2 parents 21db0d3 + 3018c47 commit de69801
Show file tree
Hide file tree
Showing 7 changed files with 1,138 additions and 1,102 deletions.
4 changes: 2 additions & 2 deletions dist/vuefinder.cjs

Large diffs are not rendered by default.

2,203 changes: 1,110 additions & 1,093 deletions dist/vuefinder.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vuefinder",
"version": "2.5.2",
"version": "2.5.3",
"description": "Vuefinder is a file manager component for vuejs.",
"type": "module",
"files": [
Expand Down
6 changes: 5 additions & 1 deletion src/components/Breadcrumb.vue
Original file line number Diff line number Diff line change
Expand Up @@ -271,8 +271,12 @@ const vClickOutside = {
*/
const toggleTreeView = () => {
app.showTreeView = !app.showTreeView;
setStore('show-tree-view', app.showTreeView);
}
watch(() => app.showTreeView, (newShowTreeView, oldValue) => {
if (newShowTreeView !== oldValue) {
setStore('show-tree-view', newShowTreeView);
}
});
/**
*
Expand Down
11 changes: 7 additions & 4 deletions src/components/Toolbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
</template>

<script setup>
import {inject, ref} from 'vue';
import {inject, ref, watch} from 'vue';
import {FEATURES} from "../features.js";
import ModalNewFolder from "./modals/ModalNewFolder.vue";
import ModalNewFile from "./modals/ModalNewFile.vue";
Expand Down Expand Up @@ -108,16 +108,19 @@ app.emitter.on('vf-search-query', ({newQuery}) => {
const toggleFullScreen = () => {
app.fullScreen = !app.fullScreen;
}
watch(() => app.fullScreen, () => {
if (app.fullScreen) {
// add body over flow hidden
// add body overflow hidden
document.querySelector('body').style.overflow = 'hidden';
} else {
// remove body over flow hidden
// remove body overflow hidden
document.querySelector('body').style.overflow = '';
}
setStore('full-screen', app.fullScreen);
app.emitter.emit('vf-fullscreen-toggle');
}
});
// View Management
const toggleView = () => {
Expand Down
8 changes: 7 additions & 1 deletion src/components/modals/ModalAbout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<div>
<div>
<nav class="flex" aria-label="Tabs">
<nav class="flex overflow-auto" aria-label="Tabs">
<button v-for="tab in tabs" :key="tab.name"
@click="selectedTab = tab.key "
:class="[tab.key === selectedTab ? 'bg-gray-100 text-gray-700 dark:bg-gray-700 dark:text-gray-300 border-sky-500' : 'text-gray-500 dark:text-gray-500 hover:text-gray-700 border-gray-300 dark:border-gray-600', 'px-3 py-2 border-b font-medium text-sm']" :aria-current="tab.current ? 'page' : undefined">{{ tab.name }}</button>
Expand Down Expand Up @@ -177,6 +177,12 @@
<kbd>Ctrl</kbd> + <kbd>,</kbd>
</div>
</div>
<div class="flex justify-between text-sm text-gray-500 dark:text-gray-400">
{{ t('Toggle Full Screen') }}
<div>
<kbd>Ctrl</kbd> + <kbd>Enter</kbd>
</div>
</div>
</div>
</div>

Expand Down
6 changes: 6 additions & 0 deletions src/composables/useHotkeyActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const KEYBOARD_SHORTCUTS = {
F2: 'F2',
F5: 'F5',
DELETE: 'Delete',
ENTER: 'Enter',
BACKSLASH: 'Backslash',
KEY_A: 'KeyA',
KEY_E: 'KeyE',
Expand Down Expand Up @@ -57,6 +58,11 @@ export function useHotkeyActions(app) {
app.storage.setStore('show-tree-view', app.showTreeView);
}

if (e.metaKey && e.code === KEYBOARD_SHORTCUTS.ENTER) {
app.fullScreen = !app.fullScreen;
app.root.focus();
}

if (e.metaKey && e.code === KEYBOARD_SHORTCUTS.KEY_A) {
app.dragSelect.selectAll();
e.preventDefault()
Expand Down

0 comments on commit de69801

Please sign in to comment.