refactor(popup_editor): inject note detail widget

This commit is contained in:
Elian Doran
2025-07-09 21:20:16 +03:00
parent 55b3bf6036
commit bfec44aa5a
2 changed files with 12 additions and 4 deletions

View File

@@ -259,7 +259,8 @@ export default class DesktopLayout {
// Desktop-specific dialogs. // Desktop-specific dialogs.
.child(new PasswordNoteSetDialog()) .child(new PasswordNoteSetDialog())
.child(new UploadAttachmentsDialog()) .child(new UploadAttachmentsDialog())
.child(new PopupEditorDialog()); .child(new PopupEditorDialog()
.child(new NoteDetailWidget()));
applyModals(rootContainer); applyModals(rootContainer);
return rootContainer; return rootContainer;

View File

@@ -1,5 +1,6 @@
import { openDialog } from "../../services/dialog.js"; import { openDialog } from "../../services/dialog.js";
import BasicWidget from "../basic_widget.js"; import BasicWidget from "../basic_widget.js";
import Container from "../containers/container.js";
const TPL = /*html*/`\ const TPL = /*html*/`\
<div class="popup-editor-dialog modal fade mx-auto" tabindex="-1" role="dialog"> <div class="popup-editor-dialog modal fade mx-auto" tabindex="-1" role="dialog">
@@ -11,14 +12,14 @@ const TPL = /*html*/`\
</div> </div>
<div class="modal-body"> <div class="modal-body">
Hi <!-- This is where the content will be injected. -->
</div> </div>
</div> </div>
</div> </div>
</div> </div>
`; `;
export default class PopupEditorDialog extends BasicWidget { export default class PopupEditorDialog extends Container<BasicWidget> {
constructor() { constructor() {
super(); super();
@@ -28,7 +29,13 @@ export default class PopupEditorDialog extends BasicWidget {
} }
doRender() { doRender() {
this.$widget = $(TPL); // This will populate this.$widget with the content of the children.
super.doRender();
// Now we wrap it in the modal.
const $newWidget = $(TPL);
$newWidget.find(".modal-body").append(this.$widget.children());
this.$widget = $newWidget;
} }
async refresh() { async refresh() {