gitea: default repo setting; editor: asset picker with thumbnail grid
Gitea plugin: default_repo field per account (stored in DB, pre-fills create issue form but stays editable). Editor toolbar: asset picker flyout with 4-column thumbnail grid and live search filter. Clicking a tile inserts the matching markdown. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
c5bf8b0407
commit
04b52ecc19
9 files changed
+197
-6
No files matched your search
@@ -113,6 +113,10 @@ function buildSettingsPanel(panelEl) {
|
||||
<span class="font-pixel text-[9px] text-t-dim uppercase">access token <span id="gitea-tok-hint" class="text-t-muted normal-case text-[8px]"></span></span>
|
||||
<input id="gitea-acc-token" type="password" autocomplete="off" class="w-full bg-t-bg border border-t-border text-t-bright px-2 py-1.5 text-xs focus:border-t-accent focus:outline-none font-mono">
|
||||
</label>
|
||||
<label class="block">
|
||||
<span class="font-pixel text-[9px] text-t-dim uppercase">default repo <span class="text-t-muted normal-case text-[8px]">(owner/repo)</span></span>
|
||||
<input id="gitea-acc-default-repo" type="text" placeholder="owner/repo" autocomplete="off" class="w-full bg-t-bg border border-t-border text-t-bright px-2 py-1.5 text-xs focus:border-t-accent focus:outline-none font-mono">
|
||||
</label>
|
||||
<div class="flex items-center gap-2 pt-1">
|
||||
<button type="submit" id="gitea-acc-save" class="flex items-center gap-1.5 px-3 py-1.5 text-xs border border-t-accent text-t-accent hover:bg-t-accent/10 transition-colors"><i class="ph ph-floppy-disk text-sm"></i><span class="font-pixel text-[10px]">Save</span></button>
|
||||
<button type="button" id="gitea-acc-test" class="flex items-center gap-1.5 px-3 py-1.5 text-xs border border-t-border text-t-muted hover:border-t-accent hover:text-t-accent transition-colors"><i class="ph ph-plug text-sm"></i><span class="font-pixel text-[10px]">Test</span></button>
|
||||
@@ -150,7 +154,7 @@ function renderAccountsList() {
|
||||
<i class="ph ph-git-pull-request text-t-accent text-base"></i>
|
||||
<div class="gitea-account-info">
|
||||
<div class="gitea-account-name">${escapeHtml(a.name)}</div>
|
||||
<div class="gitea-account-meta">${escapeHtml(a.base_url)}</div>
|
||||
<div class="gitea-account-meta">${escapeHtml(a.base_url)}${a.default_repo ? ' · ' + escapeHtml(a.default_repo) : ''}</div>
|
||||
</div>
|
||||
<div class="gitea-account-actions">
|
||||
<button class="toolbar-btn gitea-edit-btn" title="Edit"><i class="ph ph-pencil-simple text-sm"></i></button>
|
||||
@@ -201,6 +205,7 @@ function resetAccountForm() {
|
||||
$('gitea-acc-name').value = '';
|
||||
$('gitea-acc-baseurl').value = '';
|
||||
$('gitea-acc-token').value = '';
|
||||
$('gitea-acc-default-repo').value = '';
|
||||
setAccountStatus('');
|
||||
$('gitea-tok-hint').textContent = '';
|
||||
}
|
||||
@@ -214,6 +219,7 @@ function editAccount(id) {
|
||||
$('gitea-acc-name').value = acc.name;
|
||||
$('gitea-acc-baseurl').value = acc.base_url;
|
||||
$('gitea-acc-token').value = '';
|
||||
$('gitea-acc-default-repo').value = acc.default_repo || '';
|
||||
$('gitea-tok-hint').textContent = '(leave blank to keep existing)';
|
||||
setAccountStatus('');
|
||||
$('gitea-acc-name').focus();
|
||||
@@ -240,6 +246,7 @@ async function saveAccount(e) {
|
||||
name: $('gitea-acc-name').value.trim(),
|
||||
base_url: $('gitea-acc-baseurl').value.trim(),
|
||||
token: $('gitea-acc-token').value,
|
||||
default_repo: $('gitea-acc-default-repo').value.trim(),
|
||||
};
|
||||
if (!payload.name || !payload.base_url || (!editingAccountId && !payload.token)) {
|
||||
setAccountStatus('name, base url, and token are required', 'error');
|
||||
@@ -713,8 +720,9 @@ async function openCreateForm() {
|
||||
$('gitea-create-form').classList.remove('hidden');
|
||||
$('gitea-create-form').classList.add('flex');
|
||||
|
||||
// Reset form
|
||||
$('gitea-create-repo').value = '';
|
||||
// Reset form — pre-fill default repo if configured
|
||||
const currentAccount = accounts.find(a => a.id === currentAccountId);
|
||||
$('gitea-create-repo').value = currentAccount?.default_repo || '';
|
||||
$('gitea-create-title').value = '';
|
||||
$('gitea-create-body').value = '';
|
||||
setCreateStatus('');
|
||||
@@ -766,6 +774,8 @@ async function openCreateForm() {
|
||||
errBox.classList.remove('hidden');
|
||||
}
|
||||
}
|
||||
|
||||
if (currentAccount?.default_repo) loadCreateRepoLabels();
|
||||
}
|
||||
|
||||
function updateRepoHint() {
|
||||
|
||||
Reference in new issue
Block a user