Работа над BookmarkSettings

This commit is contained in:
Book Pauk
2020-11-03 00:26:25 +07:00
parent 8b66fd522d
commit 213f7e48c9
3 changed files with 87 additions and 10 deletions

View File

@@ -0,0 +1,59 @@
<template>
<Window ref="window" width="600px" height="95%" @close="close">
<template slot="header">
Настроить закладки
</template>
</Window>
</template>
<script>
//-----------------------------------------------------------------------------
import Vue from 'vue';
import Component from 'vue-class-component';
import Window from '../../share/Window.vue';
const BookmarkSettingsProps = Vue.extend({
props: {
libs: Object,
}
});
export default @Component({
components: {
Window,
},
watch: {
libs: function() {
},
}
})
class BookmarkSettings extends BookmarkSettingsProps {
created() {
}
mounted() {
}
init() {
this.$refs.window.init();
}
close() {
this.$emit('close');
}
keyHook(event) {
if (event.type == 'keydown' && event.key == 'Escape') {
this.close();
return true;
}
return false;
}
}
//-----------------------------------------------------------------------------
</script>
<style scoped>
</style>

View File

@@ -23,8 +23,8 @@
<q-btn class="q-mr-xs" round dense color="blue" icon="la la-plus" @click.stop="addBookmark" size="12px"> <q-btn class="q-mr-xs" round dense color="blue" icon="la la-plus" @click.stop="addBookmark" size="12px">
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Добавить закладку</q-tooltip> <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Добавить закладку</q-tooltip>
</q-btn> </q-btn>
<q-btn round dense color="blue" icon="la la-bars" @click.stop="bookmarkSettings" size="12px" disabled> <q-btn round dense color="blue" icon="la la-bars" @click.stop="bookmarkSettings" size="12px">
<q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Настроить закладки (пока недоступно)</q-tooltip> <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%">Настроить закладки</q-tooltip>
</q-btn> </q-btn>
</template> </template>
<template v-slot:selected> <template v-slot:selected>
@@ -97,6 +97,7 @@
</template> </template>
</Dialog> </Dialog>
</div> </div>
<BookmarkSettings v-if="bookmarkSettingsActive" ref="bookmarkSettings" :libs="libs" @close="closeBookmarkSettings"></BookmarkSettings>
</Window> </Window>
</template> </template>
@@ -108,6 +109,8 @@ import _ from 'lodash';
import Window from '../share/Window.vue'; import Window from '../share/Window.vue';
import Dialog from '../share/Dialog.vue'; import Dialog from '../share/Dialog.vue';
import BookmarkSettings from './BookmarkSettings/BookmarkSettings.vue';
import rstore from '../../store/modules/reader'; import rstore from '../../store/modules/reader';
import * as utils from '../../share/utils'; import * as utils from '../../share/utils';
@@ -118,7 +121,8 @@ const proxySubst = {
export default @Component({ export default @Component({
components: { components: {
Window, Window,
Dialog Dialog,
BookmarkSettings
}, },
watch: { watch: {
libs: function() { libs: function() {
@@ -153,6 +157,8 @@ class ExternalLibs extends Vue {
bookmarkDesc = ''; bookmarkDesc = '';
defaultRootLink = ''; defaultRootLink = '';
bookmarkSettingsActive = false;
created() { created() {
this.$root.addKeyHook(this.keyHook); this.$root.addKeyHook(this.keyHook);
@@ -549,9 +555,6 @@ class ExternalLibs extends Vue {
this.addBookmarkVisible = false; this.addBookmarkVisible = false;
} }
bookmarkSettings() {
}
fullScreenToggle() { fullScreenToggle() {
this.fullScreenActive = !this.fullScreenActive; this.fullScreenActive = !this.fullScreenActive;
if (this.fullScreenActive) { if (this.fullScreenActive) {
@@ -584,14 +587,28 @@ class ExternalLibs extends Vue {
} }
} }
keyHook() { bookmarkSettings() {
this.bookmarkSettingsActive = true;
this.$nextTick(() => {
this.$refs.bookmarkSettings.init();
});
}
closeBookmarkSettings() {
this.bookmarkSettingsActive = false;
}
keyHook(event) {
if (this.$root.rootRoute() == '/external-libs') { if (this.$root.rootRoute() == '/external-libs') {
if (this.bookmarkSettingsActive && this.$refs.bookmarkSettings.keyHook(event))
return true;
if (this.$refs.dialogAddBookmark.active) if (this.$refs.dialogAddBookmark.active)
return false; return false;
if (event.type == 'keydown' && event.key == 'F4') { if (event.type == 'keydown' && event.key == 'F4') {
this.addBookmark() this.addBookmark();
return; return true;
} }
if (event.type == 'keydown' && event.key == 'Escape' && if (event.type == 'keydown' && event.key == 'Escape' &&
@@ -599,8 +616,8 @@ class ExternalLibs extends Vue {
(document.activeElement != this.$refs.selectedLink.$refs.target || !this.$refs.selectedLink.menu) (document.activeElement != this.$refs.selectedLink.$refs.target || !this.$refs.selectedLink.menu)
) { ) {
this.close(); this.close();
return true;
} }
return true;
} }
return false; return false;
} }

View File

@@ -124,6 +124,7 @@ class Window extends Vue {
.main { .main {
background-color: transparent !important; background-color: transparent !important;
z-index: 50; z-index: 50;
overflow: hidden;
} }
.xyfit { .xyfit {