diff --git a/src/renderer/App.vue b/src/renderer/App.vue index c7bc9a96a..edbaffc23 100644 --- a/src/renderer/App.vue +++ b/src/renderer/App.vue @@ -2,23 +2,27 @@
+ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -29,6 +33,10 @@ created by solvedDev + + + +
@@ -48,6 +56,7 @@ import startUp from "./scripts/utilities/startUp"; import EventBus from './scripts/EventBus'; import Vue from "vue"; + import TabSystem from './scripts/TabSystem'; export default { name: 'bridge', @@ -81,6 +90,7 @@ update_styles: theme.update_styles }); }); + EventBus.on("updateTabUI", this.updateSplitScreen); }, computed: { is_sidebar_open() { @@ -111,12 +121,19 @@ return { content: "", file: "", - path: "" + path: "", + has_split_screen: false }; }, methods: { openTwitter() { shell.openExternal("https://twitter.com/solvedDev"); + }, + updateSplitScreen() { + this.has_split_screen = TabSystem.getCurrentProjects(true).length > 0; + }, + setSplitScreen(val) { + TabSystem.split_screen_active = val; } } } diff --git a/src/renderer/components/editor_shell/JsonEditor/JsonInput.vue b/src/renderer/components/editor_shell/JsonEditor/JsonInput.vue index db0b2d80b..33feee142 100644 --- a/src/renderer/components/editor_shell/JsonEditor/JsonInput.vue +++ b/src/renderer/components/editor_shell/JsonEditor/JsonInput.vue @@ -43,7 +43,8 @@ tab_id: Number, render_object: Object, file_navigation: String, - current_file_path: String + current_file_path: String, + is_active: Boolean }, data() { return { @@ -55,17 +56,20 @@ if(this.type == "edit") { this.value = TabSystem.getCurrentNavContent(); EventBus.on("updateFileNavigation", this.updateValue); - EventBus.on("setWatcherInactive", () => this.watcher_active = false); + EventBus.on("setWatcherInactive", () => { + if(!this.is_active) return; + this.watcher_active = false; + }); } else { this.updateAutoCompletions(); - EventBus.on("updateAutoCompletions", () => this.updateAutoCompletions()); + EventBus.on("updateAutoCompletions", this.updateAutoCompletions); } }, destroyed() { if(this.type == "edit") { EventBus.off("updateFileNavigation", this.updateValue); } else { - EventBus.off("updateAutoCompletions", () => this.updateAutoCompletions()); + EventBus.off("updateAutoCompletions", this.updateAutoCompletions); } }, watch: { @@ -154,6 +158,8 @@ }, updateAutoCompletions() { + if(!this.is_active) return; + if(!this.provide_auto_completions) { this.items = []; return; @@ -185,6 +191,7 @@ TabSystem.setCurrentFileNav(`${TabSystem.getCurrentNavigation()}/${path}`); }, updateValue() { + if(!this.is_active) return; this.watcher_active = false; this.value = TabSystem.getCurrentNavContent(); }, diff --git a/src/renderer/components/editor_shell/JsonEditor/Main.vue b/src/renderer/components/editor_shell/JsonEditor/Main.vue index 45dc534fd..8bfafb7d2 100644 --- a/src/renderer/components/editor_shell/JsonEditor/Main.vue +++ b/src/renderer/components/editor_shell/JsonEditor/Main.vue @@ -19,6 +19,7 @@ :object_key="`${object_key}/${(e.key + '').replace(/\//g, '#;slash;#')}`" :node_context="e" :is_immutable="is_immutable" + :is_active="is_active" /> @@ -51,6 +53,7 @@ :tab_id="tab_id" :file_navigation="file_navigation" :current_file_path="current_file_path" + :is_active="is_active" /> @@ -99,6 +104,7 @@ draggable }, props: { + is_active: Boolean, available_height: Number, current_file_path: String, object: [String, Object, Number, Boolean, Array], @@ -127,6 +133,8 @@ this.file_navigation = TabSystem.getCurrentNavigation(); }); EventBus.on("updateCurrentContent", (new_o=this.computed_object()) => { + if(!this.is_active) return; + this.render_object = new_o; }); @@ -170,7 +178,7 @@ }, key_selected_class() { - return this.is_selected(undefined, "/" + this.evaluated_key) ? "selected" : ""; + return this.is_selected(undefined, "/" + this.evaluated_key) && this.is_active ? "selected" : ""; }, value_data() { return this.render_object.data; diff --git a/src/renderer/components/editor_shell/JsonEditor/ObjectKey.vue b/src/renderer/components/editor_shell/JsonEditor/ObjectKey.vue index f5051fd7d..acc1d24db 100644 --- a/src/renderer/components/editor_shell/JsonEditor/ObjectKey.vue +++ b/src/renderer/components/editor_shell/JsonEditor/ObjectKey.vue @@ -125,12 +125,13 @@ show_comment: { default: true, type: Boolean - } + }, + is_active: Boolean }, computed: { selected_class() { if(this.$el && this.is_selected() && this.$store.state.Settings.auto_scroll_json) this.$el.scrollIntoView({ behavior: "smooth", block: "center", inline: "nearest" }); - return this.is_selected() ? "selected" : ""; + return this.is_selected() && this.is_active ? "selected" : ""; }, inversed_arrows() { return this.$store.state.Settings.inversed_arrows; diff --git a/src/renderer/components/editor_shell/JsonEditor/PredictingInput.vue b/src/renderer/components/editor_shell/JsonEditor/PredictingInput.vue index ed3f93e3b..25f79d8a6 100644 --- a/src/renderer/components/editor_shell/JsonEditor/PredictingInput.vue +++ b/src/renderer/components/editor_shell/JsonEditor/PredictingInput.vue @@ -44,7 +44,8 @@ tab_id: Number, render_object: Object, file_navigation: String, - current_file_path: String + current_file_path: String, + is_active: Boolean }, data() { return { @@ -55,10 +56,10 @@ }, mounted() { this.updateAutoCompletions(); - EventBus.on("updateAutoCompletions", () => this.updateAutoCompletions()); + EventBus.on("updateAutoCompletions", this.updateAutoCompletions); }, destroyed() { - EventBus.off("updateAutoCompletions", () => this.updateAutoCompletions()); + EventBus.off("updateAutoCompletions", this.updateAutoCompletions); }, watch: { file_navigation(nav) { @@ -124,6 +125,7 @@ updateAutoCompletions() { this.mode = "object"; + if(!this.is_active) return; if(!this.provide_auto_completions) { this.items = []; diff --git a/src/renderer/components/editor_shell/SingleFile.vue b/src/renderer/components/editor_shell/SingleFile.vue index 38ae973b4..0fb57e64a 100644 --- a/src/renderer/components/editor_shell/SingleFile.vue +++ b/src/renderer/components/editor_shell/SingleFile.vue @@ -14,6 +14,7 @@ :uuid="use_uuid" :current_file_path="file.file_path" :is_immutable="file.is_immutable" + :is_active="is_active" /> @@ -21,6 +22,12 @@ export default { name: "editor-shell-content-manager", + props: { + split_screen: { + type: Boolean, + default: false + } + }, components: { WelcomeScreen, FileManager @@ -38,8 +45,8 @@ data() { return { available_height: window.innerHeight - 92, - open_files: TabSystem.filtered(), - selected_tab: TabSystem.selected + open_files: TabSystem.getCurrentProjects(this.split_screen), + selected_tab: TabSystem.getSelectedIndex(this.split_screen) }; }, methods: { @@ -47,11 +54,11 @@ this.available_height = window.innerHeight - this.base_height; }, setOpenFiles() { - this.open_files = TabSystem.filtered(); + this.open_files = TabSystem.getCurrentProjects(this.split_screen); }, updateSelectedTab() { EventBus.trigger("bridge:closeTextCompletions"); - this.selected_tab = TabSystem.selected; + this.selected_tab = TabSystem.getSelectedIndex(this.split_screen); } }, computed: { @@ -59,7 +66,7 @@ // return this.$store.getters.open_files(); // }, // selected_tab() { - // return this.$store.state.TabSystem.selected_tab; + // return this.$store.state.TabSystem.getSelectedIndex(this.split_screen)_tab; // }, base_height() { return 98 + 22 * this.footer_visible; diff --git a/src/renderer/components/editor_shell/TabSystem.vue b/src/renderer/components/editor_shell/TabSystem.vue index fab870580..ef3609919 100644 --- a/src/renderer/components/editor_shell/TabSystem.vue +++ b/src/renderer/components/editor_shell/TabSystem.vue @@ -6,14 +6,19 @@ mdi-book-open-page-variant {{ getIcon(file.file_path) }} @@ -51,10 +56,16 @@ import { DOC_URL } from '../../scripts/constants'; export default { name: "editor-shell-tab-system", + props: { + split_screen: { + type: Boolean, + default: false + } + }, data() { return { - open_files: TabSystem.filtered(), - internal_selected_tab: TabSystem.selected, + open_files: TabSystem.getCurrentProjects(this.split_screen), + internal_selected_tab: TabSystem.getSelectedIndex(this.split_screen), unsaved: [] }; }, @@ -75,14 +86,18 @@ export default { selected_tab: { set(val=0) { this.internal_selected_tab = val; + TabSystem.split_screen_active = this.split_screen; TabSystem.select(val); }, get() { return this.internal_selected_tab; } }, + split_screen_active() { + return this.$store.state.TabSystem.split_screen_active; + }, render_open_files() { - return TabSystem.filtered(); + return TabSystem.getCurrentProjects(this.split_screen); }, has_tabs() { @@ -97,13 +112,14 @@ export default { }, methods: { closeTab(i) { + TabSystem.split_screen_active = this.split_screen; TabSystem.closeById(i); }, changeSelected() { - this.internal_selected_tab = TabSystem.selected; + this.internal_selected_tab = TabSystem.getSelectedIndex(this.split_screen); }, updateFiles() { - this.open_files = TabSystem.filtered(); + this.open_files = TabSystem.getCurrentProjects(this.split_screen); this.unsaved = this.open_files.map(f => f.is_unsaved === undefined ? false : f.is_unsaved && !f.is_immutable); }, @@ -113,6 +129,12 @@ export default { getFileName(file_name) { return file_name.length > 27 && !file_name.includes(" ") ? file_name.substr(0, 27) + "\u2026" : file_name; }, + isSelected(i) { + return this.selected_tab === i && (this.split_screen ? this.split_screen_active : !this.split_screen_active); + }, + isInactiveAndSelected(i) { + return this.selected_tab === i && !(this.split_screen ? this.split_screen_active : !this.split_screen_active); + }, showDocButton(file_path) { let file_data = (FileType.getData(file_path) || {}); diff --git a/src/renderer/components/sidebar/Main.vue b/src/renderer/components/sidebar/Main.vue index 84df5aa84..8fff03053 100644 --- a/src/renderer/components/sidebar/Main.vue +++ b/src/renderer/components/sidebar/Main.vue @@ -1,23 +1,17 @@