Merge branch 'develop' into feat/note-edit-readonly-fix2

This commit is contained in:
Jon Fuller
2025-06-01 18:51:28 -07:00
committed by GitHub
601 changed files with 15176 additions and 13798 deletions

View File

@@ -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[];

View File

@@ -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

View File

@@ -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() {

View File

@@ -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())

View File

@@ -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();