mirror of
https://github.com/zadam/trilium.git
synced 2025-11-12 16:25:51 +01:00
refactor(popup_editor): inject note detail widget
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user