Explorar o código

Работа над LibsPage

Book Pauk %!s(int64=4) %!d(string=hai) anos
pai
achega
1121f9c918

+ 12 - 1
client/components/Reader/LibsPage/LibsPage.vue

@@ -8,6 +8,7 @@ import Vue from 'vue';
 import Component from 'vue-class-component';
 import Component from 'vue-class-component';
 
 
 import Window from '../../share/Window.vue';
 import Window from '../../share/Window.vue';
+import * as utils from '../../../share/utils';
 //import rstore from '../../../store/modules/reader';
 //import rstore from '../../../store/modules/reader';
 
 
 export default @Component({
 export default @Component({
@@ -29,6 +30,16 @@ class LibsPage extends Vue {
 
 
     init() {
     init() {
         this.popupWindow = window.open(`http://${window.location.host}/?p=external-libs#/external-libs`);
         this.popupWindow = window.open(`http://${window.location.host}/?p=external-libs#/external-libs`);
+        if (this.popupWindow) {
+            //Проверка закрытия окна
+            (async() => {
+                while(this.popupWindow) {
+                    if (this.popupWindow && this.popupWindow.closed)
+                        this.close();
+                    await utils.sleep(1000);
+                }
+            })();
+        }
         this.loadLibs();
         this.loadLibs();
     }
     }
 
 
@@ -54,7 +65,7 @@ class LibsPage extends Vue {
     }*/
     }*/
 
 
     close() {
     close() {
-        this.$emit('do-action', {action: 'libs'});
+        this.$emit('libs-close');
     }
     }
 }
 }
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------

+ 6 - 4
client/components/Reader/Reader.vue

@@ -85,7 +85,7 @@
                 @stop-text-search="stopTextSearch">
                 @stop-text-search="stopTextSearch">
             </SearchPage>
             </SearchPage>
             <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @do-action="doAction"></CopyTextPage>
             <CopyTextPage v-if="copyTextActive" ref="copyTextPage" @do-action="doAction"></CopyTextPage>
-            <LibsPage v-show="libsActive" ref="libsPage" @load-book="loadBook" @do-action="doAction"></LibsPage>
+            <LibsPage v-show="libsActive" ref="libsPage" @load-book="loadBook" @libs-close="libsClose"></LibsPage>
             <RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose"></RecentBooksPage>
             <RecentBooksPage v-show="recentBooksActive" ref="recentBooksPage" @load-book="loadBook" @recent-books-close="recentBooksClose"></RecentBooksPage>
             <SettingsPage v-show="settingsActive" ref="settingsPage" @do-action="doAction"></SettingsPage>
             <SettingsPage v-show="settingsActive" ref="settingsPage" @do-action="doAction"></SettingsPage>
             <HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
             <HelpPage v-if="helpActive" ref="helpPage" @do-action="doAction"></HelpPage>
@@ -714,6 +714,11 @@ class Reader extends Vue {
         }
         }
     }
     }
 
 
+    libsClose() {
+        if (this.libsActive)
+            this.libsToogle();
+    }
+
     libsToogle() {
     libsToogle() {
         this.libsActive = !this.libsActive;
         this.libsActive = !this.libsActive;
         if (this.libsActive) {
         if (this.libsActive) {
@@ -1217,9 +1222,6 @@ class Reader extends Vue {
             if (!handled && this.copyTextActive)
             if (!handled && this.copyTextActive)
                 handled = this.$refs.copyTextPage.keyHook(event);
                 handled = this.$refs.copyTextPage.keyHook(event);
 
 
-            if (!handled && this.libsActive)
-                handled = this.$refs.libsPage.keyHook(event);
-
             if (!handled && this.$refs.page && this.$refs.page.keyHook)
             if (!handled && this.$refs.page && this.$refs.page.keyHook)
                 handled = this.$refs.page.keyHook(event);
                 handled = this.$refs.page.keyHook(event);