mirror of
https://github.com/zadam/trilium.git
synced 2025-11-07 15:09:01 +01:00
fix(client): read-only handling in canvas note
This commit is contained in:
parent
923316e14e
commit
8d21b3a8c5
@ -3,6 +3,7 @@ import utils from "../../services/utils.js";
|
|||||||
import linkService from "../../services/link.js";
|
import linkService from "../../services/link.js";
|
||||||
import server from "../../services/server.js";
|
import server from "../../services/server.js";
|
||||||
import type FNote from "../../entities/fnote.js";
|
import type FNote from "../../entities/fnote.js";
|
||||||
|
import options from "../../services/options.js";
|
||||||
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
|
import type { ExcalidrawElement, Theme } from "@excalidraw/excalidraw/element/types";
|
||||||
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types";
|
import type { AppState, BinaryFileData, ExcalidrawImperativeAPI, ExcalidrawProps, LibraryItem, SceneData } from "@excalidraw/excalidraw/types";
|
||||||
import type { JSX } from "react";
|
import type { JSX } from "react";
|
||||||
@ -447,6 +448,9 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onChangeHandler() {
|
onChangeHandler() {
|
||||||
|
if (options.is("databaseReadonly")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
// changeHandler is called upon any tiny change in excalidraw. button clicked, hover, etc.
|
// changeHandler is called upon any tiny change in excalidraw. button clicked, hover, etc.
|
||||||
// make sure only when a new element is added, we actually save something.
|
// make sure only when a new element is added, we actually save something.
|
||||||
const isNewSceneVersion = this.isNewSceneVersion();
|
const isNewSceneVersion = this.isNewSceneVersion();
|
||||||
@ -540,7 +544,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
this.saveData();
|
this.saveData();
|
||||||
},
|
},
|
||||||
onChange: () => this.onChangeHandler(),
|
onChange: () => this.onChangeHandler(),
|
||||||
viewModeEnabled: false,
|
viewModeEnabled: options.is("databaseReadonly"),
|
||||||
zenModeEnabled: false,
|
zenModeEnabled: false,
|
||||||
gridModeEnabled: false,
|
gridModeEnabled: false,
|
||||||
isCollaborating: false,
|
isCollaborating: false,
|
||||||
@ -567,6 +571,10 @@ export default class ExcalidrawTypeWidget extends TypeWidget {
|
|||||||
* info: sceneVersions are not incrementing. it seems to be a pseudo-random number
|
* info: sceneVersions are not incrementing. it seems to be a pseudo-random number
|
||||||
*/
|
*/
|
||||||
isNewSceneVersion() {
|
isNewSceneVersion() {
|
||||||
|
if (options.is("databaseReadonly")) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const sceneVersion = this.getSceneVersion();
|
const sceneVersion = this.getSceneVersion();
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user