|
1 | 1 | <script> |
2 | 2 | import { getContext } from 'svelte'; |
| 3 | + import { get_page_browser } from './page_browser_context.svelte.js'; |
3 | 4 |
|
4 | 5 | const svedit = getContext('svedit'); |
| 6 | + const page_browser = get_page_browser(); |
5 | 7 |
|
6 | 8 | let toggle_link_command = $derived(svedit.session.commands?.toggle_link); |
7 | 9 | let href_input_value = $state('https://'); |
|
69 | 71 | onclick={handle_backdrop_click} |
70 | 72 | > |
71 | 73 | <div class="flex flex-col"> |
72 | | - <input |
73 | | - bind:this={href_input_ref} |
74 | | - type="url" |
75 | | - bind:value={href_input_value} |
76 | | - placeholder="https://example.com" |
77 | | - class="w-72 px-3 py-2 text-sm text-gray-700 border-b border-gray-200 focus:border-(--svedit-editing-stroke) focus:ring-(--svedit-editing-stroke)" |
78 | | - onkeydown={handle_keydown} |
79 | | - /> |
| 74 | + <div class="flex items-stretch border-b border-gray-200"> |
| 75 | + <input |
| 76 | + bind:this={href_input_ref} |
| 77 | + type="url" |
| 78 | + bind:value={href_input_value} |
| 79 | + placeholder="https://example.com" |
| 80 | + class="w-72 min-w-0 flex-1 border-0 px-3 py-2 text-sm text-gray-700 outline-none focus:ring-1 focus:ring-(--svedit-editing-stroke)" |
| 81 | + onkeydown={handle_keydown} |
| 82 | + /> |
| 83 | + <button |
| 84 | + type="button" |
| 85 | + class="shrink-0 cursor-pointer border-l border-gray-200 px-3 text-(--svedit-editing-stroke) hover:bg-[oklch(from_var(--svedit-brand)_0.97_0.015_h)]" |
| 86 | + title="Select page" |
| 87 | + aria-label="Select page" |
| 88 | + onclick={() => { |
| 89 | + page_browser.open_select((document_id) => { |
| 90 | + href_input_value = `/${document_id}`; |
| 91 | + open_in_new_tab = false; |
| 92 | + }); |
| 93 | + }} |
| 94 | + > |
| 95 | + ↗ |
| 96 | + </button> |
| 97 | + </div> |
80 | 98 | <div class="flex items-center justify-between px-3 py-2"> |
81 | 99 | <label class="flex items-center gap-2 cursor-pointer"> |
82 | 100 | <input |
|
0 commit comments