Skip to content

Commit 02872f3

Browse files
authored
Cleaning up.
2 parents 37b486a + 1400728 commit 02872f3

8 files changed

Lines changed: 123 additions & 160 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"url": "git+https://github.com/opencor/webapp.git"
2424
},
2525
"type": "module",
26-
"version": "0.20260224.0",
26+
"version": "0.20260224.1",
2727
"scripts": {
2828
"archive:web": "bun src/renderer/scripts/archive.web.js",
2929
"build": "electron-vite build",

src/renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
},
4040
"./style.css": "./dist/opencor.css"
4141
},
42-
"version": "0.20260224.0",
42+
"version": "0.20260224.1",
4343
"scripts": {
4444
"build": "vite build && bun scripts/generate.version.js",
4545
"build:lib": "vite build --config vite.lib.config.ts && cp index.d.ts dist/index.d.ts",

src/renderer/src/components/ContentsComponent.vue

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
:scrollable="true"
2222
:selectOnFocus="true"
2323
>
24-
<TabList :id="fileTablistId" class="border-b border-b-primary shrink-0">
24+
<TabList class="border-b border-b-primary shrink-0">
2525
<Tab
2626
v-for="fileTab in fileTabs"
2727
:id="`tab_${fileTab.file.path()}`"
@@ -81,16 +81,6 @@ const props = defineProps<{
8181
}>();
8282
defineEmits<(event: 'error', message: string) => void>();
8383
84-
export interface IContentsComponent {
85-
openFile(file: locApi.File): void;
86-
closeCurrentFile(): void;
87-
closeAllFiles(): void;
88-
hasFile(filePath: string): boolean;
89-
hasFiles(): boolean;
90-
selectFile(filePath: string): void;
91-
}
92-
93-
const fileTablistId = vue.ref('contentsComponentFileTablist');
9484
const fileTabs = vue.ref<IFileTab[]>([]);
9585
const activeFile = vue.ref<string>('');
9686
@@ -201,16 +191,6 @@ vue.watch(activeFile, (newActiveFile: string) => {
201191
electronApi?.fileSelected(newActiveFile);
202192
});
203193
204-
// Various things that need to be done once we are mounted.
205-
206-
const crtInstance = vue.getCurrentInstance();
207-
208-
vue.onMounted(() => {
209-
// Customise our IDs.
210-
211-
fileTablistId.value = `contentsComponentFileTablist${String(crtInstance?.uid)}`;
212-
});
213-
214194
// Keyboard shortcuts.
215195
216196
if (common.isDesktop()) {

src/renderer/src/components/MainMenu.vue

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<Menubar ref="menuBar" :id="props.id" :model="items">
2+
<Menubar ref="menuBarRef" :id="props.id" :model="items">
33
<template #item="{ item, props }">
44
<a v-bind="props.action">
55
<div class="p-menubar-item-label">{{ item.label }}</div>
@@ -152,13 +152,13 @@ const items = [
152152
153153
// A few things that can only be done when the component is mounted.
154154
155-
const menuBar = vue.ref<(vue.ComponentPublicInstance<typeof Menubar> & { hide: () => void }) | null>(null);
155+
const menuBarRef = vue.ref<(InstanceType<typeof Menubar> & { hide: () => void; $el: HTMLElement }) | null>(null);
156156
157157
vue.onMounted(() => {
158-
if (menuBar.value) {
158+
if (menuBarRef.value) {
159159
// Ensure that the menubar never gets the 'p-menubar-mobile' class, which would turn it into a hamburger menu.
160160
161-
const menuBarElement = menuBar.value.$el as HTMLElement;
161+
const menuBarElement = menuBarRef.value.$el;
162162
const mutationObserver = new MutationObserver(() => {
163163
if (menuBarElement.classList.contains('p-menubar-mobile')) {
164164
menuBarElement.classList.remove('p-menubar-mobile');
@@ -167,7 +167,7 @@ vue.onMounted(() => {
167167
168168
mutationObserver.observe(menuBarElement, { attributes: true, attributeFilter: ['class'] });
169169
170-
// Close the menu when clicking clicking on the menubar but outside of the main menu items.
170+
// Close the menu when clicking on the menubar but outside of the main menu items.
171171
172172
const onClick = (event: MouseEvent) => {
173173
const target = event.target as Node;
@@ -177,7 +177,7 @@ vue.onMounted(() => {
177177
!menuBarElement.querySelector('.p-menubar-root-list')?.contains(target) &&
178178
!Array.from(document.querySelectorAll('.p-menubar-submenu')).some((submenu) => submenu.contains(target))
179179
) {
180-
menuBar.value?.hide();
180+
menuBarRef.value?.hide();
181181
}
182182
};
183183

0 commit comments

Comments
 (0)