Skip to content

Commit

Permalink
Try improve button indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Nigel2392 committed May 23, 2024
1 parent 24a3ec7 commit d8cf007
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = wagtail_fedit
version = 1.5.9rc4
version = 1.5.9rc5
description = Frontend editing for your Wagtail site
long_description = file: README.md
long_description_content_type = text/markdown
Expand Down
8 changes: 6 additions & 2 deletions wagtail_fedit/static/wagtail_fedit/css/frontend.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,20 @@ html, body {
.wagtail-fedit-adapter-wrapper:not(.wagtail-fedit-block):has(.wagtail-fedit-adapter-wrapper) > .wagtail-fedit-buttons {
right: 30px;
}
.wagtail-fedit-adapter-wrapper:has(.wagtail-fedit-block):has(.wagtail-fedit-model) > .wagtail-fedit-buttons {
right: 60px;
}
.wagtail-fedit-buttons {
display: flex;
flex-wrap: wrap;
max-height: 100%;
gap: 0.15em;
border-radius: 0.5em;
position: absolute;
right: 0;
z-index: 1;
}
.wagtail-fedit-buttons--overflow {
flex-direction: row-reverse !important;
}

.wagtail-fedit-adapter-wrapper.wagtail-fedit-inline {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion wagtail_fedit/static/wagtail_fedit/js/edit.js

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions wagtail_fedit/static_src/editors/base/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,22 @@ class BaseWagtailFeditEditor extends EventTarget {
this.iframe = null;
this.init();

let buttonWrapper = this.wrapperElement.firstElementChild as HTMLElement;
if (!this.wrapperElement.querySelector(".wagtail-fedit-adapter-wrapper")) {
let imgTag = this.wrapperElement.querySelector("img");
if (imgTag) {
imgTag.addEventListener("load", () => {
if ((buttonWrapper.clientHeight - 15) > this.wrapperElement.clientHeight) { // Some leeway for padding
buttonWrapper.classList.add("wagtail-fedit-buttons--overflow");
}
});
} else {
if ((buttonWrapper.clientHeight - 15) > this.wrapperElement.clientHeight) { // Some leeway for padding
buttonWrapper.classList.add("wagtail-fedit-buttons--overflow");
}
}
}

if (window.location.hash === `#${this.wrapperElement.id}`) {
this.openEditor();
this.focus();
Expand Down

0 comments on commit d8cf007

Please sign in to comment.