phcode-dev / phoenix

Phoenix is a modern open-source Code Editor for the web, built for the browser.
https://phcode.io
GNU Affero General Public License v3.0
1.79k stars 124 forks source link

fix: live preview UX where clicking on lp will open html when editing unrelated ts/json/js file #1800

Closed abose closed 3 months ago

abose commented 3 months ago

Context and Problem

Currently, when live previewing an HTML file (e.g., a.html) and switching to an unrelated file (e.g., a.json or a TypeScript file generated by a build step), clicking on the live preview unexpectedly switches the editor back to the main HTML file. This behavior disrupts the user’s workflow, especially when working on files indirectly related to the HTML being previewed. Users might find themselves forcibly navigated away from the task at hand, leading to potential confusion and inefficiency.

The behavior was initially added to phoenix to help new users navigate better, but is not hindering more advanced workflows that needs more user context. So we are reverting this change.

This change

This pull request introduces a change to maintain workflow continuity:

  1. Preserve Current Editor State: If a user is working on an unrelated file and clicks on the live preview, the editor will no longer switch back to the main HTML file automatically.
  2. Explicit Navigation Option: To view or edit the main HTML file in the context of live preview, users can now explicitly click on the title bar of the live preview pane. This action will open the associated HTML file, providing a deliberate choice to switch contexts without disrupting the current workflow. image
phoenixide commented 3 months ago

Thank You for making this pull request.

sonarcloud[bot] commented 3 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud