feat: Multi-tab workspace with localStorage session persistence#40
Merged
ThisIs-Developer merged 2 commits intomainfrom Mar 7, 2026
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
- Add tab bar HTML to index.html (between header and dropzone) - Add complete tab bar CSS to styles.css (tabs, dark mode, animations, responsive) - Add TabManager module to script.js: - Storage helpers (localStorage keys, load/save) - deriveTitleFromContent, createTab, renderTabBar with drag-and-drop - initTabs, switchTab, newTab, closeTab, updateActiveTabTitle - saveCurrentTabState, restoreViewMode helper - Wire into existing app: initTabs() replaces renderMarkdown() on init - importMarkdownFile opens files in new tab - Debounced save (500ms) and title update (800ms) on editor input - saveCurrentTabState on view mode button click - Ctrl/Cmd+T (new tab), Ctrl/Cmd+W (close tab) keyboard shortcuts - tab-new-btn click handler - loadFromShareHash persists shared content to current tab - Max 20 tabs with informative alert Co-authored-by: ThisIs-Developer <109382325+ThisIs-Developer@users.noreply.github.com>
Deploying markdown-viewer with
|
| Latest commit: |
d8510fc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://c78cd5f8.markdown-viewer.pages.dev |
| Branch Preview URL: | https://copilot-add-document-tabs-se.markdown-viewer.pages.dev |
Deploying markdownviewer with
|
| Latest commit: |
d8510fc
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2a010d86.markdownviewer.pages.dev |
| Branch Preview URL: | https://copilot-add-document-tabs-se.markdownviewer.pages.dev |
Copilot
AI
changed the title
[WIP] Add multi-tab workspace system to Markdown Viewer application
feat: Multi-tab workspace with localStorage session persistence
Mar 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a VS Code–style tabbed interface to the Markdown Viewer so users can work across multiple documents simultaneously, with full session restore on reload via
localStorage.Data model
Each tab persists
{ id, title, content, scrollPos, viewMode, createdAt }undermarkdownViewerTabsinlocalStorage; active tab ID is stored separately undermarkdownViewerActiveTab.index.html#tab-bar) inserted between<header>and the dropzone — a scrollable#tab-listplus a+new-tab button.styles.css≤480px.script.js—TabManagermoduleinitTabs()— replaces the barerenderMarkdown()init call; restores tabs, active tab content, view mode, and scroll position fromlocalStorage. Falls back tosampleMarkdownon first run.switchTab(tabId)— flushes current tab state before loading the target tab's content, view mode, and scroll position.newTab(content?, title?)— capped at 20 tabs; called by the+button,Ctrl/Cmd+T, and on file import (opens in a new tab instead of overwriting the current one).closeTab(tabId)—Ctrl/Cmd+Wor the×button; last tab is protected.renderTabBar()— full re-render with HTML5 drag-and-drop reordering; active tab auto-scrolled into view.saveCurrentTabState()— debounced 500 ms on editor input; immediate on view mode change.updateActiveTabTitle()— debounced 800 ms; derives title from first H1 → first non-empty line (≤30 chars) →'Untitled'; skips write if unchanged.restoreViewMode(mode)— extracted helper that resetscurrentViewModetonullbefore callingsetViewMode()to force re-application regardless of previous state.Import integration
Share-URL integration
loadFromShareHash()now callssaveCurrentTabState()+updateActiveTabTitle()after decoding, so the shared content is persisted into the active tab's slot.Original prompt
Feature: Document Tabs & Session Management
Implement a full multi-tab workspace system in the Markdown Viewer application. Users currently can only work with a single document at a time. This feature adds a VS Code–style tabbed interface with complete
localStorage-based session persistence so nothing is lost on refresh.Files to Modify
index.html— Add the tab bar HTML structure (between<header>and the dropzone<div>)styles.css— Add all tab bar styles, dark mode support, responsive behaviour, and animationsscript.js— Add the entireTabManagermodule and wire it into the existing app logicDetailed Requirements
1. Data Model (
script.js)Maintain a
tabsarray in memory and sync it tolocalStorageunder the keymarkdownViewerTabs. Each tab object has:A
activeTabIdstring is stored separately inlocalStorageasmarkdownViewerActiveTab.2. Tab Bar HTML (insert into
index.html)Insert this block directly above the
<div id="dropzone" ...>element and below the closing</header>:3. Tab Bar CSS (append to
styles.css)Add a clearly delimited section at the bottom of
styles.css: