Skip to content

Updated shareable preview#108

Merged
ThisIs-Developer merged 1 commit into
mainfrom
shareable-link
May 24, 2026
Merged

Updated shareable preview#108
ThisIs-Developer merged 1 commit into
mainfrom
shareable-link

Conversation

@ThisIs-Developer
Copy link
Copy Markdown
Owner

No description provided.

Copilot AI review requested due to automatic review settings May 24, 2026 16:01
@vercel
Copy link
Copy Markdown

vercel Bot commented May 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
markdown-viwer Ready Ready Preview, Comment May 24, 2026 4:01pm

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the “share via URL” experience by introducing a dedicated Share modal (with view-only vs edit link modes) and adjusting shared-link loading behavior to open the appropriate view mode. It also adds a preprocessing step intended to protect escaped dollar signs from being misinterpreted by MathJax.

Changes:

  • Add a new Share modal UI to generate/copy share links with “View only” vs “Edit” modes.
  • Update share-hash loading to support an &edit=1 flag and switch view mode accordingly.
  • Add Share modal styles and a Markdown preprocess step for escaped dollar signs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
index.html Adds Share modal markup (mode cards, URL field, copy/close controls).
styles.css Adds styling for the Share modal and selectable mode cards.
script.js Implements Share modal behavior, share URL building/parsing (incl. edit=1), and adds a preprocess hook for escaped $.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread script.js
Comment on lines +669 to +670
// This prevents MathJax from treating lone $ as a math delimiter.
const protectedMarkdown = markdown.replace(/\\\$/g, '$');
Comment thread script.js
Comment on lines +5062 to +5081
function openShareModal() {
// Reset to view-only by default each time
shareModeView.checked = true;
syncShareCardStyles();
updateShareUrlField();
shareModal.style.display = '';
requestAnimationFrame(() => {
shareModal.classList.add('is-visible');
shareModal.setAttribute('aria-hidden', 'false');
});
}

const originalHTML = btn.innerHTML;
const copiedHTML = '<i class="bi bi-check-lg"></i> Copied!';
function closeShareModal() {
shareModal.classList.remove('is-visible');
shareModal.setAttribute('aria-hidden', 'true');
shareModal.addEventListener('transitionend', function handler() {
shareModal.style.display = 'none';
shareModal.removeEventListener('transitionend', handler);
});
}
Comment thread styles.css
}

.share-mode-card.is-selected {
border-color: var(--accent-color);
Comment thread styles.css
Comment on lines +2724 to +2730
.share-mode-card.is-selected {
border-color: var(--accent-color);
background: color-mix(in srgb, var(--accent-color) 8%, transparent);
}

.share-mode-card input[type="radio"] {
display: none;
Comment thread index.html
</div>
<div class="share-url-row">
<input type="text" id="share-url-input" class="rename-modal-input share-url-input" readonly placeholder="Generating link…" aria-label="Share URL" />
<button class="reset-modal-btn share-copy-btn" id="share-copy-btn" title="Copy link">
Comment thread index.html
Comment on lines +484 to +528
<!-- Share Modal -->
<div id="share-modal" class="reset-modal-overlay modal-overlay" role="dialog" aria-modal="true" aria-labelledby="share-modal-title" aria-hidden="true" style="display:none;">
<div class="reset-modal-box reset-modal-box--wide modal-box">
<div class="modal-header">
<p id="share-modal-title" class="reset-modal-message">Share Document</p>
<button type="button" class="modal-close-btn" id="share-modal-close-icon" aria-label="Close share dialog">
<i class="bi bi-x-lg"></i>
</button>
</div>
<div class="modal-body">
<p class="share-modal-description">Choose how recipients can interact with this document.</p>
<div class="share-mode-cards">
<label class="share-mode-card" id="share-card-view" for="share-mode-view">
<input type="radio" id="share-mode-view" name="share-mode" value="view" checked />
<span class="share-card-icon"><i class="bi bi-eye"></i></span>
<span class="share-card-body">
<span class="share-card-title">View only</span>
<span class="share-card-desc">Opens in preview mode. The editor is hidden.</span>
</span>
<span class="share-card-check"><i class="bi bi-check-lg"></i></span>
</label>
<label class="share-mode-card" id="share-card-edit" for="share-mode-edit">
<input type="radio" id="share-mode-edit" name="share-mode" value="edit" />
<span class="share-card-icon"><i class="bi bi-pencil-square"></i></span>
<span class="share-card-body">
<span class="share-card-title">Edit</span>
<span class="share-card-desc">Opens in split editor + preview mode.</span>
</span>
<span class="share-card-check"><i class="bi bi-check-lg"></i></span>
</label>
</div>
<div class="share-url-row">
<input type="text" id="share-url-input" class="rename-modal-input share-url-input" readonly placeholder="Generating link…" aria-label="Share URL" />
<button class="reset-modal-btn share-copy-btn" id="share-copy-btn" title="Copy link">
<i class="bi bi-clipboard"></i>
</button>
</div>
<p class="share-modal-notice"><i class="bi bi-info-circle"></i> The entire document is encoded in the URL. No data is sent to any server.</p>
</div>
<div class="reset-modal-actions">
<button class="reset-modal-btn reset-modal-cancel" id="share-modal-close">Close</button>
</div>
</div>
</div>

@ThisIs-Developer ThisIs-Developer merged commit 1ba8cbc into main May 24, 2026
7 checks passed
@ThisIs-Developer ThisIs-Developer deleted the shareable-link branch May 24, 2026 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants