Skip to content

feat(mdviewer): show crown icon on edit button for free users#2811

Merged
abose merged 4 commits intomainfrom
ai
Apr 13, 2026
Merged

feat(mdviewer): show crown icon on edit button for free users#2811
abose merged 4 commits intomainfrom
ai

Conversation

@abose
Copy link
Copy Markdown
Member

@abose abose commented Apr 12, 2026

Add a gold crown icon after the "Edit" text to indicate it's a Pro feature, so free users know before clicking. Pro status is sent from Phoenix to the md viewer iframe via MDVIEWR_SET_PRO_STATUS message on iframe ready and on entitlement changes.

if (!iframeWindow) {
return;
}
iframeWindow.postMessage({
abose added 4 commits April 13, 2026 11:31
Add a gold crown icon after the "Edit" text to indicate it's a Pro
feature, so free users know before clicking. Pro status is sent from
Phoenix to the md viewer iframe via MDVIEWR_SET_PRO_STATUS message
on iframe ready and on entitlement changes.
…sion

- Save scroll position before hiding md iframe (panel close / HTML switch)
  so it can be restored on reopen. Wrapped in try-catch to handle sandboxed
  cross-origin iframe access that was causing a SecurityError and breaking
  the md-to-html preview switch entirely.

- Flush (not cancel) pending debounced content-change in handleSwitchFile
  and handleSetContent so outgoing file edits are preserved in cache, preventing
  data loss when users switch files within the 50ms debounce window.

- Tag mdviewrContentChanged messages with filePath so MarkdownSync can
  verify the change matches the active document, preventing stale edits
  from a previous file from modifying the wrong CM document.

- Guard MarkdownSync._onIframeContentChanged against stale content changes
  arriving after document close (null CM check + filePath mismatch check).

- Guard doc-cache.saveActiveScrollPos against overwriting saved non-zero
  scroll with 0 after browser resets scrollTop on hide/show.

- Fix _waitForMdPreviewReady in all 4 md test files: increase timeout from
  default 2s to 5s, re-read editor content each poll iteration so comparison
  adapts to async content sync that may modify the document.
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
C Maintainability Rating on New Code (required ≥ A)
D Security Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@abose abose merged commit 3a10ef5 into main Apr 13, 2026
15 of 21 checks passed
@abose abose deleted the ai branch April 13, 2026 07:06
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