Skip to content

Commit

Permalink
online_editor: Some documentation in the README
Browse files Browse the repository at this point in the history
Document the query arguments
  • Loading branch information
ogoffart authored May 14, 2022
1 parent f1fb451 commit a64dc65
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion tools/online_editor/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
# Slint Online Editor

This directory contains the frontend code for the online code editor
which is hosted in https://slint-ui.com/editor
which is hosted in https://slint-ui.com/editor (last stable) and
https://slint-ui.com/snapshots/master/editor (nightly)

To try it out locally type this in this directory:
```sh
npm install
npm start
```

## Documentation

The `index.html` page contains a code editor and every key press reload the preview.
The `preview.html` page contains only the preview and the code must be given via query parameter.

* `?load_url=` query argument make it possible to load the .slint code directly from an URL.
If the slint code contains relative path for imports or images, they are loaded relative to
that slint file. That way it is possible to load code from github (via raw.githubusercontent)
or gists.

Example: this loads the printerdemo.slint file from the github URL
- https://slint-ui.com/editor?load_url=https://raw.githubusercontent.com/slint-ui/slint/master/examples/printerdemo/ui/printerdemo.slint
- https://slint-ui.com/editor/preview.html?load_url=https://raw.githubusercontent.com/slint-ui/slint/master/examples/printerdemo/ui/printerdemo.slint

* `?snippet=` query argument, followed by the URL-encoded slint code, will simply load this code
this is what is used tor the premalink feature

Example: a simple code with "Hello Slint"
- https://slint-ui.com/editor/?snippet=_+%3A%3D+Text+%7B+text%3A+%22Hello+Slint%22%3B+%7D
- https://slint-ui.com/editor/preview.html?snippet=_+%3A%3D+Text+%7B+text%3A+%22Hello+Slint%22%3B+%7D

0 comments on commit a64dc65

Please sign in to comment.