mirror of
https://github.com/zadam/trilium.git
synced 2025-11-11 08:58:58 +01:00
chore(react/type_widget): bring back read-only
This commit is contained in:
parent
3d5b319eb2
commit
c8a9b994d6
@ -1,5 +1,5 @@
|
|||||||
import { isMobile } from "../../../services/utils";
|
import { isMobile } from "../../../services/utils";
|
||||||
import { useTriliumOption } from "../../react/hooks";
|
import { useNoteLabel, useNoteLabelBoolean, useTriliumOption } from "../../react/hooks";
|
||||||
import { TypeWidgetProps } from "../type_widget";
|
import { TypeWidgetProps } from "../type_widget";
|
||||||
import "./SplitEditor.css";
|
import "./SplitEditor.css";
|
||||||
|
|
||||||
@ -12,14 +12,19 @@ import "./SplitEditor.css";
|
|||||||
* - Can display errors to the user via {@link setError}.
|
* - Can display errors to the user via {@link setError}.
|
||||||
* - Horizontal or vertical orientation for the editor/preview split, adjustable via the switch split orientation button floating button.
|
* - Horizontal or vertical orientation for the editor/preview split, adjustable via the switch split orientation button floating button.
|
||||||
*/
|
*/
|
||||||
export default function SplitEditor({ }: TypeWidgetProps) {
|
export default function SplitEditor({ note }: TypeWidgetProps) {
|
||||||
const splitEditorOrientation = useSplitOrientation();
|
const splitEditorOrientation = useSplitOrientation();
|
||||||
|
const [ readOnly ] = useNoteLabelBoolean(note, "readOnly");
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={`note-detail-split note-detail-printable ${"split-" + splitEditorOrientation}`}>
|
<div className={`note-detail-split note-detail-printable ${"split-" + splitEditorOrientation} ${readOnly ? "split-read-only" : ""}`}>
|
||||||
|
{!readOnly && (
|
||||||
<div className="note-detail-split-editor-col">
|
<div className="note-detail-split-editor-col">
|
||||||
<div className="note-detail-split-editor">Detail goes here.</div>
|
<div className="note-detail-split-editor">Detail goes here.</div>
|
||||||
<div className="admonition caution note-detail-error-container hidden-ext">Errors go here.</div>
|
<div className="admonition caution note-detail-error-container hidden-ext">Errors go here.</div>
|
||||||
</div>
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className="note-detail-split-preview-col">
|
<div className="note-detail-split-preview-col">
|
||||||
<div className="note-detail-split-preview">Preview goes here</div>
|
<div className="note-detail-split-preview">Preview goes here</div>
|
||||||
<div className="btn-group btn-group-sm map-type-switcher content-floating-buttons preview-buttons bottom-right" role="group">Buttons go here</div>
|
<div className="btn-group btn-group-sm map-type-switcher content-floating-buttons preview-buttons bottom-right" role="group">Buttons go here</div>
|
||||||
|
|||||||
@ -85,12 +85,6 @@ export default abstract class AbstractSplitTypeWidget extends TypeWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#adjustLayoutOrientation() {
|
#adjustLayoutOrientation() {
|
||||||
// Read-only
|
|
||||||
const isReadOnly = this.note?.hasLabel("readOnly");
|
|
||||||
if (this.isReadOnly !== isReadOnly) {
|
|
||||||
this.$editorCol.toggle(!isReadOnly);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Vertical vs horizontal layout
|
// Vertical vs horizontal layout
|
||||||
if (this.layoutOrientation !== layoutOrientation || this.isReadOnly !== isReadOnly) {
|
if (this.layoutOrientation !== layoutOrientation || this.isReadOnly !== isReadOnly) {
|
||||||
this.$widget
|
this.$widget
|
||||||
|
|||||||
@ -29,7 +29,6 @@ type Labels = {
|
|||||||
status: string;
|
status: string;
|
||||||
pageSize: number;
|
pageSize: number;
|
||||||
geolocation: string;
|
geolocation: string;
|
||||||
readOnly: boolean;
|
|
||||||
expanded: boolean;
|
expanded: boolean;
|
||||||
"calendar:hideWeekends": boolean;
|
"calendar:hideWeekends": boolean;
|
||||||
"calendar:weekNumbers": boolean;
|
"calendar:weekNumbers": boolean;
|
||||||
@ -42,6 +41,7 @@ type Labels = {
|
|||||||
|
|
||||||
// Note-type specific
|
// Note-type specific
|
||||||
webViewSrc: string;
|
webViewSrc: string;
|
||||||
|
readOnly: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user