Skip to content

Commit a4bc8f5

Browse files
committed
feat: update the whole live preview docs as per new features
1 parent 17ba81b commit a4bc8f5

26 files changed

+135
-36
lines changed

docs/07-Features/06-Live Preview/01-live-preview.md

Lines changed: 127 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,136 @@ title: Live Preview
44
import React from 'react';
55
import VideoPlayer from '@site/src/components/Video/player';
66

7-
The Live Preview feature in Phoenix Code provides instant feedback on changes made to HTML and CSS files, enabling developers to see their edits in real-time. This feature is activated by default for HTML projects, while other project types require manual setup.
8-
9-
## Activating Live Preview for HTML Files
10-
1. Select the HTML file you wish to edit from the editing panel.
11-
![Open file](../images/livePreview/open.png "Open the HTML file from the editing panel")
12-
2. Click the lightning bolt icon, located on the right panel, to initiate Live Preview.
13-
![Lightning icon](../images/livePreview/off.png "Initiate Live Preview by clicking the lightning icon")
14-
3. The icon turns gold when Live Preview is active.
15-
![Lightning icon active](../images/livePreview/on.png)
16-
View the side-by-side Live Preview alongside the code.
17-
![Live Preview active](../images/livePreview/livepreviewon.png "Live Preview alongside code")
18-
19-
## Detaching Live Preview to a New Window
20-
1. Hover over the Live Preview panel.
21-
2. Click the pop-out icon to detach Live Preview into a new window.
22-
![Detaching to new window](../images/livePreview/popout.png "Click to detach Live Preview to a new window")
23-
3. Live Preview will now display in your default web browser, allowing for uninterrupted coding and viewing.
24-
25-
## Selecting a Browser for Live Preview
26-
1. Hover over the Live Preview panel.
27-
2. Choose your preferred browser by clicking its icon. ![Browser selected](../images/livePreview/browser-choice.png "Live Preview in selected browser")
28-
3. Live Preview opens in the chosen browser.
29-
30-
## Reload Live Preview
31-
![Reload Live Preview](../images/livePreview/reload.png)
32-
The **Reload** button in the live preview toolbar allows you to manually refresh the Live Preview pane to ensure it reflects the latest changes in your code. While Live Preview updates automatically, the Reload button can be helpful if you encounter synchronization issues.
33-
34-
## Disable Live Preview
35-
You can disable the live preview panel at startup by following these steps:
36-
1. Click the settings icon in the toolbar (hover over the toolbar to make it appear).
37-
![Settings Icon](../images/livePreview/settings-gear.png)
38-
39-
2. This will open the live preview settings menu:
40-
![Settings menu](../images/livePreview/live-preview-settings-menu.png)
41-
3. Disable the `Show Live Preview Panel at Startup` option.
7+
The **Live Preview** feature in **Phoenix Code** provides instant feedback on changes made to **HTML** and **CSS** files, letting you see your edits in real-time.
428

9+
> For HTML files, Live Preview is enabled by default. For other file types, you might need to do some manual setup.
10+
11+
---
12+
13+
## Showing or Hiding Live Preview
14+
15+
To show or hide Live Preview, click the **Lightning Bolt** icon at the top of the right panel.
16+
17+
![Live Preview Toggle](../images/livePreview/lp-bolt.png "Live Preview toggle button")
18+
19+
You can use this button to toggle the visibility of the Live Preview panel.
20+
21+
Alternatively, you can toggle Live Preview from the menu bar by clicking `File > Live Preview`, or use the keyboard shortcut.
22+
23+
![Live Preview toggle menu option](../images/livePreview/lp-menu.png "Live Preview toggle menu option")
24+
25+
---
26+
27+
## Understanding the Bolt Icon
28+
29+
The Live Preview bolt icon appears in different colors, each indicating a different status:
30+
31+
![Live Preview gray bolt icon](../images/livePreview/lp-gray-bolt.png "Live Preview gray bolt icon")
32+
33+
* **Gray bolt**: Live Preview is currently turned off.
34+
35+
![Live Preview half yellow bolt icon](../images/livePreview/lp-half-bolt.png "Live Preview half yellow bolt icon")
36+
37+
* **Half yellow bolt**: Live Preview is connecting.
38+
39+
![Live Preview full yellow bolt icon](../images/livePreview/lp-full-bolt.png "Live Preview full yellow bolt icon")
40+
41+
* **Full yellow bolt**: Live Preview is successfully connected. Changes will now appear in real-time.
42+
43+
![Live Preview pink bolt icon](../images/livePreview/lp-pink-bolt.png "Live Preview pink bolt icon")
44+
45+
* **Pink bolt**: There is a syntax error in your code. Live Preview is not updating because of that.
46+
47+
> You can also hover over the bolt icon to see a tooltip showing the current status.
48+
49+
### Status Overlays
50+
51+
When there's a syntax error, the bolt icon turns pink and **Phoenix Code** also displays an overlay in Live Preview stating that there is an error.
52+
53+
![Live Preview syntax error overlay](../images/livePreview/lp-syntax-error-overlay.png "Live Preview syntax error overlay")
54+
55+
You can close this overlay by clicking the `×` icon. **Phoenix Code** won't show the overlay again.
56+
57+
**Phoenix Code** also displays a connecting overlay while Live Preview is establishing a connection.
58+
59+
![Live Preview connecting overlay](../images/livePreview/lp-connecting-overlay.png "Live Preview connecting overlay")
60+
61+
---
62+
63+
## Live Preview Toolbar
64+
65+
**Phoenix Code** provides various options in the Live Preview toolbar.
66+
67+
![Live Preview Toolbar](../images/livePreview/lp-toolbar.png "Live Preview toolbar")
68+
69+
> The browser icons and settings button are hidden by default and appear only on hover. Browser icons are available only in the Desktop app.
70+
71+
### Toolbar Options
72+
73+
![Live Preview reload](../images/livePreview/lp-reload.png "Live Preview reload")
74+
75+
* **Reload Live Preview** — Refreshes the Live Preview page. Normally, Live Preview updates in real-time but you can use this when Live Preview lags behind or doesn't update with your code changes.
76+
77+
![Live Preview mode](../images/livePreview/lp-mode.png "Live Preview mode")
78+
79+
* **Live Preview Modes** — Live Preview offers 3 modes: **Preview Mode**, **Highlight Mode**, and **Edit Mode**.
80+
81+
- **Preview Mode**: Disables all editing features. The page appears as it would in a normal browser.
82+
> Live Preview still updates in real-time when you edit source code in Preview Mode.
83+
84+
- **Highlight Mode**: When you click an element in Live Preview, a highlight marker appears showing the element's position, padding, and margin. **Phoenix Code** also moves your cursor in the editor to that element so you can start editing directly. Highlighting also works in reverse: moving your cursor in the editor highlights the corresponding element in Live Preview.
85+
86+
<VideoPlayer
87+
src="https://docs-images.phcode.dev/videos/live-preview/highlight-mode.mp4"
88+
/>
89+
90+
- **Edit Mode**: Allows you to edit Live Preview directly. You can edit text content, delete, duplicate, drag-drop elements and much more right from the Live Preview. **Phoenix Code** will automatically update the source code.
91+
[Read more about Live Preview Edit Mode](../../pro-features/live-preview-edit).
92+
> The `Edit Highlights on Hover` option in the dropdown is an Edit Mode feature.
93+
94+
<VideoPlayer
95+
src="https://docs-images.phcode.dev/videos/live-preview/preview-mode-button.mp4"
96+
/>
97+
98+
99+
* **Preview Mode Button** — Located right after the Reload button, this provides a quick shortcut to switch to Preview Mode. Click it to switch to Preview Mode; click again to return to your previous mode.
100+
101+
![Live Preview pin](../images/livePreview/lp-pin.png "Live Preview pin")
102+
103+
* **Pin or Unpin Preview Page** — Pin a file in Live Preview so it remains displayed even when you switch to other files. Click again to unpin.
104+
105+
![Live Preview filename](../images/livePreview/lp-filename.png "Live Preview filename")
106+
107+
* **File Name** — Displays the name of the currently previewed file. Click it to open that file in the editor (if not already open).
108+
109+
![Live Preview popout](../images/livePreview/lp-popout.png "Live Preview popout")
110+
111+
* **Pop Out to New Window** — Opens Live Preview in your default browser. This is helpful when you want to see how your page looks in a full browser window.
112+
113+
![Live Preview browsers](../images/livePreview/lp-browsers.png "Live Preview browsers")
114+
115+
* **Browser Icons** — Select a specific browser icon to open the page in that browser. This helps you see how your page looks across different browsers. The icons are hidden by default. You need to hover over the toolbar to reveal them.
116+
> This option is available only in Desktop apps.
117+
118+
![Live Preview settings](../images/livePreview/lp-setting.png "Live Preview settings")
119+
120+
* **Live Preview Settings** — Located at the right-most side of the toolbar. [Read more about Live Preview Settings](./live-preview-settings/#accessing-live-preview-settings).
121+
122+
---
123+
124+
## Using Live Preview with HTML Files
125+
126+
1. Open the HTML file you want to preview.
127+
2. Click the **Lightning Bolt** icon to open Live Preview (if it's closed).
128+
3. Make changes to the HTML file and see them update in Live Preview in real-time.
129+
130+
> If changes don't appear, reload Live Preview and wait until the bolt icon turns full yellow.
131+
132+
---
43133

44134
## Live Preview Demonstrated
45-
<VideoPlayer
135+
136+
<VideoPlayer
46137
src="https://docs-images.phcode.dev/videos/phcode.io-site/live_preview.mp4"
47138
/>
48139

-4.94 KB
Binary file not shown.
-397 KB
Binary file not shown.
168 KB
Loading
29.4 KB
Loading
15.5 KB
Loading
26.2 KB
Loading
1.57 KB
Loading
1.96 KB
Loading
1.66 KB
Loading

0 commit comments

Comments
 (0)