mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-08-10 02:02:29 +08:00
feat(client): display PDFs as full width
This commit is contained in:
parent
2a90f4c6e9
commit
659e551cdd
@ -4,6 +4,7 @@ import attributeService from "../services/attributes.js";
|
||||
import type BasicWidget from "./basic_widget.js";
|
||||
import type { EventData } from "../components/app_context.js";
|
||||
import type NoteContext from "../components/note_context.js";
|
||||
import type FNote from "../entities/fnote.js";
|
||||
|
||||
export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {
|
||||
|
||||
@ -47,7 +48,7 @@ export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {
|
||||
return;
|
||||
}
|
||||
|
||||
this.$widget.toggleClass("full-content-width", ["image", "mermaid", "book", "render", "canvas", "webView", "mindMap", "geoMap"].includes(note.type) || !!note?.isLabelTruthy("fullContentWidth"));
|
||||
this.$widget.toggleClass("full-content-width", this.#isFullWidthNote(note));
|
||||
|
||||
this.$widget.addClass(note.getCssClass());
|
||||
|
||||
@ -57,6 +58,18 @@ export default class NoteWrapperWidget extends FlexContainer<BasicWidget> {
|
||||
this.$widget.toggleClass("protected", note.isProtected);
|
||||
}
|
||||
|
||||
#isFullWidthNote(note: FNote) {
|
||||
if (["image", "mermaid", "book", "render", "canvas", "webView", "mindMap", "geoMap"].includes(note.type)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (note.type === "file" && note.mime === "application/pdf") {
|
||||
return true;
|
||||
}
|
||||
|
||||
return !!note?.isLabelTruthy("fullContentWidth");
|
||||
}
|
||||
|
||||
async entitiesReloadedEvent({ loadResults }: EventData<"entitiesReloaded">) {
|
||||
// listening on changes of note.type and CSS class
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user