feat(ext/popup): add pop-out to tab for forms
Forms can now be opened in a full browser tab via the ⤴ button, solving Chrome's popup closure on file picker interaction. Deep linking via URL params preserves view, item type, and item ID. Also removes the unused dropdown picker code from item-list.ts. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
/// Typed-item add/edit form dispatcher. Each type's renderForm lives in
|
||||
/// its own module under ./types/. Document stays "coming soon" until γ.
|
||||
|
||||
import { navigate, getState, setState, escapeHtml } from '../popup';
|
||||
import { navigate, getState, setState, escapeHtml, popOutToTab } from '../popup';
|
||||
import type { Item, ItemType } from '../../shared/types';
|
||||
|
||||
const TYPE_OPTIONS: Array<{ type: ItemType; icon: string; label: string }> = [
|
||||
@@ -57,6 +57,8 @@ function renderTypeSelection(app: HTMLElement): void {
|
||||
<div style="display:flex; align-items:center; gap:12px; margin-bottom:16px;">
|
||||
<button class="btn" id="back-btn">← back</button>
|
||||
<h3 style="margin:0;">new item</h3>
|
||||
<span style="flex:1;"></span>
|
||||
<button class="btn" id="popout-btn" title="Open in tab">⤴</button>
|
||||
</div>
|
||||
<div class="type-select-list">
|
||||
${TYPE_OPTIONS.map((opt) => `
|
||||
@@ -70,6 +72,7 @@ function renderTypeSelection(app: HTMLElement): void {
|
||||
`;
|
||||
|
||||
document.getElementById('back-btn')?.addEventListener('click', () => navigate('list'));
|
||||
document.getElementById('popout-btn')?.addEventListener('click', popOutToTab);
|
||||
|
||||
document.querySelectorAll<HTMLButtonElement>('[data-type]').forEach((btn) => {
|
||||
btn.addEventListener('click', () => {
|
||||
|
||||
Reference in New Issue
Block a user