Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: tool drawer for edit and live-reload buttons #1164

Merged
merged 4 commits into from Nov 12, 2023

Conversation

dairiki
Copy link
Contributor

@dairiki dairiki commented Sep 15, 2023

This replaces the edit pencil on HTML artifacts served by the admin server with "tool drawer".

The tool drawer contains an edit button (which takes the place of the edit pencil), as well as a toggle button that can be used to disable live-reload (see #1027) for the window.

If the tool drawer is obscuring part of the HTML page that one would like to look at or click on, the drawer may be dragged vertically to reposition it. It may also be (mostly) hidden off screen to minimize its visual impact.

output

Issue(s) Resolved

The "edit pencil" can obscure part of the web page

Sometimes, e.g. when working on a site that has a hamburger "site menu" button in the upper right corner of the page, Lektor's "edit pencil" button (also located in the upper right corner of the page) will obscure part of the page that one might like to see (and be able to click).

This solves that problem, since the tool drawer may be dragged to a different position.

There's no per-window control to disable live-reload

When editing a page, in order to be able to easily compare "before" and "after" views of the page, one might want to have two preview windows open: one with live-reload enabled and one with live-reload disabled. The live-reload toggle button added in this PR allows for that.

Related Issues / Links

Doc PR: lektor/lektor-website#380

Description of Changes

  • Wrote at least one-line docstrings (for any new functions)
  • Added unit test(s) covering the changes (if testable) (Well... unit tests were added/fixed for the backend (python) changes. There are currently no tests for the new frontend code.)
  • Included a screenshot or animation (if affecting the UI, see Licecap)
  • Link to corresponding documentation pull request for getlektor.com

This replaces the *edit pencil* on HTML artifacts served by the admin
server with "tool drawer".

The tool drawer contains an edit button (which takes the place of the
edit pencil), as well as a toggle button that can be used to disable
live-reload (see lektor#1027) for the window.

If the tool drawer is obscuring part of the HTML page that one would
like to look at or click on, the drawer may be dragged vertically
to reposition it.  It may also be (mostly) hidden off screen to
minimize its visual impact.
Using a real link (`<a href="...">`) instead of a button with onclick
handler allows the user to, e.g., open a new window with a
live-preview by middle or right clicking on the button.

Anyway, since the "button" leads to a new URL outside of the admin
app, it's the right thing to do.  E.g. see
https://css-tricks.com/buttons-vs-links/.
Strict mode causes everything to be rendered twice. (I noticed this
because GlobalActions was firing off two request for /previewinfo for
every page change.) This is not particularly efficient, and is
probably not appropriate for the production build.
The `--no-reload` option was add in PR lektor#1027 (c38596a).  It disables
the live-reload feature globally.  Since this PR adds the ability to
disable live-reload on a per-window basis, the global option no longer
seems necessary.
@dairiki dairiki merged commit 1255d0f into lektor:master Nov 12, 2023
15 checks passed
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.

None yet

1 participant