Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src-tauri/capabilities/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"core:default",
"fs:default",
"http:default",
"core:webview:allow-create-webview-window",
{
"identifier": "http:allow-fetch",
"allow": [
Expand Down
36 changes: 30 additions & 6 deletions src/components/Panels/Shared/HelpButton.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,44 @@
<p v-if="helplink" class="btn-parent">
<button
id="HelpButton"
class="btn btn-primary btn-xs" type="button"
class="btn btn-primary btn-xs"
type="button"
@click="helpButtonClick"
>
&#9432 Help
&#9432; Help
</button>
</p>
</template>

<script lang="ts" setup>
import { isTauri } from '@tauri-apps/api/core'
import { WebviewWindow } from '@tauri-apps/api/webviewWindow'
import { computed } from 'vue'

const props = defineProps({
obj: { type: Object, default: undefined },
obj: { type: Object, default: undefined },
})
const helplink = props.obj ?. helplink
function helpButtonClick() {
window.open(helplink)

const helplink = computed(() => props.obj?.helplink)

async function helpButtonClick() {
const link = helplink.value
if (!link) return

if (await isTauri()) {
try {
new WebviewWindow(`help-${Date.now()}`, {
url: link,
title: 'Help - CircuitVerse',
width: 1000,
height: 700
})
} catch {
// Fallback to browser if WebviewWindow fails
window.open(link, '_blank')
}
} else {
window.open(link, '_blank')
}
}
</script>
Loading