bring back the possibility to close the floating buttons again, closes #3116

This commit is contained in:
zadam
2022-09-18 14:57:44 +02:00
parent 84f72edf1d
commit d4658b9c2a
8 changed files with 95 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
import Container from "../containers/container.js";
import NoteContextAwareWidget from "../note_context_aware_widget.js";
const TPL = `
<div class="floating-buttons">
@@ -16,7 +16,7 @@ const TPL = `
z-index: 100;
}
.floating-buttons-children > * {
.floating-buttons-children > *:not(.hidden-int):not(.no-content-hidden) {
margin-left: 10px;
}
@@ -24,12 +24,16 @@ const TPL = `
font-size: 130%;
padding: 5px 10px 4px 10px;
}
.floating-buttons.temporarily-hidden {
display: none;
}
</style>
<div class="floating-buttons-children"></div>
</div>`;
export default class FloatingButtons extends Container {
export default class FloatingButtons extends NoteContextAwareWidget {
doRender() {
this.$widget = $(TPL);
this.$children = this.$widget.find(".floating-buttons-children");
@@ -38,4 +42,16 @@ export default class FloatingButtons extends Container {
this.$children.append(widget.render());
}
}
async refreshWithNote(note) {
this.toggle(true);
}
toggle(show) {
this.$widget.toggleClass("temporarily-hidden", !show);
}
hideFloatingButtonsCommand() {
this.toggle(false);
}
}