added editor info to statusbar
mellbacon committed
May 16, 2023 at 14:54 UTC
d4e119c54b00865ccef9e43077c42ecddc2be5e4
3 files changed
+39
-8
src/lib/EditorTabList.svelte
+2
@@ -3,6 +3,7 @@
3
import Dropdown from "./utility/Dropdown.svelte";
4
import TabList from "./Tab/TabList.svelte";
5
import { Tab } from "./Tab/Tab";
6
+ import Editor from "./Editor.svelte";
7
</script>
8
<script lang="ts" context="module">
9
class EditorTab {
@@ -42,6 +43,7 @@
43
}
44
45
export let hidden = editorTab.hidden;
46
+ export let isfile = editorTab.isfile;
47
let tabs = editorTab.tabs;
48
</script>
49
<div id="editor-tabs" class:hidden={$hidden}>
src/lib/Statusbar.svelte
+29
-2
@@ -1,3 +1,7 @@
1
+<script lang="ts">
2
+ import { isfile } from "./EditorTabList.svelte";
3
+</script>
4
+
5
<div id="statusbar">
6
<div id="title">
7
<span>Nucleus</span>
@@ -6,6 +10,15 @@
10
<div class="editor-tools">
11
12
</div>
13
+ {#if $isfile}
14
+ <div class="editor-info">
15
+ <span title="Ln: -, Col: -">- : -</span>
16
+ <div class="divider"></div>
17
+ <span>UTF-8</span>
18
+ <div class="divider"></div>
19
+ <span>Unknown</span>
20
+ </div>
21
+ {/if}
22
</div>
23
24
<style lang="scss">
@@ -33,10 +46,24 @@
46
}
47
.editor-tools {
48
height: 100%;
36
- width: -webkit-fill-available;
49
display: flex;
50
align-items: center;
39
- justify-content: space-between;
51
+ justify-content: flex-start;
52
padding-left: 10px;
53
}
54
+ .editor-info {
55
+ display: flex;
56
+ justify-content: flex-end;
57
+ align-items: center;
58
+ flex-grow: 1;
59
+ font-size: 13px;
60
+ height: 100%;
61
+ color: #8c8c8c;
62
+ span {
63
+ padding: 0 7px;
64
+ height: 100%;
65
+ display: flex;
66
+ align-items: center;
67
+ }
68
+ }
69
</style>
\ No newline at end of file
src/lib/Tab/Tab.ts
+8
-6
@@ -7,6 +7,7 @@ export class Tab {
7
tablist = [];
8
Tab; // Tab class
9
hidden = writable(true);
10
+ isfile = writable(false);
11
tabs = writable([]);
12
constructor (Tab) {
13
this.Tab = Tab;
@@ -17,6 +18,12 @@ export class Tab {
18
if (tab.id === id) {
19
this.activeid = id;
20
tab.active = true;
21
+ if (tab.isfile) {
22
+ this.isfile.set(true);
23
+ }
24
+ else {
25
+ this.isfile.set(false);
26
+ }
27
}
28
else {
29
tab.active = false;
@@ -26,12 +33,6 @@ export class Tab {
33
this.updateView();
34
}
35
updateTabs() {
29
- if (this.tablist.length === 0) {
30
- this.hidden.set(true);
31
- this.id = 0;
32
- return;
33
- }
34
-
36
if (this.tablist.length > 0) {
37
this.hidden.set(false);
38
}
@@ -96,6 +97,7 @@ export class Tab {
97
98
if (this.tablist.length === 0) {
99
this.hidden.set(true);
100
+ this.isfile.set(false);
101
this.id = 0;
102
}
103
}