mirror of
https://github.com/zadam/trilium.git
synced 2026-02-27 09:03:36 +01:00
style(next): indicate active note context
This commit is contained in:
parent
76cfced60f
commit
52292cb5a5
@ -1259,6 +1259,11 @@ body.layout-horizontal #rest-pane > .classic-toolbar-widget {
|
|||||||
#center-pane .note-split {
|
#center-pane .note-split {
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
background-color: var(--note-split-background-color, var(--main-background-color));
|
background-color: var(--note-split-background-color, var(--main-background-color));
|
||||||
|
transition: box-shadow 250ms ease-in;
|
||||||
|
|
||||||
|
&.active {
|
||||||
|
box-shadow: 0 0 0 2px var(--link-selection-outline-color) inset;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
body:not(.background-effects) #center-pane .note-split {
|
body:not(.background-effects) #center-pane .note-split {
|
||||||
|
|||||||
@ -1,10 +1,11 @@
|
|||||||
import FlexContainer from "./flex_container.js";
|
|
||||||
import appContext, { type CommandData, type CommandListenerData, type EventData, type EventNames, type NoteSwitchedContext } from "../../components/app_context.js";
|
import appContext, { type CommandData, type CommandListenerData, type EventData, type EventNames, type NoteSwitchedContext } from "../../components/app_context.js";
|
||||||
import type BasicWidget from "../basic_widget.js";
|
|
||||||
import Component from "../../components/component.js";
|
import Component from "../../components/component.js";
|
||||||
|
import NoteContext from "../../components/note_context.js";
|
||||||
import splitService from "../../services/resizer.js";
|
import splitService from "../../services/resizer.js";
|
||||||
import { isMobile } from "../../services/utils.js";
|
import { isMobile } from "../../services/utils.js";
|
||||||
import NoteContext from "../../components/note_context.js";
|
import type BasicWidget from "../basic_widget.js";
|
||||||
|
import NoteContextAwareWidget from "../note_context_aware_widget.js";
|
||||||
|
import FlexContainer from "./flex_container.js";
|
||||||
|
|
||||||
interface SplitNoteWidget extends BasicWidget {
|
interface SplitNoteWidget extends BasicWidget {
|
||||||
hasBeenAlreadyShown?: boolean;
|
hasBeenAlreadyShown?: boolean;
|
||||||
@ -74,7 +75,7 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
|
|||||||
|
|
||||||
|
|
||||||
const subContexts = activeContext.getSubContexts();
|
const subContexts = activeContext.getSubContexts();
|
||||||
let noteContext: NoteContext | undefined = undefined;
|
let noteContext: NoteContext | undefined;
|
||||||
if (isMobile() && subContexts.length > 1) {
|
if (isMobile() && subContexts.length > 1) {
|
||||||
noteContext = subContexts.find(s => s.ntxId !== ntxId);
|
noteContext = subContexts.find(s => s.ntxId !== ntxId);
|
||||||
}
|
}
|
||||||
@ -201,6 +202,11 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
|
|||||||
|
|
||||||
async refresh() {
|
async refresh() {
|
||||||
this.toggleExt(true);
|
this.toggleExt(true);
|
||||||
|
|
||||||
|
// Mark the active note context.
|
||||||
|
for (const child of this.children as NoteContextAwareWidget[]) {
|
||||||
|
child.$widget.toggleClass("active", !!child.noteContext?.isActive());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toggleInt(show: boolean) {} // not needed
|
toggleInt(show: boolean) {} // not needed
|
||||||
@ -239,16 +245,16 @@ export default class SplitNoteContainer extends FlexContainer<SplitNoteWidget> {
|
|||||||
widget.hasBeenAlreadyShown = true;
|
widget.hasBeenAlreadyShown = true;
|
||||||
|
|
||||||
return [widget.handleEvent("noteSwitched", noteSwitchedContext), this.refreshNotShown(noteSwitchedContext)];
|
return [widget.handleEvent("noteSwitched", noteSwitchedContext), this.refreshNotShown(noteSwitchedContext)];
|
||||||
} else {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
}
|
||||||
|
return Promise.resolve();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name === "activeContextChanged") {
|
if (name === "activeContextChanged") {
|
||||||
return this.refreshNotShown(data as EventData<"activeContextChanged">);
|
return this.refreshNotShown(data as EventData<"activeContextChanged">);
|
||||||
} else {
|
|
||||||
return super.handleEventInChildren(name, data);
|
|
||||||
}
|
}
|
||||||
|
return super.handleEventInChildren(name, data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
refreshNotShown(data: NoteSwitchedContext | EventData<"activeContextChanged">) {
|
refreshNotShown(data: NoteSwitchedContext | EventData<"activeContextChanged">) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user