From ee7e1a5bed7c037ed1c6c874bec8dc339c533913 Mon Sep 17 00:00:00 2001 From: "Anthony Fu (via agent)" Date: Tue, 6 Oct 2026 04:01:02 +0000 Subject: [PATCH] feat(plugin-og): follow the embedding page in the address bar --- plugins/og/app/app/app.vue | 11 ++-- .../app/components/ViewerToolbar.stories.ts | 17 ++++-- .../og/app/app/components/ViewerToolbar.vue | 28 +++++++++- plugins/og/app/app/composables/useHostPage.ts | 54 +++++++++++++++++++ plugins/og/app/app/composables/useOgViewer.ts | 43 ++++++++++++--- plugins/og/app/app/utils/address.ts | 18 +++++++ plugins/og/test/address.test.ts | 25 +++++++++ 7 files changed, 178 insertions(+), 18 deletions(-) create mode 100644 plugins/og/app/app/composables/useHostPage.ts create mode 100644 plugins/og/app/app/utils/address.ts create mode 100644 plugins/og/test/address.test.ts diff --git a/plugins/og/app/app/app.vue b/plugins/og/app/app/app.vue index 3f2ca6dcf..1d818c11d 100644 --- a/plugins/og/app/app/app.vue +++ b/plugins/og/app/app/app.vue @@ -20,7 +20,11 @@ onMounted(() => viewer.inspect()) v-model:target="viewer.target.value" :loading="viewer.loading.value" :is-static="viewer.isStatic.value" + :is-embedded="viewer.isEmbedded" + :url="viewer.snapshot.value?.url" + :status="viewer.snapshot.value?.status" @inspect="viewer.inspect()" + @refresh="viewer.refresh()" />
@@ -48,13 +52,6 @@ onMounted(() => viewer.inspect())
-
- - - {{ viewer.snapshot.value.url }} - - HTTP {{ viewer.snapshot.value.status }} -
diff --git a/plugins/og/app/app/components/ViewerToolbar.stories.ts b/plugins/og/app/app/components/ViewerToolbar.stories.ts index 9e3000e98..0faca57e6 100644 --- a/plugins/og/app/app/components/ViewerToolbar.stories.ts +++ b/plugins/og/app/app/components/ViewerToolbar.stories.ts @@ -18,7 +18,18 @@ export const Idle: Story = { const target = ref('https://devfra.me/') return { target } }, - template: ``, + template: ``, + }), +} + +export const Embedded: Story = { + render: () => ({ + components: { ViewerToolbar }, + setup() { + const target = ref('/guide/') + return { target } + }, + template: ``, }), } @@ -29,7 +40,7 @@ export const Loading: Story = { const target = ref('https://devfra.me/') return { target } }, - template: ``, + template: ``, }), } @@ -40,6 +51,6 @@ export const Static: Story = { const target = ref('https://devfra.me/') return { target } }, - template: ``, + template: ``, }), } diff --git a/plugins/og/app/app/components/ViewerToolbar.vue b/plugins/og/app/app/components/ViewerToolbar.vue index 0dd63f90c..0cd507a01 100644 --- a/plugins/og/app/app/components/ViewerToolbar.vue +++ b/plugins/og/app/app/components/ViewerToolbar.vue @@ -1,14 +1,21 @@