mirror of
https://github.com/zadam/trilium.git
synced 2025-11-13 08:45:50 +01:00
Merge branch 'develop' into feat/note-edit-readonly-fix2
This commit is contained in:
@@ -27,6 +27,7 @@ import type EditableTextTypeWidget from "../widgets/type_widgets/editable_text.j
|
||||
import type { NativeImage, TouchBar } from "electron";
|
||||
import TouchBarComponent from "./touch_bar.js";
|
||||
import type { CKTextEditor } from "@triliumnext/ckeditor5";
|
||||
import type CodeMirror from "@triliumnext/codemirror";
|
||||
|
||||
interface Layout {
|
||||
getRootWidget: (appContext: AppContext) => RootWidget;
|
||||
@@ -191,7 +192,7 @@ export type CommandMappings = {
|
||||
ExecuteCommandData<CKTextEditor> & {
|
||||
callback?: GetTextEditorCallback;
|
||||
};
|
||||
executeWithCodeEditor: CommandData & ExecuteCommandData<CodeMirrorInstance>;
|
||||
executeWithCodeEditor: CommandData & ExecuteCommandData<CodeMirror>;
|
||||
/**
|
||||
* Called upon when attempting to retrieve the content element of a {@link NoteContext}.
|
||||
* Generally should not be invoked manually, as it is used by {@link NoteContext.getContentElement}.
|
||||
@@ -283,6 +284,9 @@ export type CommandMappings = {
|
||||
type EventMappings = {
|
||||
initialRenderComplete: {};
|
||||
frocaReloaded: {};
|
||||
setLeftPaneVisibility: {
|
||||
leftPaneVisible: boolean | null;
|
||||
}
|
||||
protectedSessionStarted: {};
|
||||
notesReloaded: {
|
||||
noteIds: string[];
|
||||
|
||||
@@ -11,6 +11,7 @@ import type { ViewScope } from "../services/link.js";
|
||||
import type FNote from "../entities/fnote.js";
|
||||
import type TypeWidget from "../widgets/type_widgets/type_widget.js";
|
||||
import type { CKTextEditor } from "@triliumnext/ckeditor5";
|
||||
import type CodeMirror from "@triliumnext/codemirror";
|
||||
|
||||
export interface SetNoteOpts {
|
||||
triggerSwitchEvent?: unknown;
|
||||
@@ -158,6 +159,9 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
|
||||
}
|
||||
|
||||
saveToRecentNotes(resolvedNotePath: string) {
|
||||
if (options.is("databaseReadonly")) {
|
||||
return;
|
||||
}
|
||||
setTimeout(async () => {
|
||||
// we include the note in the recent list only if the user stayed on the note at least 5 seconds
|
||||
if (resolvedNotePath && resolvedNotePath === this.notePath) {
|
||||
@@ -253,6 +257,10 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
|
||||
return false;
|
||||
}
|
||||
|
||||
if (options.is("databaseReadonly")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (this.note.isLabelTruthy("readOnly")) {
|
||||
return true;
|
||||
}
|
||||
@@ -331,7 +339,7 @@ class NoteContext extends Component implements EventListener<"entitiesReloaded">
|
||||
|
||||
async getCodeEditor() {
|
||||
return this.timeout(
|
||||
new Promise<CodeMirrorInstance>((resolve) =>
|
||||
new Promise<CodeMirror>((resolve) =>
|
||||
appContext.triggerCommand("executeWithCodeEditor", {
|
||||
resolve,
|
||||
ntxId: this.ntxId
|
||||
|
||||
@@ -78,15 +78,15 @@ export default class RootCommandExecutor extends Component {
|
||||
}
|
||||
|
||||
hideLeftPaneCommand() {
|
||||
options.save(`leftPaneVisible`, "false");
|
||||
appContext.triggerEvent("setLeftPaneVisibility", { leftPaneVisible: false });
|
||||
}
|
||||
|
||||
showLeftPaneCommand() {
|
||||
options.save(`leftPaneVisible`, "true");
|
||||
appContext.triggerEvent("setLeftPaneVisibility", { leftPaneVisible: true });
|
||||
}
|
||||
|
||||
toggleLeftPaneCommand() {
|
||||
options.toggle("leftPaneVisible");
|
||||
appContext.triggerEvent("setLeftPaneVisibility", { leftPaneVisible: null });
|
||||
}
|
||||
|
||||
async showBackendLogCommand() {
|
||||
|
||||
@@ -44,6 +44,9 @@ export default class TabManager extends Component {
|
||||
if (!appContext.isMainWindow) {
|
||||
return;
|
||||
}
|
||||
if (options.is("databaseReadonly")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const openNoteContexts = this.noteContexts
|
||||
.map((nc) => nc.getPojoState())
|
||||
|
||||
@@ -54,7 +54,7 @@ export default class TouchBarComponent extends Component {
|
||||
#refreshTouchBar() {
|
||||
const { TouchBar } = this.remote;
|
||||
const parentComponent = this.lastFocusedComponent;
|
||||
let touchBar = null;
|
||||
let touchBar: Electron.CrossProcessExports.TouchBar | null = null;
|
||||
|
||||
if (this.$activeModal?.length) {
|
||||
touchBar = this.#buildModalTouchBar();
|
||||
|
||||
Reference in New Issue
Block a user