xyxu-html-editor
A visual editor for .html / .htm files in VS Code. Click elements on the rendered page, change them in the panel on the right, and press Ctrl+S (Cmd+S) to write the changes to the file. The extension never saves on its own.
Use
- Right-click an
.html / .htm file in the Explorer, in its text editor or on its tab, and choose xyxu-html-editor. The visual editor opens as the last tab of the current editor group.
- Click an element to select it. Alt+↑ selects its parent, Alt+↓ a child. The breadcrumb above the page shows the path; click a crumb to select it.
- Change text, typography, layout, size, background, spacing, border, shadow and image settings in the panel.
- Double-click any text on the page to edit it in place: Enter or a click outside commits, Esc cancels. In a paragraph with tags inside, such as
Hello <b>bold</b> and <a>link</a>, only the stretch of text you double-clicked changes; the tags stay as they are, and their own text is edited by double-clicking it. For an element with tags inside, the Text section lists each stretch of text between the tags in its own field ("before ", "between and ", "after ").
- In a table, add or delete rows and columns from the Table section. Tables with merged cells are not changed.
- Delete element (or the Delete key on the page) removes the selected element.
- Ctrl+Z undoes, Ctrl+Shift+Z / Ctrl+Y redoes.
- Ctrl+S saves. Only the changed parts of the file are rewritten; formatting, comments, line endings and encoding stay as they were.
Setting
| Setting |
Default |
Effect |
xyxu-html-editor.runScripts |
true |
Run the page's scripts in the visual editor. Scripts are never removed from the file. |
Known limitations
- With
runScripts on, the page's own scripts run in the same origin as the editor and could drive its controls; they can never save the file. Turn runScripts off for pages you do not trust.
- While editing text in place, web fonts from other hosts may show in a fallback font until the edit ends.
- A page that navigates every time it loads cannot be edited with
runScripts on.
- Tables with merged cells (
colspan / rowspan > 1) are not changed; tables whose col / colgroup has span > 1 allow row operations but not column operations.
- Platforms: tested on Linux. Windows and macOS: to be decided by the user (U-2).
- Styles are written to the element's
style attribute; stylesheet rules are not edited.
- A file whose encoding cannot be written back byte for byte opens read-only: the panel is greyed out and edits are refused.
- Text that a page script created or changed, and text beside an element the browser adds without a tag in the file (for example an implied
tbody, or the empty paragraph a stray </p> makes), cannot be edited; double-clicking it shows "This text cannot be edited here".
- The undo history is not kept across a window reload; unsaved changes are.
License
MIT. The license text is in the LICENSE file shipped with the extension.
| |