Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/CODE_STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ A line-by-line map of the main application file and key functions.
| ~3840–4030 | Save/load | `save`, `load`, `setFromHash`, URL updates |
| ~4030–4125 | Theme | Light/dark toggle, URL param, system preference |
| ~4125–4685 | Version history | `pushLocalVersion`, `versionUndo`, `versionRedo`, `enterPreview`, `exitPreview` |
| ~4685–4760 | UI helpers | `setSaveStatus`, `notify`, `updateQR` |
| ~4588–4727 | Export | `downloadTXT`, `downloadHTML`, `downloadMD` |
| ~4685–4756 | UI helpers | `setSaveStatus`, `notify`, `updateQR` |
| ~4756–4940 | Export | `downloadTXT`, `downloadHTML`, `downloadMD` |
| ~4727–5100 | Initialization | DOM ready, hash load, event listeners, Editor setup |

## Key Functions
Expand Down
16 changes: 15 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5110,6 +5110,21 @@ <h4 id="size-tooltip-title">Document is getting large</h4>
document.getElementById('editor-wrap')?.classList.remove('encrypted-mode')
updateLockButtonVisibility()
document.getElementById('unlock-password').value = ''
renderAllBlocks()

if (previewHash) {
const wrap = document.getElementById('editor-wrap')
const text = document.getElementById('preview-banner-text')
if (wrap) wrap.classList.add('preview-mode')
if (text) text.textContent = 'Previewing ' + formatVersionLabel(previewHash)
updateTitle()
updateQR()
updateStatusBar()
renderHistoryGraph()
notify('Unlocked preview')
return
}

const prevHead = getHeadHash()
const hash = '#' + await getShortestHash(blocks)
history.replaceState({}, '', buildUrl(hash))
Expand All @@ -5119,7 +5134,6 @@ <h4 id="size-tooltip-title">Document is getting large</h4>
pushLocalVersion(hash, prevHead ? [prevHead] : (getLocalVersions()[0]?.hash ? [getLocalVersions()[0].hash] : []))
localStorage.setItem('hash', hash)
} catch (e) {}
renderAllBlocks()
updateTitle()
updateQR()
updateStatusBar()
Expand Down