mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
buttons on the left
This commit is contained in:
parent
d18b95d87c
commit
845f5d15c4
@ -38,6 +38,8 @@ import RootContainer from "../widgets/containers/root_container.js";
|
|||||||
import NoteUpdateStatusWidget from "../widgets/note_update_status.js";
|
import NoteUpdateStatusWidget from "../widgets/note_update_status.js";
|
||||||
import SpacerWidget from "../widgets/spacer.js";
|
import SpacerWidget from "../widgets/spacer.js";
|
||||||
import QuickSearchWidget from "../widgets/quick_search.js";
|
import QuickSearchWidget from "../widgets/quick_search.js";
|
||||||
|
import ButtonWidget from "../widgets/button_widget.js";
|
||||||
|
import ProtectedSessionStatusWidget from "../widgets/protected_session_status.js";
|
||||||
|
|
||||||
const RIGHT_PANE_CSS = `
|
const RIGHT_PANE_CSS = `
|
||||||
<style>
|
<style>
|
||||||
@ -141,6 +143,29 @@ export default class DesktopLayout {
|
|||||||
|
|
||||||
return new RootContainer()
|
return new RootContainer()
|
||||||
.setParent(appContext)
|
.setParent(appContext)
|
||||||
|
.child(new FlexContainer("column")
|
||||||
|
.child(new GlobalMenuWidget())
|
||||||
|
.child(new ButtonWidget()
|
||||||
|
.icon("bx-file-blank")
|
||||||
|
.title("New note")
|
||||||
|
.command("createNoteIntoInbox"))
|
||||||
|
.child(new ButtonWidget()
|
||||||
|
.icon("bx-search")
|
||||||
|
.title("Search")
|
||||||
|
.command("searchNotes"))
|
||||||
|
.child(new ButtonWidget()
|
||||||
|
.icon("bx-send")
|
||||||
|
.title("Jump to note")
|
||||||
|
.command("jumpToNote"))
|
||||||
|
.child(new ButtonWidget()
|
||||||
|
.icon("bx-history")
|
||||||
|
.title("Show recent changes")
|
||||||
|
.command("showRecentChanges"))
|
||||||
|
.child(new SpacerWidget())
|
||||||
|
.child(new ProtectedSessionStatusWidget())
|
||||||
|
.child(new SyncStatusWidget())
|
||||||
|
.css("width", "50px")
|
||||||
|
)
|
||||||
.child(new SidePaneContainer('left')
|
.child(new SidePaneContainer('left')
|
||||||
.hideInZenMode()
|
.hideInZenMode()
|
||||||
.css("width", "300px")
|
.css("width", "300px")
|
||||||
@ -152,16 +177,10 @@ export default class DesktopLayout {
|
|||||||
.id('center-pane')
|
.id('center-pane')
|
||||||
.css("flex-grow", "1")
|
.css("flex-grow", "1")
|
||||||
.child(new FlexContainer('row').overflowing()
|
.child(new FlexContainer('row').overflowing()
|
||||||
.filling()
|
.child(new TabRowWidget())
|
||||||
.child(new GlobalMenuWidget())
|
|
||||||
.child(new SyncStatusWidget())
|
|
||||||
.child(new SpacerWidget())
|
|
||||||
.child(new TitleBarButtonsWidget())
|
.child(new TitleBarButtonsWidget())
|
||||||
.css('height', '36px')
|
.css('height', '36px')
|
||||||
)
|
)
|
||||||
.child(new FlexContainer('row').overflowing()
|
|
||||||
.child(new TabRowWidget())
|
|
||||||
)
|
|
||||||
.child(new FlexContainer('row').class('title-row')
|
.child(new FlexContainer('row').class('title-row')
|
||||||
.css('align-items: center;')
|
.css('align-items: center;')
|
||||||
.cssBlock('.title-row > * { margin: 5px; }')
|
.cssBlock('.title-row > * { margin: 5px; }')
|
||||||
|
@ -3,6 +3,7 @@ import appContext from "./app_context.js";
|
|||||||
import dateNoteService from "../services/date_notes.js";
|
import dateNoteService from "../services/date_notes.js";
|
||||||
import treeService from "../services/tree.js";
|
import treeService from "../services/tree.js";
|
||||||
import openService from "./open.js";
|
import openService from "./open.js";
|
||||||
|
import protectedSessionService from "./protected_session.js";
|
||||||
|
|
||||||
export default class RootCommandExecutor extends Component {
|
export default class RootCommandExecutor extends Component {
|
||||||
jumpToNoteCommand() {
|
jumpToNoteCommand() {
|
||||||
@ -93,4 +94,12 @@ export default class RootCommandExecutor extends Component {
|
|||||||
openService.openNoteExternally(noteId);
|
openService.openNoteExternally(noteId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
enterProtectedSessionCommand() {
|
||||||
|
protectedSessionService.enterProtectedSession();
|
||||||
|
}
|
||||||
|
|
||||||
|
leaveProtectedSessionCommand() {
|
||||||
|
protectedSessionService.leaveProtectedSession();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
49
src/public/app/widgets/button_widget.js
Normal file
49
src/public/app/widgets/button_widget.js
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import BasicWidget from "./basic_widget.js";
|
||||||
|
|
||||||
|
const TPL = `
|
||||||
|
<span class="button-widget"
|
||||||
|
title="">
|
||||||
|
<span class="bx"></span>
|
||||||
|
</span>
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default class ButtonWidget extends BasicWidget {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.options = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
doRender() {
|
||||||
|
this.$widget = $(TPL);
|
||||||
|
this.refreshIcon();
|
||||||
|
this.overflowing();
|
||||||
|
|
||||||
|
this.$widget.on("click", () => this.triggerCommand(this.options.command));
|
||||||
|
|
||||||
|
super.doRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
refreshIcon() {
|
||||||
|
this.$widget.attr("title", this.options.title);
|
||||||
|
this.$widget.find("span.bx")
|
||||||
|
.removeClass()
|
||||||
|
.addClass("bx")
|
||||||
|
.addClass(this.options.icon);
|
||||||
|
}
|
||||||
|
|
||||||
|
icon(icon) {
|
||||||
|
this.options.icon = icon;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
title(title) {
|
||||||
|
this.options.title = title;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
command(command) {
|
||||||
|
this.options.command = command;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
33
src/public/app/widgets/protected_session_status.js
Normal file
33
src/public/app/widgets/protected_session_status.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import ButtonWidget from "./button_widget.js";
|
||||||
|
import protectedSessionHolder from "../services/protected_session_holder.js";
|
||||||
|
|
||||||
|
export default class ProtectedSessionStatusWidget extends ButtonWidget {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
}
|
||||||
|
|
||||||
|
doRender() {
|
||||||
|
this.updateOptions();
|
||||||
|
|
||||||
|
super.doRender();
|
||||||
|
}
|
||||||
|
|
||||||
|
updateOptions() {
|
||||||
|
this.options.icon = protectedSessionHolder.isProtectedSessionAvailable()
|
||||||
|
? "bx-shield-quarter"
|
||||||
|
: "bx-log-in";
|
||||||
|
|
||||||
|
this.options.title = protectedSessionHolder.isProtectedSessionAvailable()
|
||||||
|
? "Protected session is active. Click to leave protected session."
|
||||||
|
: "Click to enter protected session";
|
||||||
|
|
||||||
|
this.options.command = protectedSessionHolder.isProtectedSessionAvailable()
|
||||||
|
? "leaveProtectedSession"
|
||||||
|
: "enterProtectedSession";
|
||||||
|
}
|
||||||
|
|
||||||
|
protectedSessionStartedEvent() {
|
||||||
|
this.updateOptions();
|
||||||
|
this.refreshIcon();
|
||||||
|
}
|
||||||
|
}
|
@ -928,3 +928,15 @@ ul.fancytree-container li {
|
|||||||
padding: 10px;
|
padding: 10px;
|
||||||
margin: 10px;
|
margin: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.button-widget .bx {
|
||||||
|
font-size: 180%;
|
||||||
|
display: inline-block;
|
||||||
|
position: relative;
|
||||||
|
padding: 10px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button-widget:hover .bx {
|
||||||
|
background-color: var(--hover-item-background-color);
|
||||||
|
}
|
||||||
|
@ -16,7 +16,7 @@ function getNotesAndBranchesAndAttributes(noteIds) {
|
|||||||
|
|
||||||
collectedNoteIds.add(note.noteId);
|
collectedNoteIds.add(note.noteId);
|
||||||
|
|
||||||
for (const branch of note.parentBranches) {
|
for (const branch of note.getParentBranches()) {
|
||||||
collectedBranchIds.add(branch.branchId);
|
collectedBranchIds.add(branch.branchId);
|
||||||
|
|
||||||
collectEntityIds(branch.parentNote);
|
collectEntityIds(branch.parentNote);
|
||||||
|
@ -153,8 +153,6 @@ function findResultsWithQuery(query, searchContext) {
|
|||||||
|
|
||||||
const expression = parseQueryToExpression(query, searchContext);
|
const expression = parseQueryToExpression(query, searchContext);
|
||||||
|
|
||||||
console.log("expression", expression);
|
|
||||||
|
|
||||||
if (!expression) {
|
if (!expression) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user