Fix stream site URL template editing and add NIP-53 starts/ends tags
This commit is contained in:
+55
-4
@@ -372,6 +372,21 @@
|
||||
min-height: 40px;
|
||||
}
|
||||
|
||||
.docEventPre {
|
||||
margin: 0;
|
||||
min-height: 40px;
|
||||
overflow: auto;
|
||||
white-space: pre-wrap;
|
||||
word-break: break-word;
|
||||
font-family: var(--font-family);
|
||||
font-size: 84%;
|
||||
line-height: 1.35;
|
||||
border: 1px solid var(--muted-color);
|
||||
border-radius: 8px;
|
||||
padding: 10px;
|
||||
background: color-mix(in srgb, var(--secondary-color) 90%, var(--muted-color) 10%);
|
||||
}
|
||||
|
||||
#divDocumentInfo {
|
||||
font-size: 72%;
|
||||
color: var(--muted-color);
|
||||
@@ -1286,17 +1301,46 @@ user:
|
||||
`;
|
||||
}
|
||||
|
||||
function buildEventViewJson() {
|
||||
const d = String(CURRENT_NOTE || '').trim();
|
||||
const note = d ? (OBJ_NOTES[d] || null) : null;
|
||||
const fallbackKind = Number(note?.kind) === 30023 ? 30023 : 30024;
|
||||
const tags = collectDocumentTags();
|
||||
return {
|
||||
id: String(note?.id || ''),
|
||||
pubkey: String(note?.pubkey || currentPubkey || ''),
|
||||
kind: fallbackKind,
|
||||
created_at: Number(note?.created_at || Math.floor(Date.now() / 1000)),
|
||||
tags,
|
||||
content: String(taDocument?.value || '')
|
||||
};
|
||||
}
|
||||
|
||||
function updateDocumentView() {
|
||||
if (!taDocument || !divDocumentPreview) return;
|
||||
if (documentViewMode === 'markdown') {
|
||||
const metaGridEl = document.querySelector('#divAiDocumentPane .docPaneMetaGrid');
|
||||
const isMarkdown = documentViewMode === 'markdown';
|
||||
const isEvent = documentViewMode === 'event';
|
||||
|
||||
if (isMarkdown || isEvent) {
|
||||
taDocument.style.display = 'none';
|
||||
if (metaGridEl) metaGridEl.style.display = 'none';
|
||||
divDocumentPreview.style.display = 'block';
|
||||
const metaHtml = renderDocumentMetaPreview();
|
||||
const bodyHtml = renderDocumentPreview(taDocument.value || '');
|
||||
divDocumentPreview.innerHTML = `${metaHtml}<div class="docPreviewContent">${bodyHtml}</div>`;
|
||||
|
||||
if (isMarkdown) {
|
||||
const metaHtml = renderDocumentMetaPreview();
|
||||
const bodyHtml = renderDocumentPreview(taDocument.value || '');
|
||||
divDocumentPreview.innerHTML = `${metaHtml}<div class="docPreviewContent">${bodyHtml}</div>`;
|
||||
return;
|
||||
}
|
||||
|
||||
const eventJson = JSON.stringify(buildEventViewJson(), null, 2);
|
||||
divDocumentPreview.innerHTML = `<pre class="docEventPre">${escapeHtml(eventJson)}</pre>`;
|
||||
return;
|
||||
}
|
||||
|
||||
taDocument.style.display = 'block';
|
||||
if (metaGridEl) metaGridEl.style.display = 'grid';
|
||||
divDocumentPreview.style.display = 'none';
|
||||
}
|
||||
|
||||
@@ -4279,6 +4323,13 @@ user:
|
||||
updateDocumentView();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'View Event',
|
||||
onClick: () => {
|
||||
documentViewMode = 'event';
|
||||
updateDocumentView();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Copy document',
|
||||
onClick: async () => {
|
||||
|
||||
Reference in New Issue
Block a user